using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using QuickChat.RadialMenu;
using TMPro;
using TerminalApi;
using TerminalApi.Classes;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("QuickChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuickChat")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5c2f0b6a-7ca6-4131-abbf-3f1d4650154e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.0.0.0")]
internal static class QuickChatExtensions
{
internal static string RemoveWhiteSpace(this string self)
{
return new string(self.Where((char c) => !char.IsWhiteSpace(c)).ToArray());
}
internal static string CapitalizeFirstChar(this string self)
{
if (self == null || self.Length == 0)
{
return self;
}
return self[0].ToString().ToUpper() + self.Substring(1);
}
}
namespace QuickChat
{
[HarmonyPatch(typeof(HUDManager))]
internal class ChatCharacterLimitPatcher
{
public static int CharacterLimit = 9999;
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void CharacterLimitPatchTMP(ref TMP_InputField ___chatTextField)
{
___chatTextField.characterLimit = 0;
}
[HarmonyPatch("AddPlayerChatMessageServerRpc")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> CharacterLimitPatchServerRPC(IEnumerable<CodeInstruction> instructions)
{
return FindAndReplaceCharacterLimit(new List<CodeInstruction>(instructions)).AsEnumerable();
}
[HarmonyPatch("SubmitChat_performed")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> CharacterLimitPatchSubmitChat(IEnumerable<CodeInstruction> instructions)
{
return FindAndReplaceCharacterLimit(new List<CodeInstruction>(instructions)).AsEnumerable();
}
private static List<CodeInstruction> FindAndReplaceCharacterLimit(List<CodeInstruction> code)
{
for (int i = 0; i < code.Count - 1; i++)
{
if (code[i].opcode == OpCodes.Callvirt && code[i].operand.ToString() == "Int32 get_Length()" && code[i + 1].opcode == OpCodes.Ldc_I4_S)
{
code[i + 1].opcode = OpCodes.Ldc_I4;
code[i + 1].operand = CharacterLimit;
break;
}
}
return code;
}
}
[HarmonyPatch(typeof(HUDManager))]
internal class ChatPatcher
{
internal static Dictionary<string, string> ChatShortcuts = new Dictionary<string, string>();
internal static string Prefix = "/";
internal static bool CaseSensitive = false;
internal static void ChatCommandsGen(string rawShortcuts)
{
string[] array = rawShortcuts.Split(new char[1] { ',' });
ChatShortcuts.Clear();
string[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
string[] array3 = array2[i].Split(new char[1] { ':' });
if (!Utility.IsNullOrWhiteSpace(array3[0]) && !Utility.IsNullOrWhiteSpace(array3[1]))
{
string text = Prefix + array3[0].RemoveWhiteSpace();
string text2 = array3[1].Trim();
if (!CaseSensitive)
{
text = text.ToLower();
}
Plugin.LogSource.LogDebug((object)("New Chat Shortcut: \"" + text + "\" => \"" + text2 + "\""));
ChatShortcuts.Add(text, text2);
}
}
}
internal static void ChatShortcutsGeneration(int num, List<SimpleShortcut> simpleShortcuts)
{
ChatShortcuts.Clear();
for (int i = 0; i < num; i++)
{
string nameValue = simpleShortcuts[i].nameValue;
string resultValue = simpleShortcuts[i].resultValue;
if (!Utility.IsNullOrWhiteSpace(nameValue) && !Utility.IsNullOrWhiteSpace(resultValue))
{
string text = Prefix + nameValue.RemoveWhiteSpace();
string text2 = resultValue.Trim();
if (!CaseSensitive)
{
text = text.ToLower();
}
Plugin.LogSource.LogDebug((object)("New Chat Shortcut: \"" + text + "\" => \"" + text2 + "\""));
ChatShortcuts.Add(text, text2);
}
}
}
public static string GetChatShortcutsList()
{
string text = string.Empty;
foreach (KeyValuePair<string, string> chatShortcut in ChatShortcuts)
{
int num = ChatShortcuts.Keys.ToList().IndexOf(chatShortcut.Key);
text = text + GetChatShortcutAdvancedFormat(num, chatShortcut.Key, chatShortcut.Value) + "\n";
}
return text;
}
public static string GetChatShortcutAdvancedFormat(int num, string name, string result)
{
return $"{num} - {name} : {result}";
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StopSelectionOnOpenChatPatch(ref TMP_InputField ___chatTextField)
{
___chatTextField.onFocusSelectAll = false;
}
[HarmonyPatch("AddTextToChatOnServer")]
[HarmonyPrefix]
private static void ChatPatch(ref string chatMessage, ref int playerId)
{
string key = (CaseSensitive ? chatMessage : chatMessage.ToLower());
Plugin.LogSource.LogDebug((object)("Tried to change command " + chatMessage));
if (ChatShortcuts.ContainsKey(key))
{
string text = (chatMessage = ChatShortcuts[key]);
Plugin.LogSource.LogDebug((object)("Found command " + chatMessage + " => " + text));
}
}
[HarmonyPatch("EnableChat_performed")]
[HarmonyPostfix]
private static void PrefixOnChatPatch(ref PlayerControllerB ___localPlayer, ref TMP_InputField ___chatTextField)
{
if (ShortcutHandler.QuickChatPrefixOnChat.Value)
{
___chatTextField.text = ShortcutHandler.QuickChatPrefix.Value;
___chatTextField.MoveToEndOfLine(false, false);
}
}
}
internal class ShortcutHandler
{
internal static ConfigEntry<bool> QuickChatUseAdvanced;
internal static ConfigEntry<bool> QuickChatPrefixOnChat;
internal static ConfigEntry<bool> QuickChatCaseSensitive;
internal static ConfigEntry<string> QuickChatPrefix;
internal static ConfigEntry<int> QuickChatSimpleShortcutsNumber;
internal static ConfigEntry<string> QuickChatShortcutsAdvanced;
internal static List<SimpleShortcut> SimpleShortcuts = new List<SimpleShortcut>();
internal static bool UseAdvanced => QuickChatUseAdvanced.Value;
internal static int SimpleShortcutsNum => QuickChatSimpleShortcutsNumber.Value;
internal static string AdvancedShortcutsRaw => QuickChatShortcutsAdvanced.Value;
internal static void Init()
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Expected O, but got Unknown
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Expected O, but got Unknown
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Expected O, but got Unknown
//IL_0171: Expected O, but got Unknown
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Expected O, but got Unknown
//IL_0309: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Expected O, but got Unknown
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Expected O, but got Unknown
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Expected O, but got Unknown
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Expected O, but got Unknown
QuickChatUseAdvanced = Plugin.ConfigF.Bind<bool>("General", "Use Advanced Shortcut Definition", false, "Allows user to define shortcuts with one Text Field (Only one restart required).");
QuickChatPrefixOnChat = Plugin.ConfigF.Bind<bool>("General", "Put Prefix on Chat", false, "Automatically your desired prefix when you open chat.");
QuickChatCaseSensitive = Plugin.ConfigF.Bind<bool>("Shortcuts", "Is Case Sensitive?", false, "Are the shortcuts case sensitive? (Requires shortcut to be UPPERCASE or lowercase depending on definition of shortcut).");
QuickChatPrefix = Plugin.ConfigF.Bind<string>("Shortcuts", "Chat Prefix", "/", "The prefix to use before a shortcut (say the prefix was \"/\": [/SHORTCUT_NAME => MESSAGE].");
BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(QuickChatUseAdvanced, true);
BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(QuickChatPrefixOnChat, false);
BoolCheckBoxConfigItem val3 = new BoolCheckBoxConfigItem(QuickChatCaseSensitive, false);
QuickChatCaseSensitive.SettingChanged += delegate
{
SaveCaseSensitive();
};
TextInputFieldConfigItem val4 = new TextInputFieldConfigItem(QuickChatPrefix, new TextInputFieldOptions
{
RequiresRestart = false
});
QuickChatPrefix.SettingChanged += delegate
{
SaveChatShortcuts(SimpleShortcutsNum, SimpleShortcuts);
};
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
LethalConfigManager.AddConfigItem((BaseConfigItem)val4);
if (!UseAdvanced)
{
QuickChatSimpleShortcutsNumber = Plugin.ConfigF.Bind<int>("Shortcuts", "Simple Shortcuts Amount", 4, "Amount of simple shortcuts (REQUIRES RESTART TO UPDATE).");
ConfigEntry<int> quickChatSimpleShortcutsNumber = QuickChatSimpleShortcutsNumber;
IntInputFieldOptions val5 = new IntInputFieldOptions
{
RequiresRestart = true
};
((BaseRangeOptions<int>)val5).Min = 1;
((BaseRangeOptions<int>)val5).Max = 20;
LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(quickChatSimpleShortcutsNumber, val5));
for (int i = 0; i < SimpleShortcutsNum; i++)
{
int num = i + 1;
ConfigEntry<string> val6 = Plugin.ConfigF.Bind<string>($"Simple Shortcut {num}", "Name", $"Name{num}", "The Name of the Shortcut that will be changed to the Result on enter.");
TextInputFieldConfigItem val7 = new TextInputFieldConfigItem(val6, new TextInputFieldOptions
{
RequiresRestart = false
});
val6.SettingChanged += delegate
{
SaveChatShortcuts(SimpleShortcutsNum, SimpleShortcuts);
};
ConfigEntry<string> val8 = Plugin.ConfigF.Bind<string>($"Simple Shortcut {num}", "Result", $"Result{num}", "The Result that will be shown after entering the Shortcut.");
TextInputFieldConfigItem val9 = new TextInputFieldConfigItem(val8, new TextInputFieldOptions
{
RequiresRestart = false
});
val8.SettingChanged += delegate
{
SaveChatShortcuts(SimpleShortcutsNum, SimpleShortcuts);
};
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7);
LethalConfigManager.AddConfigItem((BaseConfigItem)val9);
SimpleShortcuts.Add(new SimpleShortcut
{
name = val6,
result = val8
});
}
}
else
{
QuickChatShortcutsAdvanced = Plugin.ConfigF.Bind<string>("Shortcuts", "Advanced Chat Shortcuts", "a:My Balls", "Shortcuts in format of [SHORTCUT_NAME : MESSAGE, SHORTCUT_NAME2 : MESSAGE2] without the [].");
TextInputFieldConfigItem val10 = new TextInputFieldConfigItem(QuickChatShortcutsAdvanced, new TextInputFieldOptions
{
RequiresRestart = false
});
QuickChatShortcutsAdvanced.SettingChanged += delegate
{
SaveChatShortcuts(AdvancedShortcutsRaw);
};
LethalConfigManager.AddConfigItem((BaseConfigItem)val10);
}
SaveCaseSensitive();
SaveBasedOnUseAdvanced();
Plugin.LogSource.LogDebug((object)"QuickChat Config Successfully Loaded!");
}
internal static void SaveCaseSensitive()
{
ChatPatcher.CaseSensitive = QuickChatCaseSensitive.Value;
}
internal static void SavePrefix()
{
ChatPatcher.Prefix = QuickChatPrefix.Value;
}
internal static void SaveChatShortcuts(string rawShortcuts)
{
SavePrefix();
ChatPatcher.ChatCommandsGen(rawShortcuts);
}
internal static void SaveChatShortcuts(int num, List<SimpleShortcut> simpleShortcuts)
{
if (simpleShortcuts.Count == 0 || simpleShortcuts == null)
{
SaveChatShortcuts(AdvancedShortcutsRaw);
}
SavePrefix();
ChatPatcher.ChatShortcutsGeneration(num, simpleShortcuts);
}
internal static void SaveBasedOnUseAdvanced()
{
if (UseAdvanced)
{
SaveChatShortcuts(AdvancedShortcutsRaw);
}
else
{
SaveChatShortcuts(SimpleShortcutsNum, SimpleShortcuts);
}
}
internal static string GetConfigType()
{
if (!UseAdvanced)
{
return "Simple";
}
return "Advanced";
}
}
internal class SimpleShortcut
{
internal ConfigEntry<string> name;
internal ConfigEntry<string> result;
internal string nameValue => name.Value;
internal string resultValue => result.Value;
}
[BepInPlugin("alfungy.quickchat", "Quick Chat", "2.1.7")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony Harmony = new Harmony("alfungy.quickchat");
internal static ManualLogSource LogSource = Logger.CreateLogSource("alfungy.quickchat");
internal static ConfigFile ConfigF;
private void Awake()
{
ConfigF = ((BaseUnityPlugin)this).Config;
LogSource.LogInfo((object)"Quick Chat 2.1.7 has been loaded!");
LethalConfigManager.SkipAutoGen();
RadialMenuConfig.Init();
RadialMenuSetupDefaults.Init();
ShortcutHandler.Init();
TerminalHandler.Init();
Harmony.PatchAll(typeof(ChatPatcher));
Harmony.PatchAll(typeof(ChatCharacterLimitPatcher));
Harmony.PatchAll(typeof(RadialMenuHUD));
Harmony.PatchAll(typeof(RadialMenuInput));
Harmony.PatchAll(typeof(RadialMenuSetupDefaults));
Harmony.PatchAll(typeof(RadialMenuManager));
}
}
internal static class PluginInfo
{
public const string ModGUID = "alfungy.quickchat";
public const string ModName = "Quick Chat";
public const string ModVersion = "2.1.7";
}
[HarmonyPatch(typeof(Terminal))]
internal class TerminalHandler
{
internal static TerminalNode ShortcutHomeNode => TerminalApi.CreateTerminalNode("Welcome to the Quick Chat Shortcuts Page or the Q.C.S.P. for very very long.\nHere you can currently only view your shortcuts.\n\n----------------------------\n\nConfig Type: " + ShortcutHandler.GetConfigType() + "\n\nShortcuts List:\n" + ChatPatcher.GetChatShortcutsList(), false, "");
internal static TerminalNode CurrentNode => TerminalApi.Terminal.currentNode;
internal static Terminal CurrentTerminal => TerminalApi.Terminal;
internal static void Init()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
TerminalApi.AddCommand("qcview", new CommandInfo
{
Title = "qcview",
Description = "Display all shortcuts",
Category = "Other",
TriggerNode = ShortcutHomeNode,
DisplayTextSupplier = () => ShortcutHomeNode.displayText
}, (string)null, true);
}
}
}
namespace QuickChat.RadialMenu
{
public class RadialMenuConfig
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static EventHandler <>9__10_0;
public static EventHandler <>9__10_1;
public static EventHandler <>9__10_2;
public static EventHandler <>9__11_0;
public static CanModifyDelegate <>9__11_6;
public static EventHandler <>9__11_1;
public static CanModifyDelegate <>9__11_7;
public static EventHandler <>9__11_2;
public static EventHandler <>9__11_3;
public static CanModifyDelegate <>9__11_8;
public static EventHandler <>9__11_4;
public static CanModifyDelegate <>9__11_9;
public static EventHandler <>9__11_5;
internal void <Init>b__10_0(object obj, EventArgs args)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
if (RadialMenuManager.RadialMenuLoaded)
{
((Graphic)RadialMenuHUD.RadialMenuHUDBackground).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)QuickChatRadialMenuBackgroundAlpha.Value));
}
}
internal void <Init>b__10_1(object obj, EventArgs args)
{
if (RadialMenuManager.RadialMenuLoaded)
{
((TMP_Text)RadialMenuHUD.RadialMenuHUDRecentText).fontSizeMin = QuickChatRadialMenuRecentTextMinSize.Value;
}
}
internal void <Init>b__10_2(object obj, EventArgs args)
{
if (RadialMenuManager.RadialMenuLoaded)
{
((TMP_Text)RadialMenuHUD.RadialMenuHUDRecentText).fontSizeMax = QuickChatRadialMenuRecentTextMaxSize.Value;
}
}
internal void <Binds>b__11_0(object obj, EventArgs args)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (!QuickChatRadialMenuToggleUseMouse.Value)
{
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, ((InputControl)Keyboard.current[QuickChatRadialMenuToggleKey.Value]).path, !QuickChatRadialMenuToggleUseMouse.Value);
}
else
{
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, GetMousePath(QuickChatRadialMenuToggleMouseButton.Value), QuickChatRadialMenuToggleUseMouse.Value);
}
}
internal CanModifyResult <Binds>b__11_6()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
return CanModifyResult.op_Implicit(!QuickChatRadialMenuToggleUseMouse.Value);
}
internal void <Binds>b__11_1(object obj, EventArgs args)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, ((InputControl)Keyboard.current[QuickChatRadialMenuToggleKey.Value]).path, !QuickChatRadialMenuToggleUseMouse.Value);
}
internal CanModifyResult <Binds>b__11_7()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return CanModifyResult.op_Implicit(QuickChatRadialMenuToggleUseMouse.Value);
}
internal void <Binds>b__11_2(object obj, EventArgs args)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, GetMousePath(QuickChatRadialMenuToggleMouseButton.Value), QuickChatRadialMenuToggleUseMouse.Value);
}
internal void <Binds>b__11_3(object obj, EventArgs args)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (!QuickChatRadialMenuGoBackUseMouse.Value)
{
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, ((InputControl)Keyboard.current[QuickChatRadialMenuGoBackKey.Value]).path, !QuickChatRadialMenuGoBackUseMouse.Value);
}
else
{
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, GetMousePath(QuickChatRadialMenuGoBackMouseButton.Value), QuickChatRadialMenuGoBackUseMouse.Value);
}
}
internal CanModifyResult <Binds>b__11_8()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
return CanModifyResult.op_Implicit(!QuickChatRadialMenuGoBackUseMouse.Value);
}
internal void <Binds>b__11_4(object obj, EventArgs args)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, ((InputControl)Keyboard.current[QuickChatRadialMenuGoBackKey.Value]).path, !QuickChatRadialMenuGoBackUseMouse.Value);
}
internal CanModifyResult <Binds>b__11_9()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return CanModifyResult.op_Implicit(QuickChatRadialMenuGoBackUseMouse.Value);
}
internal void <Binds>b__11_5(object obj, EventArgs args)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, GetMousePath(QuickChatRadialMenuGoBackMouseButton.Value), QuickChatRadialMenuGoBackUseMouse.Value);
}
}
internal static ConfigEntry<bool> QuickChatRadialMenuToggleUseMouse;
internal static ConfigEntry<Key> QuickChatRadialMenuToggleKey;
internal static ConfigEntry<MouseButton> QuickChatRadialMenuToggleMouseButton;
internal static ConfigEntry<bool> QuickChatRadialMenuGoBackUseMouse;
internal static ConfigEntry<Key> QuickChatRadialMenuGoBackKey;
internal static ConfigEntry<MouseButton> QuickChatRadialMenuGoBackMouseButton;
internal static ConfigEntry<int> QuickChatRadialMenuBackgroundAlpha;
internal static ConfigEntry<int> QuickChatRadialMenuRecentTextMinSize;
internal static ConfigEntry<int> QuickChatRadialMenuRecentTextMaxSize;
internal static ConfigEntry<bool> QuickChatRadialMenuUseColoredText;
internal static void Init()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_0050: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_00de: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Expected O, but got Unknown
//IL_012d: Expected O, but got Unknown
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Expected O, but got Unknown
Binds();
QuickChatRadialMenuBackgroundAlpha = Plugin.ConfigF.Bind<int>("Radial Menu Background", "Alpha of Radial Menu background", 200, "The alpha (transparency) of the background when opening the Radial Menu.");
ConfigEntry<int> quickChatRadialMenuBackgroundAlpha = QuickChatRadialMenuBackgroundAlpha;
IntSliderOptions val = new IntSliderOptions
{
RequiresRestart = false
};
((BaseRangeOptions<int>)val).Min = 0;
((BaseRangeOptions<int>)val).Max = 255;
IntSliderConfigItem val2 = new IntSliderConfigItem(quickChatRadialMenuBackgroundAlpha, val);
QuickChatRadialMenuBackgroundAlpha.SettingChanged += delegate
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
if (RadialMenuManager.RadialMenuLoaded)
{
((Graphic)RadialMenuHUD.RadialMenuHUDBackground).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)QuickChatRadialMenuBackgroundAlpha.Value));
}
};
QuickChatRadialMenuRecentTextMinSize = Plugin.ConfigF.Bind<int>("Radial Menu Recent Text", "Radial Menu Text Minimum Size", 8, "The minimum size that the recent text can be.");
QuickChatRadialMenuRecentTextMaxSize = Plugin.ConfigF.Bind<int>("Radial Menu Recent Text", "Radial Menu Text Maximum Size", 18, "The maximum size that the recent text can be.");
ConfigEntry<int> quickChatRadialMenuRecentTextMinSize = QuickChatRadialMenuRecentTextMinSize;
IntSliderOptions val3 = new IntSliderOptions
{
RequiresRestart = false
};
((BaseRangeOptions<int>)val3).Min = 1;
((BaseRangeOptions<int>)val3).Max = 24;
IntSliderConfigItem val4 = new IntSliderConfigItem(quickChatRadialMenuRecentTextMinSize, val3);
QuickChatRadialMenuRecentTextMinSize.SettingChanged += delegate
{
if (RadialMenuManager.RadialMenuLoaded)
{
((TMP_Text)RadialMenuHUD.RadialMenuHUDRecentText).fontSizeMin = QuickChatRadialMenuRecentTextMinSize.Value;
}
};
ConfigEntry<int> quickChatRadialMenuRecentTextMaxSize = QuickChatRadialMenuRecentTextMaxSize;
IntSliderOptions val5 = new IntSliderOptions
{
RequiresRestart = false
};
((BaseRangeOptions<int>)val5).Min = 1;
((BaseRangeOptions<int>)val5).Max = 24;
IntSliderConfigItem val6 = new IntSliderConfigItem(quickChatRadialMenuRecentTextMaxSize, val5);
QuickChatRadialMenuRecentTextMaxSize.SettingChanged += delegate
{
if (RadialMenuManager.RadialMenuLoaded)
{
((TMP_Text)RadialMenuHUD.RadialMenuHUDRecentText).fontSizeMax = QuickChatRadialMenuRecentTextMaxSize.Value;
}
};
QuickChatRadialMenuUseColoredText = Plugin.ConfigF.Bind<bool>("Radial Menu Compatibility", "Radial Menu Text Use Color in Chat", true, "If the RadialMenu text should use colored text in chat.");
BoolCheckBoxConfigItem val7 = new BoolCheckBoxConfigItem(QuickChatRadialMenuUseColoredText, true);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
LethalConfigManager.AddConfigItem((BaseConfigItem)val7);
}
internal static void Binds()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Expected O, but got Unknown
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Expected O, but got Unknown
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Expected O, but got Unknown
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Expected O, but got Unknown
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Expected O, but got Unknown
QuickChatRadialMenuToggleUseMouse = Plugin.ConfigF.Bind<bool>("Radial Menu Binds", "Toggle Open & Close Use Mouse", false, "Whether or not you use the mouse to open the radial menu.");
QuickChatRadialMenuToggleKey = Plugin.ConfigF.Bind<Key>("Radial Menu Binds", "Toggle Open & Close Key", (Key)53, "The key used to open and close the radial menu.");
QuickChatRadialMenuToggleMouseButton = Plugin.ConfigF.Bind<MouseButton>("Radial Menu Binds", "Toggle Open & Close Mouse", (MouseButton)2, "The mouse button used to open and close the radial menu.");
BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(QuickChatRadialMenuToggleUseMouse, false);
QuickChatRadialMenuToggleUseMouse.SettingChanged += delegate
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (!QuickChatRadialMenuToggleUseMouse.Value)
{
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, ((InputControl)Keyboard.current[QuickChatRadialMenuToggleKey.Value]).path, !QuickChatRadialMenuToggleUseMouse.Value);
}
else
{
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, GetMousePath(QuickChatRadialMenuToggleMouseButton.Value), QuickChatRadialMenuToggleUseMouse.Value);
}
};
ConfigEntry<Key> quickChatRadialMenuToggleKey = QuickChatRadialMenuToggleKey;
EnumDropDownOptions val2 = new EnumDropDownOptions
{
RequiresRestart = false
};
object obj2 = <>c.<>9__11_6;
if (obj2 == null)
{
CanModifyDelegate val3 = () => CanModifyResult.op_Implicit(!QuickChatRadialMenuToggleUseMouse.Value);
<>c.<>9__11_6 = val3;
obj2 = (object)val3;
}
((BaseOptions)val2).CanModifyCallback = (CanModifyDelegate)obj2;
EnumDropDownConfigItem<Key> val4 = new EnumDropDownConfigItem<Key>(quickChatRadialMenuToggleKey, val2);
QuickChatRadialMenuToggleKey.SettingChanged += delegate
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, ((InputControl)Keyboard.current[QuickChatRadialMenuToggleKey.Value]).path, !QuickChatRadialMenuToggleUseMouse.Value);
};
ConfigEntry<MouseButton> quickChatRadialMenuToggleMouseButton = QuickChatRadialMenuToggleMouseButton;
EnumDropDownOptions val5 = new EnumDropDownOptions
{
RequiresRestart = false
};
object obj3 = <>c.<>9__11_7;
if (obj3 == null)
{
CanModifyDelegate val6 = () => CanModifyResult.op_Implicit(QuickChatRadialMenuToggleUseMouse.Value);
<>c.<>9__11_7 = val6;
obj3 = (object)val6;
}
((BaseOptions)val5).CanModifyCallback = (CanModifyDelegate)obj3;
EnumDropDownConfigItem<MouseButton> val7 = new EnumDropDownConfigItem<MouseButton>(quickChatRadialMenuToggleMouseButton, val5);
QuickChatRadialMenuToggleKey.SettingChanged += delegate
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, GetMousePath(QuickChatRadialMenuToggleMouseButton.Value), QuickChatRadialMenuToggleUseMouse.Value);
};
QuickChatRadialMenuGoBackUseMouse = Plugin.ConfigF.Bind<bool>("Radial Menu Binds", "Go Back Use Mouse", true, "Whether or not you use the mouse to go back one menu in the radial menu.");
QuickChatRadialMenuGoBackKey = Plugin.ConfigF.Bind<Key>("Radial Menu Binds", "Go Back Key", (Key)32, "The key used to go back one menu in the radial menu.");
QuickChatRadialMenuGoBackMouseButton = Plugin.ConfigF.Bind<MouseButton>("Radial Menu Binds", "Go Back Mouse", (MouseButton)1, "The mouse button used to go back one menu in the radial menu.");
BoolCheckBoxConfigItem val8 = new BoolCheckBoxConfigItem(QuickChatRadialMenuGoBackUseMouse, false);
QuickChatRadialMenuGoBackUseMouse.SettingChanged += delegate
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (!QuickChatRadialMenuGoBackUseMouse.Value)
{
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, ((InputControl)Keyboard.current[QuickChatRadialMenuGoBackKey.Value]).path, !QuickChatRadialMenuGoBackUseMouse.Value);
}
else
{
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, GetMousePath(QuickChatRadialMenuGoBackMouseButton.Value), QuickChatRadialMenuGoBackUseMouse.Value);
}
};
ConfigEntry<Key> quickChatRadialMenuGoBackKey = QuickChatRadialMenuGoBackKey;
EnumDropDownOptions val9 = new EnumDropDownOptions
{
RequiresRestart = false
};
object obj4 = <>c.<>9__11_8;
if (obj4 == null)
{
CanModifyDelegate val10 = () => CanModifyResult.op_Implicit(!QuickChatRadialMenuGoBackUseMouse.Value);
<>c.<>9__11_8 = val10;
obj4 = (object)val10;
}
((BaseOptions)val9).CanModifyCallback = (CanModifyDelegate)obj4;
EnumDropDownConfigItem<Key> val11 = new EnumDropDownConfigItem<Key>(quickChatRadialMenuGoBackKey, val9);
QuickChatRadialMenuGoBackKey.SettingChanged += delegate
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, ((InputControl)Keyboard.current[QuickChatRadialMenuGoBackKey.Value]).path, !QuickChatRadialMenuGoBackUseMouse.Value);
};
ConfigEntry<MouseButton> quickChatRadialMenuGoBackMouseButton = QuickChatRadialMenuGoBackMouseButton;
EnumDropDownOptions val12 = new EnumDropDownOptions
{
RequiresRestart = false
};
object obj5 = <>c.<>9__11_9;
if (obj5 == null)
{
CanModifyDelegate val13 = () => CanModifyResult.op_Implicit(QuickChatRadialMenuGoBackUseMouse.Value);
<>c.<>9__11_9 = val13;
obj5 = (object)val13;
}
((BaseOptions)val12).CanModifyCallback = (CanModifyDelegate)obj5;
EnumDropDownConfigItem<MouseButton> obj6 = new EnumDropDownConfigItem<MouseButton>(quickChatRadialMenuGoBackMouseButton, val12);
QuickChatRadialMenuGoBackMouseButton.SettingChanged += delegate
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, GetMousePath(QuickChatRadialMenuGoBackMouseButton.Value), QuickChatRadialMenuGoBackUseMouse.Value);
};
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)obj6);
UpdateBindings();
}
internal static void ChangeBinding(InputAction action, string bindingPathOverride, bool allowChange)
{
if (allowChange && action != null)
{
InputActionRebindingExtensions.ApplyBindingOverride(action, bindingPathOverride, (string)null, (string)null);
}
}
internal static string GetMousePath(MouseButton button)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected I4, but got Unknown
Mouse current = Mouse.current;
string result = string.Empty;
switch ((int)button)
{
case 0:
result = ((InputControl)current.leftButton).path;
break;
case 1:
result = ((InputControl)current.rightButton).path;
break;
case 2:
result = ((InputControl)current.middleButton).path;
break;
case 3:
result = ((InputControl)current.forwardButton).path;
break;
case 4:
result = ((InputControl)current.backButton).path;
break;
}
return result;
}
internal static void UpdateBindings()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!QuickChatRadialMenuToggleUseMouse.Value)
{
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, ((InputControl)Keyboard.current[QuickChatRadialMenuToggleKey.Value]).path, !QuickChatRadialMenuToggleUseMouse.Value);
}
else
{
ChangeBinding(RadialMenuInput.RadialMenuToggleAction, GetMousePath(QuickChatRadialMenuToggleMouseButton.Value), QuickChatRadialMenuToggleUseMouse.Value);
}
}
catch
{
}
try
{
if (!QuickChatRadialMenuGoBackUseMouse.Value)
{
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, ((InputControl)Keyboard.current[QuickChatRadialMenuGoBackKey.Value]).path, !QuickChatRadialMenuGoBackUseMouse.Value);
}
else
{
ChangeBinding(RadialMenuInput.RadialMenuGoBackAction, GetMousePath(QuickChatRadialMenuGoBackMouseButton.Value), QuickChatRadialMenuGoBackUseMouse.Value);
}
}
catch
{
}
}
public static IntSliderConfigItem[] ColorConfigFromButton(ConfigFile ConfigF, RadialMenu.RadialButton radialButton)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Expected O, but got Unknown
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Expected O, but got Unknown
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Expected O, but got Unknown
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
RadialMenu radialMenu = radialButton.connectingRadialMenu();
ConfigEntry<int>[] colorValues = new ConfigEntry<int>[4]
{
ConfigF.Bind<int>(radialMenu.name + " RadialMenu Options", "Color R", ConvertToRGB32(radialButton.buttonColor.r), "The Red of the RadialButton Color"),
ConfigF.Bind<int>(radialMenu.name + " RadialMenu Options", "Color G", ConvertToRGB32(radialButton.buttonColor.g), "The Green of the RadialButton Color"),
ConfigF.Bind<int>(radialMenu.name + " RadialMenu Options", "Color B", ConvertToRGB32(radialButton.buttonColor.b), "The Blue of the RadialButton Color"),
ConfigF.Bind<int>(radialMenu.name + " RadialMenu Options", "Color A", ConvertToRGB32(radialButton.buttonColor.a), "The Alpha (Transparency) of the RadialButton Color")
};
IntSliderOptions val = new IntSliderOptions();
((BaseRangeOptions<int>)val).Min = 0;
((BaseRangeOptions<int>)val).Max = 255;
((BaseOptions)val).RequiresRestart = false;
IntSliderOptions val2 = val;
IntSliderConfigItem val3 = new IntSliderConfigItem(colorValues[0], val2);
colorValues[0].SettingChanged += delegate
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
radialButton.buttonColor = new Color(ConvertToRGB(colorValues[0].Value), radialButton.buttonColor.g, radialButton.buttonColor.b, radialButton.buttonColor.a);
};
IntSliderConfigItem val4 = new IntSliderConfigItem(colorValues[1], val2);
colorValues[1].SettingChanged += delegate
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
radialButton.buttonColor = new Color(radialButton.buttonColor.r, ConvertToRGB(colorValues[1].Value), radialButton.buttonColor.b, radialButton.buttonColor.a);
};
IntSliderConfigItem val5 = new IntSliderConfigItem(colorValues[2], val2);
colorValues[2].SettingChanged += delegate
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
radialButton.buttonColor = new Color(radialButton.buttonColor.r, radialButton.buttonColor.g, ConvertToRGB(colorValues[2].Value), radialButton.buttonColor.a);
};
IntSliderConfigItem val6 = new IntSliderConfigItem(colorValues[3], val2);
colorValues[3].SettingChanged += delegate
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
radialButton.buttonColor = new Color(radialButton.buttonColor.r, radialButton.buttonColor.g, radialButton.buttonColor.b, ConvertToRGB(colorValues[3].Value));
};
return (IntSliderConfigItem[])(object)new IntSliderConfigItem[4] { val3, val4, val5, val6 };
}
public static TextInputFieldConfigItem DisplayTextConfigFromButton(ConfigFile ConfigF, RadialMenu.RadialButton radialButton)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Expected O, but got Unknown
RadialMenu radialMenu = radialButton.connectingRadialMenu();
ConfigEntry<string> displayTextValue = ConfigF.Bind<string>(radialMenu.name + " RadialMenu Options", "Display Text", radialButton.displayText, "The Display Text of the Radial Button");
TextInputFieldConfigItem val = new TextInputFieldConfigItem(displayTextValue, false);
displayTextValue.SettingChanged += delegate
{
radialButton.displayText = displayTextValue.Value;
};
return val;
}
private static int ConvertToRGB32(float colorValue)
{
return (int)(colorValue * 255f);
}
private static float ConvertToRGB(int colorValue)
{
return (float)colorValue / 255f;
}
}
public class RadialMenuHUD
{
public delegate void RadialMenuHUDLoadingEvent();
public delegate void RadialMenuHUDTextEvent(string text);
internal static GameObject RadialMenuHUDObject;
internal static Image RadialMenuHUDBackground;
internal static TextMeshProUGUI RadialMenuHUDRecentText;
internal static Camera RadialMenuHUDCamera;
internal static Vector2 Center => new Vector2((float)(Screen.width / 2), (float)(Screen.height / 2));
public static event RadialMenuHUDLoadingEvent OnHUDPreLoaded;
public static event RadialMenuHUDLoadingEvent OnHUDPostLoaded;
public static event RadialMenuHUDLoadingEvent OnHUDPreUnloaded;
public static event RadialMenuHUDLoadingEvent OnHUDPostUnloaded;
public static event RadialMenuHUDTextEvent OnHUDChatPreviewUpdated;
public static event RadialMenuHUDTextEvent OnHUDRecentTextUpdated;
internal static void Init()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
RadialMenuHUD.OnHUDPreLoaded?.Invoke();
Transform val = ((Component)GameObject.Find("Systems").transform.Find("UI")).transform.Find("Canvas");
RadialMenuHUDCamera = ((Component)((Component)GameObject.Find("Systems").transform.Find("UI")).transform.Find("UICamera")).GetComponent<Camera>();
RadialMenuHUDObject = new GameObject
{
name = "QuickChat Container"
};
RadialMenuHUDObject.transform.SetParent(val, false);
RectTransform obj = RadialMenuHUDObject.AddComponent<RectTransform>();
obj.offsetMax = new Vector2(25f, 75f);
obj.offsetMin = new Vector2(0f, 50f);
RadialMenuHUDBackground = new GameObject
{
name = "QuickChat Background"
}.AddComponent<Image>();
((Component)RadialMenuHUDBackground).transform.SetParent(RadialMenuHUDObject.transform, false);
((Component)RadialMenuHUDBackground).transform.SetSiblingIndex(0);
((Graphic)RadialMenuHUDBackground).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)RadialMenuConfig.QuickChatRadialMenuBackgroundAlpha.Value));
((Graphic)RadialMenuHUDBackground).rectTransform.anchoredPosition = Vector2.op_Implicit(RadialMenuHUDCamera.ScreenToWorldPoint(Vector2.op_Implicit(Center)));
((Graphic)RadialMenuHUDBackground).rectTransform.sizeDelta = new Vector2((float)Screen.width, (float)Screen.height);
RadialMenuHUDRecentText = new GameObject
{
name = "Most Recent Text"
}.AddComponent<TextMeshProUGUI>();
((TMP_Text)RadialMenuHUDRecentText).transform.SetParent(RadialMenuHUDObject.transform, false);
((TMP_Text)RadialMenuHUDRecentText).alignment = (TextAlignmentOptions)514;
((TMP_Text)RadialMenuHUDRecentText).enableWordWrapping = true;
((TMP_Text)RadialMenuHUDRecentText).enableAutoSizing = true;
((TMP_Text)RadialMenuHUDRecentText).fontSizeMin = RadialMenuConfig.QuickChatRadialMenuRecentTextMinSize.Value;
((TMP_Text)RadialMenuHUDRecentText).fontSizeMax = RadialMenuConfig.QuickChatRadialMenuRecentTextMaxSize.Value;
((TMP_Text)RadialMenuHUDRecentText).rectTransform.sizeDelta = new Vector2(350f, 350f);
((TMP_Text)RadialMenuHUDRecentText).rectTransform.anchoredPosition = Vector2.op_Implicit(RadialMenuHUDCamera.ScreenToWorldPoint(Vector2.op_Implicit(Center)));
RadialMenuHUDObject.SetActive(false);
RadialMenuManager.RadialMenuLoaded = true;
RadialMenuHUD.OnHUDPostLoaded?.Invoke();
}
public static void DeInit()
{
RadialMenuHUD.OnHUDPreUnloaded?.Invoke();
RadialMenuManager.RadialMenuLoaded = false;
RadialMenuHUD.OnHUDPostUnloaded?.Invoke();
}
public static void ToggleRadialMenu(bool open, bool modifyInput = true)
{
if (RadialMenuManager.RadialMenuLoaded)
{
if (!open)
{
RadialMenuManager.ResetChatText();
}
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
RadialMenuHUDObject.SetActive(open);
RadialMenuManager.RadialMenuOpen = open;
if (modifyInput)
{
Cursor.visible = open;
Cursor.lockState = (CursorLockMode)((!open) ? 1 : 0);
localPlayerController.disableLookInput = open;
}
HUDManager.Instance.chatTextField.textComponent.enableWordWrapping = !open;
}
}
public static void UpdateChatPreview(string text)
{
HUDManager.Instance.chatTextField.text = string.Empty;
HUDManager.Instance.chatTextField.MoveToEndOfLine(false, false);
HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, 1f, 1f, 1f);
RadialMenuHUD.OnHUDChatPreviewUpdated?.Invoke(text);
}
public static void UpdateChatRecentText(string text)
{
((TMP_Text)RadialMenuHUDRecentText).text = text;
RadialMenuHUD.OnHUDRecentTextUpdated?.Invoke(text);
}
[HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")]
[HarmonyPostfix]
private static void OpenQuickMenuCloseRadialMenuPatch()
{
ToggleRadialMenu(open: false, modifyInput: false);
}
[HarmonyPatch(typeof(QuickMenuManager), "CloseQuickMenu")]
[HarmonyPostfix]
private static void CloseQuickMenuFixLookInputPatch()
{
GameNetworkManager.Instance.localPlayerController.disableLookInput = false;
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
[HarmonyPostfix]
private static void PlayerControllerBKillPlayerCloseRadialMenuPatch()
{
ToggleRadialMenu(open: false, modifyInput: false);
}
}
public class RadialMenuInput
{
public delegate void RadialMenuInputLoadingEvent();
public delegate void RadialMenuInputEvent();
public delegate void RadialMenuToggleInputEvent(bool activated);
internal static InputAction RadialMenuToggleAction = new InputAction("Open", (InputActionType)1, "<Keyboard>/alt", (string)null, (string)null, (string)null);
internal static InputAction RadialMenuGoBackAction = new InputAction("Close", (InputActionType)1, "<Mouse>/rightButton", (string)null, (string)null, (string)null);
public static event RadialMenuInputLoadingEvent OnInputPreLoaded;
public static event RadialMenuInputLoadingEvent OnInputPostLoaded;
public static event RadialMenuInputLoadingEvent OnInputPreUnloaded;
public static event RadialMenuInputLoadingEvent OnInputPostUnloaded;
public static event RadialMenuInputEvent OnInputGoBack;
public static event RadialMenuToggleInputEvent OnInputToggle;
internal static void Init()
{
RadialMenuInput.OnInputPreLoaded?.Invoke();
RadialMenuConfig.UpdateBindings();
RadialMenuToggleAction.Enable();
RadialMenuGoBackAction.Enable();
RadialMenuToggleAction.performed += RadialMenuToggleAction_performed;
RadialMenuGoBackAction.performed += RadialMenuGoBackAction_performed;
Cursor.lockState = (CursorLockMode)1;
RadialMenuInput.OnInputPostLoaded?.Invoke();
}
internal static void DeInit()
{
RadialMenuInput.OnInputPreUnloaded?.Invoke();
RadialMenuToggleAction.Disable();
RadialMenuGoBackAction.Disable();
RadialMenuToggleAction.performed -= RadialMenuToggleAction_performed;
RadialMenuGoBackAction.performed -= RadialMenuGoBackAction_performed;
RadialMenuInput.OnInputPostUnloaded?.Invoke();
}
private static void RadialMenuToggleAction_performed(CallbackContext ctx)
{
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if (!localPlayerController.isTypingChat && !localPlayerController.isPlayerDead && !localPlayerController.quickMenuManager.isMenuOpen)
{
RadialMenuManager.RadialMenuOpen = !RadialMenuManager.RadialMenuOpen;
RadialMenuHUD.ToggleRadialMenu(RadialMenuManager.RadialMenuOpen);
RadialMenuInput.OnInputToggle?.Invoke(RadialMenuManager.RadialMenuOpen);
}
}
private static void RadialMenuGoBackAction_performed(CallbackContext ctx)
{
RadialMenuManager.GoBackMenu();
RadialMenuManager.UpdateChat();
RadialMenuInput.OnInputGoBack?.Invoke();
}
[HarmonyPatch(typeof(HUDManager), "CanPlayerScan")]
[HarmonyPrefix]
private static bool PingScanRadialMenuOpenPatch()
{
if (RadialMenuManager.RadialMenuOpen)
{
return false;
}
return true;
}
[HarmonyPatch(typeof(PlayerControllerB), "CanUseItem")]
[HarmonyPrefix]
private static bool ActivateItemRadialMenuOpenPatch()
{
if (RadialMenuManager.RadialMenuOpen)
{
return false;
}
return true;
}
}
public class RadialMenuManager
{
public delegate void RadialMenuMainLoadingEvent();
internal static bool RadialMenuLoaded = false;
internal static bool RadialMenuOpen = false;
public static List<RadialMenu> RadialMenuRegistry { get; private set; } = new List<RadialMenu>();
public static List<RadialMenu> RadialMenuHistory { get; private set; } = new List<RadialMenu>();
public static RadialMenu CurrentMenu { get; private set; }
public static RadialMenu LastMenu
{
get
{
if (RadialMenuHistory.Count <= 0)
{
return null;
}
return RadialMenuHistory.Last();
}
}
public static RadialMenu MainMenu { get; private set; } = new RadialMenu
{
name = "MainMenu"
};
public static List<RadialMenu.RadialButton> RadialButtonHistory { get; private set; } = new List<RadialMenu.RadialButton>();
public static RadialMenu.RadialButton MostRecentButton
{
get
{
if (RadialButtonHistory.Count <= 0)
{
return null;
}
return RadialButtonHistory.Last();
}
}
public static string MostRecentText
{
get
{
if (RadialButtonHistory.Count <= 0)
{
return string.Empty;
}
return RadialButtonHistory.Last().text.Trim();
}
}
public static event RadialMenuMainLoadingEvent OnMainMenuPreRegister;
public static event RadialMenuMainLoadingEvent OnMainMenuPostRegister;
public static event RadialMenuMainLoadingEvent OnReady;
public static event RadialMenuMainLoadingEvent OnPreExit;
public static event RadialMenuMainLoadingEvent OnPostExit;
[HarmonyPatch(typeof(RoundManager), "Awake")]
[HarmonyPostfix]
private static void AwakePatch()
{
RadialMenuHUD.Init();
RadialMenuInput.Init();
RadialMenuManager.OnMainMenuPreRegister?.Invoke();
RegisterRadialMenu(MainMenu);
RadialMenuManager.OnMainMenuPostRegister?.Invoke();
foreach (RadialMenu item in RadialMenuRegistry)
{
item.CreateRadialMenu(RadialMenuHUD.RadialMenuHUDObject.transform);
}
SetCurrentMenu(MainMenu);
RefreshMenu();
RadialMenuManager.OnReady?.Invoke();
}
[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
[HarmonyPostfix]
private static void ResetPatch()
{
RadialMenuManager.OnPreExit?.Invoke();
foreach (RadialMenu item in RadialMenuRegistry)
{
item.RemoveRadialMenu();
}
RadialMenuInput.DeInit();
RadialMenuHUD.DeInit();
RadialMenuManager.OnPostExit?.Invoke();
}
public static RadialMenu ConstructAndRegisterRadialMenu(RadialMenu radialMenu)
{
RegisterRadialMenu(radialMenu);
return radialMenu;
}
public static void RegisterRadialMenu(RadialMenu radialMenu)
{
if (!RadialMenuRegistry.Contains(radialMenu))
{
RadialMenuRegistry.Add(radialMenu);
}
}
public static void SetCurrentMenu(RadialMenu menu, bool saveLastToHistory = true)
{
if (CurrentMenu != menu)
{
if (CurrentMenu != null && saveLastToHistory && CurrentMenu.saveToHistory)
{
RadialMenuHistory.Add(CurrentMenu);
}
CurrentMenu = menu;
}
}
public static void GoBackMenu()
{
if (RadialMenuHistory.Count > 0)
{
RadialMenu lastMenu = LastMenu;
RadialMenu currentMenu = CurrentMenu;
if (RadialMenuHistory.Count == RadialButtonHistory.Count)
{
RemoveRadialButtonHistory();
}
SetCurrentMenu(lastMenu, saveLastToHistory: false);
RefreshMenu(currentMenu, lastMenu);
RemoveFromRadialMenuHistory();
}
}
public static void RefreshMenu()
{
RadialMenu lastMenu = LastMenu;
if (lastMenu != null)
{
lastMenu.gameObject.SetActive(false);
}
RadialMenu currentMenu = CurrentMenu;
if (currentMenu != null)
{
currentMenu.gameObject.SetActive(true);
}
}
public static void RefreshMenu(RadialMenu deactivatingMenu, RadialMenu activatingMenu)
{
if (deactivatingMenu != null)
{
deactivatingMenu.gameObject.SetActive(false);
}
if (activatingMenu != null)
{
activatingMenu.gameObject.SetActive(true);
}
}
public static void AddToRadialMenuHistory(RadialMenu radialMenu)
{
RadialMenuHistory.Add(radialMenu);
}
public static void ModifyRadialMenuHistory(RadialMenu radialMenu, int i)
{
RadialMenuHistory.RemoveAt(i);
RadialMenuHistory.Insert(i, radialMenu);
}
public static void RemoveFromRadialMenuHistory()
{
RadialMenuHistory.RemoveAt(RadialMenuHistory.Count - 1);
}
public static void RemoveFromRadialMenuHistory(int i)
{
RadialMenuHistory.RemoveAt(i);
}
public static void AddRadialButtonHistory(RadialMenu.RadialButton radialButton)
{
RadialButtonHistory.Add(radialButton);
UpdateChat();
}
public static void AddRadialButtonHistory(string text)
{
RadialMenu.RadialButton item = new RadialMenu.RadialButton(text);
RadialButtonHistory.Add(item);
UpdateChat();
}
public static void InsertRadialButtonHistory(RadialMenu.RadialButton radialButton, int i)
{
RadialButtonHistory.Insert(i, radialButton);
UpdateChat();
}
public static void InsertRadialButtonHistory(string text, int i)
{
RadialMenu.RadialButton item = new RadialMenu.RadialButton(text);
RadialButtonHistory.Insert(i, item);
UpdateChat();
}
public static void ModifyRadialButtonHistory(RadialMenu.RadialButton radialButton, int i)
{
RadialButtonHistory.RemoveAt(i);
RadialButtonHistory.Insert(i, radialButton);
UpdateChat();
}
public static void ModifyRadialButtonHistory(string text, int i)
{
RadialMenu.RadialButton item = new RadialMenu.RadialButton(text);
RadialButtonHistory.RemoveAt(i);
RadialButtonHistory.Insert(i, item);
UpdateChat();
}
public static void RemoveRadialButtonHistory()
{
if (RadialButtonHistory.Count > 0)
{
RadialButtonHistory.RemoveAt(RadialButtonHistory.Count - 1);
UpdateChat();
}
}
public static void RemoveRadialButtonHistory(int i)
{
if (RadialButtonHistory.Count > 0)
{
RadialButtonHistory.RemoveAt(i);
UpdateChat();
}
}
internal static void UpdateChat()
{
RadialMenuHUD.UpdateChatPreview(JoinChatText().CapitalizeFirstChar());
RadialMenuHUD.UpdateChatRecentText(MostRecentText.CapitalizeFirstChar());
}
internal static string JoinChatText()
{
return GeneralExtensions.Join<RadialMenu.RadialButton>((IEnumerable<RadialMenu.RadialButton>)RadialButtonHistory, (Func<RadialMenu.RadialButton, string>)((RadialMenu.RadialButton radialButton) => radialButton.text), " ").Trim();
}
internal static void ResetChatText()
{
RadialButtonHistory.Clear();
RadialMenuHUD.UpdateChatPreview(string.Empty);
RadialMenuHUD.UpdateChatRecentText(string.Empty);
SetCurrentMenu(MainMenu);
RefreshMenu();
RadialMenuHistory.Clear();
}
internal static void SendChatText()
{
string text = MostRecentButton.punctuation?.Invoke();
string self = JoinChatText();
self = self.CapitalizeFirstChar() + text;
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
HUDManager.Instance.AddTextToChatOnServer(self, (int)localPlayerController.playerClientId);
RadialMenuHUD.ToggleRadialMenu(open: false);
}
}
public class RadialMenu
{
public class RadialButton
{
public delegate void RadialButtonClicked(RadialMenu radialMenu, RadialButton radialButton);
private Sprite m_buttonSprite;
private Color m_buttonColor = Color.white;
private string m_text = string.Empty;
private string m_displayText = string.Empty;
private Func<string> m_punctuation = () => ".";
private Vector2 m_positionOverride = Vector2.zero;
private Vector2 m_sizeDelta = Vector2.one * 75f;
private float m_textSize = 12f;
private Color m_textColor = Color.black;
private TextAlignmentOptions m_textAlignment = (TextAlignmentOptions)514;
public bool useTextColorOnChat;
public RadialMenu parentRadialMenu;
public Func<RadialMenu> connectingRadialMenu;
public Action<RadialMenu, RadialButton> preRadialButtonClicked;
public Action<RadialMenu, RadialButton> postRadialButtonClicked;
public bool saveToHistory = true;
private bool created;
public GameObject gameObject { get; private set; }
public Transform transform { get; private set; }
public RectTransform rectTransform { get; private set; }
public Image image { get; private set; }
public Button button { get; private set; }
public TextMeshProUGUI textField { get; private set; }
public Sprite buttonSprite
{
get
{
return m_buttonSprite;
}
set
{
if (created && (Object)(object)image != (Object)null)
{
image.sprite = value;
}
m_buttonSprite = value;
}
}
public Color buttonColor
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return m_buttonColor;
}
set
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (created && (Object)(object)image != (Object)null)
{
((Graphic)image).color = value;
}
m_buttonColor = value;
}
}
public string text
{
get
{
return m_text;
}
set
{
string text = value.Trim();
if (created && (Object)(object)textField != (Object)null)
{
((TMP_Text)textField).text = ((displayText == string.Empty) ? ("\"" + text + "\"") : displayText);
}
m_text = text;
}
}
public string displayText
{
get
{
return m_displayText;
}
set
{
if (created && (Object)(object)textField != (Object)null)
{
((TMP_Text)textField).text = ((displayText == string.Empty) ? ("\"" + value + "\"") : displayText);
}
m_displayText = value;
}
}
public Func<string> punctuation
{
get
{
return m_punctuation;
}
set
{
m_punctuation = value;
}
}
public Vector2 positionOverride
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return m_positionOverride;
}
set
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
m_positionOverride = value;
if (created && parentRadialMenu != null)
{
parentRadialMenu.EvenlySplitOnUnitCircle();
}
}
}
public Vector2 sizeDelta
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return m_sizeDelta;
}
set
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (created && (Object)(object)rectTransform != (Object)null)
{
rectTransform.sizeDelta = value;
}
m_sizeDelta = value;
}
}
public float textSize
{
get
{
return m_textSize;
}
set
{
if (created && (Object)(object)textField != (Object)null)
{
((TMP_Text)textField).fontSize = value;
}
m_textSize = value;
}
}
public Color textColor
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return m_textColor;
}
set
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (created && (Object)(object)textField != (Object)null)
{
((Graphic)textField).color = value;
}
m_textColor = value;
}
}
public TextAlignmentOptions textAlignment
{
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return m_textAlignment;
}
set
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (created && (Object)(object)textField != (Object)null)
{
((TMP_Text)textField).alignment = value;
}
m_textAlignment = value;
}
}
private string expressText
{
get
{
if (!(displayText == string.Empty))
{
return displayText;
}
return "\"" + text + "\"";
}
}
public event RadialButtonClicked PreRadialButtonClicked;
public event RadialButtonClicked PostRadialButtonClicked;
internal void QuoteOnQuoteDestroyRadialButton()
{
if (created)
{
created = false;
}
}
internal void CreateTextField()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject
{
name = expressText
};
val.transform.SetParent(transform, false);
textField = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)textField).text = ((displayText == string.Empty) ? ("\"" + text + "\"") : displayText);
((TMP_Text)textField).fontSize = textSize;
((Graphic)textField).color = textColor;
((TMP_Text)textField).alignment = textAlignment;
((TMP_Text)textField).rectTransform.sizeDelta = sizeDelta;
((TMP_Text)textField).enableWordWrapping = true;
}
internal void SetTextColorOnChat()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if (useTextColorOnChat && RadialMenuConfig.QuickChatRadialMenuUseColoredText.Value)
{
string text = ColorUtility.ToHtmlStringRGBA(textColor);
string text2 = this.text;
this.text = "<color=#" + text + ">" + text2 + "</color>";
this.text.Trim();
}
}
internal void SetupRadialButton(RadialMenu parentRadialMenu)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
if (!created)
{
created = true;
gameObject = new GameObject
{
name = expressText
};
transform = gameObject.transform;
transform.SetParent(parentRadialMenu.transform, false);
this.parentRadialMenu = parentRadialMenu;
CreateTextField();
image = gameObject.AddComponent<Image>();
image.sprite = buttonSprite;
((Graphic)image).color = buttonColor;
button = gameObject.AddComponent<Button>();
((Selectable)button).image = image;
((UnityEvent)button.onClick).AddListener(new UnityAction(OnClick));
text = text.Trim();
SetTextColorOnChat();
Transform obj = ((Component)button).transform;
rectTransform = (RectTransform)(object)((obj is RectTransform) ? obj : null);
rectTransform.sizeDelta = sizeDelta;
}
}
internal void OnClick()
{
preRadialButtonClicked?.Invoke(parentRadialMenu, this);
this.PreRadialButtonClicked?.Invoke(parentRadialMenu, this);
RadialMenu radialMenu = connectingRadialMenu?.Invoke();
RadialMenu currentMenu = RadialMenuManager.CurrentMenu;
if (saveToHistory)
{
RadialMenuManager.AddRadialButtonHistory(this);
}
if (radialMenu == null || radialMenu.radialButtons.Count <= 0)
{
RadialMenuManager.SendChatText();
}
else
{
RadialMenuManager.SetCurrentMenu(radialMenu, RadialMenuManager.LastMenu != currentMenu);
}
RadialMenuManager.RefreshMenu(currentMenu, radialMenu);
postRadialButtonClicked?.Invoke(parentRadialMenu, this);
this.PostRadialButtonClicked?.Invoke(parentRadialMenu, this);
}
public RadialButton()
{
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
public RadialButton(RadialMenu connectingRadialMenu)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
displayText = connectingRadialMenu.name;
this.connectingRadialMenu = () => connectingRadialMenu;
}
public RadialButton(RadialMenu connectingRadialMenu, Color buttonColor)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
displayText = connectingRadialMenu.name;
this.buttonColor = buttonColor;
this.connectingRadialMenu = () => connectingRadialMenu;
}
public RadialButton(string text)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
}
public RadialButton(string text, Color buttonColor)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
this.buttonColor = buttonColor;
}
public RadialButton(string text, char punctuation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
displayText = $"\"{text}{punctuation}\"";
this.punctuation = () => punctuation.ToString();
}
public RadialButton(string text, string displayText)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
this.displayText = displayText;
}
public RadialButton(string text, RadialMenu connectingRadialMenu)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
this.connectingRadialMenu = () => connectingRadialMenu;
}
public RadialButton(string text, char punctuation, Color buttonColor)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
displayText = $"\"{text}{punctuation}\"";
this.punctuation = () => punctuation.ToString();
this.buttonColor = buttonColor;
}
public RadialButton(string text, string displayText, RadialMenu connectingRadialMenu)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
this.displayText = displayText;
this.connectingRadialMenu = () => connectingRadialMenu;
}
public RadialButton(string text, string displayText, string punctuation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
this.text = text;
this.displayText = displayText;
this.punctuation = () => punctuation;
}
}
public class UnitCircleOffset
{
public const float RIGHT = 0f;
public const float TOP_RIGHT = (float)Math.PI / 4f;
public const float TOP = (float)Math.PI / 2f;
public const float TOP_LEFT = (float)Math.PI * 3f / 4f;
public const float LEFT = (float)Math.PI;
public const float BOTTOM_LEFT = 3.926991f;
public const float BOTTOM = 4.712389f;
public const float BOTTOM_RIGHT = 5.4977875f;
}
private List<RadialButton> m_radialButtons = new List<RadialButton>();
public string name = "Menu";
public bool saveToHistory = true;
private float m_radialOffset = 4.712389f;
private float m_outwards = 175f;
public GameObject gameObject { get; private set; }
public Transform transform { get; private set; }
public List<RadialButton> radialButtons
{
get
{
return m_radialButtons;
}
set
{
m_radialButtons = value;
UpdateRadialButtons(m_radialButtons);
}
}
public float radialOffset
{
get
{
return m_radialOffset;
}
set
{
m_radialOffset = value;
EvenlySplitOnUnitCircle();
}
}
public float outwards
{
get
{
return m_outwards;
}
set
{
m_outwards = value;
EvenlySplitOnUnitCircle();
}
}
public bool created { get; private set; }
public void AddRadialButton(RadialButton button)
{
radialButtons.Add(button);
}
public void InsertRadialButton(RadialButton button, int i)
{
radialButtons.Insert(i, button);
}
public void UpdateRadialButtons(List<RadialButton> radialButtons)
{
if (created)
{
m_radialButtons.ForEach(delegate(RadialButton button)
{
button.QuoteOnQuoteDestroyRadialButton();
});
}
m_radialButtons.Clear();
m_radialButtons = radialButtons;
UpdateRadialButtons();
}
public void UpdateRadialButtons()
{
if (created)
{
radialButtons.ForEach(delegate(RadialButton button)
{
button.SetupRadialButton(this);
});
EvenlySplitOnUnitCircle();
}
}
public void RemoveRadialButton(int i)
{
radialButtons.RemoveAt(i);
}
internal void EvenlySplitOnUnitCircle()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
for (int j = 0; j < radialButtons.Count; j++)
{
RadialButton radialButton = radialButtons[j];
if (radialButton.positionOverride != Vector2.zero)
{
radialButton.rectTransform.anchoredPosition = radialButton.positionOverride;
continue;
}
float x2 = GetPointOnUnitCircle(j);
Vector2 anchoredPosition = Vector2.op_Implicit(RadialMenuHUD.RadialMenuHUDCamera.ScreenToWorldPoint(Vector2.op_Implicit(RadialMenuHUD.Center))) + GetPositionOnUnitCircle(x2) * outwards;
radialButton.rectTransform.anchoredPosition = anchoredPosition;
}
float GetPointOnUnitCircle(int i)
{
return (float)Math.PI * 2f * ((float)i / (float)radialButtons.Count) + radialOffset;
}
static Vector2 GetPositionOnUnitCircle(float x)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return new Vector2(Mathf.Cos(x), Mathf.Sin(x));
}
}
internal void CreateRadialMenu(Transform parentTransform)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
if (!created)
{
created = true;
gameObject = new GameObject
{
name = name
};
transform = gameObject.transform;
transform.SetParent(parentTransform, false);
UpdateRadialButtons();
gameObject.SetActive(false);
}
}
internal void RemoveRadialMenu()
{
created = false;
radialButtons.ForEach(delegate(RadialButton button)
{
button.QuoteOnQuoteDestroyRadialButton();
});
}
public RadialMenu(bool autoRegister = true)
{
if (autoRegister)
{
RadialMenuManager.RegisterRadialMenu(this);
}
}
public RadialMenu(string name, bool autoRegister = true)
{
this.name = name;
if (autoRegister)
{
RadialMenuManager.RegisterRadialMenu(this);
}
}
}
public class RadialMenuSetupDefaults
{
public static RadialMenu positionsMenu = new RadialMenu("Positions");
public static RadialMenu monstersMenu2 = new RadialMenu("Monsters 2")
{
saveToHistory = false,
radialOffset = (float)Math.PI
};
public static RadialMenu monstersMenu = new RadialMenu("Monsters")
{
radialOffset = 0f
};
public static RadialMenu commandsMenu = new RadialMenu("Commands");
public static RadialMenu answersMenu = new RadialMenu("Answers");
public static RadialMenu questionsMenu = new RadialMenu("Questions");
public static RadialMenu greetingsMenu = new RadialMenu("Greetings");
public static RadialMenu observationsMenu = new RadialMenu("Observations");
public static RadialMenu urgentMenu = new RadialMenu("Urgent");
public static RadialMenu defaultMenu = new RadialMenu("Default Menu");
public static List<RadialMenu.RadialButton> defaultMenuButtons = new List<RadialMenu.RadialButton>();
internal static void Init()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
defaultMenuButtons = new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton(observationsMenu, Color.cyan),
new RadialMenu.RadialButton(questionsMenu, Color.yellow),
new RadialMenu.RadialButton(commandsMenu, Color.magenta),
new RadialMenu.RadialButton(urgentMenu, Color.red),
new RadialMenu.RadialButton(answersMenu, Color.green),
new RadialMenu.RadialButton(greetingsMenu, Color.white)
};
positionsMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("that way", "\"that way\" (point)")
{
postRadialButtonClicked = delegate
{
PerformEmoteFix(2);
}
},
new RadialMenu.RadialButton("to the right"),
new RadialMenu.RadialButton("up ahead"),
new RadialMenu.RadialButton("here"),
new RadialMenu.RadialButton("to the left")
});
monstersMenu2.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton
{
displayText = "Last Page",
saveToHistory = false,
connectingRadialMenu = () => monstersMenu
},
new RadialMenu.RadialButton("Nutcracker", positionsMenu),
new RadialMenu.RadialButton("Coil-Head", positionsMenu),
new RadialMenu.RadialButton("Jester", positionsMenu),
new RadialMenu.RadialButton("Masked", positionsMenu),
new RadialMenu.RadialButton("Forest Keeper", positionsMenu),
new RadialMenu.RadialButton("Baboon Hawk", positionsMenu),
new RadialMenu.RadialButton("Eyeless Dog", positionsMenu)
{
preRadialButtonClicked = delegate
{
RadialMenuManager.ModifyRadialButtonHistory("There's an", RadialMenuManager.RadialButtonHistory.Count - 1);
}
},
new RadialMenu.RadialButton("Earth Leviathan", positionsMenu)
{
preRadialButtonClicked = delegate
{
RadialMenuManager.ModifyRadialButtonHistory("There's an", RadialMenuManager.RadialButtonHistory.Count - 1);
}
}
});
monstersMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton
{
displayText = "Next Page",
saveToHistory = false,
connectingRadialMenu = () => monstersMenu2
},
new RadialMenu.RadialButton("Snare Flea", positionsMenu),
new RadialMenu.RadialButton("Bunker Spider", positionsMenu),
new RadialMenu.RadialButton("Hoarding Bug", positionsMenu),
new RadialMenu.RadialButton("Bracken", positionsMenu),
new RadialMenu.RadialButton("Thumper", positionsMenu),
new RadialMenu.RadialButton("Hydrogere", positionsMenu),
new RadialMenu.RadialButton("Ghost Girl", positionsMenu),
new RadialMenu.RadialButton("Spore Lizard", positionsMenu)
});
commandsMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("Follow me"),
new RadialMenu.RadialButton("Stop walking"),
new RadialMenu.RadialButton("Be quiet"),
new RadialMenu.RadialButton("I'm gonna go"),
new RadialMenu.RadialButton("Let's go", "\"Let's go {direction}\"", positionsMenu)
});
answersMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("I'm thinking", Color.gray)
{
textColor = Color.white
},
new RadialMenu.RadialButton("No", Color.red),
new RadialMenu.RadialButton("Yes", Color.green)
});
questionsMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("What was that", '?'),
new RadialMenu.RadialButton("Who's there", '?'),
new RadialMenu.RadialButton("Are you okay", '?'),
new RadialMenu.RadialButton("Did you hear that", '?'),
new RadialMenu.RadialButton("Are you real", '?'),
new RadialMenu.RadialButton("What's up", '?'),
new RadialMenu.RadialButton("What", '?')
});
greetingsMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("Hello", '.'),
new RadialMenu.RadialButton("Hi", '.')
});
observationsMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("More scrap", "\"More scrap {direction}\"", positionsMenu),
new RadialMenu.RadialButton("There's a trap", "\"There's a trap {direction}\"", positionsMenu),
new RadialMenu.RadialButton("There's a dead end", "\"There's a dead end {direction}\"", positionsMenu),
new RadialMenu.RadialButton("There's a", "\"There's a(n) {monster} {direction}\"", monstersMenu),
new RadialMenu.RadialButton("That's a mimic fire exit", '!'),
new RadialMenu.RadialButton("That's not real", '!')
});
urgentMenu.UpdateRadialButtons(new List<RadialMenu.RadialButton>
{
new RadialMenu.RadialButton("I'm about to die", '!'),
new RadialMenu.RadialButton("Run", '!'),
new RadialMenu.RadialButton("Help", '!'),
new RadialMenu.RadialButton("We have to get out of here", '!')
});
defaultMenu.UpdateRadialButtons(defaultMenuButtons);
List<TextInputFieldConfigItem> list = new List<TextInputFieldConfigItem>();
List<IntSliderConfigItem[]> list2 = new List<IntSliderConfigItem[]>();
foreach (RadialMenu.RadialButton defaultMenuButton in defaultMenuButtons)
{
list.Add(RadialMenuConfig.DisplayTextConfigFromButton(Plugin.ConfigF, defaultMenuButton));
list2.Add(RadialMenuConfig.ColorConfigFromButton(Plugin.ConfigF, defaultMenuButton));
}
foreach (TextInputFieldConfigItem item in list)
{
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)item);
}
foreach (IntSliderConfigItem[] item2 in list2)
{
for (int i = 0; i < item2.Length; i++)
{
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)item2[i]);
}
}
RadialMenuManager.MainMenu.AddRadialButton(new RadialMenu.RadialButton(defaultMenu));
}
private static void PerformEmoteFix(int emoteIndex)
{
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
localPlayerController.timeSinceStartingEmote = 0f;
localPlayerController.performingEmote = true;
localPlayerController.playerBodyAnimator.SetInteger("emoteNumber", emoteIndex);
localPlayerController.StartPerformingEmoteServerRpc();
}
}
}