// Consolidated decompiled source — Azumatt-HideUI v1.0.1 // Generated by Hexium's decompiled-source browser. Best-effort concatenation of every type in this // version's manifest — decompiler output isn't guaranteed to compile as-is. using System; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis; using System.IO; using System.Reflection; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using UnityEngine; using System.Linq; // ---- HideUI.dll :: Microsoft.CodeAnalysis.EmbeddedAttribute ---- namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } // ---- HideUI.dll :: System.Runtime.CompilerServices.NullableAttribute ---- namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } } // ---- HideUI.dll :: System.Runtime.CompilerServices.NullableContextAttribute ---- namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } // ---- HideUI.dll :: HideUI.HideUIPlugin ---- namespace HideUI { [BepInPlugin("Azumatt.HideUI", "HideUI", "1.0.1")] public class HideUIPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string? Category; [UsedImplicitly] public Action? CustomDrawer; } private class AcceptableShortcuts : AcceptableValueBase { public AcceptableShortcuts() : base(typeof(KeyboardShortcut)) { } public override object Clamp(object value) { return value; } public override bool IsValid(object value) { return true; } public override string ToDescriptionString() { return "# Acceptable values: " + string.Join(", ", UnityInput.Current.SupportedKeyCodes); } } internal const string ModName = "HideUI"; internal const string ModVersion = "1.0.1"; internal const string Author = "Azumatt"; private const string ModGUID = "Azumatt.HideUI"; private static string ConfigFileName = "Azumatt.HideUI.cfg"; private static string ConfigFileFullPath; private readonly Harmony _harmony = new Harmony("Azumatt.HideUI"); public static readonly ManualLogSource HideUILogger; private static ConfigEntry hideUiHotkey; private static ConfigEntry shouldHideUI; public void Awake() { hideUiHotkey = base.Config.Bind("1 - General", "Hide UI Hotkey", new KeyboardShortcut(KeyCode.H), new ConfigDescription("Hotkey to toggle on and off the UI.", null, new AcceptableShortcuts())); shouldHideUI = base.Config.Bind("1 - General", "Hide UI", Toggle.Off, "If on, the UI will be hidden. If off, the UI will be shown. The hotkey automatically toggles this value."); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); SetupWatcher(); } private void Update() { if ((bool)(UnityEngine.Object)(object)Global.code && !((UnityEngine.Object)(object)Global.code.uiGameMenu == null) && !((UnityEngine.Object)(object)Global.code.uiCombat == null)) { ApplyUIState(); if (hideUiHotkey.Value.IsKeyDown()) { shouldHideUI.Value = ((shouldHideUI.Value != Toggle.On) ? Toggle.On : Toggle.Off); } } } public void ApplyUIState() { bool flag = shouldHideUI.Value == Toggle.On; ((Component)(object)Global.code.uiCombat).gameObject.SetActive(!flag); Global.code.uiGameMenu.hideUI = flag; } private void OnDestroy() { base.Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { HideUILogger.LogDebug("ReadConfigValues called"); base.Config.Reload(); } catch { HideUILogger.LogError("There was an issue loading your " + ConfigFileName); HideUILogger.LogError("Please check your config entries for spelling and format!"); } } internal ConfigEntry TextEntryConfig(string group, string name, T value, string desc) { ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { CustomDrawer = TextAreaDrawer }; return base.Config.Bind(group, name, value, new ConfigDescription(desc, null, configurationManagerAttributes)); } internal static void TextAreaDrawer(ConfigEntryBase entry) { GUILayout.ExpandHeight(expand: true); GUILayout.ExpandWidth(expand: true); entry.BoxedValue = GUILayout.TextArea((string)entry.BoxedValue, GUILayout.ExpandWidth(expand: true), GUILayout.ExpandHeight(expand: true)); } static HideUIPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; HideUILogger = BepInEx.Logging.Logger.CreateLogSource("HideUI"); hideUiHotkey = null; shouldHideUI = null; } } } // ---- HideUI.dll :: HideUI.KeyboardExtensions ---- namespace HideUI { public static class KeyboardExtensions { public static bool IsKeyDown(this KeyboardShortcut shortcut) { if (shortcut.MainKey != KeyCode.None && Input.GetKeyDown(shortcut.MainKey)) { return shortcut.Modifiers.All(Input.GetKey); } return false; } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { if (shortcut.MainKey != KeyCode.None && Input.GetKey(shortcut.MainKey)) { return shortcut.Modifiers.All(Input.GetKey); } return false; } } }