using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("MMOHeimMainMenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Custom main menu assets, loading art rotation, and Discord link for MMOHeim.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MMOHeimMainMenu")] [assembly: AssemblyTitle("MMOHeimMainMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MMOHeimMainMenu { internal static class LoadingScreens { internal struct LoadingTargetResult { internal bool IsValid; internal bool IsRaw; internal Image? Image; internal RawImage? RawImage; internal int Score; internal string Path; internal string ObjectName; } [CompilerGenerated] private sealed class d__17 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LoadingTargetResult result; public Sprite sprite; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Time.realtimeSinceStartup + 2400f; break; case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < 5__2 && !MMOHeimMainMenuPlugin.TryGetLocalPlayerPresentPlain() && (Object)(object)MMOHeimMainMenuPlugin.Instance != (Object)null) { ApplyLoadingTargetResult(result, sprite); <>2__current = (object)new WaitForSecondsRealtime(2f); <>1__state = 1; return true; } _forceCoroutine = null; 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 d__20 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LoadingTargetResult result; private float 5__2; private float 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__20(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; 5__2 = 0f; 5__3 = 1f; if (result.IsRaw && (Object)(object)result.RawImage != (Object)null) { 5__3 = ((Graphic)result.RawImage).canvasRenderer.GetAlpha(); } else if ((Object)(object)result.Image != (Object)null) { 5__3 = ((Graphic)result.Image).canvasRenderer.GetAlpha(); } break; case 1: <>1__state = -1; break; } if (5__2 < 0.6f) { 5__2 += Time.unscaledDeltaTime; float num = Mathf.Clamp01(5__2 / 0.6f); float a = Mathf.Lerp(5__3, 0f, num); TryApplyAlpha(result, a); <>2__current = null; <>1__state = 1; return true; } ClearLoadingTarget(result); LoadingArtSessionActive = 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 d__13 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private float 5__2; private string 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 2u) { try { } finally { <>m__Finally1(); } } 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; if (WatcherRunning) { result = false; } else { WatcherRunning = true; <>1__state = -3; <>2__current = (object)new WaitForSecondsRealtime(0f); <>1__state = 1; result = true; } goto end_IL_0000; case 1: <>1__state = -3; 5__2 = Time.realtimeSinceStartup + 2400f; 5__3 = null; break; case 2: <>1__state = -3; break; case 3: <>1__state = -3; break; } if (Time.realtimeSinceStartup < 5__2 && !MMOHeimMainMenuPlugin.TryGetLocalPlayerPresentPlain()) { if (5__3 == null) { 5__3 = MMOHeimMainMenuPlugin.GetRandomLoadingArtPath(); } string text = 5__3; if (string.IsNullOrEmpty(text) || !File.Exists(text)) { <>2__current = (object)new WaitForSecondsRealtime(0.5f); <>1__state = 2; result = true; } else { Sprite val = SpriteFromFile(text); if (!((Object)(object)val != (Object)null)) { goto IL_012b; } LoadingTargetResult loadingTargetResult = FindBestConnectedWorldLoadingTarget(); if (!loadingTargetResult.IsValid || !ApplyLoadingTargetResult(loadingTargetResult, val)) { Object.Destroy((Object)(object)val); goto IL_012b; } LoadingTargetResult result2 = loadingTargetResult; LoadingArtSessionActive = true; StartForceKeep(loadingTargetResult, val); StartCleanup(result2); result = false; <>m__Finally1(); } } else { 5__3 = null; <>m__Finally1(); result = false; } goto end_IL_0000; IL_012b: <>2__current = (object)new WaitForSecondsRealtime(0.5f); <>1__state = 3; result = true; end_IL_0000:; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; WatcherRunning = false; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__15 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LoadingTargetResult result; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Time.realtimeSinceStartup + 2400f; break; case 1: <>1__state = -1; break; } if (!MMOHeimMainMenuPlugin.TryGetLocalPlayerPresentPlain() && Time.realtimeSinceStartup < 5__2) { MMOHeimMainMenuPlugin.IsWorldFullyLoaded(); <>2__current = (object)new WaitForSecondsRealtime(0.5f); <>1__state = 1; return true; } MMOHeimMainMenuPlugin.IsWorldFullyLoaded(); FadeOutAndClearLoadingTarget(result); _cleanupCoroutine = null; 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 float PostSceneDelaySeconds = 0f; private const float SearchIntervalSeconds = 0.5f; private const float MaxLoadWaitSeconds = 2400f; private const float MaintainArtIntervalSeconds = 2f; private const int MinimumValidScore = 300; private const float LoadingFadeOutSeconds = 0.6f; private static Coroutine? _cleanupCoroutine; private static Coroutine? _forceCoroutine; internal static volatile bool WatcherRunning; internal static volatile bool LoadingArtSessionActive; internal static void ResetForMainMenu() { LoadingArtSessionActive = false; } internal static void TryStartLoadingScreenWatcher() { if (MMOHeimMainMenuPlugin.EnableCustomLoadingScreens && !((Object)(object)MMOHeimMainMenuPlugin.Instance == (Object)null) && !WatcherRunning && !LoadingArtSessionActive) { ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StartCoroutine(WaitForConnectedWorldLoadAndReplaceCoroutine()); } } [IteratorStateMachine(typeof(d__13))] internal static IEnumerator WaitForConnectedWorldLoadAndReplaceCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0); } private static void StartCleanup(LoadingTargetResult result) { if (!((Object)(object)MMOHeimMainMenuPlugin.Instance == (Object)null) && result.IsValid) { if (_cleanupCoroutine != null) { ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StopCoroutine(_cleanupCoroutine); _cleanupCoroutine = null; } _cleanupCoroutine = ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StartCoroutine(WaitUntilWorldThenClear(result)); } } [IteratorStateMachine(typeof(d__15))] private static IEnumerator WaitUntilWorldThenClear(LoadingTargetResult result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__15(0) { result = result }; } private static void StartForceKeep(LoadingTargetResult result, Sprite sprite) { if (!((Object)(object)MMOHeimMainMenuPlugin.Instance == (Object)null) && result.IsValid && !((Object)(object)sprite == (Object)null)) { if (_forceCoroutine != null) { ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StopCoroutine(_forceCoroutine); _forceCoroutine = null; } _forceCoroutine = ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StartCoroutine(ForceKeepCoroutine(result, sprite)); } } [IteratorStateMachine(typeof(d__17))] private static IEnumerator ForceKeepCoroutine(LoadingTargetResult result, Sprite sprite) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { result = result, sprite = sprite }; } private static Sprite? SpriteFromFile(string absolutePath) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) try { byte[] data = File.ReadAllBytes(absolutePath); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!TextureDecode.LoadImage(val, data, markNonReadable: false)) { Object.Destroy((Object)(object)val); return null; } val.Apply(true, false); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } catch { return null; } } private static void FadeOutAndClearLoadingTarget(LoadingTargetResult result) { if (!result.IsValid || (Object)(object)MMOHeimMainMenuPlugin.Instance == (Object)null) { ClearLoadingTarget(result); LoadingArtSessionActive = false; return; } if (_cleanupCoroutine != null) { ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StopCoroutine(_cleanupCoroutine); _cleanupCoroutine = null; } IEnumerator enumerator = LoadingFadeCoroutine(result); ((MonoBehaviour)MMOHeimMainMenuPlugin.Instance).StartCoroutine(enumerator); } [IteratorStateMachine(typeof(d__20))] private static IEnumerator LoadingFadeCoroutine(LoadingTargetResult result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__20(0) { result = result }; } private static void TryApplyAlpha(LoadingTargetResult result, float a) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (result.IsValid) { Color color = default(Color); ((Color)(ref color))..ctor(1f, 1f, 1f, Mathf.Clamp01(a)); if (result.IsRaw && (Object)(object)result.RawImage != (Object)null) { ((Graphic)result.RawImage).color = color; ((Graphic)result.RawImage).SetAllDirty(); } else if (!result.IsRaw && (Object)(object)result.Image != (Object)null) { ((Graphic)result.Image).color = color; ((Graphic)result.Image).SetAllDirty(); } } } internal static LoadingTargetResult FindBestConnectedWorldLoadingTarget() { LoadingTargetResult loadingTargetResult = default(LoadingTargetResult); loadingTargetResult.IsValid = false; loadingTargetResult.IsRaw = false; loadingTargetResult.Image = null; loadingTargetResult.RawImage = null; loadingTargetResult.Score = int.MinValue; loadingTargetResult.Path = string.Empty; loadingTargetResult.ObjectName = string.Empty; LoadingTargetResult result = loadingTargetResult; Image[] array = Resources.FindObjectsOfTypeAll(); foreach (Image val in array) { if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { int num = CalculateConnectedWorldLoadingImageScore(val); if (num > result.Score) { result.IsValid = num >= 300; result.IsRaw = false; result.Image = val; result.RawImage = null; result.Score = num; result.Path = GetHierarchyPath(((Component)val).transform); result.ObjectName = ((Object)((Component)val).gameObject).name; } } } RawImage[] array2 = Resources.FindObjectsOfTypeAll(); foreach (RawImage val2 in array2) { if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null) { int num2 = CalculateConnectedWorldLoadingRawImageScore(val2); if (num2 > result.Score) { result.IsValid = num2 >= 300; result.IsRaw = true; result.Image = null; result.RawImage = val2; result.Score = num2; result.Path = GetHierarchyPath(((Component)val2).transform); result.ObjectName = ((Object)((Component)val2).gameObject).name; } } } return result; } private static bool ApplyLoadingTargetResult(LoadingTargetResult result, Sprite customSprite) { if (!result.IsValid || (Object)(object)customSprite == (Object)null) { return false; } if (result.IsRaw) { if ((Object)(object)result.RawImage == (Object)null) { return false; } ApplyLoadingRawImage(result.RawImage, customSprite); } else { if ((Object)(object)result.Image == (Object)null) { return false; } ApplyLoadingImage(result.Image, customSprite); } return true; } private static void ApplyLoadingImage(Image target, Sprite customSprite) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) target.sprite = customSprite; target.overrideSprite = customSprite; ((Behaviour)target).enabled = true; target.preserveAspect = false; target.type = (Type)0; ((Graphic)target).material = null; ((Graphic)target).color = Color.white; StretchToFullscreen(((Graphic)target).rectTransform); ((Graphic)target).SetAllDirty(); } private static void ApplyLoadingRawImage(RawImage target, Sprite customSprite) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) target.texture = (Texture)(object)customSprite.texture; ((Behaviour)target).enabled = true; ((Graphic)target).material = null; ((Graphic)target).color = Color.white; StretchToFullscreen(((Graphic)target).rectTransform); ((Graphic)target).SetAllDirty(); } private static void ClearLoadingTarget(LoadingTargetResult result) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (result.IsValid) { if (result.IsRaw && (Object)(object)result.RawImage != (Object)null && (Object)(object)((Component)result.RawImage).gameObject != (Object)null) { result.RawImage.texture = null; ((Graphic)result.RawImage).color = new Color(1f, 1f, 1f, 0f); ((Behaviour)result.RawImage).enabled = false; ((Graphic)result.RawImage).SetAllDirty(); } else if (!result.IsRaw && (Object)(object)result.Image != (Object)null && (Object)(object)((Component)result.Image).gameObject != (Object)null) { result.Image.sprite = null; result.Image.overrideSprite = null; ((Graphic)result.Image).color = new Color(1f, 1f, 1f, 0f); ((Behaviour)result.Image).enabled = false; ((Graphic)result.Image).SetAllDirty(); } } } private static bool Approximately(float a, float b) { return Mathf.Abs(a - b) <= 0.001f; } internal static bool IsFullscreenLike(RectTransform rt) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0080: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rt == (Object)null) { return false; } bool num = Approximately(rt.anchorMin.x, 0f) && Approximately(rt.anchorMin.y, 0f) && Approximately(rt.anchorMax.x, 1f) && Approximately(rt.anchorMax.y, 1f); bool flag = Approximately(rt.offsetMin.x, 0f) && Approximately(rt.offsetMin.y, 0f) && Approximately(rt.offsetMax.x, 0f) && Approximately(rt.offsetMax.y, 0f); return num && flag; } internal static string GetHierarchyPath(Transform transform) { if ((Object)(object)transform == (Object)null) { return ""; } List list = new List(); Transform val = transform; while ((Object)(object)val != (Object)null) { list.Insert(0, ((Object)val).name); val = val.parent; } return string.Join("/", list.ToArray()); } internal static int CalculateConnectedWorldLoadingImageScore(Image img) { //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((img != null) ? ((Component)img).gameObject : null) == (Object)null) { return int.MinValue; } string text = ((Object)((Component)img).gameObject).name ?? string.Empty; text = text.ToLowerInvariant(); string text2 = GetHierarchyPath(((Component)img).transform).ToLowerInvariant(); string text3 = (((Object)(object)img.sprite != (Object)null) ? (((Object)img.sprite).name ?? string.Empty).ToLowerInvariant() : string.Empty); if (!text2.Contains("loadinggui")) { return int.MinValue; } if (text2.Contains("popupblockingbackground") || text2.Contains("unifiedpopup") || text2.Contains("achievementpopup") || text2.Contains("achievementui") || text2.Contains("editguild") || text2.Contains("createguild") || text2.Contains("searchguild") || text2.Contains("guildmanagementui") || text2.Contains("applicationsui") || text2.Contains("noguild") || text2.Contains("discord") || text2.Contains("_console(clone)") || text2.Contains("/_console") || text2.Contains("logoutput") || text2.Contains("serveroptions") || text2.Contains("connectionfailed") || text2.Contains("managesavesmenu") || text2.Contains("removecharacterdialog") || text2.Contains("pleasewait")) { return int.MinValue; } if (!text.Contains("crosshair") && !text.Contains("healthicon") && !text.Contains("foodicon") && !text.Contains("windicon") && !text.Contains("mounticon") && !text.Contains("player_marker") && !text.Contains("ship_marker") && !text.Contains("wind_marker")) { switch (text) { case "backgroundback": case "buttonclose": case "button": case "border": case "bkg": case "bar": case "darken": case "handle": case "separator": break; default: { if (text2.Contains("/enemyhud/") || text2.Contains("/inventory_screen/") || text2.Contains("/statuseffects/") || text2.Contains("/keyhints/") || text2.Contains("/buildhud/") || text2.Contains("/shiphud/controls/") || text2.Contains("/crosshair/") || text2.Contains("/guardianpower/")) { return int.MinValue; } int num = 0; if (text == "screen") { num += 5000; } if (text2.EndsWith("/hud/screen")) { num += 5000; } if (text2.Contains("/hud/screen")) { num += 3000; } if (text2.Contains("loadinggui")) { num += 300; } if (text2.Contains("pixelfix")) { num += 40; } if (text2.Contains("/hud/")) { num += 150; } if (text2.Contains("/ingamegui/")) { num += 50; } if (text == "background") { num += 180; } if (text.Contains("background")) { num += 120; } if (text3.Contains("background")) { num += 60; } if (text.Contains("image")) { num += 20; } if (((Behaviour)img).enabled) { num += 20; } if (((Component)img).gameObject.activeInHierarchy) { num += 60; } if ((Object)(object)((Graphic)img).canvasRenderer != (Object)null && ((Graphic)img).canvasRenderer.GetAlpha() > 0.01f) { num += 40; } RectTransform rectTransform = ((Graphic)img).rectTransform; if ((Object)(object)rectTransform != (Object)null) { Rect rect = rectTransform.rect; float num2 = Mathf.Abs(((Rect)(ref rect)).width); rect = rectTransform.rect; float num3 = Mathf.Abs(((Rect)(ref rect)).height); float num4 = num2 * num3; if (num4 < 200000f) { return int.MinValue; } if (num4 > 300000f) { num += 60; } if (num4 > 500000f) { num += 120; } if (num4 > 1000000f) { num += 220; } if (num4 > 1800000f) { num += 320; } if (num2 >= (float)Screen.width * 0.7f) { num += 80; } if (num3 >= (float)Screen.height * 0.7f) { num += 80; } if (num2 >= (float)Screen.width * 0.9f) { num += 100; } if (num3 >= (float)Screen.height * 0.9f) { num += 100; } if (IsFullscreenLike(rectTransform)) { num += 400; } } return num; } } } return int.MinValue; } internal static int CalculateConnectedWorldLoadingRawImageScore(RawImage raw) { //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((raw != null) ? ((Component)raw).gameObject : null) == (Object)null) { return int.MinValue; } string text = (((Object)((Component)raw).gameObject).name ?? string.Empty).ToLowerInvariant(); string text2 = GetHierarchyPath(((Component)raw).transform).ToLowerInvariant(); if (!text2.Contains("loadinggui")) { return int.MinValue; } if (text2.Contains("popupblockingbackground") || text2.Contains("unifiedpopup") || text2.Contains("achievementpopup") || text2.Contains("achievementui") || text2.Contains("editguild") || text2.Contains("createguild") || text2.Contains("searchguild") || text2.Contains("guildmanagementui") || text2.Contains("applicationsui") || text2.Contains("noguild") || text2.Contains("discord") || text2.Contains("_console(clone)") || text2.Contains("/_console") || text2.Contains("logoutput") || text2.Contains("serveroptions") || text2.Contains("connectionfailed") || text2.Contains("managesavesmenu") || text2.Contains("removecharacterdialog") || text2.Contains("pleasewait")) { return int.MinValue; } if (text2.Contains("/enemyhud/") || text2.Contains("/inventory_screen/") || text2.Contains("/statuseffects/") || text2.Contains("/keyhints/") || text2.Contains("/buildhud/") || text2.Contains("/shiphud/controls/") || text2.Contains("/crosshair/") || text2.Contains("/guardianpower/")) { return int.MinValue; } int num = 0; if (text == "screen") { num += 5000; } if (text2.EndsWith("/hud/screen")) { num += 5000; } if (text2.Contains("/hud/screen")) { num += 3000; } if (text2.Contains("loadinggui")) { num += 300; } if (text2.Contains("pixelfix")) { num += 40; } if (text2.Contains("/hud/")) { num += 150; } if (text == "background") { num += 180; } if (text.Contains("background")) { num += 120; } if (text.Contains("image")) { num += 20; } if (((Behaviour)raw).enabled) { num += 20; } if (((Component)raw).gameObject.activeInHierarchy) { num += 60; } RectTransform rectTransform = ((Graphic)raw).rectTransform; if ((Object)(object)rectTransform != (Object)null) { Rect rect = rectTransform.rect; float num2 = Mathf.Abs(((Rect)(ref rect)).width); rect = rectTransform.rect; float num3 = Mathf.Abs(((Rect)(ref rect)).height); float num4 = num2 * num3; if (num4 < 200000f) { return int.MinValue; } if (num4 > 300000f) { num += 60; } if (num4 > 500000f) { num += 120; } if (num4 > 1000000f) { num += 220; } if (num4 > 1800000f) { num += 320; } if (num2 >= (float)Screen.width * 0.7f) { num += 80; } if (num3 >= (float)Screen.height * 0.7f) { num += 80; } if (num2 >= (float)Screen.width * 0.9f) { num += 100; } if (num3 >= (float)Screen.height * 0.9f) { num += 100; } if (IsFullscreenLike(rectTransform)) { num += 400; } } return num; } internal static void StretchToFullscreen(RectTransform rt) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rt == (Object)null)) { rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.pivot = new Vector2(0.5f, 0.5f); rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; rt.anchoredPosition = Vector2.zero; ((Transform)rt).localScale = Vector3.one; ((Transform)rt).localRotation = Quaternion.identity; } } } internal static class Hu { internal const string StartGameLower = "játék indítása"; internal const string SettingsLower = "beállitások"; internal const string PatchNotesTitleLower = "frissítési napló"; internal const string ModdedMarkerLower = "módosított"; } [BepInPlugin("rdmods.mmheim.mainmenu", "MMOHeim Main Menu", "1.0.0")] public sealed class MMOHeimMainMenuPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__61_0; internal void b__61_0() { Application.OpenURL("https://discord.gg/yX9tv3FXY6"); LogInfo("Discord opened."); } } [CompilerGenerated] private sealed class d__68 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float seconds; private MMOHeimMainMenuPlugin 5__2; private AudioSource 5__3; private float 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__68(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = Instance; if ((Object)(object)5__2?._menuMusicSource == (Object)null) { StopMenuMusic(); return false; } 5__3 = 5__2._menuMusicSource; 5__4 = 5__3.volume; 5__5 = 0f; break; case 1: <>1__state = -1; break; } if (5__5 < seconds && (Object)(object)5__3 != (Object)null) { 5__5 += Time.unscaledDeltaTime; 5__3.volume = Mathf.Lerp(5__4, 0f, Mathf.Clamp01(5__5 / seconds)); <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)5__2 != (Object)null) { 5__2._menuMusicFadeCoroutine = null; } StopMenuMusic(); LogInfo("Menu music stopped after fade."); 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 d__48 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__48(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__2 = 0; break; case 1: <>1__state = -1; 5__2++; break; } if (5__2 < 8) { HideMenuClutterOnce(); <>2__current = (object)new WaitForSecondsRealtime(0.5f); <>1__state = 1; return true; } 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 d__64 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private UnityWebRequest 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__64(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(0.1f); <>1__state = 1; result = true; break; case 1: { <>1__state = -1; string musicPath = GetMusicPath(); if (!File.Exists(musicPath)) { LogWarn("mainmenu.ogg missing: " + musicPath); result = false; break; } string absoluteUri = new Uri(Path.GetFullPath(musicPath)).AbsoluteUri; 5__2 = UnityWebRequestMultimedia.GetAudioClip(absoluteUri, (AudioType)14); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 2; result = true; break; } case 2: { <>1__state = -3; AudioClip content = DownloadHandlerAudioClip.GetContent(5__2); if ((Object)(object)content == (Object)null || (Object)(object)Instance == (Object)null) { LogWarn("Music failed: " + 5__2.error); result = false; } else { EnsureMenuMusicAudio(Instance); AudioSource menuMusicSource = Instance._menuMusicSource; menuMusicSource.clip = content; menuMusicSource.loop = true; menuMusicSource.volume = 0.55f; if (!menuMusicSource.isPlaying) { menuMusicSource.Play(); } LogInfo("Menu music playing."); if ((Object)(object)Instance != (Object)null) { Instance._menuMusicStartCoroutine = null; } result = false; } <>m__Finally1(); break; } } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__62 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MMOHeimMainMenuPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__62(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_009d: 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_00d3: Expected O, but got Unknown int num = <>1__state; MMOHeimMainMenuPlugin mMOHeimMainMenuPlugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)_discordLogoImage == (Object)null) { return false; } string discordLogoPath = GetDiscordLogoPath(); if (!File.Exists(discordLogoPath)) { return false; } Sprite val = LoadSpriteFromDisk(discordLogoPath); if ((Object)(object)val != (Object)null && (Object)(object)_discordLogoImage != (Object)null) { _discordLogoImage.sprite = val; _discordLogoImage.overrideSprite = val; _discordLogoImage.type = (Type)0; ((Graphic)_discordLogoImage).color = Color.white; ((Graphic)_discordLogoImage).material = null; foreach (Transform item in ((Component)_discordLogoImage).transform) { Transform val2 = item; if (((Object)val2).name == "DiscordGlyph") { ((Component)val2).gameObject.SetActive(false); } } } mMOHeimMainMenuPlugin._discordLogoCoroutine = null; 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 d__45 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float seconds; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__45(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; 5__2 = Time.realtimeSinceStartup + seconds; break; case 1: <>1__state = -1; break; } if (Time.realtimeSinceStartup < 5__2 && (Object)(object)Instance != (Object)null) { MuteVanillaMenuMusicNow(); <>2__current = null; <>1__state = 1; return true; } 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 d__52 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private int 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__52(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(0.75f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__2 = 0; break; case 2: <>1__state = -1; goto IL_013e; case 3: { <>1__state = -1; goto IL_013e; } IL_013e: 5__2++; break; } if (5__2 < 6) { FejdStartup val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null || !File.Exists(GetLogoPath())) { <>2__current = (object)new WaitForSecondsRealtime(0.75f); <>1__state = 2; return true; } Image val2 = null; int num = int.MinValue; Image[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (Image val3 in componentsInChildren) { if (!((Object)(object)val3 == (Object)null)) { int num2 = ScoreLogo(val3); if (num2 > num) { num = num2; val2 = val3; } } } if ((Object)(object)val2 != (Object)null && num >= 50) { Sprite val4 = LoadSpriteFromDisk(GetLogoPath()); if ((Object)(object)val4 != (Object)null) { ApplyLogo(val2, val4); LogInfo($"Logo applied (score {num})."); return false; } } <>2__current = (object)new WaitForSecondsRealtime(0.75f); <>1__state = 3; return true; } 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 const string ModGuid = "rdmods.mmheim.mainmenu"; public const string ModName = "MMOHeim Main Menu"; public const string AssetFolderName = "MMOheimMainMenu"; public const string LoadingArtFolderName = "LoadingArt"; public const int LoadingArtMaxSlot = 12; public const string DiscordInviteUrl = "https://discord.gg/yX9tv3FXY6"; public const string DiscordTitleText = "Need help? Join Discord!"; public const string DiscordButtonText = "Click here to join Discord!"; internal static bool MenuMusicFadeCommittedForSession; internal static readonly bool EnableCustomLoadingScreens = true; private ConfigEntry? _enableLogging; private Harmony? _harmony; private GameObject? _menuMusicGo; private AudioSource? _menuMusicSource; private Coroutine? _menuMusicFadeCoroutine; private Coroutine? _menuMusicStartCoroutine; private static GameObject? _discordPanel; private Coroutine? _discordLogoCoroutine; private static Image? _discordLogoImage; private static readonly HashSet NeverHide = new HashSet(StringComparer.Ordinal) { "startgui", "worldpanel", "startgame", "topleft", "topright", "menu", "joinpanel", "panel", "tooltips" }; internal static MMOHeimMainMenuPlugin? Instance { get; private set; } internal static ConfigEntry? ModEnabled { get; private set; } internal static ManualLogSource? ModLog { get; private set; } private void Awake() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown Instance = this; ModLog = ((BaseUnityPlugin)this).Logger; MenuMusicFadeCommittedForSession = false; ModEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Turn this mod on or off."); _enableLogging = ((BaseUnityPlugin)this).Config.Bind("General", "EnableLogging", false, "Write informational logs from MMOHeim Main Menu."); ((BaseUnityPlugin)this).Config.Save(); if (!ModEnabled.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"MMOHeim Main Menu is disabled in config."); return; } EnsureAssetDirectories(); _harmony = new Harmony("rdmods.mmheim.mainmenu"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("MMOHeim Main Menu loaded. Asset root: " + GetAssetRootPath())); } private void OnDestroy() { if (_discordLogoCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_discordLogoCoroutine); _discordLogoCoroutine = null; } if (_menuMusicFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_menuMusicFadeCoroutine); _menuMusicFadeCoroutine = null; } if (_menuMusicStartCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_menuMusicStartCoroutine); _menuMusicStartCoroutine = null; } StopMenuMusic(); Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _harmony = null; Instance = null; } internal static bool TryGetLocalPlayerPresentPlain() { try { return (Object)(object)Player.m_localPlayer != (Object)null; } catch { return false; } } internal static void CommitMenuMusicFadeForWorldEntry(string trigger) { if (ModEnabled != null && ModEnabled.Value && !MenuMusicFadeCommittedForSession) { MenuMusicFadeCommittedForSession = true; LogInfo("Stopping menu music (" + trigger + ")."); FadeOutAndStopMenuMusic(); } } internal static bool IsWorldFullyLoaded() { bool num = TryGetLocalPlayerPresentPlain(); if (num && !MenuMusicFadeCommittedForSession) { CommitMenuMusicFadeForWorldEntry("local player in world"); } return num; } internal static void LogInfo(string message) { if (Instance?._enableLogging != null && Instance._enableLogging.Value) { ManualLogSource? modLog = ModLog; if (modLog != null) { modLog.LogInfo((object)message); } } } internal static void LogWarn(string message) { ManualLogSource? modLog = ModLog; if (modLog != null) { modLog.LogWarning((object)message); } } internal static string GetAssetRootPath() { return Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "MMOheimMainMenu"); } internal static string GetLoadingArtFolder() { return Path.Combine(GetAssetRootPath(), "LoadingArt"); } internal static string GetLogoPath() { return Path.Combine(GetAssetRootPath(), "logo.png"); } internal static string GetDiscordLogoPath() { return Path.Combine(GetAssetRootPath(), "discordlogo.png"); } internal static string GetMusicPath() { return Path.Combine(GetAssetRootPath(), "mainmenu.ogg"); } internal static string? GetRandomLoadingArtPath() { string loadingArtFolder = GetLoadingArtFolder(); if (!Directory.Exists(loadingArtFolder)) { return null; } string result = null; int num = 0; for (int i = 1; i <= 12; i++) { string text = Path.Combine(loadingArtFolder, $"art{i}.png"); if (File.Exists(text)) { num++; if (num == 1 || Random.Range(0, num) == 0) { result = text; } } } return result; } private void EnsureAssetDirectories() { try { Directory.CreateDirectory(GetAssetRootPath()); Directory.CreateDirectory(GetLoadingArtFolder()); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not create asset folders: " + ex.Message)); } } [IteratorStateMachine(typeof(d__45))] internal static IEnumerator MuteVanillaMenuMusicLoop(float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__45(0) { seconds = seconds }; } private static void MuteVanillaMenuMusicNow() { try { if (!(Resources.FindObjectsOfTypeAll(typeof(AudioSource)) is AudioSource[] array)) { return; } AudioSource[] array2 = array; foreach (AudioSource val in array2) { if (!((Object)(object)((val != null) ? ((Component)val).gameObject : null) == (Object)null) && !((Object)(object)val == (Object)(object)Instance?._menuMusicSource)) { string text = ((Object)((Component)val).gameObject).name.ToLowerInvariant(); string text2 = (((Object)(object)val.clip != (Object)null) ? ((Object)val.clip).name.ToLowerInvariant() : string.Empty); string text3 = LoadingScreens.GetHierarchyPath(((Component)val).transform).ToLowerInvariant(); if ((text3.Contains("fejd") || text3.Contains("menu") || text3.Contains("main") || text.Contains("music") || text.Contains("audio") || text2.Contains("menu") || text2.Contains("theme") || text2.Contains("music")) && (val.isPlaying || !(val.volume <= 0.001f))) { val.volume = 0f; val.Stop(); } } } } catch (Exception ex) { ManualLogSource? modLog = ModLog; if (modLog != null) { modLog.LogError((object)ex); } } } [IteratorStateMachine(typeof(d__48))] internal static IEnumerator HideUnwantedMainMenuUiDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__48(0); } private static void HideMenuClutterOnce() { FejdStartup val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { return; } Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { GameObject gameObject = ((Component)componentsInChildren[i]).gameObject; string text = (((Object)gameObject).name ?? string.Empty).ToLowerInvariant(); if (!NeverHide.Contains(text)) { string lowerOwn = GetOwnText(gameObject).ToLowerInvariant(); if (ShouldHideUi(text, lowerOwn)) { gameObject.SetActive(false); } } } } private static bool ShouldHideUi(string lowerName, string lowerOwn) { bool flag; switch (lowerName) { case "canvas changelog": case "changelog": case "topic": case "patchlogscroll": flag = true; break; default: flag = false; break; } if (flag || lowerOwn == "frissítési napló") { return true; } if (lowerName.Contains("merch") || lowerName == "valheim.shop" || lowerName == "url" || lowerOwn == "valheim.shop") { return true; } if (lowerName == "modded_text" || lowerOwn.Contains("currently playing a modded version") || lowerOwn.Contains("modded version") || lowerOwn.Contains("módosított")) { return true; } return false; } private static string GetOwnText(GameObject go) { TextMeshProUGUI component = go.GetComponent(); if ((Object)(object)component != (Object)null && !string.IsNullOrWhiteSpace(((TMP_Text)component).text)) { return ((TMP_Text)component).text.Trim(); } Text component2 = go.GetComponent(); if (!((Object)(object)component2 != (Object)null) || string.IsNullOrWhiteSpace(component2.text)) { return string.Empty; } return component2.text.Trim(); } [IteratorStateMachine(typeof(d__52))] internal static IEnumerator ReplaceLogoDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__52(0); } private static int ScoreLogo(Image img) { //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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) string text = (((Object)((Component)img).gameObject).name ?? "").ToLowerInvariant(); string text2 = (((Object)(object)img.sprite != (Object)null) ? ((Object)img.sprite).name.ToLowerInvariant() : ""); int num = 0; if (text.Contains("logo")) { num += 100; } if (text.Contains("valheim")) { num += 80; } if (text2.Contains("logo")) { num += 50; } if (((Component)img).gameObject.activeInHierarchy) { num += 15; } if (((Behaviour)img).enabled) { num += 10; } RectTransform rectTransform = ((Graphic)img).rectTransform; if ((Object)(object)rectTransform != (Object)null) { Rect rect = rectTransform.rect; float width = ((Rect)(ref rect)).width; rect = rectTransform.rect; if (Mathf.Abs(width * ((Rect)(ref rect)).height) > 10000f) { num += 10; } if (((Transform)rectTransform).position.y > (float)Screen.height * 0.45f) { num += 10; } } return num; } private static Sprite? LoadSpriteFromDisk(string path) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) try { byte[] data = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!TextureDecode.LoadImage(val, data, markNonReadable: false)) { Object.Destroy((Object)(object)val); return null; } val.Apply(true, false); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } catch (Exception ex) { LogWarn("logo load: " + ex.Message); return null; } } private static void ApplyLogo(Image target, Sprite sp) { //IL_002b: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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) target.sprite = sp; target.overrideSprite = sp; ((Behaviour)target).enabled = true; target.preserveAspect = true; target.type = (Type)0; ((Graphic)target).material = null; ((Graphic)target).color = Color.white; if ((Object)(object)((Graphic)target).rectTransform != (Object)null) { RectTransform rectTransform = ((Graphic)target).rectTransform; Rect rect = sp.rect; float width = ((Rect)(ref rect)).width; rect = sp.rect; rectTransform.sizeDelta = new Vector2(width, ((Rect)(ref rect)).height); ((Transform)((Graphic)target).rectTransform).localScale = Vector3.one; } } internal static TextMeshProUGUI? FindBestMenuTmpText(FejdStartup startup) { if ((Object)(object)startup == (Object)null) { return null; } TextMeshProUGUI result = null; int num = int.MinValue; TextMeshProUGUI[] componentsInChildren = ((Component)startup).GetComponentsInChildren(true); foreach (TextMeshProUGUI val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string text = (((TMP_Text)val).text ?? "").ToLowerInvariant(); string text2 = (((Object)((Component)val).gameObject).name ?? "").ToLowerInvariant(); int num2 = 0; if (text.Contains("start game") || text.Contains("játék indítása")) { num2 += 300; } if (text.Contains("beállitások") || text.Contains("settings")) { num2 += 220; } if (text2.Contains("text")) { num2 += 20; } if (((TMP_Text)val).fontSize >= 20f) { num2 += 15; } if (num2 > num) { num = num2; result = val; } } } return result; } internal static Button? FindBestVisibleMainMenuButton(FejdStartup startup) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0102: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)startup == (Object)null) { return null; } Button result = null; int num = int.MinValue; Button[] componentsInChildren = ((Component)startup).GetComponentsInChildren