Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of UpdatesChecker v1.1.4
UpdatesChecker.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Threading.Tasks; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; 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(UpdatesChecker), "UpdatesChecker", "1.1.4", "DiumStream", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: AssemblyMetadata("NexusModID", "795")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("0.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } public class UpdatesChecker : MelonMod { [CompilerGenerated] private sealed class <CheckForUpdatesAsync>d__12 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public UpdatesChecker <>4__this; private Task <task>5__1; private Exception <ex>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CheckForUpdatesAsync>d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <task>5__1 = null; <ex>5__2 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <task>5__1 = null; try { <task>5__1 = <>4__this.CheckForUpdates(); } catch (Exception ex) { <ex>5__2 = ex; MelonLogger.Error(Localization.Get("cache_error", <ex>5__2.Message)); return false; } break; case 1: <>1__state = -1; break; } if (<task>5__1 != null && !<task>5__1.IsCompleted) { <>2__current = null; <>1__state = 1; return true; } if (<task>5__1 != null && <task>5__1.Exception != null) { MelonLogger.Error(Localization.Get("cache_error", <task>5__1.Exception.InnerException?.Message ?? <task>5__1.Exception.Message)); return false; } MelonLogger.Msg(Localization.Get("updates_found", updatesAvailable.Count)); <>4__this.SaveCache(); <>4__this.SaveCustomNexusIDsTemplate(); UIHandler.UpdateUpdateBadge(); if ((Object)(object)UIHandler.modWindow != (Object)null && UIHandler.modWindow.activeSelf) { UIHandler.SetView(UIHandler.currentView); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <StartupUpdateCheck>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public UpdatesChecker <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartupUpdateCheck>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; MelonLogger.Msg(Localization.Get("checking_updates")); <>2__current = <>4__this.CheckForUpdatesAsync(); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)UIHandler.modWindow != (Object)null && UIHandler.modWindow.activeSelf) { UIHandler.SetView(UIHandler.currentView); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string API_URL = "https://api.nexusmods.com/v2/graphql"; private const string CACHE_FILE = "UserData/UpdatesChecker/UpdateChecker.json"; private const string CUSTOM_IDS_FILE = "UserData/UpdatesChecker/CustomNexusIDs.json"; private static readonly HttpClient client = new HttpClient(); public static List<ModUpdate> updatesAvailable = new List<ModUpdate>(); public static List<ModInfo> incompatibleMods = new List<ModInfo>(); private static List<CustomModIdMapping> customIdMappings = new List<CustomModIdMapping>(); public static UpdatesChecker instance = null; private LocalizationOption _lastLocalization; public override void OnInitializeMelon() { try { Config.Load(); } catch (Exception ex) { MelonLogger.Error(Localization.Get("config_load_error", ex.Message)); } instance = this; _lastLocalization = Config.Localization?.Value ?? LocalizationOption.English; string path = Path.GetDirectoryName("UserData/UpdatesChecker/UpdateChecker.json") ?? "UserData/UpdatesChecker"; try { Directory.CreateDirectory(path); } catch (Exception ex2) { MelonLogger.Error(Localization.Get("directory_create_error", ex2.Message)); } UIHandler.Initialize((MelonMod)(object)this); LoadCustomNexusIDs(); MelonCoroutines.Start(StartupUpdateCheck()); } public override void OnUpdate() { if (Config.Localization?.Value != _lastLocalization) { MelonLogger.Msg($"Localization changed: {_lastLocalization} -> {Config.Localization?.Value}. Updating UI dynamically..."); _lastLocalization = Config.Localization?.Value ?? LocalizationOption.English; UIHandler.UpdateLocalization(); } } [IteratorStateMachine(typeof(<StartupUpdateCheck>d__11))] private IEnumerator StartupUpdateCheck() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartupUpdateCheck>d__11(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<CheckForUpdatesAsync>d__12))] public IEnumerator CheckForUpdatesAsync() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CheckForUpdatesAsync>d__12(0) { <>4__this = this }; } public async Task CheckForUpdates() { updatesAvailable.Clear(); List<ModInfo> mods = GetInstalledMods(); Dictionary<int, string> latestVersions = await FetchLatestVersions(mods); foreach (ModInfo mod in mods) { if (mod.NexusID <= 0) { continue; } if (latestVersions.TryGetValue(mod.NexusID, out string latestVersion)) { if (!VersionMatch(mod.Version, latestVersion)) { updatesAvailable.Add(new ModUpdate { ModName = mod.Name, CurrentVersion = mod.Version, LatestVersion = latestVersion }); if (mod.Name == "UpdatesChecker") { LogSelfCheckResult(mod.Version, latestVersion); } } } else { MelonLogger.Warning(Localization.Get("invalid_api_response", mod.Name)); } latestVersion = null; } } private async Task<Dictionary<int, string>> FetchLatestVersions(List<ModInfo> mods) { List<Dictionary<string, object>> ids = new List<Dictionary<string, object>>(); foreach (ModInfo mod in mods) { if (mod.NexusID > 0) { ids.Add(new Dictionary<string, object> { { "gameDomain", "schedule1" }, { "modId", mod.NexusID } }); } } string query = "\r\n query legacyModsByDomain($ids: [CompositeDomainWithIdInput!]!) {\r\n legacyModsByDomain(ids: $ids) {\r\n nodes {\r\n modId\r\n version\r\n }\r\n }\r\n }\r\n "; var payload = new { query = query, variables = new { ids } }; StringContent content = new StringContent(JsonConvert.SerializeObject((object)payload), Encoding.UTF8, "application/json"); HttpResponseMessage response; try { response = await client.PostAsync("https://api.nexusmods.com/v2/graphql", content); } catch (Exception ex2) { MelonLogger.Error(Localization.Get("graphql_request_error", ex2.Message)); return new Dictionary<int, string>(); } if (response == null || !response.IsSuccessStatusCode) { MelonLogger.Error(Localization.Get("graphql_status_error", response?.StatusCode.ToString() ?? "null")); return new Dictionary<int, string>(); } string responseContent = await response.Content.ReadAsStringAsync(); GraphQLModsResponse data; try { data = JsonConvert.DeserializeObject<GraphQLModsResponse>(responseContent); } catch (Exception ex) { MelonLogger.Error(Localization.Get("graphql_deserialization_error", ex.Message)); return new Dictionary<int, string>(); } Dictionary<int, string> versions = new Dictionary<int, string>(); if (data?.data?.legacyModsByDomain?.nodes != null) { foreach (GraphQLModNode node in data.data.legacyModsByDomain.nodes) { if (node != null && node.version != null) { versions[node.modId] = node.version; } } } return versions; } private void SaveCache() { CacheData cacheData = new CacheData { Updates = updatesAvailable, Incompatibles = incompatibleMods }; try { File.WriteAllText("UserData/UpdatesChecker/UpdateChecker.json", JsonConvert.SerializeObject((object)cacheData, (Formatting)1)); } catch (Exception ex) { MelonLogger.Error(Localization.Get("cache_save_error", ex.Message)); } } private void LoadCustomNexusIDs() { string path = Path.GetDirectoryName("UserData/UpdatesChecker/CustomNexusIDs.json") ?? "UserData/UpdatesChecker"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (!File.Exists("UserData/UpdatesChecker/CustomNexusIDs.json")) { MelonLogger.Msg(Localization.Get("custom_id_file_missing")); return; } try { string text = File.ReadAllText("UserData/UpdatesChecker/CustomNexusIDs.json"); customIdMappings = JsonConvert.DeserializeObject<List<CustomModIdMapping>>(text) ?? new List<CustomModIdMapping>(); MelonLogger.Msg(Localization.Get("custom_id_loaded", customIdMappings.Count)); } catch (Exception ex) { MelonLogger.Error(Localization.Get("custom_id_error", ex.Message)); } } private void SaveCustomNexusIDsTemplate() { List<CustomModIdMapping> list = new List<CustomModIdMapping>(); string path = Path.GetDirectoryName("UserData/UpdatesChecker/CustomNexusIDs.json") ?? "UserData/UpdatesChecker"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (File.Exists("UserData/UpdatesChecker/CustomNexusIDs.json")) { try { string text = File.ReadAllText("UserData/UpdatesChecker/CustomNexusIDs.json"); list = JsonConvert.DeserializeObject<List<CustomModIdMapping>>(text) ?? new List<CustomModIdMapping>(); } catch (Exception ex) { MelonLogger.Error(Localization.Get("custom_id_error", ex.Message)); } } int num = 0; foreach (ModInfo mod in incompatibleMods) { if (!list.Exists((CustomModIdMapping m) => m.ModName.Equals(mod.Name, StringComparison.OrdinalIgnoreCase))) { list.Add(new CustomModIdMapping { ModName = mod.Name, NexusID = null }); num++; } } if (list.Count == 0) { list.Add(new CustomModIdMapping { ModName = "Example Mod Name", NexusID = 9999 }); } try { File.WriteAllText("UserData/UpdatesChecker/CustomNexusIDs.json", JsonConvert.SerializeObject((object)list, (Formatting)1)); if (num > 0) { MelonLogger.Msg(Localization.Get("custom_id_file_updated", num)); } } catch (Exception ex2) { MelonLogger.Error(Localization.Get("custom_id_template_error", ex2.Message)); } } private void LogSelfCheckResult(string current, string latest) { string text = (VersionMatch(current, latest) ? Localization.Get("status_up_to_date") : Localization.Get("status_update_available", current, latest)); MelonLogger.Msg(Localization.Get("self_check_result", "UpdatesChecker", text)); } private bool VersionMatch(string current, string latest) { try { Version version = new Version(current); Version version2 = new Version(latest); return version >= version2; } catch { return string.Equals(current, latest, StringComparison.OrdinalIgnoreCase); } } private List<ModInfo> GetInstalledMods() { List<ModInfo> list = new List<ModInfo>(); incompatibleMods.Clear(); int selfNexusId = GetSelfNexusId(); if (selfNexusId > 0) { list.Add(new ModInfo { Name = "UpdatesChecker", Version = "1.1.4", NexusID = selfNexusId, IsCompatible = true }); } foreach (MelonMod melon in MelonTypeBase<MelonMod>.RegisteredMelons) { if (((MelonBase)melon).Info.Name == "UpdatesChecker") { continue; } int num = GetNexusIdFromMod(melon); bool flag = num > 0; if (!flag) { CustomModIdMapping customModIdMapping = customIdMappings.Find((CustomModIdMapping m) => m.ModName.Equals(((MelonBase)melon).Info.Name, StringComparison.OrdinalIgnoreCase)); if (customModIdMapping != null && customModIdMapping.NexusID.HasValue && customModIdMapping.NexusID.Value > 0) { num = customModIdMapping.NexusID.Value; flag = true; MelonLogger.Msg($"[Custom ID] Found Nexus ID {num} for {((MelonBase)melon).Info.Name}"); } } ModInfo item = new ModInfo { Name = ((MelonBase)melon).Info.Name, Version = ((MelonBase)melon).Info.Version, NexusID = num, IsCompatible = flag }; list.Add(item); if (!flag) { incompatibleMods.Add(item); MelonLogger.Warning(Localization.Get("incompatible_mod_warning", ((MelonBase)melon).Info.Name)); } } return list; } private int GetSelfNexusId() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); IEnumerable<AssemblyMetadataAttribute> customAttributes = executingAssembly.GetCustomAttributes<AssemblyMetadataAttribute>(); foreach (AssemblyMetadataAttribute item in customAttributes) { if (item.Key.Equals("NexusModID", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(item.Value, out var result)) { return result; } MelonLogger.Error(Localization.Get("invalid_nexusid", "UpdateChecker", item.Value ?? "null")); return -1; } } } catch (Exception ex) { MelonLogger.Error(Localization.Get("cache_error", ex.Message)); } return -1; } private int GetNexusIdFromMod(MelonMod mod) { try { MelonAssembly melonAssembly = ((MelonBase)mod).MelonAssembly; Assembly assembly = ((melonAssembly != null) ? melonAssembly.Assembly : null); if (assembly == null) { return -1; } IEnumerable<AssemblyMetadataAttribute> customAttributes = assembly.GetCustomAttributes<AssemblyMetadataAttribute>(); foreach (AssemblyMetadataAttribute item in customAttributes) { if (item.Key.Equals("NexusModID", StringComparison.OrdinalIgnoreCase)) { if (int.TryParse(item.Value, out var result)) { return result; } MelonLogger.Error(Localization.Get("invalid_nexusid", ((MelonBase)mod).Info.Name, item.Value ?? "null")); return -1; } } } catch (Exception ex) { MelonLogger.Error(Localization.Get("cache_error", ex.Message)); } return -1; } } public class CustomModIdMapping { public string ModName { get; set; } = string.Empty; public int? NexusID { get; set; } } public class CacheData { public List<ModUpdate> Updates { get; set; } = new List<ModUpdate>(); public List<ModInfo> Incompatibles { get; set; } = new List<ModInfo>(); } public class ModInfo { public string Name { get; set; } = string.Empty; public string Version { get; set; } = string.Empty; public int NexusID { get; set; } public bool IsCompatible { get; set; } } public class ModUpdate { public string ModName { get; set; } = string.Empty; public string CurrentVersion { get; set; } = string.Empty; public string LatestVersion { get; set; } = string.Empty; } public class GraphQLModsResponse { public GraphQLModsData? data { get; set; } } public class GraphQLModsData { public GraphQLLegacyModsByDomain? legacyModsByDomain { get; set; } } public class GraphQLLegacyModsByDomain { public List<GraphQLModNode>? nodes { get; set; } } public class GraphQLModNode { public int modId { get; set; } public string? version { get; set; } } public enum LocalizationOption { English, French } public static class Config { public static MelonPreferences_Category Category { get; private set; } public static MelonPreferences_Entry<LocalizationOption> Localization { get; private set; } public static void Load() { Category = MelonPreferences.CreateCategory("UpdatesChecker_Settings", "Updates Checker"); Localization = Category.CreateEntry<LocalizationOption>("Localization", LocalizationOption.English, "Localization", "UI Localization (English/French)", false, false, (ValueValidator)null, (string)null); } public static string GetLocalization() { if (Localization == null) { return "en"; } LocalizationOption value = Localization.Value; if (1 == 0) { } string result = value switch { LocalizationOption.English => "en", LocalizationOption.French => "fr", _ => "en", }; if (1 == 0) { } return result; } } public static class Localization { public static string Get(string key, params object[] args) { LocalizationOption value = Config.Localization.Value; if (1 == 0) { } string text2; if (value == LocalizationOption.French) { if (1 == 0) { } string text = key switch { "update_checker" => "UPDATE CHECKER", "all_up_to_date" => "✅ Tous les mods sont à jour", "updates_found" => "{0} mises à jour trouvées", "checking_updates" => "Vérification des mises à jour...", "checking_n_mods" => "Vérification de {0} mods...", "main_menu_not_found" => "Menu principal introuvable - Bouton flottant utilisé", "cache_error" => "Erreur de vérification/API : {0}", "cache_save_error" => "Erreur sauvegarde cache : {0}", "rate_limit" => "Limite API atteinte - Pause de 60s", "http_code" => "{0} - Code HTTP {1}", "invalid_api_response" => "{0} - Réponse API invalide", "error_mod" => "Erreur {0}: {1}", "no_nexusid" => "{0} - Aucun NexusModID trouvé", "invalid_nexusid" => "Format NexusID invalide dans {0}: {1}", "current_version" => "Version actuelle", "new_version" => "Nouvelle version", "version" => "Version", "missing_nexusmodid" => "⚠\ufe0f NexusModID Manquant", "back" => "Retour", "close" => "Fermer", "incompatible_mods" => "Mods Incompatibles", "no_incompatible_mods" => "\ud83c\udf89 Aucun mod incompatible détecté", "incompatible_mods_count" => "{0} mods incompatibles détectés", "incompatible_info" => "Pour rendre un mod compatible, ajoutez son NexusModID dans CustomNexusIDs.json. Cela permet de le suivre sans que le développeur n'ait à l'inclure.", "config_load_error" => "Config.Load() échoué : {0}", "directory_create_error" => "Directory.CreateDirectory échoué : {0}", "custom_id_file_missing" => "Fichier CustomNexusIDs.json manquant. Création d'un modèle après la vérification.", "custom_id_loaded" => "IDs personnalisés chargés : {0} entrées.", "custom_id_error" => "Erreur de chargement d'ID personnalisé : {0}", "custom_id_template_error" => "Erreur de sauvegarde d'ID personnalisé : {0}", "custom_id_file_updated" => "CustomNexusIDs.json mis à jour. Ajout de {0} nouveaux mods pour compléter.", "graphql_request_error" => "La requête GraphQL a échoué : {0}", "graphql_status_error" => "La requête GraphQL a échoué : code {0}", "graphql_deserialization_error" => "La désérialisation de la réponse GraphQL a échoué : {0}", "status_up_to_date" => "✓ {0} est à jour ({1})", "status_update_available" => "⚠\ufe0f {0} : Mise à jour disponible ({1} → {2})", "self_check_result" => "[Auto-Vérification] {0} {1}", "incompatible_mod_warning" => "[Incompatible] {0} - Aucun NexusModID (métadonnée ou fichier personnalisé)", _ => key, }; if (1 == 0) { } text2 = text; } else { if (1 == 0) { } string text = key switch { "update_checker" => "UPDATE CHECKER", "all_up_to_date" => "✅ All mods are up to date", "updates_found" => "{0} updates found", "checking_updates" => "Checking for updates...", "checking_n_mods" => "Checking {0} mods...", "main_menu_not_found" => "Main menu not found - Floating button used", "cache_error" => "Check/API Error: {0}", "cache_save_error" => "Cache save error: {0}", "rate_limit" => "API Rate Limit Hit - Pausing for 60s", "http_code" => "{0} - HTTP Code {1}", "invalid_api_response" => "{0} - Invalid API response", "error_mod" => "Error {0}: {1}", "no_nexusid" => "{0} - No NexusModID found", "invalid_nexusid" => "Invalid NexusID format in {0}: {1}", "current_version" => "Current Version", "new_version" => "New Version", "version" => "Version", "missing_nexusmodid" => "⚠\ufe0f Missing NexusModID", "back" => "Back", "close" => "Close", "incompatible_mods" => "Incompatible mods", "no_incompatible_mods" => "\ud83c\udf89 No incompatible mods detected", "incompatible_mods_count" => "{0} incompatible mods detected", "incompatible_info" => "To make a mod compatible, add its NexusModID to CustomNexusIDs.json. This allows tracking it without the developer needing to include it.", "config_load_error" => "Config.Load() failed: {0}", "directory_create_error" => "Directory.CreateDirectory failed: {0}", "custom_id_file_missing" => "CustomNexusIDs.json file missing. Creating template after check.", "custom_id_loaded" => "Custom IDs loaded: {0} entries.", "custom_id_error" => "Custom ID load error: {0}", "custom_id_template_error" => "Custom ID save error: {0}", "custom_id_file_updated" => "CustomNexusIDs.json updated. Added {0} new mods to complete.", "graphql_request_error" => "GraphQL request failed: {0}", "graphql_status_error" => "GraphQL request failed: code {0}", "graphql_deserialization_error" => "GraphQL response deserialization failed: {0}", "status_up_to_date" => "✓ {0} is up to date ({1})", "status_update_available" => "⚠\ufe0f {0}: Update available ({1} → {2})", "self_check_result" => "[Auto-Check] {0} {1}", "incompatible_mod_warning" => "[Incompatible] {0} - No NexusModID (metadata or custom file)", _ => key, }; if (1 == 0) { } text2 = text; } if (1 == 0) { } string format = text2; return string.Format(format, args); } } public static class PluginInfo { public const string PLUGIN_AUTHOR = "DiumStream"; public const string PLUGIN_NAME = "UpdatesChecker"; public const string PLUGIN_VERSION = "1.1.4"; } public static class UIHandler { public enum UIHandlerView { Updates, Incompatible } public static class RoundedCorners { public static Texture2D CreateRoundedTexture(int width, int height, int radius, Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(width, height); Color[] array = (Color[])(object)new Color[width * height]; float num = radius * radius; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { bool flag = false; if (j < radius && i < radius) { flag = (float)((j - radius) * (j - radius) + (i - radius) * (i - radius)) > num; } else if (j < radius && i > height - radius) { flag = (float)((j - radius) * (j - radius) + (i - (height - radius)) * (i - (height - radius))) > num; } else if (j > width - radius && i < radius) { flag = (float)((j - (width - radius)) * (j - (width - radius)) + (i - radius) * (i - radius)) > num; } else if (j > width - radius && i > height - radius) { flag = (float)((j - (width - radius)) * (j - (width - radius)) + (i - (height - radius)) * (i - (height - radius))) > num; } array[i * width + j] = (flag ? Color.clear : color); } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); return val; } } [CompilerGenerated] private sealed class <AnimateViewChange>d__54 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public UIHandlerView newView; public float duration; private CanvasGroup <cg>5__1; private float <t>5__2; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateViewChange>d__54(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <cg>5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (isAnimating || (Object)(object)contentContainer == (Object)null) { return false; } isAnimating = true; <cg>5__1 = contentContainer.GetComponent<CanvasGroup>() ?? contentContainer.AddComponent<CanvasGroup>(); <t>5__2 = 0f; goto IL_00d9; case 1: <>1__state = -1; goto IL_00d9; case 2: <>1__state = -1; <t>5__2 = 0f; break; case 3: { <>1__state = -1; break; } IL_00d9: if (<t>5__2 < duration) { <t>5__2 += Time.unscaledDeltaTime; <cg>5__1.alpha = Mathf.Lerp(1f, 0f, <t>5__2 / duration); <>2__current = null; <>1__state = 1; return true; } <cg>5__1.alpha = 0f; ApplyView(newView); <>2__current = null; <>1__state = 2; return true; } if (<t>5__2 < duration) { <t>5__2 += Time.unscaledDeltaTime; <cg>5__1.alpha = Mathf.Lerp(0f, 1f, <t>5__2 / duration); <>2__current = null; <>1__state = 3; return true; } <cg>5__1.alpha = 1f; isAnimating = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <AnimateWindowClose>d__49 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject window; public float duration; private CanvasGroup <cg>5__1; private float <t>5__2; private float <p>5__3; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateWindowClose>d__49(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <cg>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (isAnimating) { return false; } isAnimating = true; <cg>5__1 = window.GetComponent<CanvasGroup>() ?? window.AddComponent<CanvasGroup>(); <t>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<t>5__2 < duration) { <t>5__2 += Time.unscaledDeltaTime; <p>5__3 = Mathf.Clamp01(<t>5__2 / duration); <cg>5__1.alpha = 1f - <p>5__3; window.transform.localScale = Vector3.Lerp(Vector3.one, Vector3.one * 0.85f, <p>5__3); <>2__current = null; <>1__state = 1; return true; } <cg>5__1.alpha = 0f; window.transform.localScale = Vector3.one * 0.85f; window.SetActive(false); isAnimating = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <AnimateWindowOpen>d__48 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject window; public float duration; private CanvasGroup <cg>5__1; private float <t>5__2; private float <p>5__3; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateWindowOpen>d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <cg>5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (isAnimating) { return false; } isAnimating = true; <cg>5__1 = window.GetComponent<CanvasGroup>() ?? window.AddComponent<CanvasGroup>(); window.SetActive(true); <cg>5__1.alpha = 0f; window.transform.localScale = Vector3.one * 0.85f; <t>5__2 = 0f; break; case 1: <>1__state = -1; break; } if (<t>5__2 < duration) { <t>5__2 += Time.unscaledDeltaTime; <p>5__3 = Mathf.Clamp01(<t>5__2 / duration); <cg>5__1.alpha = <p>5__3; window.transform.localScale = Vector3.Lerp(Vector3.one * 0.85f, Vector3.one, <p>5__3); <>2__current = null; <>1__state = 1; return true; } <cg>5__1.alpha = 1f; window.transform.localScale = Vector3.one; isAnimating = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <CloseWindowAndReactivateHome>d__50 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject window; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CloseWindowAndReactivateHome>d__50(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = AnimateWindowClose(window); <>1__state = 1; return true; case 1: <>1__state = -1; currentView = UIHandlerView.Updates; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MenuDelayedInit>d__43 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object? IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MenuDelayedInit>d__43(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!buttonInitialized) { Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name != "Menu")) { if ((Object)(object)modButton != (Object)null) { modButton.SetActive(false); modButton = null; } if ((Object)(object)modWindow != (Object)null) { modWindow.SetActive(false); } FindMainMenu(); isInitializing = false; return false; } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static GameObject? modButton; public static GameObject? incompatibleModsNavButton; public static GameObject? backButton; public static GameObject? modWindow; public static Text? titleText; public static GameObject? contentContainer; public static GameObject? updateBadge; public static Text? updateBadgeText; public static UIHandlerView currentView = UIHandlerView.Updates; private static Sprite? _windowBgSprite; private static Sprite? _buttonBackSprite; private static Sprite? _buttonCloseSprite; private static Sprite? _elementBgSprite; private static Sprite? _scrollbarHandleSprite; private static Font? _arialFont; public static RectTransform? contentReference; public static bool buttonInitialized = false; public static bool isInitializing = false; private static bool isAnimating = false; public static Text? mainButtonText; public static Text? closeButtonText; public static Text? incompatibleNavButtonText; public static Text? backButtonText; private static readonly Color WindowBgColor = new Color(0.08f, 0.08f, 0.08f, 0.98f); private static readonly Color ScrollBgColor = new Color(0.12f, 0.12f, 0.12f, 0.5f); private static readonly Color ElementBgColor = new Color(0.08f, 0.08f, 0.08f, 0.95f); private static readonly Color IncompatibleButtonColor = new Color(0.8f, 0.2f, 0.2f, 0.7f); private static readonly Color BackButtonColor = new Color(0.2f, 0.2f, 0.8f, 0.7f); private static readonly Color CloseButtonColor = new Color(0.8f, 0.2f, 0.2f, 0.7f); private static readonly Color TitleTextColor = new Color(0.9f, 0.95f, 1f); private static readonly Color IncompatibleTitleColor = new Color(1f, 0.4f, 0.4f); private static readonly Color DefaultTextColor = new Color(0.95f, 0.95f, 0.95f, 1f); private static readonly Color ScrollbarColor = new Color(0.4f, 0.4f, 0.4f, 0.8f); private static Sprite? _circleSprite; private static Font GetArialFont() { if (_arialFont == null) { _arialFont = Resources.GetBuiltinResource<Font>("Arial.ttf"); } return _arialFont; } private static Sprite GetWindowBgSprite() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_windowBgSprite == (Object)null) { Texture2D val = RoundedCorners.CreateRoundedTexture(460, 600, 20, WindowBgColor); _windowBgSprite = Sprite.Create(val, new Rect(0f, 0f, 460f, 600f), new Vector2(0.5f, 0.5f)); ((Object)_windowBgSprite).name = "WindowBgSprite"; } return _windowBgSprite; } private static Sprite GetButtonSprite(Color color, string name) { //IL_0029: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) if (name == "CloseButton" && (Object)(object)_buttonCloseSprite == (Object)null) { Texture2D val = RoundedCorners.CreateRoundedTexture(180, 40, 8, color); _buttonCloseSprite = Sprite.Create(val, new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); ((Object)_buttonCloseSprite).name = name + "Sprite"; return _buttonCloseSprite; } if (name == "BackButton" && (Object)(object)_buttonBackSprite == (Object)null) { Texture2D val2 = RoundedCorners.CreateRoundedTexture(180, 40, 8, color); _buttonBackSprite = Sprite.Create(val2, new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); ((Object)_buttonBackSprite).name = name + "Sprite"; return _buttonBackSprite; } if (name == "NavButton") { Texture2D val3 = RoundedCorners.CreateRoundedTexture(180, 40, 8, color); Sprite val4 = Sprite.Create(val3, new Rect(0f, 0f, 180f, 40f), new Vector2(0.5f, 0.5f)); ((Object)val4).name = name + "Sprite"; return val4; } return _buttonCloseSprite ?? GetButtonSprite(CloseButtonColor, "CloseButton"); } private static Sprite GetElementBgSprite() { //IL_001a: 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_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_elementBgSprite == (Object)null) { Texture2D val = RoundedCorners.CreateRoundedTexture(380, 80, 12, ElementBgColor); _elementBgSprite = Sprite.Create(val, new Rect(0f, 0f, 380f, 80f), new Vector2(0.5f, 0.5f)); ((Object)_elementBgSprite).name = "ElementBgSprite"; } return _elementBgSprite; } private static Sprite GetScrollbarHandleSprite() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_scrollbarHandleSprite == (Object)null) { Texture2D val = RoundedCorners.CreateRoundedTexture(10, 30, 5, ScrollbarColor); _scrollbarHandleSprite = Sprite.Create(val, new Rect(0f, 0f, 10f, 30f), new Vector2(0.5f, 0.5f)); ((Object)_scrollbarHandleSprite).name = "ScrollbarHandleSprite"; } return _scrollbarHandleSprite; } private static Sprite GetCircleSprite(Color color) { //IL_0017: 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) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_circleSprite == (Object)null) { Texture2D val = RoundedCorners.CreateRoundedTexture(30, 30, 15, color); _circleSprite = Sprite.Create(val, new Rect(0f, 0f, 30f, 30f), new Vector2(0.5f, 0.5f)); ((Object)_circleSprite).name = "CircleBadgeSprite"; } return _circleSprite; } public static void Initialize(MelonMod instance) { if (!isInitializing) { isInitializing = true; MelonCoroutines.Start(MenuDelayedInit()); } } [IteratorStateMachine(typeof(<MenuDelayedInit>d__43))] public static IEnumerator MenuDelayedInit() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MenuDelayedInit>d__43(0); } public static void FindMainMenu() { try { GameObject val = GameObject.Find("MainMenu"); if ((Object)(object)val == (Object)null) { MelonLogger.Warning(Localization.Get("main_menu_not_found")); return; } Transform val2 = val.transform.Find("Home"); if ((Object)(object)val2 == (Object)null) { MelonLogger.Warning("Home menu not found under MainMenu!"); return; } GameObject gameObject = ((Component)val2).gameObject; CreateLeftMenuButton(gameObject); buttonInitialized = true; } catch (Exception ex) { MelonLogger.Error("FindMainMenu error: " + ex.Message + "\n" + ex.StackTrace); } } public static void CreateLeftMenuButton(GameObject mainMenu) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0054: 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) //IL_0080: 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_00ac: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)modButton != (Object)null)) { modButton = new GameObject("UpdateButtons"); modButton.transform.SetParent(mainMenu.transform, false); RectTransform val = modButton.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0f, 0.5f); val.anchorMax = new Vector2(0f, 0.5f); val.pivot = new Vector2(0f, 0.5f); val.anchoredPosition = new Vector2(45f, -10f); val.sizeDelta = new Vector2(200f, 60f); Image val2 = modButton.AddComponent<Image>(); ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.01f); GameObject val3 = new GameObject("Text"); val3.transform.SetParent(modButton.transform, false); Text val4 = val3.AddComponent<Text>(); val4.text = Localization.Get("update_checker"); val4.font = GetArialFont(); ((Graphic)val4).color = Color.white; val4.alignment = (TextAnchor)4; val4.fontSize = 24; val4.fontStyle = (FontStyle)1; mainButtonText = val4; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val5 = modButton.AddComponent<Button>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val2; ((UnityEventBase)val5.onClick).RemoveAllListeners(); ((UnityEvent)val5.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { ToggleWindow(); })); updateBadge = new GameObject("UpdateBadge"); updateBadge.transform.SetParent(modButton.transform, false); RectTransform val6 = updateBadge.AddComponent<RectTransform>(); val6.anchorMin = new Vector2(1f, 1f); val6.anchorMax = new Vector2(1f, 1f); val6.pivot = new Vector2(1f, 1f); val6.anchoredPosition = new Vector2(-15f, -10f); val6.sizeDelta = new Vector2(25f, 25f); Image val7 = updateBadge.AddComponent<Image>(); ((Graphic)val7).color = new Color(0.8f, 0.2f, 0.2f, 1f); val7.sprite = GetCircleSprite(((Graphic)val7).color); GameObject val8 = new GameObject("CountText"); val8.transform.SetParent(updateBadge.transform, false); RectTransform val9 = val8.AddComponent<RectTransform>(); val9.anchorMin = Vector2.zero; val9.anchorMax = Vector2.one; val9.offsetMin = Vector2.zero; val9.offsetMax = Vector2.zero; Text val10 = val8.AddComponent<Text>(); val10.font = GetArialFont(); ((Graphic)val10).color = Color.white; val10.alignment = (TextAnchor)4; val10.fontSize = 18; val10.fontStyle = (FontStyle)1; updateBadgeText = val10; if ((Object)(object)modWindow == (Object)null) { modWindow = CreateWindow(mainMenu); modWindow.SetActive(false); } UpdateUpdateBadge(); } } catch (Exception ex) { MelonLogger.Error("Erreur CreateLeftMenuButton: " + ex.Message); } } public static void CreateIncompatibleModsButton(GameObject parent) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0054: 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) //IL_0080: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)incompatibleModsNavButton != (Object)null)) { incompatibleModsNavButton = new GameObject("IncompatibleModsButton"); incompatibleModsNavButton.transform.SetParent(parent.transform, false); RectTransform val = incompatibleModsNavButton.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0.5f, 0f); val.anchorMax = new Vector2(0.5f, 0f); val.pivot = new Vector2(0.5f, 0f); val.anchoredPosition = new Vector2(-100f, 20f); val.sizeDelta = new Vector2(180f, 40f); Image val2 = incompatibleModsNavButton.AddComponent<Image>(); ((Graphic)val2).color = IncompatibleButtonColor; val2.sprite = GetButtonSprite(((Graphic)val2).color, "NavButton"); GameObject val3 = new GameObject("Text"); val3.transform.SetParent(incompatibleModsNavButton.transform, false); Text val4 = val3.AddComponent<Text>(); val4.text = Localization.Get("incompatible_mods"); val4.font = GetArialFont(); ((Graphic)val4).color = Color.white; val4.alignment = (TextAnchor)4; val4.fontSize = 16; val4.fontStyle = (FontStyle)1; incompatibleNavButtonText = val4; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val5 = incompatibleModsNavButton.AddComponent<Button>(); ((Selectable)val5).targetGraphic = (Graphic)(object)val2; ((UnityEventBase)val5.onClick).RemoveAllListeners(); ((UnityEvent)val5.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { SetView(UIHandlerView.Incompatible); })); } } catch (Exception ex) { MelonLogger.Error("CreateIncompatibleModsButton error: " + ex.Message); } } public static void CreateBackButton(GameObject parent) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0054: 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) //IL_0080: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)backButton != (Object)null)) { backButton = new GameObject("BackButton"); backButton.transform.SetParent(parent.transform, false); RectTransform val = backButton.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0.5f, 0f); val.anchorMax = new Vector2(0.5f, 0f); val.pivot = new Vector2(0.5f, 0f); val.anchoredPosition = new Vector2(-100f, 20f); val.sizeDelta = new Vector2(180f, 40f); Image val2 = backButton.AddComponent<Image>(); ((Graphic)val2).color = BackButtonColor; val2.sprite = GetButtonSprite(((Graphic)val2).color, "BackButton"); GameObject val3 = new GameObject("Text"); val3.transform.SetParent(backButton.transform, false); Text val4 = val3.AddComponent<Text>(); val4.text = Localization.Get("back"); val4.font = GetArialFont(); ((Graphic)val4).color = Color.white; val4.alignment = (TextAnchor)4; val4.fontSize = 16; val4.fontStyle = (FontStyle)1; backButtonText = val4; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val5 = backButton.AddComponent<Button>(); ((UnityEventBase)val5.onClick).RemoveAllListeners(); ((UnityEvent)val5.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { SetView(UIHandlerView.Updates); })); backButton.SetActive(false); } } catch (Exception ex) { MelonLogger.Error("CreateBackButton error: " + ex.Message); } } [IteratorStateMachine(typeof(<AnimateWindowOpen>d__48))] private static IEnumerator AnimateWindowOpen(GameObject window, float duration = 0.18f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateWindowOpen>d__48(0) { window = window, duration = duration }; } [IteratorStateMachine(typeof(<AnimateWindowClose>d__49))] private static IEnumerator AnimateWindowClose(GameObject window, float duration = 0.18f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateWindowClose>d__49(0) { window = window, duration = duration }; } [IteratorStateMachine(typeof(<CloseWindowAndReactivateHome>d__50))] private static IEnumerator CloseWindowAndReactivateHome(GameObject window) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CloseWindowAndReactivateHome>d__50(0) { window = window }; } public static void ToggleWindow() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) try { if (isAnimating) { return; } if ((Object)(object)modWindow == (Object)null) { GameObject? obj = modButton; object obj2; if (obj == null) { obj2 = null; } else { Transform parent = obj.transform.parent; obj2 = ((parent != null) ? ((Component)parent).gameObject : null); } if (obj2 == null) { obj2 = GetOrCreateCanvas(); } GameObject parent2 = (GameObject)obj2; modWindow = CreateWindow(parent2); } if (!modWindow.activeSelf) { MelonCoroutines.Start(AnimateWindowOpen(modWindow)); RectTransform component = modWindow.GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; ApplyView(UIHandlerView.Updates); if ((Object)(object)contentContainer != (Object)null) { CanvasGroup component2 = contentContainer.GetComponent<CanvasGroup>(); if ((Object)(object)component2 != (Object)null) { component2.alpha = 1f; } } } else { MelonCoroutines.Start(CloseWindowAndReactivateHome(modWindow)); } } catch (Exception ex) { MelonLogger.Error("ToggleWindow Error: " + ex.Message); } } public static GameObject CreateWindow(GameObject parent) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Expected O, but got Unknown //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0490: 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_04a7: Expected O, but got Unknown //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Expected O, but got Unknown //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Expected O, but got Unknown //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: 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_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Expected O, but got Unknown //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Unknown result type (might be due to invalid IL or missing references) GameObject window = new GameObject("ModsWindow"); window.transform.SetParent(parent.transform, false); window.AddComponent<CanvasGroup>(); RectTransform val = window.AddComponent<RectTransform>(); val.anchorMin = new Vector2(0.5f, 0.5f); val.anchorMax = new Vector2(0.5f, 0.5f); val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(460f, 600f); val.anchoredPosition = Vector2.zero; Image val2 = window.AddComponent<Image>(); ((Graphic)val2).color = WindowBgColor; val2.sprite = GetWindowBgSprite(); GameObject val3 = new GameObject("Title"); val3.transform.SetParent(window.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = new Vector2(0.5f, 1f); val4.anchorMax = new Vector2(0.5f, 1f); val4.pivot = new Vector2(0.5f, 1f); val4.anchoredPosition = new Vector2(0f, -20f); val4.sizeDelta = new Vector2(400f, 40f); titleText = val3.AddComponent<Text>(); titleText.font = GetArialFont(); ((Graphic)titleText).color = TitleTextColor; titleText.alignment = (TextAnchor)1; titleText.fontSize = 28; titleText.fontStyle = (FontStyle)1; GameObject val5 = new GameObject("ScrollView"); val5.transform.SetParent(window.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = new Vector2(0f, 0f); val6.anchorMax = new Vector2(1f, 1f); val6.offsetMin = new Vector2(20f, 125f); val6.offsetMax = new Vector2(-35f, -70f); ScrollRect val7 = val5.AddComponent<ScrollRect>(); val7.movementType = (MovementType)2; val7.inertia = true; val7.decelerationRate = 0.05f; val7.scrollSensitivity = 25f; ((Graphic)val5.AddComponent<Image>()).color = ScrollBgColor; Mask val8 = val5.AddComponent<Mask>(); val8.showMaskGraphic = false; contentContainer = new GameObject("Content"); contentContainer.transform.SetParent(val5.transform, false); contentContainer.AddComponent<CanvasGroup>(); RectTransform val9 = contentContainer.AddComponent<RectTransform>(); val9.anchorMin = new Vector2(0.5f, 1f); val9.anchorMax = new Vector2(0.5f, 1f); val9.pivot = new Vector2(0.5f, 1f); val9.sizeDelta = new Vector2(400f, 0f); VerticalLayoutGroup val10 = contentContainer.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val10).padding = new RectOffset(10, 10, 10, 10); ((HorizontalOrVerticalLayoutGroup)val10).spacing = 15f; ((LayoutGroup)val10).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)val10).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)val10).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val10).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val10).childForceExpandWidth = false; ContentSizeFitter val11 = contentContainer.AddComponent<ContentSizeFitter>(); val11.verticalFit = (FitMode)2; val7.content = val9; val7.viewport = val6; GameObject val12 = new GameObject("VerticalScrollbar"); val12.transform.SetParent(window.transform, false); RectTransform val13 = val12.AddComponent<RectTransform>(); val13.anchorMin = new Vector2(1f, 0f); val13.anchorMax = new Vector2(1f, 1f); val13.pivot = new Vector2(1f, 0f); val13.anchoredPosition = new Vector2(-15f, 125f); val13.sizeDelta = new Vector2(12f, -195f); Scrollbar val14 = val12.AddComponent<Scrollbar>(); val14.direction = (Direction)2; Image val15 = val12.AddComponent<Image>(); ((Graphic)val15).color = new Color(0.1f, 0.1f, 0.1f, 0.5f); GameObject val16 = new GameObject("Handle"); val16.transform.SetParent(val12.transform, false); RectTransform val17 = val16.AddComponent<RectTransform>(); val17.anchorMin = Vector2.zero; val17.anchorMax = Vector2.one; val17.offsetMin = new Vector2(1f, 1f); val17.offsetMax = new Vector2(-1f, -1f); Image val18 = val16.AddComponent<Image>(); val18.sprite = GetScrollbarHandleSprite(); ((Graphic)val18).color = ScrollbarColor; val18.type = (Type)1; val14.handleRect = val17; val7.verticalScrollbar = val14; val7.verticalScrollbarVisibility = (ScrollbarVisibility)1; GameObject val19 = new GameObject("ContentSeparator"); val19.transform.SetParent(window.transform, false); RectTransform val20 = val19.AddComponent<RectTransform>(); val20.anchorMin = new Vector2(0.5f, 0f); val20.anchorMax = new Vector2(0.5f, 0f); val20.pivot = new Vector2(0.5f, 0f); val20.anchoredPosition = new Vector2(0f, 75f); val20.sizeDelta = new Vector2(420f, 2f); Image val21 = val19.AddComponent<Image>(); ((Graphic)val21).color = new Color(0.3f, 0.3f, 0.3f, 0.8f); CreateIncompatibleModsButton(window); CreateBackButton(window); GameObject val22 = new GameObject("CloseButton"); val22.transform.SetParent(window.transform, false); RectTransform val23 = val22.AddComponent<RectTransform>(); val23.anchorMin = new Vector2(0.5f, 0f); val23.anchorMax = new Vector2(0.5f, 0f); val23.pivot = new Vector2(0.5f, 0f); val23.anchoredPosition = new Vector2(100f, 20f); val23.sizeDelta = new Vector2(180f, 40f); Image val24 = val22.AddComponent<Image>(); ((Graphic)val24).color = CloseButtonColor; val24.sprite = GetButtonSprite(((Graphic)val24).color, "CloseButton"); GameObject val25 = new GameObject("Text"); val25.transform.SetParent(val22.transform, false); Text val26 = val25.AddComponent<Text>(); val26.text = Localization.Get("close"); val26.font = GetArialFont(); ((Graphic)val26).color = Color.white; val26.alignment = (TextAnchor)4; val26.fontSize = 16; val26.fontStyle = (FontStyle)1; closeButtonText = val26; RectTransform component = val25.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Button val27 = val22.AddComponent<Button>(); ((UnityEventBase)val27.onClick).RemoveAllListeners(); ((UnityEvent)val27.onClick).AddListener(UnityAction.op_Implicit((Action)delegate { MelonCoroutines.Start(CloseWindowAndReactivateHome(window)); })); return window; } private static void ApplyView(UIHandlerView view) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) currentView = view; if (!((Object)(object)modWindow == (Object)null)) { if ((Object)(object)titleText != (Object)null) { titleText.text = ((view == UIHandlerView.Updates) ? Localization.Get("update_checker") : Localization.Get("incompatible_mods")); ((Graphic)titleText).color = ((view == UIHandlerView.Updates) ? TitleTextColor : IncompatibleTitleColor); } if ((Object)(object)incompatibleModsNavButton != (Object)null) { incompatibleModsNavButton.SetActive(view == UIHandlerView.Updates); } if ((Object)(object)backButton != (Object)null) { backButton.SetActive(view == UIHandlerView.Incompatible); } UpdateContent(view); } } [IteratorStateMachine(typeof(<AnimateViewChange>d__54))] private static IEnumerator AnimateViewChange(UIHandlerView newView, float duration = 0.15f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateViewChange>d__54(0) { newView = newView, duration = duration }; } public static void UpdateLocalization() { if ((Object)(object)mainButtonText != (Object)null) { mainButtonText.text = Localization.Get("update_checker"); } if ((Object)(object)incompatibleNavButtonText != (Object)null) { incompatibleNavButtonText.text = Localization.Get("incompatible_mods"); } if ((Object)(object)backButtonText != (Object)null) { backButtonText.text = Localization.Get("back"); } if ((Object)(object)closeButtonText != (Object)null) { closeButtonText.text = Localization.Get("close"); } if ((Object)(object)modWindow != (Object)null && modWindow.activeSelf) { ApplyView(currentView); } } public static void ShowNotification() { } public static void UpdateUpdateBadge() { if (!((Object)(object)updateBadge == (Object)null) && !((Object)(object)updateBadgeText == (Object)null)) { int num = UpdatesChecker.updatesAvailable?.Count ?? 0; bool flag = num > 0; if (updateBadge.activeSelf != flag) { updateBadge.SetActive(flag); } if (flag) { updateBadgeText.text = num.ToString(); } } } public static void SetView(UIHandlerView newView) { if (currentView != newView && !isAnimating && !((Object)(object)modWindow == (Object)null)) { MelonCoroutines.Start(AnimateViewChange(newView)); } } public static void UpdateContent(UIHandlerView view) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)contentContainer == (Object)null) { GameObject? obj = modWindow; object obj2; if (obj == null) { obj2 = null; } else { Transform obj3 = obj.transform.Find("ScrollView/Content"); obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); } contentContainer = (GameObject?)obj2; if ((Object)(object)contentContainer == (Object)null) { return; } } RectTransform component = contentContainer.GetComponent<RectTransform>(); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(400f, 0f); for (int num = contentContainer.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)contentContainer.transform.GetChild(num)).gameObject); } float num2 = 95f; if (view == UIHandlerView.Updates) { IEnumerable<ModUpdate> updatesAvailable = UpdatesChecker.updatesAvailable; IEnumerable<ModUpdate> enumerable = updatesAvailable ?? Enumerable.Empty<ModUpdate>(); if (!enumerable.Any()) { CreateTextElement(contentContainer, Localization.Get("all_up_to_date"), 80f, (TextAnchor)4); } else { foreach (ModUpdate item in enumerable) { CreateTextElement(contentContainer, $"<b><size=18>{item.ModName}</size></b>\n<color=#aaaaaa>{Localization.Get("current_version")}: {item.CurrentVersion}</color>\n<color=#4CAF50>{Localization.Get("new_version")}: {item.LatestVersion}</color>\n" + "<color=#555555>────────────────────</color>", 80f, (TextAnchor)4); } } float num3 = (enumerable.Any() ? ((float)enumerable.Count() * num2) : num2); component.sizeDelta = new Vector2(400f, Mathf.Max(300f, num3)); return; } IEnumerable<ModInfo> incompatibleMods = UpdatesChecker.incompatibleMods; IEnumerable<ModInfo> enumerable2 = incompatibleMods ?? Enumerable.Empty<ModInfo>(); CreateTextElement(contentContainer, "<size=14><color=#AAAAAA>" + Localization.Get("incompatible_info") + "</color></size>", 60f, (TextAnchor)0); float num4 = 75f; if (!enumerable2.Any()) { CreateTextElement(contentContainer, Localization.Get("no_incompatible_mods"), 80f, (TextAnchor)4); float num5 = num4 + num2; component.sizeDelta = new Vector2(400f, Mathf.Max(300f, num5)); } else { foreach (ModInfo item2 in enumerable2) { CreateTextElement(contentContainer, $"<b><size=18>{item2.Name}</size></b>\n<color=#ff5555>{Localization.Get("missing_nexusmodid")}</color>\n<color=#aaaaaa>{Localization.Get("version")}: {item2.Version}</color>\n" + "<color=#555555>────────────────────</color>", 80f, (TextAnchor)4); } float num6 = num4 + (float)enumerable2.Count() * num2; component.sizeDelta = new Vector2(400f, Mathf.Max(300f, num6)); } LayoutRebuilder.ForceRebuildLayoutImmediate(component); } catch (Exception ex) { MelonLogger.Error("UpdateContent error: " + ex.Message); } } public static void CreateTextElement(GameObject parent, string text, float height = 80f, TextAnchor alignment = 4) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0032: 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_005e: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00c2: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("UpdateElement"); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 1f); val2.anchorMax = new Vector2(0.5f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(380f, height); Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = ElementBgColor; val3.sprite = GetElementBgSprite(); GameObject val4 = new GameObject("Text"); val4.transform.SetParent(val.transform, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = new Vector2(10f, 5f); val5.offsetMax = new Vector2(-10f, -5f); Text val6 = val4.AddComponent<Text>(); val6.text = text; val6.font = GetArialFont(); ((Graphic)val6).color = DefaultTextColor; val6.fontSize = 16; val6.supportRichText = true; val6.alignment = alignment; LayoutElement val7 = val.AddComponent<LayoutElement>(); val7.minHeight = height; val7.preferredHeight = height; val7.preferredWidth = 380f; Outline val8 = val4.AddComponent<Outline>(); ((Shadow)val8).effectColor = new Color(0f, 0f, 0f, 0.3f); ((Shadow)val8).effectDistance = new Vector2(1f, -1f); } catch (Exception ex) { MelonLogger.Error("CreateTextElement error: " + ex.GetType().Name + " - " + ex.Message); } } public static GameObject GetOrCreateCanvas() { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown try { GameObject val = GameObject.Find("Canvas"); if ((Object)(object)val == (Object)null) { val = new GameObject("Canvas"); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val.AddComponent<CanvasScaler>(); val.AddComponent<GraphicRaycaster>(); if ((Object)(object)Object.FindObjectOfType<EventSystem>() == (Object)null) { GameObject val3 = new GameObject("EventSystem"); val3.AddComponent<EventSystem>(); val3.AddComponent<StandaloneInputModule>(); } } return val; } catch (Exception ex) { MelonLogger.Error("GetOrCreateCanvas error: " + ex.Message); return ((Component)new GameObject("FallbackCanvas").AddComponent<Canvas>()).gameObject; } } }