mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
Stickers: added some code
This commit is contained in:
parent
07d6dff0a9
commit
58079d9390
36 changed files with 2092 additions and 1651 deletions
53
Stickers/Integrations/BTKUI/UIAddon.Page.PlayerOptions.cs
Normal file
53
Stickers/Integrations/BTKUI/UIAddon.Page.PlayerOptions.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using BTKUILib;
|
||||
using BTKUILib.UIObjects;
|
||||
using BTKUILib.UIObjects.Components;
|
||||
using NAK.Stickers.Networking;
|
||||
|
||||
namespace NAK.Stickers.Integrations;
|
||||
|
||||
public static partial class BTKUIAddon
|
||||
{
|
||||
#region Setup
|
||||
|
||||
private static ToggleButton _disallowForSessionButton;
|
||||
|
||||
private static void Setup_PlayerOptionsPage()
|
||||
{
|
||||
Category category = QuickMenuAPI.PlayerSelectPage.AddCategory(ModSettings.SM_SettingsCategory, ModSettings.ModName);
|
||||
|
||||
//Button identifyButton = category.AddButton("Identify Stickers", "Stickers-magnifying-glass", "Identify this players stickers by making them flash.");
|
||||
//identifyButton.OnPress += OnPressIdentifyPlayerStickersButton;
|
||||
|
||||
Button clearStickersButton = category.AddButton("Clear Stickers", "Stickers-eraser", "Clear this players stickers.");
|
||||
clearStickersButton.OnPress += OnPressClearSelectedPlayerStickersButton;
|
||||
|
||||
_disallowForSessionButton = category.AddToggle("Block for Session", "Disallow this player from using stickers for this session. This setting will not persist through restarts.", false);
|
||||
_disallowForSessionButton.OnValueUpdated += OnToggleDisallowForSessionButton;
|
||||
QuickMenuAPI.OnPlayerSelected += (_, id) => { _disallowForSessionButton.ToggleValue = ModNetwork.IsPlayerACriminal(id); };
|
||||
}
|
||||
|
||||
#endregion Setup
|
||||
|
||||
#region Callbacks
|
||||
|
||||
// private static void OnPressIdentifyPlayerStickersButton()
|
||||
// {
|
||||
// if (string.IsNullOrEmpty(QuickMenuAPI.SelectedPlayerID)) return;
|
||||
// StickerSystem.Instance.OnStickerIdentifyReceived(QuickMenuAPI.SelectedPlayerID);
|
||||
// }
|
||||
|
||||
private static void OnPressClearSelectedPlayerStickersButton()
|
||||
{
|
||||
if (string.IsNullOrEmpty(QuickMenuAPI.SelectedPlayerID)) return;
|
||||
StickerSystem.Instance.OnStickerClearAllReceived(QuickMenuAPI.SelectedPlayerID);
|
||||
}
|
||||
|
||||
private static void OnToggleDisallowForSessionButton(bool isOn)
|
||||
{
|
||||
if (string.IsNullOrEmpty(QuickMenuAPI.SelectedPlayerID)) return;
|
||||
ModNetwork.HandleDisallowForSession(QuickMenuAPI.SelectedPlayerID, isOn);
|
||||
}
|
||||
|
||||
|
||||
#endregion Callbacks
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue