Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LateGameUpgrades Gui v0.1.4
LGUGui.dll
Decompiled 5 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LGUGui.NetcodePatcher; using LethalCompanyInputUtils.Api; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using Microsoft.CodeAnalysis; using MoreShipUpgrades.API; using MoreShipUpgrades.Managers; using MoreShipUpgrades.UI.TerminalNodes; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("MoreShipUpgrades")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LGUGui")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Example Dice Addon")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8c26ccb3fcac04ac5ec671a536631dfe51490ba1")] [assembly: AssemblyProduct("LGUGui")] [assembly: AssemblyTitle("LGUGui")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LGUGui { public class ConfigManager { [MethodImpl(MethodImplOptions.NoInlining)] public static void setupLethalConfig() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //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_007e: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown ConfigEntry<float> transparency = Plugin.transparency; FloatSliderOptions val = new FloatSliderOptions(); ((BaseRangeOptions<float>)val).Min = 0f; ((BaseRangeOptions<float>)val).Max = 1f; ((BaseOptions)val).RequiresRestart = false; FloatSliderConfigItem val2 = new FloatSliderConfigItem(transparency, val); ConfigEntry<float> openSpeed = Plugin.openSpeed; FloatSliderOptions val3 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val3).Min = 0f; ((BaseRangeOptions<float>)val3).Max = 1f; ((BaseOptions)val3).RequiresRestart = false; FloatSliderConfigItem val4 = new FloatSliderConfigItem(openSpeed, val3); TextDropDownConfigItem val5 = new TextDropDownConfigItem(Plugin.selectedFontName, false); ConfigEntry<int> sortOrder = Plugin.sortOrder; IntSliderOptions val6 = new IntSliderOptions(); ((BaseRangeOptions<int>)val6).Min = 0; ((BaseRangeOptions<int>)val6).Max = 2; ((BaseOptions)val6).RequiresRestart = false; IntSliderConfigItem val7 = new IntSliderConfigItem(sortOrder, val6); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7); } } public class IngameKeybinds : LcInputActions { [InputAction("<Keyboard>/p", Name = "PurchaseMenu")] public InputAction PurchaseMenu { get; set; } = null; } public class MoreShipUpgradesPatch { [HarmonyPatch(typeof(LguStore), "HandleUpgradeClientRpc")] private class Patch_LGU_HandleUpgrade { private static void Postfix(string name, bool increment) { new PurchaseMenu().refresh(); } } } [BepInPlugin("Slayer6409.LGU_GUI", "LGU_GUI", "0.1.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string modGUID = "Slayer6409.LGU_GUI"; private const string modName = "LGU_GUI"; private const string modVersion = "0.1.4"; public static AssetBundle LoadedAssets; public static ManualLogSource CustomLogger; public static GameObject NetworkerPrefab; public static GameObject PurchaseMenuPrefab; public static GameObject UpgradeButton; public static GameObject TradePrefab; internal static IngameKeybinds Keybinds = null; public static ConfigFile ClientSideConfigs = null; private static readonly string directoryPath = Path.Combine(Application.persistentDataPath, "LGU_GUI"); private readonly Harmony harmony = new Harmony("Slayer6409.LGU_GUI"); public static ConfigEntry<bool> onlyInOrbit; public static ConfigEntry<bool> onlyOnShip; public static ConfigEntry<bool> extendedLog; public static ConfigEntry<bool> adminStuff; public static ConfigEntry<float> transparency; public static ConfigEntry<float> openSpeed; public static ConfigEntry<string> selectedFontName; public static ConfigEntry<int> sortOrder; public static Dictionary<string, TMP_FontAsset> fonts = new Dictionary<string, TMP_FontAsset>(); private void Awake() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown CustomLogger = Logger.CreateLogSource("LateGameUpgrades GUI"); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } LoadedAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lgugui")); ClientSideConfigs = new ConfigFile(Path.Combine(directoryPath, "LGU_GUI_ClientSide.json"), true); PurchaseMenuPrefab = LoadedAssets.LoadAsset<GameObject>("PurchaseGUI"); PurchaseMenuPrefab.AddComponent<MenuController>(); PurchaseMenuPrefab.AddComponent<UIFadeEffect>(); UpgradeButton = LoadedAssets.LoadAsset<GameObject>("UpgradePrefab"); TradePrefab = LoadedAssets.LoadAsset<GameObject>("TradePrefab"); fonts.Add("ARIAL", LoadedAssets.LoadAsset<TMP_FontAsset>("ARIAL SDF")); fonts.Add("LiberationSans", LoadedAssets.LoadAsset<TMP_FontAsset>("LiberationSans SDF")); fonts.Add("3270-Regular", LoadedAssets.LoadAsset<TMP_FontAsset>("3270-Regular SDF")); fonts.Add("Comic Sans", LoadedAssets.LoadAsset<TMP_FontAsset>("Comic Sans MS SDF")); fonts.Add("Party Vibes", LoadedAssets.LoadAsset<TMP_FontAsset>("Party Vibes SDF")); fonts.Add("Perfect DOS VGA 437", LoadedAssets.LoadAsset<TMP_FontAsset>("Perfect DOS VGA 437 SDF")); fonts.Add("shlop rg", LoadedAssets.LoadAsset<TMP_FontAsset>("shlop rg SDF")); fonts.Add("WEBDINGS", LoadedAssets.LoadAsset<TMP_FontAsset>("WEBDINGS SDF")); fonts.Add("Lizzie", LoadedAssets.LoadAsset<TMP_FontAsset>("Lizzie-vmnD SDF")); fonts.Add("Seven Segment", LoadedAssets.LoadAsset<TMP_FontAsset>("Seven Segment SDF")); fonts.Add("Conthrax-SemiBold", LoadedAssets.LoadAsset<TMP_FontAsset>("Conthrax-SemiBold SDF")); fonts.Add("Astronomus", LoadedAssets.LoadAsset<TMP_FontAsset>("Astronomus SDF")); fonts.Add("ciacode39_m", LoadedAssets.LoadAsset<TMP_FontAsset>("ciacode39_m SDF")); fonts.Add("DOTMATRI", LoadedAssets.LoadAsset<TMP_FontAsset>("DOTMATRI SDF")); fonts.Add("Minecrafter.Reg", LoadedAssets.LoadAsset<TMP_FontAsset>("Minecrafter.Reg SDF")); configSetup(); harmony.PatchAll(); Keybinds = new IngameKeybinds(); Keybinds.PurchaseMenu.performed += delegate { tryShowMenu(); }; selectedFontName.SettingChanged += delegate { changeFont(); }; if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { ConfigManager.setupLethalConfig(); } CustomLogger.LogInfo((object)"Plugin LGUGui is loaded!"); } public static void ExtendedLogging(string msg, LogLevel level = 16) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (extendedLog.Value) { CustomLogger.Log(level, (object)msg); } } public void configSetup() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown onlyInOrbit = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Only In Orbit", false, "Makes it to where you are only able to upgrade in orbit."); onlyOnShip = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Only On Ship", true, "Makes it to where you are only able to upgrade pn the ship."); extendedLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Extended Logging", false, "Log more debug stuff"); adminStuff = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "Admin Mode", false, "Enable the Admin Button"); string[] array = fonts.Keys.ToArray(); selectedFontName = ClientSideConfigs.Bind<string>("Client Side", "Selected Font", array.Contains("LiberationSans") ? "LiberationSans" : array.First(), new ConfigDescription("Select which font to use in the LGU GUI.", (AcceptableValueBase)(object)new AcceptableValueList<string>(array), Array.Empty<object>())); transparency = ClientSideConfigs.Bind<float>("Client Side", "Transparency", 0.93f, "Sets the transparency of the GUI."); openSpeed = ClientSideConfigs.Bind<float>("Client Side", "Open Speed", 0.15f, "Sets the open animation speed of the GUI."); sortOrder = ClientSideConfigs.Bind<int>("Client Side", "Sort Order", 0, "Sets the sort order of the upgrades"); } public static void changeFont() { if ((Object)(object)PurchaseMenu.menu != (Object)null) { ApplyFontTo(PurchaseMenu.menu); } } public static void ApplyFontTo(GameObject root) { if ((Object)(object)root == (Object)null) { return; } if (!fonts.TryGetValue(selectedFontName.Value, out var value) || (Object)(object)value == (Object)null) { CustomLogger.LogWarning((object)("Font '" + selectedFontName.Value + "' not found or null when applying to purchase menu.")); return; } int num = 0; int num2 = 0; int num3 = 0; bool flag = false; TextMeshProUGUI[] componentsInChildren = root.GetComponentsInChildren<TextMeshProUGUI>(true); foreach (TextMeshProUGUI val in componentsInChildren) { if ((Object)(object)val == (Object)null) { num3++; continue; } if (((TMP_Text)val).font == value) { num2++; continue; } try { ((TMP_Text)val).font = value; num++; } catch (Exception ex) { ExtendedLogging("ApplyFontTo: failed on " + ((Object)val).name + ": " + ex.GetType().Name + ": " + ex.Message + ". Attempting to default to Ariel", (LogLevel)4); num3++; try { flag = true; if (fonts.TryGetValue("ARIAL", out var value2)) { ((TMP_Text)val).font = value2; } } catch (Exception) { CustomLogger.LogWarning((object)"Failed to default to arial, please change your font in the config"); } } } string text = (flag ? "ARIAL" : selectedFontName.Value); ExtendedLogging("Applied font '" + text + "' to purchase menu. " + $"changed={num}, skipped={num2}, failed={num3}", (LogLevel)16); } public void tryShowMenu() { PlayerControllerB val = StartOfRound.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { return; } bool flag = val.quickMenuManager?.isMenuOpen ?? false; bool flag2 = (Object)(object)PurchaseMenu.menu != (Object)null && PurchaseMenu.menu.activeInHierarchy; if ((!flag || flag2) && (!onlyInOrbit.Value || StartOfRound.Instance.inShipPhase) && (!onlyOnShip.Value || val.isInHangarShipRoom) && !val.inTerminalMenu && !val.isTypingChat) { if (flag2) { PurchaseMenu.menuController.CloseMenu(); } else { PurchaseMenu.initMenu(); } } } } public class PurchaseMenu { [CompilerGenerated] private static class <>O { public static UnityAction <0>__showTradeGui; public static UnityAction <1>__showAdminGui; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction<float> <>9__18_1; public static UnityAction<float> <>9__18_2; public static UnityAction <>9__18_3; public static UnityAction <>9__18_4; public static UnityAction <>9__18_5; public static UnityAction <>9__18_6; public static UnityAction <>9__18_7; public static UnityAction <>9__18_8; public static UnityAction <>9__18_9; public static UnityAction <>9__18_10; public static UnityAction <>9__18_11; public static Func<CustomTerminalNode, string> <>9__24_1; public static Func<CustomTerminalNode, int> <>9__24_3; public static Func<CustomTerminalNode, bool> <>9__24_5; public static Func<CustomTerminalNode, string> <>9__24_6; public static Func<CustomTerminalNode, string> <>9__24_8; public static Func<PlayerControllerB, string> <>9__30_0; public static Func<PlayerControllerB, string> <>9__31_0; internal void <initMenu>b__18_1(float value) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Plugin.transparency.Value = value; foreach (Graphic graphic in fader.graphics) { if ((Object)(object)graphic != (Object)null) { Color color = graphic.color; color.a = value; graphic.color = color; } } } internal void <initMenu>b__18_2(float value) { Plugin.openSpeed.Value = value; } internal void <initMenu>b__18_3() { showUpgrades(shared: true); } internal void <initMenu>b__18_4() { showUpgrades(shared: false); } internal void <initMenu>b__18_5() { showSettingsMenu(settings: true); } internal void <initMenu>b__18_6() { showSettingsMenu(settings: false); } internal void <initMenu>b__18_7() { sortMode = 0; refreshStuff(); } internal void <initMenu>b__18_8() { sortMode = 1; refreshStuff(); } internal void <initMenu>b__18_9() { sortMode = 2; refreshStuff(); } internal void <initMenu>b__18_10() { menuController.CloseMenu(); } internal void <initMenu>b__18_11() { menuController.CloseMenu(); } internal string <showUpgrades>b__24_1(CustomTerminalNode x) { return x.Name; } internal int <showUpgrades>b__24_3(CustomTerminalNode x) { return x.GetCurrentPrice(); } internal bool <showUpgrades>b__24_5(CustomTerminalNode x) { return x.SalePercentage < 1f; } internal string <showUpgrades>b__24_6(CustomTerminalNode x) { return x.Name; } internal string <showUpgrades>b__24_8(CustomTerminalNode x) { return x.Name; } internal string <showAdminGui>b__30_0(PlayerControllerB p) { return p.playerUsername; } internal string <showTradeGui>b__31_0(PlayerControllerB p) { return p.playerUsername; } } [CompilerGenerated] private sealed class <WaitFade>d__19 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitFade>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; fader.FadeIn(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static GameObject menu; public static MenuController menuController; public static GameObject mainScreen; public static GameObject settingsScreen; public static TMP_Text currencyText; public static UIFadeEffect fader; public static bool isTrackedYet = false; public static Transform mainScrollContent; public static Transform ListUpgrades; public static Transform PurchaseUpgrade; public static Color NormalTextColor = new Color(0.02942256f, 0.8113208f, 0f, 1f); public static Color RedTextColor = new Color(0.7169812f, 0.03853131f, 0f, 1f); public static Color SaleColor = new Color(0f, 0.7f, 1f, 1f); public static bool _toggledQuickMenuFlag; public static int sortMode = 0; public static CustomTerminalNode currentSelection; public static string location; private static bool isOpening = false; public static void initMenu() { //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Expected O, but got Unknown //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Expected O, but got Unknown //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Expected O, but got Unknown //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Expected O, but got Unknown //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Expected O, but got Unknown //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Expected O, but got Unknown //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Expected O, but got Unknown //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Expected O, but got Unknown //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Expected O, but got Unknown //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Expected O, but got Unknown if (isOpening || ((Object)(object)menu != (Object)null && menu.activeInHierarchy)) { return; } isOpening = true; try { Plugin.ExtendedLogging("Initializing LGU Menu", (LogLevel)16); if ((Object)(object)StartOfRound.Instance?.localPlayerController?.quickMenuManager == (Object)null || (Object)(object)CurrencyManager.Instance == (Object)null) { Plugin.ExtendedLogging("Aborting menu init: StartOfRound or CurrencyManager is null", (LogLevel)16); return; } if ((Object)(object)menu == (Object)null) { menu = Object.Instantiate<GameObject>(Plugin.PurchaseMenuPrefab); if ((Object)(object)menuController == (Object)null) { menu.AddComponent<MenuController>(); } menuController = menu.GetComponent<MenuController>(); mainScreen = ((Component)menu.transform.Find("Background")).gameObject; settingsScreen = ((Component)menu.transform.Find("SettingsMenu")).gameObject; currencyText = ((Component)mainScreen.transform.Find("TotalPoints")).GetComponent<TMP_Text>(); fader = menu.GetComponent<UIFadeEffect>(); if ((Object)(object)fader == (Object)null) { fader = menu.AddComponent<UIFadeEffect>(); } Button component = ((Component)mainScreen.transform.Find("SharedUpgrades")).GetComponent<Button>(); Button component2 = ((Component)mainScreen.transform.Find("IndividualUpgrades")).GetComponent<Button>(); Button component3 = ((Component)mainScreen.transform.Find("TradePoints")).GetComponent<Button>(); Button component4 = ((Component)mainScreen.transform.Find("Settings")).GetComponent<Button>(); Button component5 = ((Component)settingsScreen.transform.Find("Back")).GetComponent<Button>(); Button component6 = ((Component)menu.transform.Find("Background/ListUpgrades/Sort/Name")).GetComponent<Button>(); Button component7 = ((Component)menu.transform.Find("Background/ListUpgrades/Sort/Cost")).GetComponent<Button>(); Button component8 = ((Component)menu.transform.Find("Background/ListUpgrades/Sort/Sale")).GetComponent<Button>(); mainScrollContent = mainScreen.transform.Find("ListUpgrades/Scroll View/Viewport/Content"); ListUpgrades = mainScreen.transform.Find("ListUpgrades"); PurchaseUpgrade = mainScreen.transform.Find("PurchaseUpgrade"); List<OptionData> list = new List<OptionData>(); list.Add(new OptionData(Plugin.selectedFontName.Value)); foreach (KeyValuePair<string, TMP_FontAsset> font in Plugin.fonts) { if (!(font.Key == Plugin.selectedFontName.Value)) { list.Add(new OptionData(font.Key)); } } Slider component9 = ((Component)settingsScreen.transform.Find("TransparencySlider")).GetComponent<Slider>(); Slider component10 = ((Component)settingsScreen.transform.Find("TimeSlider")).GetComponent<Slider>(); TMP_Dropdown fontDropdown = ((Component)settingsScreen.transform.Find("Dropdown")).GetComponent<TMP_Dropdown>(); fontDropdown.ClearOptions(); fontDropdown.options = list; fontDropdown.value = 0; ((UnityEvent<int>)(object)fontDropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int index) { Plugin.selectedFontName.Value = fontDropdown.options[index].text; }); component9.value = Plugin.transparency.Value; ((UnityEvent<float>)(object)component9.onValueChanged).AddListener((UnityAction<float>)delegate(float value) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Plugin.transparency.Value = value; foreach (Graphic graphic in fader.graphics) { if ((Object)(object)graphic != (Object)null) { Color color = graphic.color; color.a = value; graphic.color = color; } } }); component10.value = Plugin.openSpeed.Value; ((UnityEvent<float>)(object)component10.onValueChanged).AddListener((UnityAction<float>)delegate(float value) { Plugin.openSpeed.Value = value; }); ButtonClickedEvent onClick = component.onClick; object obj = <>c.<>9__18_3; if (obj == null) { UnityAction val = delegate { showUpgrades(shared: true); }; <>c.<>9__18_3 = val; obj = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj); ButtonClickedEvent onClick2 = component2.onClick; object obj2 = <>c.<>9__18_4; if (obj2 == null) { UnityAction val2 = delegate { showUpgrades(shared: false); }; <>c.<>9__18_4 = val2; obj2 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj2); ButtonClickedEvent onClick3 = component4.onClick; object obj3 = <>c.<>9__18_5; if (obj3 == null) { UnityAction val3 = delegate { showSettingsMenu(settings: true); }; <>c.<>9__18_5 = val3; obj3 = (object)val3; } ((UnityEvent)onClick3).AddListener((UnityAction)obj3); ButtonClickedEvent onClick4 = component5.onClick; object obj4 = <>c.<>9__18_6; if (obj4 == null) { UnityAction val4 = delegate { showSettingsMenu(settings: false); }; <>c.<>9__18_6 = val4; obj4 = (object)val4; } ((UnityEvent)onClick4).AddListener((UnityAction)obj4); ButtonClickedEvent onClick5 = component3.onClick; object obj5 = <>O.<0>__showTradeGui; if (obj5 == null) { UnityAction val5 = showTradeGui; <>O.<0>__showTradeGui = val5; obj5 = (object)val5; } ((UnityEvent)onClick5).AddListener((UnityAction)obj5); ButtonClickedEvent onClick6 = component6.onClick; object obj6 = <>c.<>9__18_7; if (obj6 == null) { UnityAction val6 = delegate { sortMode = 0; refreshStuff(); }; <>c.<>9__18_7 = val6; obj6 = (object)val6; } ((UnityEvent)onClick6).AddListener((UnityAction)obj6); ButtonClickedEvent onClick7 = component7.onClick; object obj7 = <>c.<>9__18_8; if (obj7 == null) { UnityAction val7 = delegate { sortMode = 1; refreshStuff(); }; <>c.<>9__18_8 = val7; obj7 = (object)val7; } ((UnityEvent)onClick7).AddListener((UnityAction)obj7); ButtonClickedEvent onClick8 = component8.onClick; object obj8 = <>c.<>9__18_9; if (obj8 == null) { UnityAction val8 = delegate { sortMode = 2; refreshStuff(); }; <>c.<>9__18_9 = val8; obj8 = (object)val8; } ((UnityEvent)onClick8).AddListener((UnityAction)obj8); Button component11 = ((Component)mainScreen.transform.Find("xButton")).GetComponent<Button>(); ButtonClickedEvent onClick9 = component11.onClick; object obj9 = <>c.<>9__18_10; if (obj9 == null) { UnityAction val9 = delegate { menuController.CloseMenu(); }; <>c.<>9__18_10 = val9; obj9 = (object)val9; } ((UnityEvent)onClick9).AddListener((UnityAction)obj9); Button component12 = ((Component)settingsScreen.transform.Find("xButton")).GetComponent<Button>(); ButtonClickedEvent onClick10 = component12.onClick; object obj10 = <>c.<>9__18_11; if (obj10 == null) { UnityAction val10 = delegate { menuController.CloseMenu(); }; <>c.<>9__18_11 = val10; obj10 = (object)val10; } ((UnityEvent)onClick10).AddListener((UnityAction)obj10); } Button component13 = ((Component)mainScreen.transform.Find("Admin")).GetComponent<Button>(); if (Plugin.adminStuff.Value && (((NetworkBehaviour)StartOfRound.Instance).IsHost || StartOfRound.Instance.localPlayerController.playerSteamId == 76561198077184650L)) { Plugin.ExtendedLogging("Admin Stuff", (LogLevel)16); ((Component)component13).gameObject.SetActive(true); ButtonClickedEvent onClick11 = component13.onClick; object obj11 = <>O.<1>__showAdminGui; if (obj11 == null) { UnityAction val11 = showAdminGui; <>O.<1>__showAdminGui = val11; obj11 = (object)val11; } ((UnityEvent)onClick11).AddListener((UnityAction)obj11); } Plugin.ApplyFontTo(menu); currencyText.text = CurrencyManager.Instance.CurrencyAmount.ToString(); resetView(); menu.SetActive(true); QuickMenuManager val12 = StartOfRound.Instance?.localPlayerController?.quickMenuManager; if ((Object)(object)val12 != (Object)null && !val12.isMenuOpen) { val12.isMenuOpen = true; _toggledQuickMenuFlag = true; } else { _toggledQuickMenuFlag = false; } ((MonoBehaviour)menuController).StartCoroutine(WaitFade()); Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; menuController.Reopen(); StartOfRound.Instance.localPlayerController.quickMenuManager.isMenuOpen = true; } finally { isOpening = false; } } [IteratorStateMachine(typeof(<WaitFade>d__19))] private static IEnumerator WaitFade() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitFade>d__19(0); } public static void resetView() { mainScreen.gameObject.SetActive(true); ((Component)PurchaseUpgrade).gameObject.SetActive(false); ((Component)ListUpgrades).gameObject.SetActive(false); settingsScreen.gameObject.SetActive(false); } public static void LogTransformTree(Transform t, string prefix = "") { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Plugin.ExtendedLogging(prefix + ((Object)t).name, (LogLevel)16); foreach (Transform item in t) { Transform t2 = item; LogTransformTree(t2, prefix + ((Object)t).name + "/"); } } public static void clearMainViewport() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown foreach (Transform item in mainScrollContent) { Transform val = item; Object.Destroy((Object)(object)((Component)val).gameObject); } } public static void swapTwo(bool purchase) { ((Component)PurchaseUpgrade).gameObject.SetActive(purchase); ((Component)ListUpgrades).gameObject.SetActive(!purchase); } public static void showUpgrades(bool shared) { //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Expected O, but got Unknown //IL_0434: Unknown result type (might be due to invalid IL or missing references) currentSelection = null; location = "showUpgrades," + shared; swapTwo(purchase: false); int currencyAmount = CurrencyManager.Instance.CurrencyAmount; currencyText.text = currencyAmount.ToString(); clearMainViewport(); List<CustomTerminalNode> upgradeNodes = UpgradeApi.GetUpgradeNodes(); foreach (CustomTerminalNode upgrade in sortMode switch { 0 => from x in upgradeNodes where x.SharedUpgrade == shared orderby x.Name select x, 1 => from x in upgradeNodes where x.SharedUpgrade == shared orderby x.GetCurrentPrice() select x, 2 => from x in upgradeNodes where x.SharedUpgrade == shared orderby x.SalePercentage < 1f descending, x.Name select x, _ => from x in upgradeNodes where x.SharedUpgrade == shared orderby x.Name select x, }) { int currentPrice = upgrade.GetCurrentPrice(); int num = (upgrade.AlternateCurrency ? CurrencyManager.Instance.GetCurrencyAmountFromCredits(currentPrice) : currentPrice); int currentLevel = upgrade.GetCurrentLevel(); int num2 = currentLevel + upgrade.GetRemainingLevels(); bool flag = upgrade.GetRemainingLevels() == 0; bool flag2 = num <= currencyAmount; Plugin.ExtendedLogging("Init Upgrade: " + upgrade.Name, (LogLevel)16); GameObject val = Object.Instantiate<GameObject>(Plugin.UpgradeButton, mainScrollContent); Plugin.ApplyFontTo(val); Button component = ((Component)val.transform.Find("Button")).GetComponent<Button>(); TMP_Text component2 = ((Component)((Component)component).transform.Find("Text (TMP)")).GetComponent<TMP_Text>(); component2.text = $"{upgrade.Name} : {currentLevel}/{num2}"; ((Graphic)component2).color = (flag2 ? NormalTextColor : RedTextColor); if (flag2 && !flag && upgrade.SalePercentage < 1f) { ((Graphic)component2).color = SaleColor; } TMP_Text component3 = ((Component)val.transform.Find("DisplayText")).GetComponent<TMP_Text>(); ((Graphic)component3).color = (flag2 ? NormalTextColor : RedTextColor); if (flag2 && !flag && upgrade.SalePercentage < 1f) { ((Graphic)component3).color = SaleColor; } TMP_Text component4 = ((Component)val.transform.Find("DisplayText/PointsRequired")).GetComponent<TMP_Text>(); if (flag) { component4.text = "Maxed"; } else if (upgrade.SalePercentage < 1f) { float num3 = (1f - upgrade.SalePercentage) * 100f; component4.text = $"{num} ({Mathf.RoundToInt(num3)}% off)"; } else { component4.text = num.ToString(); } ((Graphic)component4).color = (flag2 ? NormalTextColor : RedTextColor); if (flag2 && !flag && upgrade.SalePercentage < 1f) { ((Graphic)component4).color = SaleColor; } ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { swapTwo(purchase: true); showUpgradeGui(upgrade); }); } } public static void showSettingsMenu(bool settings) { mainScreen.gameObject.SetActive(!settings); settingsScreen.gameObject.SetActive(settings); } public static void refreshStuff(bool trade = false) { if ((Object)(object)menu == (Object)null || !menu.activeInHierarchy) { return; } if (trade) { if (location == "showUpgrades," + false) { showUpgrades(shared: false); } if (location == "showTradeGui") { showTradeGui(); } } if (location == "showUpgrades," + true) { showUpgrades(shared: true); } if (location == "showUpgrades," + false) { showUpgrades(shared: false); } if (location == "showUpgradeGui" && currentSelection != null) { showUpgradeGui(currentSelection); } } public void refresh(bool trade = false) { if ((Object)(object)menu == (Object)null || !menu.activeInHierarchy) { return; } if (trade) { if (location == "showUpgrades," + false) { showUpgrades(shared: false); } if (location == "showTradeGui") { showTradeGui(); } } if (location == "showUpgrades," + true) { showUpgrades(shared: true); } if (location == "showUpgrades," + false) { showUpgrades(shared: false); } if (location == "showUpgradeGui" && currentSelection != null) { showUpgradeGui(currentSelection); } } public static void showUpgradeGui(CustomTerminalNode currentUpgrade) { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown currentSelection = currentUpgrade; location = "showUpgradeGui"; TextMeshProUGUI component = ((Component)menu.transform.Find("Background/PurchaseUpgrade/Text (TMP)")).GetComponent<TextMeshProUGUI>(); Button purchaseButton = ((Component)menu.transform.Find("Background/PurchaseUpgrade/PurchaseButton")).GetComponent<Button>(); TMP_Text component2 = ((Component)((Component)purchaseButton).transform.Find("Text (TMP)")).GetComponent<TMP_Text>(); Button refundButton = ((Component)menu.transform.Find("Background/PurchaseUpgrade/RefundButton")).GetComponent<Button>(); TMP_Text component3 = ((Component)((Component)refundButton).transform.Find("Text (TMP)")).GetComponent<TMP_Text>(); Button component4 = ((Component)menu.transform.Find("Background/PurchaseUpgrade/BackButton")).GetComponent<Button>(); ((TMP_Text)component).text = currentUpgrade.Description; bool usesLGU = currentUpgrade.AlternateCurrency; Terminal terminal = UpgradeBus.Instance.GetTerminal(); int num = (usesLGU ? CurrencyManager.Instance.CurrencyAmount : terminal.groupCredits); int currentPrice = currentUpgrade.GetCurrentPrice(); int num2 = (usesLGU ? CurrencyManager.Instance.GetCurrencyAmountFromCredits(currentPrice) : currentPrice); string arg = (usesLGU ? "pts" : "cr"); bool flag = currentPrice != int.MaxValue && num >= num2; component2.text = ((currentPrice != int.MaxValue) ? $"Purchase: {num2} {arg}" : "Maxed"); ((Selectable)purchaseButton).interactable = flag; ((Graphic)component2).color = (flag ? NormalTextColor : RedTextColor); ((UnityEventBase)purchaseButton.onClick).RemoveAllListeners(); ((UnityEvent)purchaseButton.onClick).AddListener((UnityAction)delegate { ((Selectable)purchaseButton).interactable = false; int currentPrice2 = currentUpgrade.GetCurrentPrice(); int num9 = (usesLGU ? CurrencyManager.Instance.GetCurrencyAmountFromCredits(currentPrice2) : currentPrice2); if (currentPrice2 == int.MaxValue) { showUpgradeGui(currentUpgrade); } else if ((usesLGU && CurrencyManager.Instance.CurrencyAmount < num9) || (!usesLGU && terminal.groupCredits < num9)) { showUpgradeGui(currentUpgrade); } else { Plugin.ExtendedLogging(string.Format("Purchasing Upgrade: {0} for {1} {2}", currentUpgrade.Name, num9, usesLGU ? "pts" : "cr"), (LogLevel)16); if (usesLGU) { CurrencyManager instance2 = CurrencyManager.Instance; instance2.CurrencyAmount -= num9; } else { LguStore.Instance.SyncCreditsServerRpc(Mathf.Max(0, terminal.groupCredits - num9)); LguStore.Instance.AddUpgradeSpentCreditsServerRpc(num9); } UpgradeApi.TriggerUpgradeRankup(currentUpgrade); currencyText.text = (usesLGU ? CurrencyManager.Instance.CurrencyAmount : UpgradeBus.Instance.GetTerminal().groupCredits).ToString(); showUpgradeGui(currentUpgrade); } }); if (currentUpgrade.Refundable && ((currentUpgrade is TierTerminalNode) ? (currentUpgrade.GetCurrentLevel() > 0) : currentUpgrade.Unlocked)) { int num3 = RefundBaseNow(currentUpgrade); int num4 = (usesLGU ? CurrencyManager.Instance.GetCurrencyAmountFromCredits(num3) : num3); int num5 = Mathf.FloorToInt((float)num4 * currentUpgrade.RefundPercentage); string arg2 = (usesLGU ? "pts" : "cr"); component3.text = $"Refund : {num5} {arg2}"; ((Selectable)refundButton).interactable = num5 > 0; ((Graphic)component3).color = (((Selectable)refundButton).interactable ? NormalTextColor : RedTextColor); ((UnityEventBase)refundButton.onClick).RemoveAllListeners(); ((UnityEvent)refundButton.onClick).AddListener((UnityAction)delegate { ((Selectable)refundButton).interactable = false; int num6 = RefundBaseNow(currentUpgrade); int num7 = (usesLGU ? CurrencyManager.Instance.GetCurrencyAmountFromCredits(num6) : num6); int num8 = Mathf.FloorToInt((float)num7 * currentUpgrade.RefundPercentage); if (num8 <= 0) { showUpgradeGui(currentUpgrade); } else { Plugin.ExtendedLogging(string.Format("Refunding Upgrade: {0} for {1} {2}", currentUpgrade.Name, num8, usesLGU ? "pts" : "cr"), (LogLevel)16); if (usesLGU) { CurrencyManager instance = CurrencyManager.Instance; instance.CurrencyAmount += num8; } else { LguStore.Instance.SyncCreditsServerRpc(terminal.groupCredits + num8); } UpgradeApi.TriggerUpgradeDowngrade(currentUpgrade); currencyText.text = (usesLGU ? CurrencyManager.Instance.CurrencyAmount : UpgradeBus.Instance.GetTerminal().groupCredits).ToString(); showUpgradeGui(currentUpgrade); } }); } else { component3.text = ""; ((UnityEventBase)refundButton.onClick).RemoveAllListeners(); ((Selectable)refundButton).interactable = false; ((Graphic)component3).color = RedTextColor; } ((UnityEventBase)component4.onClick).RemoveAllListeners(); ((UnityEvent)component4.onClick).AddListener((UnityAction)delegate { showUpgrades(currentUpgrade.SharedUpgrade); }); } private static int RefundBaseNow(CustomTerminalNode node) { if (node is TierTerminalNode) { if (node.GetCurrentLevel() == 1) { return Mathf.RoundToInt((float)node.UnlockPrice * node.SalePercentage); } return node.GetPreviousPrice(); } return Mathf.RoundToInt((float)node.UnlockPrice * node.SalePercentage); } public static void showAdminGui() { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown currentSelection = null; location = "showAdminGui"; swapTwo(purchase: false); int currencyAmount = CurrencyManager.Instance.CurrencyAmount; currencyText.text = currencyAmount.ToString(); clearMainViewport(); ulong myID = StartOfRound.Instance.localPlayerController.actualClientId; foreach (PlayerControllerB item in StartOfRound.Instance.allPlayerScripts.OrderBy((PlayerControllerB p) => p.playerUsername)) { if (!item.isPlayerControlled && !item.isPlayerDead) { continue; } GameObject val = Object.Instantiate<GameObject>(Plugin.TradePrefab, mainScrollContent); Plugin.ApplyFontTo(val); Button component = ((Component)val.transform.Find("Button")).GetComponent<Button>(); ((Component)((Component)component).transform.Find("Text (TMP)")).GetComponent<TMP_Text>().text = "Add Points"; Button component2 = ((Component)val.transform.Find("Button")).GetComponent<Button>(); TMP_InputField input = ((Component)val.transform.Find("InputField (TMP)")).GetComponent<TMP_InputField>(); TMP_Text component3 = ((Component)val.transform.Find("InputField (TMP)/DisplayText")).GetComponent<TMP_Text>(); component3.text = item.playerUsername; bool isUpdating = false; ulong targetPlayerID = item.actualClientId; ((UnityEvent<string>)(object)input.onValueChanged).AddListener((UnityAction<string>)delegate(string text) { if (!isUpdating && !(text == "-") && !string.IsNullOrEmpty(text)) { if (int.TryParse(text, out var result)) { int num = Mathf.Clamp(result, -99, 9999); if (num.ToString() != text) { isUpdating = true; input.text = num.ToString(); isUpdating = false; } } else { isUpdating = true; input.text = "0"; isUpdating = false; } } }); ((UnityEvent)component.onClick).AddListener((UnityAction)delegate { //IL_001e: 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) CurrencyManager.Instance.TradePlayerCreditsServerRpc(targetPlayerID, int.Parse(input.text), default(ServerRpcParams)); if (targetPlayerID == myID) { showAdminGui(); } }); } } public static void showTradeGui() { //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown currentSelection = null; location = "showTradeGui"; swapTwo(purchase: false); int currency = CurrencyManager.Instance.CurrencyAmount; currencyText.text = currency.ToString(); clearMainViewport(); foreach (PlayerControllerB item in StartOfRound.Instance.allPlayerScripts.OrderBy((PlayerControllerB p) => p.playerUsername)) { if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)item || (!item.isPlayerControlled && !item.isPlayerDead)) { continue; } GameObject val = Object.Instantiate<GameObject>(Plugin.TradePrefab, mainScrollContent); Plugin.ApplyFontTo(val); Button tradeButton = ((Component)val.transform.Find("Button")).GetComponent<Button>(); TMP_InputField tradeInput = ((Component)val.transform.Find("InputField (TMP)")).GetComponent<TMP_InputField>(); TMP_Text component = ((Component)val.transform.Find("InputField (TMP)/DisplayText")).GetComponent<TMP_Text>(); component.text = item.playerUsername; bool isUpdating = false; ((Selectable)tradeButton).interactable = false; ulong targetPlayerID = item.actualClientId; ((UnityEvent<string>)(object)tradeInput.onValueChanged).AddListener((UnityAction<string>)delegate(string text) { if (!isUpdating) { if (int.TryParse(text, out var result)) { int num = Mathf.Clamp(result, 0, currency); if (num.ToString() != text) { isUpdating = true; tradeInput.text = num.ToString(); isUpdating = false; } ((Selectable)tradeButton).interactable = num != 0; } else { isUpdating = true; tradeInput.text = "0"; isUpdating = false; } } }); ((UnityEvent)tradeButton.onClick).AddListener((UnityAction)delegate { //IL_001e: 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) CurrencyManager.Instance.TradePlayerCreditsServerRpc(targetPlayerID, int.Parse(tradeInput.text), default(ServerRpcParams)); CurrencyManager instance = CurrencyManager.Instance; instance.CurrencyAmount -= int.Parse(tradeInput.text); showTradeGui(); }); } } } public class MenuController : MonoBehaviour { private InputAction escAction; private void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown Plugin.ExtendedLogging("Setting up Escape Action", (LogLevel)16); escAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/escape", (string)null, (string)null, (string)null); escAction.performed += delegate { CloseMenu(); }; escAction.Enable(); } public void Reopen() { InputAction obj = escAction; if (obj != null) { obj.Enable(); } } private void OnDestroy() { Plugin.ExtendedLogging("OnDestroy", (LogLevel)16); InputAction obj = escAction; if (obj != null) { obj.Disable(); } InputAction obj2 = escAction; if (obj2 != null) { obj2.Dispose(); } } public void CloseMenu() { Plugin.ExtendedLogging("Closing Menu", (LogLevel)16); if ((Object)(object)PurchaseMenu.menu == (Object)null) { return; } try { InputAction obj = escAction; if (obj != null) { obj.Disable(); } } catch { } QuickMenuManager val = StartOfRound.Instance?.localPlayerController?.quickMenuManager; if ((Object)(object)val != (Object)null && PurchaseMenu._toggledQuickMenuFlag) { val.isMenuOpen = false; PurchaseMenu._toggledQuickMenuFlag = false; } Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; if ((Object)(object)PurchaseMenu.fader != (Object)null) { Plugin.ExtendedLogging("Fader", (LogLevel)16); PurchaseMenu.fader.FadeOut(); } else { Plugin.ExtendedLogging("No Fader found??", (LogLevel)16); PurchaseMenu.menu.SetActive(false); } } } public class UIFadeEffect : MonoBehaviour { [CompilerGenerated] private sealed class <Fade>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float startAlpha; public float endAlpha; public bool disableAfter; public UIFadeEffect <>4__this; private float <fadeDuration>5__1; private float <time>5__2; private float <t>5__3; private float <alpha>5__4; private List<Graphic>.Enumerator <>s__5; private Graphic <g>5__6; private Color <c>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Fade>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__5 = default(List<Graphic>.Enumerator); <g>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.graphics = new List<Graphic>(((Component)<>4__this).GetComponentsInChildren<Graphic>(true)); <fadeDuration>5__1 = Plugin.openSpeed.Value; <time>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<time>5__2 < <fadeDuration>5__1) { <t>5__3 = <time>5__2 / <fadeDuration>5__1; <alpha>5__4 = Mathf.Lerp(startAlpha, endAlpha, <t>5__3); <>4__this.SetAlpha(<>4__this.graphics, <alpha>5__4); <time>5__2 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 1; return true; } <>s__5 = <>4__this.graphics.GetEnumerator(); try { while (<>s__5.MoveNext()) { <g>5__6 = <>s__5.Current; if ((Object)(object)<g>5__6 != (Object)null) { <c>5__7 = <g>5__6.color; <c>5__7.a = endAlpha; <g>5__6.color = <c>5__7; } <g>5__6 = null; } } finally { ((IDisposable)<>s__5).Dispose(); } <>s__5 = default(List<Graphic>.Enumerator); if (disableAfter && endAlpha == 0f) { ((Component)<>4__this).gameObject.SetActive(false); StartOfRound.Instance.localPlayerController.quickMenuManager.isMenuOpen = false; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <FadeObject>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject fadeObj; public bool fadeOut; public UIFadeEffect <>4__this; private List<Graphic> <graphicsToUse>5__1; private float <startAlpha>5__2; private float <endAlpha>5__3; private float <fadeDuration>5__4; private float <time>5__5; private float <t>5__6; private float <alpha>5__7; private List<Graphic>.Enumerator <>s__8; private Graphic <g>5__9; private Color <c>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FadeObject>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <graphicsToUse>5__1 = null; <>s__8 = default(List<Graphic>.Enumerator); <g>5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <graphicsToUse>5__1 = new List<Graphic>(fadeObj.GetComponentsInChildren<Graphic>(true)); <startAlpha>5__2 = 0f; <endAlpha>5__3 = Plugin.transparency.Value; if (fadeOut) { <startAlpha>5__2 = Plugin.transparency.Value; <endAlpha>5__3 = 0f; } <fadeDuration>5__4 = Plugin.openSpeed.Value; <time>5__5 = 0f; break; case 1: <>1__state = -1; break; } if (<time>5__5 < <fadeDuration>5__4) { <t>5__6 = <time>5__5 / <fadeDuration>5__4; <alpha>5__7 = Mathf.Lerp(<startAlpha>5__2, <endAlpha>5__3, <t>5__6); <>4__this.SetAlpha(<graphicsToUse>5__1, <alpha>5__7); <time>5__5 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 1; return true; } <>s__8 = <graphicsToUse>5__1.GetEnumerator(); try { while (<>s__8.MoveNext()) { <g>5__9 = <>s__8.Current; if ((Object)(object)<g>5__9 != (Object)null) { <c>5__10 = <g>5__9.color; <c>5__10.a = <endAlpha>5__3; <g>5__9.color = <c>5__10; } <g>5__9 = null; } } finally { ((IDisposable)<>s__8).Dispose(); } <>s__8 = default(List<Graphic>.Enumerator); if (fadeOut && <endAlpha>5__3 == 0f) { fadeObj.SetActive(false); StartOfRound.Instance.localPlayerController.quickMenuManager.isMenuOpen = false; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public List<Graphic> graphics; private void Awake() { graphics = new List<Graphic>(((Component)this).GetComponentsInChildren<Graphic>(true)); } public void doFade(GameObject target, bool fadeOut) { ((MonoBehaviour)this).StartCoroutine(FadeObject(target, fadeOut)); } [IteratorStateMachine(typeof(<FadeObject>d__3))] private IEnumerator FadeObject(GameObject fadeObj, bool fadeOut) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FadeObject>d__3(0) { <>4__this = this, fadeObj = fadeObj, fadeOut = fadeOut }; } public void FadeIn() { ((MonoBehaviour)this).StartCoroutine(Fade(0f, Plugin.transparency.Value)); } public void FadeOut(bool disableAfter = true) { ((MonoBehaviour)this).StartCoroutine(Fade(1f, 0f, disableAfter)); } private void SetAlpha(List<Graphic> graphicsToUse, float alpha) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) foreach (Graphic item in graphicsToUse) { if ((Object)(object)item != (Object)null) { Color color = item.color; color.a = alpha; item.color = color; } } } [IteratorStateMachine(typeof(<Fade>d__7))] private IEnumerator Fade(float startAlpha, float endAlpha, bool disableAfter = false) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Fade>d__7(0) { <>4__this = this, startAlpha = startAlpha, endAlpha = endAlpha, disableAfter = disableAfter }; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LGUGui"; public const string PLUGIN_NAME = "LGUGui"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace LGUGui.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }