mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
World Restriction Checks
Updated the UI based on the world restriction.
This commit is contained in:
parent
498dcff8b9
commit
be05c04e72
2 changed files with 235 additions and 194 deletions
|
@ -18,13 +18,15 @@ public static partial class BTKUIAddon
|
||||||
private static readonly MultiSelection _tabDoubleClickSelection =
|
private static readonly MultiSelection _tabDoubleClickSelection =
|
||||||
MultiSelection.CreateMultiSelectionFromMelonPref(ModSettings.Entry_TabDoubleClick);
|
MultiSelection.CreateMultiSelectionFromMelonPref(ModSettings.Entry_TabDoubleClick);
|
||||||
|
|
||||||
|
public static Button placeStickersButton;
|
||||||
|
|
||||||
#region Category Setup
|
#region Category Setup
|
||||||
|
|
||||||
private static void Setup_StickersModCategory()
|
private static void Setup_StickersModCategory()
|
||||||
{
|
{
|
||||||
_ourCategory = _rootPage.AddMelonCategory(ModSettings.Hidden_Foldout_SettingsCategory);
|
_ourCategory = _rootPage.AddMelonCategory(ModSettings.Hidden_Foldout_SettingsCategory);
|
||||||
|
|
||||||
Button placeStickersButton = _ourCategory.AddButton("Place Stickers", "Stickers-magic-wand", "Place stickers via raycast.", ButtonStyle.TextWithIcon);
|
placeStickersButton = _ourCategory.AddButton("Place Stickers", "Stickers-magic-wand", "Place stickers via raycast.", ButtonStyle.TextWithIcon);
|
||||||
placeStickersButton.OnPress += OnPlaceStickersButtonClick;
|
placeStickersButton.OnPress += OnPlaceStickersButtonClick;
|
||||||
|
|
||||||
Button clearSelfStickersButton = _ourCategory.AddButton("Clear Self", "Stickers-eraser", "Clear own stickers.", ButtonStyle.TextWithIcon);
|
Button clearSelfStickersButton = _ourCategory.AddButton("Clear Self", "Stickers-eraser", "Clear own stickers.", ButtonStyle.TextWithIcon);
|
||||||
|
@ -59,9 +61,17 @@ public static partial class BTKUIAddon
|
||||||
private static void OnPlaceStickersButtonClick()
|
private static void OnPlaceStickersButtonClick()
|
||||||
{
|
{
|
||||||
if (!_isOurTabOpened) return;
|
if (!_isOurTabOpened) return;
|
||||||
string mode = StickerSystem.Instance.IsInStickerMode ? "Exiting" : "Entering";
|
|
||||||
QuickMenuAPI.ShowAlertToast($"{mode} sticker placement mode...", 2);
|
if (StickerSystem.RestrictedInstance == false)
|
||||||
StickerSystem.Instance.IsInStickerMode = !StickerSystem.Instance.IsInStickerMode;
|
{
|
||||||
|
string mode = StickerSystem.Instance.IsInStickerMode ? "Exiting" : "Entering";
|
||||||
|
QuickMenuAPI.ShowAlertToast($"{mode} sticker placement mode...", 2);
|
||||||
|
StickerSystem.Instance.IsInStickerMode = !StickerSystem.Instance.IsInStickerMode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QuickMenuAPI.ShowAlertToast("Stickers are not allowed in this world!", 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnClearSelfStickersButtonClick()
|
private static void OnClearSelfStickersButtonClick()
|
||||||
|
@ -85,5 +95,29 @@ public static partial class BTKUIAddon
|
||||||
StickerSystem.OpenStickersFolder();
|
StickerSystem.OpenStickersFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateStickerMenu() //TODO: add Icon changing, Bono needs to expose the value first.
|
||||||
|
{
|
||||||
|
if (StickerSystem.RestrictedInstance == true)
|
||||||
|
{
|
||||||
|
_rootPage.MenuSubtitle = "Stickers... are sadly disabled in this world.";
|
||||||
|
|
||||||
|
placeStickersButton.Disabled = true;
|
||||||
|
placeStickersButton.ButtonText = "Stickers Disabled";
|
||||||
|
placeStickersButton.ButtonTooltip = "This world is not allowing Stickers.";
|
||||||
|
placeStickersButton.ButtonIcon = "Stickers-magic-wand-broken";
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_rootPage.MenuSubtitle = "Stickers! Double-click the tab to quickly toggle Sticker Mode.";
|
||||||
|
|
||||||
|
placeStickersButton.Disabled = false;
|
||||||
|
placeStickersButton.ButtonText = "Place Stickers";
|
||||||
|
placeStickersButton.ButtonTooltip = "Place stickers via raycast.";
|
||||||
|
placeStickersButton.ButtonIcon = "Stickers-magic-wand";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Button Actions
|
#endregion Button Actions
|
||||||
}
|
}
|
|
@ -2,6 +2,8 @@
|
||||||
using BTKUILib.UIObjects;
|
using BTKUILib.UIObjects;
|
||||||
using NAK.Stickers.Networking;
|
using NAK.Stickers.Networking;
|
||||||
using NAK.Stickers.Utilities;
|
using NAK.Stickers.Utilities;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace NAK.Stickers.Integrations;
|
namespace NAK.Stickers.Integrations;
|
||||||
|
|
||||||
|
@ -24,24 +26,26 @@ public static partial class BTKUIAddon
|
||||||
private static void Setup_Icons()
|
private static void Setup_Icons()
|
||||||
{
|
{
|
||||||
// All icons used - https://www.flaticon.com/authors/gohsantosadrive
|
// All icons used - https://www.flaticon.com/authors/gohsantosadrive
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-alphabet", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-alphabet.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-alphabet", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-alphabet.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-eraser", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-eraser.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-eraser", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-eraser.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-folder", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-folder.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-folder", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-folder.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-headset", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-headset.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-headset", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-headset.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-magnifying-glass", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-magnifying-glass.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-magnifying-glass", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-magnifying-glass.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-magic-wand", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-magic-wand.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-magic-wand", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-magic-wand.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-mouse", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-mouse.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-magic-wand-broken", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-magic-wand-broken.png"));
|
||||||
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-mouse", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-mouse.png"));
|
||||||
//QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-pencil", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-pencil.png"));
|
//QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-pencil", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-pencil.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-puzzle", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-puzzle.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-puzzle", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-puzzle.png"));
|
||||||
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-rubbish-bin", UIUtils.GetIconStream("Gohsantosadrive_Icons.Stickers-rubbish-bin.png"));
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-puzzle-disabled", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-puzzle-disabled.png")); //Disabled Sticker Puzzle
|
||||||
|
QuickMenuAPI.PrepareIcon(ModSettings.ModName, "Stickers-rubbish-bin", Assembly.GetExecutingAssembly().GetManifestResourceStream("Stickers.Resources.Gohsantosadrive_Icons.Stickers-rubbish-bin.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Setup_StickerModTab()
|
private static void Setup_StickerModTab()
|
||||||
{
|
{
|
||||||
_rootPage = new Page(ModSettings.ModName, ModSettings.SM_SettingsCategory, true, "Stickers-puzzle")
|
_rootPage = new Page(ModSettings.ModName, ModSettings.SM_SettingsCategory, true, "Stickers-Puzzle") //Sticker Icon will be left blank as it is updated on world join, AFTER Icon value is exposed..
|
||||||
{
|
{
|
||||||
MenuTitle = ModSettings.SM_SettingsCategory,
|
MenuTitle = ModSettings.SM_SettingsCategory,
|
||||||
MenuSubtitle = "Stickers! Double-click the tab to quickly toggle Sticker Mode.",
|
MenuSubtitle = "", //Left this blank as it is defined when the world loads
|
||||||
};
|
};
|
||||||
|
|
||||||
_rootPageElementID = _rootPage.ElementID;
|
_rootPageElementID = _rootPage.ElementID;
|
||||||
|
@ -87,7 +91,10 @@ public static partial class BTKUIAddon
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case TabDoubleClick.ToggleStickerMode:
|
case TabDoubleClick.ToggleStickerMode:
|
||||||
OnPlaceStickersButtonClick();
|
if (StickerSystem.RestrictedInstance == false)
|
||||||
|
{
|
||||||
|
OnPlaceStickersButtonClick();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TabDoubleClick.ClearAllStickers:
|
case TabDoubleClick.ClearAllStickers:
|
||||||
OnClearAllStickersButtonClick();
|
OnClearAllStickersButtonClick();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue