Decompiled source of RumbleModUI v2.1.2
Mods/ModUI.dll
Decompiled 4 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Threading.Tasks; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppRUMBLE.Managers; using Il2CppRUMBLE.Players; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using MelonLoader.Utils; using RumbleModUI; 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: MelonInfo(typeof(RumbleModUIClass), "ModUI", "2.1.2", "Baumritter", null)] [assembly: MelonGame("Buckethead Entertainment", "RUMBLE")] [assembly: VerifyLoaderVersion(0, 6, 4, true)] [assembly: MelonColor(200, 0, 200, 0)] [assembly: MelonAuthorColor(200, 0, 200, 0)] [assembly: AssemblyTitle("ModUI")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ModUI")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("caa17032-5000-4195-b343-c26492084360")] [assembly: AssemblyFileVersion("2.1.2")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("2.1.2.0")] namespace RumbleModUI; public static class Baum_API { public class Delay { private readonly bool debug = false; private DateTime debugTime; private object CRObj; private bool Running = false; private DateTime StartTime; public string DelayName; private double Wait; public bool Done = false; private event Action WaitDone; public void Start(double WaitTime, bool AllowRetrigger, Action Callback) { if (!Running || AllowRetrigger) { if (Running) { MelonCoroutines.Stop(CRObj); } StartTime = DateTime.Now; CRObj = MelonCoroutines.Start(Waiter(WaitTime, Callback)); if (debug) { MelonLogger.Msg(DelayName + " - Started"); } } } private IEnumerator Waiter(double WaitTime, Action Callback) { WaitForFixedUpdate waitForFixedUpdate = new WaitForFixedUpdate(); Running = true; this.WaitDone = Callback; while (true) { if (DateTime.Now >= StartTime.AddSeconds(WaitTime)) { this.WaitDone(); if (debug) { MelonLoggerExtension.Log(DelayName + " - Done."); } Running = false; if (CRObj != null) { MelonCoroutines.Stop(CRObj); } yield return null; } yield return waitForFixedUpdate; } } [Obsolete("Do not use")] public void Delay_Start(double WaitTime, bool AllowRetrigger = false) { if (!Running || AllowRetrigger) { if (Running) { MelonCoroutines.Stop(CRObj); } Done = false; Wait = WaitTime; StartTime = DateTime.Now; debugTime = DateTime.Now; CRObj = MelonCoroutines.Start(WaitLoop()); if (debug) { MelonLogger.Msg(DelayName + " - Started"); } } } [Obsolete("Do not use")] public void Delay_Stop(bool Done = false) { if (Done) { this.Done = true; } if (Running) { MelonCoroutines.Stop(CRObj); } Running = false; if (debug && Done) { MelonLogger.Msg(DelayName + " - Done"); } if (debug && !Done) { MelonLogger.Msg(DelayName + " - Stopped"); } TimeSpan timeSpan = DateTime.Now - debugTime; if (debug && Done) { MelonLogger.Msg(DelayName + " - " + timeSpan.TotalMilliseconds); } } [Obsolete("Do not use")] private IEnumerator WaitLoop() { WaitForFixedUpdate waitForFixedUpdate = new WaitForFixedUpdate(); Running = true; while (true) { if (DateTime.Now >= StartTime.AddSeconds(Wait)) { Delay_Stop(Done: true); yield return null; } yield return waitForFixedUpdate; } } } public class Folders { private readonly bool debug = false; private string ModFolder; private List<string> SubFolders = new List<string>(); public void SetModFolderCustom(string ModName) { ModFolder = ModName; if (debug) { MelonLogger.Msg("Set ModFolder to " + ModFolder); } } public void SetModFolderNamespace() { ModFolder = GetType().Namespace; if (debug) { MelonLogger.Msg("Set ModFolder to " + ModFolder); } } public void AddSubFolder(string FolderName) { SubFolders.Add(FolderName); if (debug) { MelonLogger.Msg("Added Subfolder " + FolderName); } } public void RemoveSubFolder(string FolderName) { SubFolders.Remove(FolderName); if (debug) { MelonLogger.Msg("Removed Subfolder " + FolderName); } } public string GetModFolder() { return ModFolder; } public string GetSubFolder(int index) { if (SubFolders.Count == 0) { return null; } return SubFolders[index]; } public void CheckAllFoldersExist() { CreateFolderIfNotExisting(GetFolderString()); if (SubFolders.Count <= 0) { return; } foreach (string subFolder in SubFolders) { CreateFolderIfNotExisting(GetFolderString(subFolder)); } } public void RemoveOtherFolders() { if (debug) { MelonLogger.Msg("Folder Removal: Start"); } string[] directories = Directory.GetDirectories(GetFolderString("", IgnoreList: true)); string[] array = directories; foreach (string text in array) { if (debug) { MelonLogger.Msg(text); } string text2 = text.Split(new char[1] { '\\' })[^1]; if (CheckIfFolderInList(text2)) { Directory.Delete(GetFolderString(text2, IgnoreList: true), recursive: true); if (debug) { MelonLogger.Msg("Deleted: " + GetFolderString(text2, IgnoreList: true)); } } } if (debug) { MelonLogger.Msg("Folder Removal: End"); } } public string GetFolderString(string SubFolder = "", bool IgnoreList = false) { string text = MelonEnvironment.UserDataDirectory + "\\" + ModFolder; if (SubFolder != "" && (SubFolders.Contains(SubFolder) || IgnoreList)) { text = ((!IgnoreList) ? (text + "\\" + SubFolders.FirstOrDefault((string x) => x.Contains(SubFolder))) : (text + "\\" + SubFolder)); if (debug) { MelonLogger.Msg("Generated Path: " + text); } } else if (debug) { MelonLogger.Msg("Generated Path with no SubFolder: " + text); } return text; } private void CreateFolderIfNotExisting(string Path) { if (debug && !Directory.Exists(Path)) { MelonLogger.Msg("Path doesn't exist: " + Path); } else if (debug && Directory.Exists(Path)) { MelonLogger.Msg("Path does exist: " + Path); } if (!Directory.Exists(Path)) { Directory.CreateDirectory(Path); } } private bool CheckIfFolderInList(string FolderName) { bool flag = false; string folderString = GetFolderString(FolderName, IgnoreList: true); if (!SubFolders.Contains(FolderName) && Directory.Exists(folderString)) { flag = true; } if (debug && flag) { MelonLogger.Msg("Folder not in List " + folderString); } else if (debug && !flag) { MelonLogger.Msg("Folder in List " + folderString); } return flag; } } public static class StringExtension { public static string SanitizeName(string Input) { bool flag = false; char[] array = Input.ToCharArray(); string text = ""; if (Input.Contains("<u>")) { Input.Replace("<u>", ""); } if (Input.Contains(",")) { Input.Replace(",", ""); } for (int i = 0; i < Input.Length; i++) { if (array[i] == '<' && i != Input.Length && (array[i + 1] == '#' || array[i + 1] == 'c')) { flag = true; } if (!flag) { text += array[i]; } if (array[i] == '>') { flag = false; } } return text; } public static string ReturnHexedString(string Input, Color32 Color) { string text = "#" + Color.r.ToString("X2") + Color.g.ToString("X2") + Color.b.ToString("X2"); return "<color=" + text + ">" + Input + "</color>"; } public static string ReturnHexedString(string Input, Gradient Gradient) { //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) if (Input.Length == 0) { return Input; } bool flag = false; char[] array = Input.ToArray(); string text = ""; for (int i = 0; i < array.Length; i++) { float num = 1f / (float)(array.Length - 1) * (float)i; Color32 val = Color32.op_Implicit(Gradient.Evaluate(num)); text = text + "<color=#" + val.r.ToString("X2") + val.g.ToString("X2") + val.b.ToString("X2") + ">"; text += array[i]; text += "</color>"; if (flag) { MelonLogger.Msg("Time:" + num.ToString("0.00") + " Color: " + val.r.ToString("X2") + val.g.ToString("X2") + val.b.ToString("X2")); } } return text; } } public static class GradientExtension { public static Gradient RainbowGradient(int Total, float Offset) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) bool flag = false; GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[8]; GradientAlphaKey[] array2 = (GradientAlphaKey[])(object)new GradientAlphaKey[8]; float num = (float)Total * 0.0027777778f; float num2 = 7f; Gradient val = new Gradient(); for (int i = 0; i < 8; i++) { float num3 = num / num2 * (float)i + 1f / (360f / Offset); float num4 = ((i <= 0) ? 0f : (1f / num2 * (float)i)); if (num3 < 0f) { num3 += 1f; } if (num3 > 1f) { num3 -= 1f; } array[i] = new GradientColorKey(Color.HSVToRGB(num3, 1f, 1f), num4); array2[i] = new GradientAlphaKey(1f, num4); if (flag) { MelonLogger.Msg("Hue: " + num3.ToString("0.00") + " Time: " + num4.ToString("0.00") + " Color: " + array[i].color.r.ToString("0.00") + " " + array[i].color.g.ToString("0.00") + " " + array[i].color.b.ToString("0.00")); } } val.SetKeys(Il2CppStructArray<GradientColorKey>.op_Implicit(array), Il2CppStructArray<GradientAlphaKey>.op_Implicit(array2)); if (flag) { MelonLogger.Msg("Key Amount: " + ((Il2CppArrayBase<GradientColorKey>)(object)val.colorKeys).Length + " " + ((Il2CppArrayBase<GradientAlphaKey>)(object)val.alphaKeys).Length); } return val; } } public static class RectTransformExtension { public enum AnchorPresets { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight, BottomStretch, VertStretchLeft, VertStretchRight, VertStretchCenter, HorStretchTop, HorStretchMiddle, HorStretchBottom, StretchAll } public enum PivotPresets { TopLeft, TopCenter, TopRight, MiddleLeft, MiddleCenter, MiddleRight, BottomLeft, BottomCenter, BottomRight } public static void SetLocalPosAndScale(GameObject Input, Vector3 Pos, Vector3 Scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Input.transform.localPosition = Pos; Input.transform.localScale = Scale; } public static void SetAnchorPos(GameObject Input, float x, float y) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) Input.GetComponent<RectTransform>().anchoredPosition = new Vector2(x, y); } public static void SetAnchors(GameObject Input, AnchorPresets alignment) { switch (alignment) { case AnchorPresets.TopLeft: AnchorHelper(Input, 0f, 1f, 0f, 1f); break; case AnchorPresets.TopCenter: AnchorHelper(Input, 0.5f, 1f, 0.5f, 1f); break; case AnchorPresets.TopRight: AnchorHelper(Input, 1f, 1f, 1f, 1f); break; case AnchorPresets.MiddleLeft: AnchorHelper(Input, 0f, 0.5f, 0f, 0.5f); break; case AnchorPresets.MiddleCenter: AnchorHelper(Input, 0.5f, 0.5f, 0.5f, 0.5f); break; case AnchorPresets.MiddleRight: AnchorHelper(Input, 1f, 0.5f, 1f, 0.5f); break; case AnchorPresets.BottomLeft: AnchorHelper(Input, 0f, 0f, 0f, 0f); break; case AnchorPresets.BottomCenter: AnchorHelper(Input, 0.5f, 0f, 0.5f, 0f); break; case AnchorPresets.BottomRight: AnchorHelper(Input, 1f, 0f, 1f, 0f); break; case AnchorPresets.BottomStretch: AnchorHelper(Input, 0f, 0f, 1f, 0f); break; case AnchorPresets.VertStretchLeft: AnchorHelper(Input, 0f, 0f, 0f, 1f); break; case AnchorPresets.VertStretchCenter: AnchorHelper(Input, 0.5f, 0f, 0.5f, 1f); break; case AnchorPresets.VertStretchRight: AnchorHelper(Input, 1f, 0f, 1f, 1f); break; case AnchorPresets.HorStretchTop: AnchorHelper(Input, 0f, 1f, 1f, 1f); break; case AnchorPresets.HorStretchMiddle: AnchorHelper(Input, 0f, 0.5f, 1f, 0.5f); break; case AnchorPresets.HorStretchBottom: AnchorHelper(Input, 0f, 0f, 1f, 0f); break; case AnchorPresets.StretchAll: AnchorHelper(Input, 0f, 0f, 1f, 1f); break; } } public static void SetPivot(GameObject Input, PivotPresets pivot) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0138: Unknown result type (might be due to invalid IL or missing references) switch (pivot) { case PivotPresets.TopLeft: Input.GetComponent<RectTransform>().pivot = new Vector2(0f, 1f); break; case PivotPresets.TopCenter: Input.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 1f); break; case PivotPresets.TopRight: Input.GetComponent<RectTransform>().pivot = new Vector2(1f, 1f); break; case PivotPresets.MiddleLeft: Input.GetComponent<RectTransform>().pivot = new Vector2(0f, 0.5f); break; case PivotPresets.MiddleCenter: Input.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f); break; case PivotPresets.MiddleRight: Input.GetComponent<RectTransform>().pivot = new Vector2(1f, 0.5f); break; case PivotPresets.BottomLeft: Input.GetComponent<RectTransform>().pivot = new Vector2(0f, 0f); break; case PivotPresets.BottomCenter: Input.GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0f); break; case PivotPresets.BottomRight: Input.GetComponent<RectTransform>().pivot = new Vector2(1f, 0f); break; } } public static void AnchorHelper(GameObject Input, float xmin, float ymin, float xmax, float ymax) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Input.GetComponent<RectTransform>().anchorMin = new Vector2(xmin, ymin); Input.GetComponent<RectTransform>().anchorMax = new Vector2(xmax, ymax); } } public static class MelonLoggerExtension { public static void Log(string LogMessage) { MelonLogger.Msg(LogMessage); } } public static class ThunderStore { public class PackageMetricsV1 { public int Downloads { get; set; } public int Rating_score { get; set; } public string Latest_version { get; set; } } public class PackageData { public string Team { get; set; } public string Package { get; set; } public string LocalVersion { get; set; } public PackageData(string team, string package, string localVersion) { Team = team; Package = package; LocalVersion = localVersion; } } public class ReturnData { public PackageData SentData { get; set; } public ThunderStoreRequest.Status Status { get; set; } } public static class ThunderStoreRequest { public enum Status { BothSame, LocalNewer, GlobalNewer, Undefined } private static bool debug = false; private static bool ClientInit = false; private static string URL = "https://thunderstore.io"; private static string Command = "api/v1/package-metrics"; private static HttpClient client = new HttpClient { Timeout = new TimeSpan(0, 0, 20) }; private static bool RequestFailed = false; private static PackageMetricsV1 PackageMetrics { get; set; } public static event Action<ReturnData> OnVersionGet; public static async void CheckVersion(PackageData data) { InitializeClient(); RequestFailed = false; await RequestData(data); } private static ReturnData OnMetricsGet(PackageData packageData) { ReturnData returnData = new ReturnData { SentData = packageData }; Version version = new Version(packageData.LocalVersion); Version value = new Version(PackageMetrics.Latest_version); int num = version.CompareTo(value); if (num < 0) { returnData.Status = Status.GlobalNewer; } else if (num > 0) { returnData.Status = Status.LocalNewer; } else { returnData.Status = Status.BothSame; } return returnData; } private static PackageMetricsV1 DeserializeResponse(string response) { PackageMetricsV1 packageMetricsV = new PackageMetricsV1(); string text = response; text = text.Replace("{", ""); text = text.Replace("}", ""); string[] array = text.Split(new char[1] { ',' }); string[] array2 = array; foreach (string text2 in array2) { string[] array3 = text2.Split(new char[1] { ':' }); if (array3[0].Contains("downloads")) { packageMetricsV.Downloads = int.Parse(array3[1]); } if (array3[0].Contains("rating_score")) { packageMetricsV.Rating_score = int.Parse(array3[1]); } if (array3[0].Contains("latest_version")) { packageMetricsV.Latest_version = array3[1].Replace("\"", ""); } } return packageMetricsV; } private static async Task<string> GetPackageMetrics(string path) { string packageMetrics = null; if (debug) { MelonLogger.Msg(path); } HttpResponseMessage response = await client.GetAsync(path); if (response.IsSuccessStatusCode) { packageMetrics = await response.Content.ReadAsStringAsync(); if (debug) { MelonLogger.Msg("Package get"); } } else { RequestFailed = true; } return packageMetrics; } private static async Task RequestData(PackageData Input) { try { string temp = await GetPackageMetrics(Command + "/" + Input.Team + "/" + Input.Package); if (debug) { MelonLogger.Msg("API - Response: " + temp); } if (RequestFailed) { ThunderStoreRequest.OnVersionGet?.Invoke(null); } if (temp != null) { PackageMetrics = DeserializeResponse(temp); ThunderStoreRequest.OnVersionGet?.Invoke(OnMetricsGet(Input)); } } catch (Exception ex2) { Exception ex = ex2; MelonLogger.Error(ex.Message); } } private static void InitializeClient() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (!ClientInit) { client.BaseAddress = new Uri(URL); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); ClientInit = true; } } } } public static class ModNetworking { public static class NetworkHandler { private static bool debug = false; private static bool TSRequestRunning = false; private static object CRObj; private static readonly string[] TSRequestBlacklist = new string[4] { "UnityExplorer", "TestMod", "TestingOnly", "ExampleName" }; private static readonly Dictionary<string, string> TSRequestNameEx = new Dictionary<string, string> { { "LIV Camera Enabler", "Rumble_LIV_Camera_Enabler" }, { "Equips THE Bucket", "Bucket_Equipper" }, { "ModUI", "RumbleModUI" }, { "Instant Park Searcher", "InstantParkSearcher" }, { "Shaky Collisions", "ShakyCollisions" }, { "No Screen Shake", "NoScreenShake" }, { "Lilly's Skins", "ButteredLillys_Skin_Manager" }, { "Additional Sounds", "Rumble_Additional_Sounds" }, { "TempoSet", "Temposet" } }; private static readonly Dictionary<string, string> TSRequestAuthorEx = new Dictionary<string, string> { { "Lilly", "ButteredLilly" }, { "hlsl (Neon)", "RightArrowSupremacy" } }; private static Dictionary<string, string> TSRequestNameExInv; internal static void CheckAllVersions() { MelonLogger.Msg("Version Check Started. This may take about up to 15 seconds per mod."); InvertDictionary(TSRequestNameEx, out TSRequestNameExInv); ThunderStore.ThunderStoreRequest.OnVersionGet += EvaluateReturnData; CRObj = MelonCoroutines.Start(VersionRequest()); } private static void InvertDictionary(Dictionary<string, string> Dictionary, out Dictionary<string, string> InverseDictionary) { InverseDictionary = new Dictionary<string, string>(); foreach (KeyValuePair<string, string> item in Dictionary) { InverseDictionary.Add(item.Value, item.Key); } } private static void CheckModVersion(string ModName, string ModAuthor, string ModVersion) { string Mod_ModName; if (TSRequestNameExInv.ContainsKey(ModName)) { Mod_ModName = TSRequestNameExInv[ModName]; } else { Mod_ModName = ReplaceSpace(ModName, Invert: true); } if (!UI.instance.Mod_Options.Exists((Mod x) => x.ModName == Mod_ModName)) { Mod mod = new Mod { ModName = Mod_ModName, ModVersion = ModVersion }; mod.SetFolder("Temp"); mod.AddDescription("Description", "", AutoGenMods, new Tags { IsEmpty = true }); UI.instance.AddMod(mod); } ThunderStore.ThunderStoreRequest.CheckVersion(new ThunderStore.PackageData(ModAuthor, ModName, ModVersion)); TSRequestRunning = true; } private static void EvaluateReturnData(ThunderStore.ReturnData Data) { if (Data == null) { TSRequestRunning = false; return; } string ModName; if (TSRequestNameExInv.ContainsKey(Data.SentData.Package)) { ModName = TSRequestNameExInv[Data.SentData.Package]; } else { ModName = ReplaceSpace(Data.SentData.Package, Invert: true); } Mod mod = UI.instance.Mod_Options.Find((Mod x) => x.ModName == ModName); if (mod == null) { if (debug) { MelonLogger.Msg("Ref missing for " + ModName); } return; } if (debug) { MelonLogger.Msg("Data received for " + ModName); } mod.SetStatus(Data.Status); TSRequestRunning = false; } private static string ReplaceSpace(string Input, bool Invert) { if (!Invert) { return Input.Replace(" ", "_"); } return Input.Replace("_", " "); } private static IEnumerator VersionRequest() { WaitForFixedUpdate waitForFixedUpdate = new WaitForFixedUpdate(); foreach (MelonBase Mod in MelonBase.RegisteredMelons) { if (!TSRequestBlacklist.Contains(Mod.Info.Name)) { string ModName = ((!TSRequestNameEx.ContainsKey(Mod.Info.Name)) ? ReplaceSpace(Mod.Info.Name, Invert: false) : TSRequestNameEx[Mod.Info.Name]); string ModAuthor = ((!TSRequestAuthorEx.ContainsKey(Mod.Info.Author)) ? ReplaceSpace(Mod.Info.Author, Invert: false) : TSRequestAuthorEx[Mod.Info.Author]); CheckModVersion(ModName, ModAuthor, Mod.Info.Version); if (debug) { MelonLogger.Msg("Request started for " + ModName + " " + ModAuthor); } while (TSRequestRunning) { yield return waitForFixedUpdate; } } } MelonLoggerExtension.Log("Version Check Done."); if (CRObj != null) { MelonCoroutines.Stop(CRObj); } yield return null; } } } public static class LoadHandler { [HarmonyPatch(typeof(PlayerManager), "SpawnPlayerController", new Type[] { typeof(Player), typeof(SpawnPointType) })] public static class SpawnPlayerControllerPatch { private static void Postfix() { LoadHandler.PlayerLoaded?.Invoke(); if (!StartupToggle) { StartupToggle = true; LoadHandler.StartupDone?.Invoke(); if (debug) { MelonLogger.Msg("Startup Load"); } } if (debug) { MelonLogger.Msg("SpawnPlayerController 1 Postfix"); } } } private static bool debug; private static bool StartupToggle { get; set; } public static event Action PlayerLoaded; public static event Action StartupDone; } public static class Serious_Business { public static string TheGame() { return "YouJustLostTheGame"; } } private static string AutoGenMods = "This Mod was automatically added by the version checker." + Environment.NewLine + "No further functionality has been added."; private static Mod ModUI { get; set; } internal static void SetMod(Mod Input) { if (ModUI == null) { ModUI = Input; } } } public class LinkGroup { public List<ModSetting> Settings = new List<ModSetting>(); public string Name { get; set; } public int Index { get; set; } public bool HasChanged { get; set; } public bool AddedToDD { get; set; } } public class Mod { public string SettingsFile = "Settings.txt"; private const string DuplicateErrorMsg = "AddToList failed: Name not unique"; private bool debug = false; private Baum_API.Folders Folders = new Baum_API.Folders(); public List<ModSetting> Settings = new List<ModSetting>(); public List<LinkGroup> LinkGroups = new List<LinkGroup>(); public string ModName { get; set; } public string ModVersion { get; set; } private bool IsFileLoaded { get; set; } private bool IsSaved { get; set; } private bool IsAdded { get; set; } public Baum_API.ThunderStore.ThunderStoreRequest.Status VersionStatus { get; set; } public event Action ModSaved; public Mod() { VersionStatus = Baum_API.ThunderStore.ThunderStoreRequest.Status.Undefined; } public void SetFolder(string Folder) { Folders.SetModFolderCustom(Folder); } public void SetSubFolder(string Folder) { Folders.RemoveSubFolder(Folder); Folders.AddSubFolder(Folder); } public void SetUIStatus(bool Status) { IsAdded = Status; } public void EnableDebug() { debug = true; } public string GetFolder() { return Folders.GetModFolder(); } public string GetSubFolder() { return Folders.GetSubFolder(0); } public bool GetReadStatus() { return IsFileLoaded; } [Obsolete("Use event ModSaved", true)] public bool GetSaveStatus() { return IsSaved; } public bool GetUIStatus() { return IsAdded; } [Obsolete("Use event ModSaved", true)] public void ConfirmSave() { IsSaved = false; } public void ConfirmRead() { IsFileLoaded = false; } public void SetLinkGroup(int index, string name = "Group") { string name2 = ((!(name == "Group")) ? name : ("Group" + index)); if (LinkGroups.Count > 0 && LinkGroups.Exists((LinkGroup x) => x.Index == index)) { if (name != "Group") { LinkGroups.Find((LinkGroup x) => x.Index == index).Name = name2; } } else { LinkGroup item = new LinkGroup { Index = index, Name = name2 }; LinkGroups.Add(item); } } public void SetStatus(Baum_API.ThunderStore.ThunderStoreRequest.Status Version) { VersionStatus = Version; } [Obsolete("Method has been deprecated because the overload has confused too many people. AddDescription and another AddToList overload has been added as replacement.", true)] public ModSetting<string> AddToList(string Name, ModSetting.AvailableTypes StringType, string Value = "", string Description = "") { if (StringType != 0 && StringType != ModSetting.AvailableTypes.String) { MelonLogger.Msg("AddToList failed: ValueType != String/Description"); return null; } if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<string> modSetting = new ModSetting<string> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = 0, ValueType = StringType }; Settings.Add(modSetting); return modSetting; } [Obsolete("Use new overload.")] public ModSetting<string> AddDescription(string Name, string Value = "", string Description = "", bool IsSummary = true, bool IsEmpty = false) { Tags tags = new Tags { IsSummary = IsSummary, IsEmpty = IsEmpty, DoNotSave = true }; return AddDescription(Name, Value, Description, tags); } [Obsolete("Use new overload.")] public ModSetting<string> AddToList(string Name, string Value = "", string Description = "") { Tags tags = new Tags(); return AddToList(Name, Value, Description, tags); } [Obsolete("Use new overload.")] public ModSetting<bool> AddToList(string Name, bool Value = false, int LinkGroup = 0, string Description = "") { Tags tags = new Tags(); return AddToList(Name, Value, LinkGroup, Description, tags); } [Obsolete("Use new overload.")] public ModSetting<int> AddToList(string Name, int Value = 0, string Description = "") { Tags tags = new Tags(); return AddToList(Name, Value, Description, tags); } [Obsolete("Use new overload.")] public ModSetting<float> AddToList(string Name, float Value = 0f, string Description = "") { Tags tags = new Tags(); return AddToList(Name, Value, Description, tags); } [Obsolete("Use new overload.")] public ModSetting<double> AddToList(string Name, double Value = 0.0, string Description = "") { Tags tags = new Tags(); return AddToList(Name, Value, Description, tags); } public ModSetting<string> AddDescription(string Name, string Value, string Description, Tags tags) { if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<string> modSetting = new ModSetting<string> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = 0, ValueType = ModSetting.AvailableTypes.Description }; tags.DoNotSave = true; AddTags(modSetting, tags); Settings.Add(modSetting); return modSetting; } public ModSetting<string> AddToList(string Name, string Value, string Description, Tags tags) { if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<string> modSetting = new ModSetting<string> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = 0, ValueType = ModSetting.AvailableTypes.String }; AddTags(modSetting, tags); Settings.Add(modSetting); return modSetting; } public ModSetting<bool> AddToList(string Name, bool Value, int LinkGroup, string Description, Tags tags) { if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<bool> modSetting = new ModSetting<bool> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = LinkGroup, ValueType = ModSetting.AvailableTypes.Boolean }; if (LinkGroup != 0) { SetLinkGroup(LinkGroup); LinkGroups.Find((LinkGroup x) => x.Index == LinkGroup).Settings.Add(modSetting); } AddTags(modSetting, tags); Settings.Add(modSetting); return modSetting; } public ModSetting<int> AddToList(string Name, int Value, string Description, Tags tags) { if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<int> modSetting = new ModSetting<int> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = 0, ValueType = ModSetting.AvailableTypes.Integer }; AddTags(modSetting, tags); Settings.Add(modSetting); return modSetting; } public ModSetting<float> AddToList(string Name, float Value, string Description, Tags tags) { if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<float> modSetting = new ModSetting<float> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = 0, ValueType = ModSetting.AvailableTypes.Float }; AddTags(modSetting, tags); Settings.Add(modSetting); return modSetting; } public ModSetting<double> AddToList(string Name, double Value, string Description, Tags tags) { if (Settings.Count > 0 && Settings.Exists((ModSetting x) => x.Name == Name)) { MelonLogger.Msg("AddToList failed: Name not unique: " + Name); return null; } ModSetting<double> modSetting = new ModSetting<double> { Name = Name, Description = Description, Value = Value, SavedValue = Value, LinkGroup = 0, ValueType = ModSetting.AvailableTypes.Double }; AddTags(modSetting, tags); Settings.Add(modSetting); return modSetting; } public void AddTags(ModSetting modSetting, Tags tags) { modSetting.Tags = tags; } public void AddValidation(string name, ValidationParameters parameters) { Settings.Find((ModSetting x) => x.Name == name).ValidationParameters = parameters; } public bool ChangeValue(string Name, string Value = "") { foreach (ModSetting setting in Settings) { if (!(setting.Name == Name)) { continue; } if (setting.LinkGroup != 0 && setting.ValueType == ModSetting.AvailableTypes.Boolean && Value == "true") { foreach (ModSetting setting2 in Settings) { if (setting2.Name != Name && setting2.LinkGroup == setting.LinkGroup) { setting2.Value = false; } } } return ValueValidation(Value, setting); } MelonLogger.Msg(ModName + " - Setting does not exist."); return false; } private bool ValueValidation(string value, ModSetting ReferenceSetting) { switch (ReferenceSetting.ValueType) { case ModSetting.AvailableTypes.Boolean: if (value.ToLower().Equals("true") || value.ToLower().Equals("false")) { ModSetting<bool> modSetting2 = (ModSetting<bool>)ReferenceSetting; if (value.ToLower().Equals("true")) { modSetting2.Value = true; } else { modSetting2.Value = false; } return true; } return false; case ModSetting.AvailableTypes.Integer: { if (int.TryParse(value, out var _)) { ModSetting<int> modSetting5 = (ModSetting<int>)ReferenceSetting; modSetting5.Value = int.Parse(value); return true; } return false; } case ModSetting.AvailableTypes.Float: { if (float.TryParse(value, out var _)) { ModSetting<float> modSetting3 = (ModSetting<float>)ReferenceSetting; modSetting3.Value = float.Parse(value); return true; } return false; } case ModSetting.AvailableTypes.Double: { if (double.TryParse(value, out var _)) { ModSetting<double> modSetting4 = (ModSetting<double>)ReferenceSetting; modSetting4.Value = double.Parse(value); return true; } return false; } case ModSetting.AvailableTypes.String: { ModSetting<string> modSetting = (ModSetting<string>)ReferenceSetting; if (!modSetting.ValidationParameters.DoValidation(value)) { return false; } modSetting.Value = value; return true; } default: return false; } } public void SaveModData(string UI_String) { string path = ((Folders.GetSubFolder(0) == null) ? (Folders.GetFolderString() + "\\" + SettingsFile) : (Folders.GetFolderString(Folders.GetSubFolder(0)) + "\\" + SettingsFile)); Folders.CheckAllFoldersExist(); string text = ModName + " " + ModVersion + Environment.NewLine + UI_String + Environment.NewLine; foreach (ModSetting setting in Settings) { if (!setting.Tags.DoNotSave) { text = text + setting.Name + ": " + setting.GetValueAsString() + Environment.NewLine; } } File.WriteAllText(path, text); for (int i = 0; i < Settings.Count; i++) { Settings[i].SavedValue = Settings[i].Value; } this.ModSaved?.Invoke(); IsSaved = true; } public void DiscardModData() { for (int i = 0; i < Settings.Count; i++) { Settings[i].Value = Settings[i].SavedValue; } } public void GetFromFile() { bool flag = false; string path = ((Folders.GetSubFolder(0) == null) ? (Folders.GetFolderString() + "\\" + SettingsFile) : (Folders.GetFolderString(Folders.GetSubFolder(0)) + "\\" + SettingsFile)); if (!File.Exists(path)) { return; } string[] array = File.ReadAllLines(path); if (array[0].Contains(ModName) && array[0].Contains(ModVersion)) { flag = true; array[0] = ""; array[1] = ""; } if (flag) { string[] array2 = array; foreach (string text in array2) { foreach (ModSetting setting in Settings) { if (setting.Name.Length + 2 >= text.Length || !(text.Substring(0, setting.Name.Length) == setting.Name)) { continue; } bool flag2 = ValueValidation(text.Substring(setting.Name.Length + 2), setting); if (flag2) { setting.SavedValue = setting.Value; } if (!flag2) { MelonLogger.Msg(ModName + " - " + setting.Name + " File Read Error."); continue; } bool flag3 = true; if (debug) { MelonLogger.Msg(ModName + " - " + setting.Name + " " + setting.Value.ToString()); } } } IsFileLoaded = true; } else { IsFileLoaded = false; } } } public abstract class ModSetting { public enum AvailableTypes { Description, String, Integer, Float, Double, Boolean } public string Name = ""; public AvailableTypes ValueType = AvailableTypes.String; public string Description = ""; public int LinkGroup = 0; public ValidationParameters ValidationParameters = new ValidationTemplate(); public Tags Tags = new Tags(); public abstract object Value { get; set; } public abstract object SavedValue { get; set; } public virtual event EventHandler<EventArgs> CurrentValueChanged; public virtual event EventHandler<EventArgs> SavedValueChanged; public ModSetting() { } public abstract string GetValueAsString(); } public class ValueChange<T> : EventArgs { public T Value { get; set; } public ValueChange(T value) { Value = value; } } public class ModSetting<T> : ModSetting { private T BG_SaveVariable; private T BG_TempVariable; public override object Value { get { return BG_TempVariable; } set { if (!value.Equals(BG_TempVariable)) { CurrentValueChanged?.Invoke(this, new ValueChange<T>((T)value)); BG_TempVariable = (T)value; } } } public override object SavedValue { get { return BG_SaveVariable; } set { if (!value.Equals(BG_SaveVariable)) { SavedValueChanged?.Invoke(this, new ValueChange<T>((T)value)); BG_SaveVariable = (T)value; } } } public override event EventHandler<EventArgs> CurrentValueChanged; public override event EventHandler<EventArgs> SavedValueChanged; public override string GetValueAsString() { if (ValueType == AvailableTypes.Boolean) { return BG_TempVariable.ToString().ToLower(); } return BG_TempVariable.ToString(); } } public class Tags { public bool IsSummary { get; set; } public bool IsEmpty { get; set; } public bool IsCustom { get; set; } public string CustomString { get; set; } public bool IsPassword { get; set; } public bool DoNotSave { get; set; } public Tags() { IsSummary = false; IsEmpty = false; IsCustom = false; CustomString = ""; IsPassword = false; DoNotSave = false; } } public static class BuildInfo { public const string ModName = "ModUI"; public const string ModVersion = "2.1.2"; public const string Description = "Adds a universal UI for Mod Creators"; public const string Author = "Baumritter"; public const string Company = ""; } public class RumbleModUIClass : MelonMod { private bool VRButtonsPressed = false; private bool VRButtonsAllowed = false; private static InputActionMap map = new InputActionMap("Tha Map"); private static InputAction rightTrigger = InputActionSetupExtensions.AddAction(map, "Right Trigger", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null); private static InputAction rightPrimary = InputActionSetupExtensions.AddAction(map, "Right Primary", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null); private static InputAction leftTrigger = InputActionSetupExtensions.AddAction(map, "Left Trigger", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null); private static InputAction leftPrimary = InputActionSetupExtensions.AddAction(map, "Left Primary", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null); [Obsolete("Please use UI.instance instead", true)] public static UI UI_Obj = UI.instance; private Mod ModUI; public override void OnInitializeMelon() { ((MelonBase)this).OnInitializeMelon(); InputActionSetupExtensions.AddBinding(rightTrigger, "<XRController>{RightHand}/trigger", (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(rightPrimary, "<XRController>{RightHand}/primaryButton", (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(leftTrigger, "<XRController>{LeftHand}/trigger", (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(leftPrimary, "<XRController>{LeftHand}/primaryButton", (string)null, (string)null, (string)null); map.Enable(); Baum_API.LoadHandler.StartupDone += InitUI; } public override void OnUpdate() { ((MelonBase)this).OnUpdate(); if (Input.GetKeyDown((KeyCode)291) || (VRButtonsAllowed && VRActivationAction())) { if (UI.instance.IsUIVisible()) { UI.instance.HideUI(); } else { UI.instance.ShowUI(); } } } private bool VRActivationAction() { float num = 0.9f; float num2 = 0.1f; if (rightTrigger.ReadValue<float>() >= num && rightPrimary.ReadValue<float>() >= num && leftTrigger.ReadValue<float>() >= num && leftPrimary.ReadValue<float>() >= num && !VRButtonsPressed) { VRButtonsPressed = true; return true; } if (rightTrigger.ReadValue<float>() <= num2 && rightPrimary.ReadValue<float>() <= num2 && leftTrigger.ReadValue<float>() <= num2 && leftPrimary.ReadValue<float>() <= num2 && VRButtonsPressed) { VRButtonsPressed = false; } return false; } private void InitUI() { ModUI = UI.instance.InitUI(); Baum_API.SetMod(ModUI); ModUI.ModSaved += OnModSaved; ModUI.Settings.Find((ModSetting x) => x.Name == GlobalConstants.DebugPass).CurrentValueChanged += PasswordValidation; ModUI.Settings.Find((ModSetting x) => x.Name == GlobalConstants.ToggleDebug).CurrentValueChanged += DebugWindowHandler; VRButtonsAllowed = (bool)ModUI.Settings.Find((ModSetting x) => x.Name == GlobalConstants.VRMenuInput).Value; Baum_API.ModNetworking.NetworkHandler.CheckAllVersions(); } private void PasswordValidation(object sender, EventArgs Event) { ValueChange<string> valueChange = Event as ValueChange<string>; if (valueChange.Value == Baum_API.Serious_Business.TheGame()) { MelonLogger.Msg("Correct Password."); } else { MelonLogger.Msg("Wrong Password."); } } private void DebugWindowHandler(object sender, EventArgs Event) { ValueChange<bool> valueChange = Event as ValueChange<bool>; if (!((string)ModUI.Settings.Find((ModSetting x) => x.Name == GlobalConstants.DebugPass).Value == Baum_API.Serious_Business.TheGame())) { return; } if (valueChange.Value) { UI.instance.SubWindow.Find((Window x) => x.Name == "DebugWindow").ShowWindow(); } else { UI.instance.SubWindow.Find((Window x) => x.Name == "DebugWindow").HideWindow(); } } private void OnModSaved() { if (ModUI.LinkGroups[0].HasChanged) { UI.instance.RefreshTheme(); ModUI.LinkGroups[0].HasChanged = false; } VRButtonsAllowed = (bool)ModUI.Settings.Find((ModSetting x) => x.Name == GlobalConstants.VRMenuInput).Value; } } internal static class GlobalConstants { public static string EntryPersistence = "Remember Dropdown Entries"; public static string VRMenuInput = "VR Menu Input"; public static string LightTheme = "Light"; public static string DarkTheme = "Dark"; public static string HCTheme = "High Contrast"; public static string Monokai = "Monokai"; public static string ToggleDebug = "Toggles Debug Menu"; public static string DebugPass = "Allow Debug Usage"; } public class UI { private class DebugButtonStatus { public string Name { get; set; } public int Index { get; set; } public bool IsAllocated { get; set; } } private const string ModName = "ModUI"; private const string ModVersion = "2.1.2"; private const string ModDescription = "This is the Mod UI by Baumritter."; public static UI instance = new UI(); private Vector3 Pos_MainWindow; private Vector3 Pos_SubWindow; private Vector3 Pos_OuterBG = new Vector3(0f, 0f, 0f); private Vector3 Pos_DescBG = new Vector3(10f, -190f, 0f); private Vector3 Pos_DescText = new Vector3(5f, -5f, 0f); private Vector3 Pos_Title = new Vector3(0f, 0f, 0f); private Vector3 Pos_DD1 = new Vector3(10f, -40f, 0f); private Vector3 Pos_DD2 = new Vector3(10f, -90f, 0f); private Vector3 Pos_IF = new Vector3(10f, -140f, 0f); private Vector3 Pos_TB = new Vector3(0f, 90f, 0f); private Vector3 Pos_B1 = new Vector3(10f, 10f, 0f); private Vector3 Pos_B2 = new Vector3(240f, 10f, 0f); private Vector2 Size_Base = new Vector2(400f, 500f); private Vector2 Size_Title = new Vector2(140f, 30f); private Vector2 Size_DD = new Vector2(380f, 40f); private Vector2 Size_DD_Ext = new Vector2(0f, 200f); private Vector2 Size_IF = new Vector2(380f, 40f); private Vector2 Size_TB = new Vector2(200f, 40f); private Vector2 Size_DescBG = new Vector2(-20f, -240f); private Vector2 Size_DescText = new Vector2(-5f, 5f); private Vector2 Size_Button = new Vector2(150f, 30f); private Color Light_Text_Basic = Color.black; private Color Light_Text_Error = new Color(0.7f, 0f, 0f, 1f); private Color Light_Text_Valid = new Color(0f, 0.7f, 0f, 1f); private Color Light_Foreground = new Color(0.9f, 0.9f, 0.9f, 0.7f); private Color Light_Background = new Color(0.7f, 0.7f, 0.7f, 0.7f); private Color Dark_Text_Basic = Color.white; private Color Dark_Text_Error = new Color(0.7f, 0f, 0f, 1f); private Color Dark_Text_Valid = new Color(0f, 0.7f, 0f, 1f); private Color Dark_Foreground = new Color(0.3f, 0.3f, 0.3f, 0.8f); private Color Dark_Background = new Color(0.1f, 0.1f, 0.1f, 0.8f); private Color HighContrast_Text_Basic = Color.yellow; private Color HighContrast_Text_Error = new Color(1f, 0f, 0f, 1f); private Color HighContrast_Text_Valid = new Color(0f, 1f, 0f, 1f); private Color HighContrast_Foreground = new Color(0.3f, 0.3f, 0.3f, 1f); private Color HighContrast_Background = new Color(0.1f, 0.1f, 0.1f, 1f); private Color Monokai_Text_Basic = Color32.op_Implicit(new Color32((byte)248, (byte)248, (byte)242, byte.MaxValue)); private Color Monokai_Text_Error = Color32.op_Implicit(new Color32((byte)249, (byte)38, (byte)114, byte.MaxValue)); private Color Monokai_Text_Valid = Color32.op_Implicit(new Color32((byte)166, (byte)226, (byte)46, byte.MaxValue)); private Color Monokai_Foreground = Color32.op_Implicit(new Color32((byte)39, (byte)40, (byte)34, (byte)245)); private Color Monokai_Background = Color32.op_Implicit(new Color32((byte)30, (byte)31, (byte)28, (byte)245)); public string Name = ""; private bool debug_UI = false; private bool IsInit = false; private bool IsVisible = false; private bool Running = false; private int ModSelection = 0; private int SettingsSelection = 0; private int SettingsOverride = 0; private GameObject UI_Parent; private GameObject Obj_MainWdw; private Window MainWindow; public List<Window> SubWindow = new List<Window>(); private List<DebugButtonStatus> DebugButtons = new List<DebugButtonStatus>(); private GameObject UI_Description; private GameObject UI_DropDown_Mod; private GameObject UI_DropDown_Settings; private GameObject UI_InputField; private GameObject UI_ToggleBox; private GameObject UI_ButtonSave; private GameObject UI_ButtonDisc; private object Enum_Save; private object Enum_Discard; private object Enum_Theme; internal List<Mod> Mod_Options = new List<Mod>(); public event Action UI_Initialized; [Obsolete("Use the UI_Initialized Event.")] public bool GetInit() { return IsInit; } internal Mod InitUI() { //IL_0038: 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_0044: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Expected O, but got Unknown //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_0763: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) if (!IsInit) { UI_Parent = GameObject.Find("Game Instance/UI"); Name = "Mod_Setting_UI"; ThemeHandler.AvailableThemes.Add(new Theme("Light", Light_Text_Basic, Light_Text_Valid, Light_Text_Error, Light_Foreground, Light_Background)); ThemeHandler.AvailableThemes.Add(new Theme("Dark", Dark_Text_Basic, Dark_Text_Valid, Dark_Text_Error, Dark_Foreground, Dark_Background)); ThemeHandler.AvailableThemes.Add(new Theme("HighContrast", HighContrast_Text_Basic, HighContrast_Text_Valid, HighContrast_Text_Error, HighContrast_Foreground, HighContrast_Background)); ThemeHandler.AvailableThemes.Add(new Theme("Monokai", Monokai_Text_Basic, Monokai_Text_Valid, Monokai_Text_Error, Monokai_Foreground, Monokai_Background)); Pos_MainWindow = new Vector3((float)(Screen.width / 2 - 300), (float)(Screen.height / 2), 0f); Pos_SubWindow = new Vector3((float)(Screen.width / 2 + 300), (float)(Screen.height / 2), 0f); MainWindow = new Window("MainWindow"); Obj_MainWdw = new GameObject("Mod_Setting_UI"); Obj_MainWdw.SetActive(false); Obj_MainWdw.transform.SetParent(UI_Parent.transform); Obj_MainWdw.AddComponent<RectTransform>(); Obj_MainWdw.GetComponent<RectTransform>().sizeDelta = Size_Base; Obj_MainWdw.transform.position = Pos_MainWindow; Obj_MainWdw.transform.localScale = new Vector3(1.5f, 1.5f, 0f); Baum_API.RectTransformExtension.SetAnchors(Obj_MainWdw, Baum_API.RectTransformExtension.AnchorPresets.MiddleCenter); Baum_API.RectTransformExtension.SetPivot(Obj_MainWdw, Baum_API.RectTransformExtension.PivotPresets.MiddleCenter); MainWindow.ParentObject = Obj_MainWdw; MainWindow.CreateBackgroundBox("Outer BG", MainWindow.ParentObject.transform, Pos_OuterBG); MainWindow.CreateTitle("Title", MainWindow.ParentObject.transform, Pos_Title, Size_Title); MainWindow.SetTitleText("ModUI V2.1.2", 20f); UI_Description = MainWindow.CreateTextBox("Description", MainWindow.ParentObject.transform, Pos_DescBG, Pos_DescText, Size_DescBG, Size_DescText); UI_DropDown_Mod = MainWindow.CreateDropdown("DropDown_Mods", MainWindow.ParentObject.transform, Pos_DD1, Size_DD, Size_DD_Ext); UI_DropDown_Settings = MainWindow.CreateDropdown("DropDown_Settings", MainWindow.ParentObject.transform, Pos_DD2, Size_DD, Size_DD_Ext); UI_InputField = MainWindow.CreateInputField("InputField", MainWindow.ParentObject.transform, Pos_IF, Size_IF); UI_ToggleBox = MainWindow.CreateToggle("ToggleBox", MainWindow.ParentObject.transform, Pos_TB, Size_TB); UI_ButtonSave = MainWindow.CreateButton("SaveButton", MainWindow.ParentObject.transform, Pos_B1, Size_Button, "Save"); UI_ButtonDisc = MainWindow.CreateButton("DiscardButton", MainWindow.ParentObject.transform, Pos_B2, Size_Button, "Discard"); UI_ToggleBox.SetActive(false); MainWindow.OnShow += DoOnShow; MainWindow.OnHide += DoOnHide; ((UnityEvent<int>)(object)UI_DropDown_Mod.GetComponent<TMP_Dropdown>().onValueChanged).AddListener(UnityAction<int>.op_Implicit((Action<int>)delegate(int value) { OnModSelectionChange(value); })); ((UnityEvent<int>)(object)UI_DropDown_Settings.GetComponent<TMP_Dropdown>().onValueChanged).AddListener(UnityAction<int>.op_Implicit((Action<int>)delegate(int value) { OnSettingsSelectionChange(value); })); ((UnityEvent<string>)(object)UI_InputField.GetComponent<TMP_InputField>().onSubmit).AddListener(UnityAction<string>.op_Implicit((Action<string>)delegate(string value) { OnInputFieldChange(value); })); ((UnityEvent<bool>)(object)UI_ToggleBox.GetComponent<Toggle>().onValueChanged).AddListener(UnityAction<bool>.op_Implicit((Action<bool>)delegate(bool value) { OnToggleChange(value); })); ((UnityEvent)UI_ButtonSave.GetComponent<Button>().onClick).AddListener(UnityAction.op_Implicit((Action)delegate { ButtonHandler(0); })); ((UnityEvent)UI_ButtonDisc.GetComponent<Button>().onClick).AddListener(UnityAction.op_Implicit((Action)delegate { ButtonHandler(1); })); Window window = new Window("DebugWindow"); GameObject val = new GameObject("DebugParent"); val.SetActive(false); val.transform.SetParent(UI_Parent.transform); val.AddComponent<RectTransform>(); val.GetComponent<RectTransform>().sizeDelta = Size_Base; val.transform.position = Pos_SubWindow; val.transform.localScale = new Vector3(1.5f, 1.5f, 0f); Baum_API.RectTransformExtension.SetAnchors(val, Baum_API.RectTransformExtension.AnchorPresets.MiddleCenter); Baum_API.RectTransformExtension.SetPivot(val, Baum_API.RectTransformExtension.PivotPresets.MiddleCenter); window.ParentObject = val; window.CreateBackgroundBox("Outer BG", window.ParentObject.transform, Pos_OuterBG); window.CreateTitle("Title", window.ParentObject.transform, Pos_Title, Size_Title); window.SetTitleText("Debug", 20f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(120f, 30f); for (int i = 1; i <= 11; i++) { float num = Size_Base.y - 30f - (float)i * 40f; window.CreateButton("LB" + i, window.ParentObject.transform, new Vector3(10f, num, 0f), Vector2.op_Implicit(val2), ""); } for (int j = 1; j <= 11; j++) { float num = Size_Base.y - 30f - (float)j * 40f; window.CreateButton("MB" + j, window.ParentObject.transform, new Vector3(140f, num, 0f), Vector2.op_Implicit(val2), ""); } for (int k = 1; k <= 11; k++) { float num = Size_Base.y - 30f - (float)k * 40f; window.CreateButton("RB" + k, window.ParentObject.transform, new Vector3(270f, num, 0f), Vector2.op_Implicit(val2), ""); } SubWindow.Add(window); PresetDebugButtons(); Mod result = AddSelf(); IsInit = true; this.UI_Initialized?.Invoke(); if (debug_UI) { MelonLogger.Msg("UI - Initialised"); } return result; } if (debug_UI) { MelonLogger.Msg("UI - Already initialised"); } return null; } internal void ShowUI() { if (IsInit) { MainWindow.ShowWindow(); IsVisible = true; if (debug_UI) { MelonLogger.Msg("UI - Shown"); } } } internal void HideUI() { if (IsInit) { MainWindow.HideWindow(); IsVisible = false; if (debug_UI) { MelonLogger.Msg("UI - Hidden"); } } } public void ForceRefresh() { OnSettingsSelectionChange(SettingsSelection); } public bool IsModSelected(string name) { if (Mod_Options[ModSelection].ModName == name) { return true; } return false; } public bool IsOptionSelected(string name) { if (Mod_Options[ModSelection].Settings[SettingsSelection].Name == name) { return true; } return false; } public bool IsUIVisible() { return IsVisible; } public void AddMod(Mod Input) { bool flag = false; foreach (Mod mod_Option in Mod_Options) { if (mod_Option.ModName == Input.ModName) { flag = true; } } if (!flag && Input.ModName != "" && Input.ModVersion != "" && Input.GetFolder() != "") { Mod_Options.Add(Input); Input.SetUIStatus(Status: true); return; } if (debug_UI) { MelonLogger.Msg("Modlist - Mod already exists."); } if (Input.ModName == "" || Input.ModVersion == "" || Input.GetFolder() == "") { MelonLogger.Msg("Mandatory Values not set."); } } public void RemoveMod(Mod Input) { bool flag = false; foreach (Mod mod_Option in Mod_Options) { if (mod_Option.ModName == Input.ModName) { Mod_Options.Remove(mod_Option); Input.SetUIStatus(Status: false); flag = true; } } if (!flag && debug_UI) { MelonLogger.Msg("Modlist - Mod doesn't exist."); } } private Mod AddSelf() { Mod mod = new Mod { ModName = "ModUI", ModVersion = "2.1.2" }; mod.SetFolder("ModUI"); mod.AddDescription("Description", "", "This is the Mod UI by Baumritter.", new Tags { IsSummary = true }); mod.AddToList(GlobalConstants.EntryPersistence, Value: false, 0, "Changes the selection of the dropdown entries to be persistent after closing and reopening.", new Tags()); mod.AddToList(GlobalConstants.VRMenuInput, Value: true, 0, "Allows the user to open/close the menu by pressing both triggers and primary buttons at the same time", new Tags()); mod.AddToList(GlobalConstants.LightTheme, Value: true, 1, "Turns Light Theme on/off.", new Tags()); mod.AddToList(GlobalConstants.DarkTheme, Value: false, 1, "Turns Dark Theme on/off.", new Tags()); mod.AddToList(GlobalConstants.HCTheme, Value: false, 1, "Turns High Contrast Theme on/off.", new Tags()); mod.AddToList(GlobalConstants.Monokai, Value: false, 1, "Turns Monokai Theme on/off.", new Tags()); mod.AddToList(GlobalConstants.ToggleDebug, Value: false, 0, "Toggles the debug window if the correct password is set in " + GlobalConstants.DebugPass + ".", new Tags { DoNotSave = true }); mod.AddToList(GlobalConstants.DebugPass, "", "Enter the password for debugging.", new Tags { DoNotSave = true, IsPassword = true, IsCustom = true, CustomString = "Enter Password..." }); mod.SetLinkGroup(1, "Themes"); mod.GetFromFile(); AddMod(mod); RefreshTheme(); return mod; } private void OnModSelectionChange(int Input) { ModSelection = Input; DoOnModSelect(); } private void OnSettingsSelectionChange(int Input) { SettingsSelection = Input; DoOnSettingsSelect(); } private void OnInputFieldChange(string Input) { DoOnInput(Input); } private void OnToggleChange(bool Input) { DoOnToggle(Input); } private void DoOnShow() { ShowSetup(); if (debug_UI) { MelonLogger.Msg("UI - OnShow"); } } private void ShowSetup() { //IL_0057: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) List<string> val = new List<string>(); foreach (Mod mod_Option in Mod_Options) { string text = ""; switch (mod_Option.VersionStatus) { case Baum_API.ThunderStore.ThunderStoreRequest.Status.BothSame: text = Baum_API.StringExtension.ReturnHexedString("=", Color32.op_Implicit(ThemeHandler.ActiveTheme.Color_Text_Valid)); break; case Baum_API.ThunderStore.ThunderStoreRequest.Status.LocalNewer: text = Baum_API.StringExtension.ReturnHexedString("<", Color32.op_Implicit(Color.blue)); break; case Baum_API.ThunderStore.ThunderStoreRequest.Status.GlobalNewer: text = Baum_API.StringExtension.ReturnHexedString(">", Color32.op_Implicit(ThemeHandler.ActiveTheme.Color_Text_Error)); break; case Baum_API.ThunderStore.ThunderStoreRequest.Status.Undefined: text = Baum_API.StringExtension.ReturnHexedString("?", Color32.op_Implicit(ThemeHandler.ActiveTheme.Color_Text_Error)); break; } val.Add(text + " | " + mod_Option.ModVersion + " | " + mod_Option.ModName); } UI_DropDown_Mod.GetComponent<TMP_Dropdown>().ClearOptions(); UI_DropDown_Mod.GetComponent<TMP_Dropdown>().AddOptions(val); val.Clear(); if ((bool)Mod_Options[0].Settings.Find((ModSetting x) => x.Name == GlobalConstants.EntryPersistence).SavedValue && ModSelection != 0) { SettingsOverride = SettingsSelection; UI_DropDown_Mod.GetComponent<TMP_Dropdown>().value = ModSelection; } else { foreach (ModSetting setting in Mod_Options[0].Settings) { if (setting.ValueType == ModSetting.AvailableTypes.Boolean && setting.LinkGroup != 0) { LinkGroup linkGroup = Mod_Options[0].LinkGroups.Find((LinkGroup x) => x.Index == setting.LinkGroup); val.Add(linkGroup.Name + " - " + setting.Name); } else { val.Add(setting.Name); } } UI_DropDown_Settings.GetComponent<TMP_Dropdown>().ClearOptions(); UI_DropDown_Settings.GetComponent<TMP_Dropdown>().AddOptions(val); if ((bool)Mod_Options[0].Settings.Find((ModSetting x) => x.Name == GlobalConstants.EntryPersistence).SavedValue && SettingsSelection != 0) { UI_DropDown_Settings.GetComponent<TMP_Dropdown>().value = SettingsSelection; } else { UI_ToggleBox.SetActive(false); UI_InputField.SetActive(true); ModSelection = 0; SettingsSelection = 0; SettingsOverride = 0; } } Inputfield_SetPlaceholder(); ((TMP_Text)((Component)UI_Description.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = Mod_Options[ModSelection].Settings[SettingsSelection].Description; MainWindow.ParentObject.transform.position = CheckBounds(MainWindow.ParentObject, IsSub: false); foreach (Window item in SubWindow) { item.ParentObject.transform.position = CheckBounds(item.ParentObject, IsSub: true); } } private Vector3 CheckBounds(GameObject Object, bool IsSub) { //IL_000f: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) RectTransform component = Object.GetComponent<RectTransform>(); float num = (float)Screen.width - (component.sizeDelta.x - 50f) * 0.5f * ((Transform)component).lossyScale.x; float num2 = (float)Screen.height - (component.sizeDelta.y - 25f) * 0.5f * ((Transform)component).lossyScale.y; float num3 = (component.sizeDelta.x - 50f) * 0.5f * ((Transform)component).lossyScale.x; float num4 = (component.sizeDelta.y - 25f) * 0.5f * ((Transform)component).lossyScale.y; if (Object.transform.position.x > num || Object.transform.position.y > num2 || Object.transform.position.x < num3 || Object.transform.position.y < num4) { if (IsSub) { return Pos_SubWindow; } return Pos_MainWindow; } return Object.transform.position; } private void DoOnHide() { foreach (Window item in SubWindow) { item.HideWindow(); } if (debug_UI) { MelonLogger.Msg("UI - OnHide"); } } private void DoOnModSelect() { List<string> val = new List<string>(); foreach (ModSetting setting in Mod_Options[ModSelection].Settings) { if (setting.ValueType == ModSetting.AvailableTypes.Boolean && setting.LinkGroup != 0) { LinkGroup linkGroup = Mod_Options[ModSelection].LinkGroups.Find((LinkGroup x) => x.Index == setting.LinkGroup); val.Add(linkGroup.Name + " - " + setting.Name); } else { val.Add(setting.Name); } } UI_DropDown_Settings.GetComponent<TMP_Dropdown>().ClearOptions(); UI_DropDown_Settings.GetComponent<TMP_Dropdown>().AddOptions(val); if (SettingsOverride != 0) { SettingsSelection = SettingsOverride; UI_DropDown_Settings.GetComponent<TMP_Dropdown>().value = SettingsOverride; SettingsOverride = 0; } else { SettingsSelection = 0; } DoOnSettingsSelect(); Inputfield_SetPlaceholder(); } private void DoOnSettingsSelect() { ((TMP_Text)((Component)UI_Description.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = Mod_Options[ModSelection].Settings[SettingsSelection].Description; if (Mod_Options[ModSelection].Settings[SettingsSelection].ValueType == ModSetting.AvailableTypes.Boolean) { UI_InputField.SetActive(false); UI_ToggleBox.SetActive(true); ToggleBox_AdjustValue(); return; } UI_ToggleBox.SetActive(false); UI_InputField.SetActive(true); if (Mod_Options[ModSelection].Settings[SettingsSelection].Tags.IsPassword) { UI_InputField.GetComponent<TMP_InputField>().inputType = (InputType)2; } else { UI_InputField.GetComponent<TMP_InputField>().inputType = (InputType)0; } Inputfield_SetPlaceholder(); } private void DoOnInput(string Input) { bool valid = Mod_Options[ModSelection].ChangeValue(Mod_Options[ModSelection].Settings[SettingsSelection].Name, Input); Inputfield_SetPlaceholder(valid); UI_InputField.GetComponent<TMP_InputField>().text = ""; } private void DoOnToggle(bool value) { //IL_014a: 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) if (value) { Mod_Options[ModSelection].ChangeValue(Mod_Options[ModSelection].Settings[SettingsSelection].Name, "true"); if (Mod_Options[ModSelection].Settings[SettingsSelection].LinkGroup != 0) { Mod_Options[ModSelection].LinkGroups.Find((LinkGroup x) => x.Index == Mod_Options[ModSelection].Settings[SettingsSelection].LinkGroup).HasChanged = true; } ((Graphic)((Component)UI_ToggleBox.transform.GetChild(0)).GetComponent<Image>()).color = ThemeHandler.ActiveTheme.Color_Text_Valid; if (debug_UI) { MelonLogger.Msg("Enum - Toggle true"); } } else { Mod_Options[ModSelection].ChangeValue(Mod_Options[ModSelection].Settings[SettingsSelection].Name, "false"); ((Graphic)((Component)UI_ToggleBox.transform.GetChild(0)).GetComponent<Image>()).color = ThemeHandler.ActiveTheme.Color_Text_Error; if (debug_UI) { MelonLogger.Msg("Enum - Toggle false"); } } } private void ToggleBox_AdjustValue() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((bool)Mod_Options[ModSelection].Settings[SettingsSelection].Value) { UI_ToggleBox.GetComponent<Toggle>().isOn = true; ((Graphic)((Component)UI_ToggleBox.transform.GetChild(0)).GetComponent<Image>()).color = ThemeHandler.ActiveTheme.Color_Text_Valid; } else { UI_ToggleBox.GetComponent<Toggle>().isOn = false; ((Graphic)((Component)UI_ToggleBox.transform.GetChild(0)).GetComponent<Image>()).color = ThemeHandler.ActiveTheme.Color_Text_Error; } } private void Inputfield_SetPlaceholder(bool Valid = true) { //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) ModSetting modSetting = Mod_Options[ModSelection].Settings[SettingsSelection]; if (modSetting.ValueType == ModSetting.AvailableTypes.Description && !modSetting.Tags.IsCustom) { if (modSetting.Tags.IsSummary) { ((TMP_Text)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).text = "Available Settings: " + (Mod_Options[ModSelection].Settings.Count - 1); } else if (modSetting.Tags.IsEmpty) { ((TMP_Text)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).text = ""; } else { ((TMP_Text)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).text = "Current Value: " + modSetting.GetValueAsString(); } } else if (modSetting.Tags.IsCustom && modSetting.Tags.CustomString != "") { ((TMP_Text)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).text = modSetting.Tags.CustomString; } else { ((TMP_Text)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).text = "Current Value: " + modSetting.GetValueAsString(); } if (Valid) { ((Graphic)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).color = ThemeHandler.ActiveTheme.Color_Text_Base; } else { ((Graphic)((Component)UI_InputField.transform.GetChild(0).FindChild("Placeholder")).GetComponent<TextMeshProUGUI>()).color = ThemeHandler.ActiveTheme.Color_Text_Error; } } private void ButtonHandler(int index) { switch (index) { case 0: SaveSettings(); if (debug_UI) { MelonLogger.Msg("Button - Save"); } break; case 1: DiscardSettings(); if (debug_UI) { MelonLogger.Msg("Button - Discard"); } break; } } private void SaveSettings() { if (!Running) { Mod_Options[ModSelection].SaveModData("Created by: ModUI 2.1.2"); Enum_Save = MelonCoroutines.Start(ButtonFeedback(UI_ButtonSave, 0.5)); } } private void DiscardSettings() { if (!Running) { Mod_Options[ModSelection].DiscardModData(); Enum_Discard = MelonCoroutines.Start(ButtonFeedback(UI_ButtonDisc, 0.5)); DoOnModSelect(); } } private IEnumerator ButtonFeedback(GameObject Button, double Delay) { WaitForFixedUpdate waitForFixedUpdate = new WaitForFixedUpdate(); Running = true; DateTime time = DateTime.Now; if (((Object)Button).name == "SaveButton") { ((TMP_Text)((Component)Button.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Saved"; } else { ((TMP_Text)((Component)Button.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Discarded"; } while (DateTime.Now <= ((DateTime)(ref time)).AddSeconds(Delay)) { yield return waitForFixedUpdate; } if (((Object)Button).name == "SaveButton") { ((TMP_Text)((Component)Button.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Save"; } else { ((TMP_Text)((Component)Button.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = "Discard"; } Running = false; if (Enum_Save != null) { MelonCoroutines.Stop(Enum_Save); } if (Enum_Discard != null) { MelonCoroutines.Stop(Enum_Discard); } yield return null; } public void AddTheme(Theme newTheme, string Description) { ThemeHandler.AvailableThemes.Add(newTheme); Mod_Options.Find((Mod x) => x.ModName == "ModUI").AddToList(newTheme.Name, Value: false, 1, Description, new Tags()); Mod_Options.Find((Mod x) => x.ModName == "ModUI").GetFromFile(); RefreshTheme(); } internal void RefreshTheme() { Enum_Theme = MelonCoroutines.Start(UpdateTheme()); } private IEnumerator UpdateTheme() { int index = 0; foreach (ModSetting setting in Mod_Options.Find((Mod x) => x.ModName == "ModUI").Settings) { if (setting.LinkGroup == 1) { if ((bool)setting.Value) { ThemeHandler.ChangeTheme(index); break; } index++; } } if (Enum_Theme != null) { MelonCoroutines.Stop(Enum_Theme); } yield return null; } public void AddDebugButton(string ButtonText, Action ButtonAction) { foreach (DebugButtonStatus DB in DebugButtons) { if (!DB.IsAllocated) { ButtonOverride(SubWindow[0].Elements.Find((GameObject x) => ((Object)x).name == DB.Name), ButtonText, ButtonAction); DB.Name = ButtonText; return; } } MelonLogger.Msg("No Debug buttons free."); } private void PresetDebugButtons() { int num = 0; foreach (GameObject element in SubWindow[0].Elements) { string name = ((Object)element).name; string text = name; if (((Object)element).name.Contains("LB") || ((Object)element).name.Contains("MB") || ((Object)element).name.Contains("RB")) { DebugButtons.Add(new DebugButtonStatus { Name = ((Object)element).name, Index = num, IsAllocated = false }); } num++; } } private void DebugActions(string ActionIndex) { } private void ButtonOverride(GameObject Element, string NewName, Action ButtonAction) { ((TMP_Text)((Component)Element.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).text = NewName; ((TMP_Text)((Component)Element.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).fontSizeMin = 8f; ((TMP_Text)((Component)Element.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).fontSizeMax = 20f; ((TMP_Text)((Component)Element.transform.GetChild(0)).GetComponent<TextMeshProUGUI>()).enableAutoSizing = true; ((UnityEvent)Element.GetComponent<Button>().onClick).AddListener(UnityAction.op_Implicit(ButtonAction)); } } internal static class TextureHandler { private static bool IsInit = false; private static bool debugTexture = false; private static Texture2D[] CustomAssets = (Texture2D[])(object)new Texture2D[4]; private static string[] CustomAssetsNames = new string[4]; private static void InitCustomTextures() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown Assembly executingAssembly = Assembly.GetExecutingAssembly(); CustomAssetsNames[0] = "RumbleModUI.Assets.UI_Arrow.png"; CustomAssetsNames[1] = "RumbleModUI.Assets.UI_BaseLight.png"; CustomAssetsNames[2] = "RumbleModUI.Assets.UI_BaseLight.png"; CustomAssetsNames[3] = "RumbleModUI.Assets.UI_Mask.png"; for (int i = 0; i < CustomAssets.Length; i++) { Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(CustomAssetsNames[i]); byte[] array = new byte[manifestResourceStream.Length]; manifestResourceStream.Read(array, 0, array.Length); CustomAssets[i] = new Texture2D(2, 2); ImageConversion.LoadImage(CustomAssets[i], Il2CppStructArray<byte>.op_Implicit(array)); ((Object)CustomAssets[i]).hideFlags = (HideFlags)61; if (debugTexture) { MelonLogger.Msg("UI - Import:" + CustomAssetsNames[i]); } } IsInit = true; } public static Sprite ConvertToSprite(int Input, bool DoBorders = false, float border = 20f) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (!IsInit) { InitCustomTextures(); } Texture2D val = CustomAssets[Input]; Rect val2 = default(Rect); ((Rect)(ref val2)).x = 0f; ((Rect)(ref val2)).y = 0f; ((Rect)(ref val2)).width = ((Texture)val).width; ((Rect)(ref val2)).height = ((Texture)val).height; Rect val3 = val2; if (DoBorders) { Vector4 val4 = default(Vector4); ((Vector4)(ref val4))..ctor(border, border, border, border); return Sprite.Create(val, val3, new Vector2(0f, 0f), (float)((Texture)val).width, 0u, (SpriteMeshType)0, val4); } return Sprite.Create(val, val3, new Vector2(0f, 0f)); } } public static class ThemeHandler { private static bool debugThemes = false; public static List<Theme> AvailableThemes = new List<Theme>(); private static List<TextMeshProUGUI> Theme_Text = new List<TextMeshProUGUI>(); private static List<Foreground_Item> Theme_Foreground = new List<Foreground_Item>(); private static List<Image> Theme_Background = new List<Image>(); public static Theme ActiveTheme { get; set; } public static void ChangeTheme(int Theme) { //IL_002d: 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_0045: Unknown result type (might be due to invalid IL or missing references) int index = Theme; if (Theme <= -1 || Theme >= AvailableThemes.Count) { index = 0; } Theme theme = AvailableThemes[index]; ChangeTextColor(theme.Color_Text_Base); ChangeFGColor(theme.Color_FG); ChangeBGColor(theme.Color_BG); ActiveTheme = theme; if (debugThemes) { MelonLogger.Msg("Theme - Theme changed"); } } public static void AddToFGTheme(GameObject Input, bool AlphaOverride) { Theme_Foreground.Add(new Foreground_Item { Image = Input.GetComponent<Image>(), FullAlphaOverride = AlphaOverride }); } public static void AddToBGTheme(GameObject Input) { Theme_Background.Add(Input.GetComponent<Image>()); } public static void AddToTextTheme(GameObject Input) { Theme_Text.Add(Input.GetComponent<TextMeshProUGUI>()); } private static void ChangeTextColor(Color Color) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) foreach (TextMeshProUGUI item in Theme_Text) { ((Graphic)item).color = Color; } if (debugThemes) { MelonLogger.Msg("Theme - Text Color changed"); } } private static void ChangeFGColor(Color Color) { //IL_001e: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) foreach (Foreground_Item item in Theme_Foreground) { ((Graphic)item.Image).color = Color; if (item.FullAlphaOverride) { ((Graphic)item.Image).color = new Color(((Graphic)item.Image).color.r, ((Graphic)item.Image).color.g, ((Graphic)item.Image).color.b, 1f); } } if (debugThemes) { MelonLogger.Msg("Theme - Foreground Color changed"); } } private static void ChangeBGColor(Color Color) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) foreach (Image item in Theme_Background) { ((Graphic)item).color = Color; } if (debugThemes) { MelonLogger.Msg("Theme - Background Color changed"); } } } internal class Foreground_Item { public Image Image; public bool FullAlphaOverride; } public class Theme { public string Name { get; set; } public Color Color_Text_Base { get; set; } public Color Color_Text_Error { get; set; } public Color Color_Text_Valid { get; set; } public Color Color_FG { get; set; } public Color Color_BG { get; set; } public Theme() { } public Theme(string name, Color Text_Base, Color Text_Valid, Color Text_Error, Color FG, Color BG) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Name = name; Color_Text_Base = Text_Base; Color_Text_Error = Text_Error; Color_Text_Valid = Text_Valid; Color_FG = FG; Color_BG = BG; } } public abstract class ValidationParameters { public abstract bool DoValidation(string Input); } public class ValidationTemplate : ValidationParameters { public override bool DoValidation(string Input) { return true; } } public class Window { private Vector3 Scl_1x1 = new Vector3(1f, 1f, 0f); public List<GameObject> Elements = new List<GameObject>(); private bool DebugWindow { get; set; } private bool HasTitle { get; set; } private GameObject Obj_Title { get; set; } private object TitleDragger { get; set; } public string Name { get; set; } public GameObject ParentObject { get; set; } public virtual event Action OnShow; public virtual event Action OnHide; public Window(string Name, bool debug = false) { //IL_0010: 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) this.Name = Name; DebugWindow = debug; } public GameObject CreateTitle(string Name, Transform Parent, Vector3 Position, Vector2 Size) { //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_0020: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) if (HasTitle) { return null; } GameObject val = new GameObject { name = Name }; GameObject val2 = new GameObject { name = "Text" }; if (DebugWindow) { MelonLogger.Msg("Title - Objects set"); } val.transform.SetParent(Parent); val2.transform.SetParent(val.transform); if (DebugWindow) { MelonLogger.Msg("Title - Parents set"); } val.AddComponent<Image>(); val.AddComponent<Button>(); val2.AddComponent<TextMeshProUGUI>(); if (DebugWindow) { MelonLogger.Msg("Title - Components set"); } SetTextProperties(val2, "Title", 20f); ((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).horizontalAlignment = (HorizontalAlignmentOptions)2; ((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).verticalAlignment = (VerticalAlignmentOptions)512; if (DebugWindow) { MelonLogger.Msg("Title - Text set"); } val.GetComponent<Image>().sprite = TextureHandler.ConvertToSprite(1, DoBorders: true); val.GetComponent<Image>().type = (Type)2; ThemeHandler.AddToFGTheme(val, AlphaOverride: false); if (DebugWindow) { MelonLogger.Msg("Title - Image set"); } val.GetComponent<RectTransform>().sizeDelta = Size; val2.GetComponent<RectTransform>().sizeDelta = Vector2.zero; if (DebugWindow) { MelonLogger.Msg("Title - Image Transforms set"); } Baum_API.RectTransformExtension.SetLocalPosAndScale(val, Position, Scl_1x1); Baum_API.RectTransformExtension.SetLocalPosAndScale(val2, Vector3.zero, Scl_1x1); if (DebugWindow) { MelonLogger.Msg("Title - Position set"); } Baum_API.RectTransformExtension.SetAnchors(val, Baum_API.RectTransformExtension.AnchorPresets.TopLeft); Baum_API.RectTransformExtension.SetPivot(val, Baum_API.RectTransformExtension.PivotPresets.TopLeft); Baum_API.RectTransformExtension.SetAnchors(val2, Baum_API.RectTransformExtension.AnchorPresets.StretchAll); Baum_API.RectTransformExtension.SetPivot(val2, Baum_API.RectTransformExtension.PivotPresets.TopLeft); if (DebugWindow) { MelonLogger.Msg("Title - Anchors/Pivots set"); } HasTitle = true; Obj_Title = val; Elements.Add(val); return val; } public GameObject CreateBackgroundBox(string Name, Transform Parent, Vector3 Position) { //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_000f: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) GameObject val = new GameObject { name = Name }; val.transform.SetParent(Parent); Baum_API.RectTransformExtension.SetLocalPosAndScale(val, Position, Scl_1x1); val.AddComponent<Image>(); val.GetComponent<Image>().sprite = TextureHandler.ConvertToSprite(1, DoBorders: true); val.GetComponent<Image>().type = (Type)2; val.GetComponent<RectTransform>().sizeDelta = Vector2.zero; ThemeHandler.AddToFGTheme(val, AlphaOverride: false); Baum_API.RectTransformExtension.SetAnchors(val, Baum_API.RectTransformExtension.AnchorPresets.StretchAll); Baum_API.RectTransformExtension.SetPivot(val, Baum_API.RectTransformExtension.PivotPresets.TopLeft); Elements.Add(val); return val; } public GameObject CreateDropdown(string Name, Transform Parent, Vector3 Position, Vector2 DD_Size, Vector2 Ext_Size) { //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_000f: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //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_0033: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0045: 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_0058: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //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_007e: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00a4: 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) //IL_00b7: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0561: 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_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_070b: Unknown result type (might be due to invalid IL or missing references) //IL_0711: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_0770: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject { name = Name }; GameObject val2 = new GameObject { name = "Label" }; GameObject val3 = new GameObject { name = "Arrow" }; GameObject val4 = new GameObject { name = "Template" }; GameObject val5 = new GameObject { name = "Viewport" }; GameObject val6 = new GameObject { name = "Content" }; GameObject val7 = new GameObject { name = "Item" }; GameObject val8 = new GameObject { name = "Item Label" }; GameObject val9 = new GameObject { name = "Item Background" }; GameObject val10 = new GameObject { name = "Scrollbar" }; GameObject val11 = new GameObject { name = "Slide" }; GameObject val12 = new GameObject { name = "Handle" }; if (DebugWindow) { MelonLogger.Msg("DropDown - Objects initialised"); } val.transform.SetParent(Parent); val2.transform.SetParent(val.transform); val3.transform.SetParent(val.transform); val4.transform.SetParent(val.transform); val5.transform.SetParent(val4.transform); val6.transform.SetParent(val5.transform); val7.transform.SetParent(val6.transform); val9.transform.SetParent(val7.transform); val8.transform.SetParent(val7.transform); val10.transform.SetParent(val4.transform); val11.transform.SetParent(val10.transform); val12.transform.SetParent(val11.transform); if (DebugWindow) { MelonLogger.Msg("DropDown - Parents set"); } val.AddComponent<Image>(); val.AddComponent<TMP_Dropdown>(); val2.AddComponent<TextMeshProUGUI>(); val3.AddComponent<Image>(); val4.AddComponent<Image>(); val4.AddComponent<ScrollRect>(); val5.AddComponent<Image>(); val5.AddComponent<Mask>(); val6.AddComponent<RectTransform>(); val7.AddComponent<Toggle>(); val7.AddComponent<RectTransform>(); val8.AddComponent<TextMeshProUGUI>(); val9.AddComponent<Image>(); val10.AddComponent<Scrollbar>(); val10.AddComponent<Image>(); val11.AddComponent<RectTransform>(); val12.AddComponent<Image>(); if (DebugWindow) { MelonLogger.Msg("DropDown - Components set"); } SetTextProperties(val2, "", 20f); SetTextProperties(val8, "", 20f); ((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).fontSizeMax = 20f; ((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).fontSizeMin = 8f; ((TMP_Text)val2.GetComponent<TextMeshProUGUI>()).enableAutoSizing = true; ((TMP_Text)val8.GetComponent<TextMeshProUGUI>()).fontSizeMax = 20f; ((TMP_Text)val8.GetComponent<TextMeshProUGUI>()).fontSizeMin = 8f; ((TMP_Text)val8.GetComponent<TextMeshProUGUI>()).enableAutoSizing = true; if (DebugWindow) { MelonLogger.Msg("DropDown - Text set"); } val3.GetComponent<Image>().sprite = TextureHandler.ConvertToSprite(0); ThemeHandler.AddToBGTheme(val3); val.GetComponent<Image>().sprite = TextureHandler.ConvertToSprite(1, DoBorders: true); val.GetComponent<Image>().type = (Type)2; ThemeHandler.AddToFGTheme(val, AlphaOverride: false); val12.GetComponent<Image>().sprite = Tex