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.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; 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: AssemblyTitle("HardheimMainMenu")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HardheimMainMenu")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("91164970-e0e4-4c7e-abd0-b6f8448cec1f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace HardheimMainMenu; [BepInPlugin("h4nz0.valheim.hardheimmainmenu", "Hardheim Main Menu", "1.0.0")] public class HardheimMainMenuPlugin : BaseUnityPlugin { internal struct LoadingTargetResult { public bool IsValid; public bool IsRaw; public Image Image; public RawImage RawImage; public int Score; public string Path; public string ObjectName; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__174_0; public static UnityAction <>9__176_0; internal void b__174_0() { _pendingQuickJoin = true; _pendingServerAddress = ((QuickJoinServerAddress.Value != null) ? QuickJoinServerAddress.Value.Trim() : string.Empty); _pendingServerPassword = QuickJoinServerPassword.Value ?? string.Empty; LogInfo("[Hardheim Main Menu] Hardheim quick join előkészítve. Cím: " + _pendingServerAddress); } internal void b__176_0() { Application.OpenURL("https://discord.gg/T4BATaaxzQ"); LogInfo("[Hardheim Main Menu] Discord meghívó megnyitva."); } } [CompilerGenerated] private sealed class <>c__DisplayClass127_0 { public Sprite customSprite; internal void b__0(Sprite sprite) { customSprite = sprite; } } [CompilerGenerated] private sealed class <>c__DisplayClass154_0 { public Sprite loadedSprite; internal void b__0(Sprite sprite) { loadedSprite = sprite; } } [CompilerGenerated] private sealed class <>c__DisplayClass155_0 { public bool attemptSuccess; internal void b__0(bool result) { attemptSuccess = result; } } [CompilerGenerated] private sealed class <>c__DisplayClass156_0 { public Sprite customSprite; internal void b__0(Sprite sprite) { customSprite = sprite; } } [CompilerGenerated] private sealed class d__175 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private int 5__1; private float 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__175(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00c2; } <>1__state = -1; if ((Object)(object)Instance == (Object)null || !EnableQuickJoinButton.Value) { return false; } 5__1 = Mathf.Max(1, RetryCount.Value); 5__2 = Mathf.Max(0.1f, RetryIntervalSeconds.Value); 5__3 = 1; goto IL_00d5; IL_00c2: 5__3++; goto IL_00d5; IL_00d5: if (5__3 <= 5__1) { if (CreateQuickJoinButton()) { return false; } if (5__3 < 5__1) { <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 1; return true; } goto IL_00c2; } LogWarning("[Hardheim Main Menu] Nem sikerült létrehozni a gyors csatlakozás gombot."); 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__160 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Image targetImage; private float 5__1; private Color 5__2; private float 5__3; private float 5__4; private float 5__5; private Color 5__6; private Color 5__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__160(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)targetImage == (Object)null || (Object)(object)((Component)targetImage).gameObject == (Object)null) { return false; } 5__1 = Mathf.Max(0.01f, FadeDuration.Value); 5__2 = ((Graphic)targetImage).color; 5__2.a = 0f; ((Graphic)targetImage).color = 5__2; 5__3 = 0f; break; case 1: <>1__state = -1; break; } if (5__3 < 5__1) { if ((Object)(object)targetImage == (Object)null || (Object)(object)((Component)targetImage).gameObject == (Object)null) { return false; } 5__3 += Time.unscaledDeltaTime; 5__4 = Mathf.Clamp01(5__3 / 5__1); 5__5 = Mathf.SmoothStep(0f, 1f, 5__4); 5__6 = ((Graphic)targetImage).color; 5__6.a = 5__5; ((Graphic)targetImage).color = 5__6; <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)targetImage != (Object)null) { 5__7 = ((Graphic)targetImage).color; 5__7.a = 1f; ((Graphic)targetImage).color = 5__7; } 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__140 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LoadingTargetResult result; private float 5__1; private float 5__2; private RawImage 5__3; private Color 5__4; private float 5__5; private float 5__6; private float 5__7; private Color 5__8; private Image 5__9; private Color 5__10; private float 5__11; private float 5__12; private float 5__13; private Color 5__14; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__140(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__3 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = Mathf.Max(0.01f, LoadingScreenFadeOutDuration.Value); 5__2 = 0f; if (result.IsRaw) { if ((Object)(object)result.RawImage == (Object)null || (Object)(object)((Component)result.RawImage).gameObject == (Object)null) { _loadingScreenFadeOutCoroutine = null; return false; } 5__3 = result.RawImage; ((Behaviour)5__3).enabled = true; 5__4 = ((Graphic)5__3).color; 5__5 = Mathf.Clamp01(5__4.a); if (5__5 < 0.01f) { 5__5 = 1f; } goto IL_01da; } if ((Object)(object)result.Image == (Object)null || (Object)(object)((Component)result.Image).gameObject == (Object)null) { _loadingScreenFadeOutCoroutine = null; return false; } 5__9 = result.Image; ((Behaviour)5__9).enabled = true; 5__10 = ((Graphic)5__9).color; 5__11 = Mathf.Clamp01(5__10.a); if (5__11 < 0.01f) { 5__11 = 1f; } goto IL_0374; case 1: <>1__state = -1; goto IL_01da; case 2: { <>1__state = -1; goto IL_0374; } IL_01da: if (5__2 < 5__1) { if ((Object)(object)5__3 == (Object)null || (Object)(object)((Component)5__3).gameObject == (Object)null) { _loadingScreenFadeOutCoroutine = null; return false; } 5__2 += Time.unscaledDeltaTime; 5__6 = Mathf.Clamp01(5__2 / 5__1); 5__7 = Mathf.Lerp(5__5, 0f, 5__6); 5__8 = ((Graphic)5__3).color; 5__8.a = 5__7; ((Graphic)5__3).color = 5__8; ((Graphic)5__3).SetAllDirty(); <>2__current = null; <>1__state = 1; return true; } 5__3 = null; break; IL_0374: if (5__2 < 5__1) { if ((Object)(object)5__9 == (Object)null || (Object)(object)((Component)5__9).gameObject == (Object)null) { _loadingScreenFadeOutCoroutine = null; return false; } 5__2 += Time.unscaledDeltaTime; 5__12 = Mathf.Clamp01(5__2 / 5__1); 5__13 = Mathf.Lerp(5__11, 0f, 5__12); 5__14 = ((Graphic)5__9).color; 5__14.a = 5__13; ((Graphic)5__9).color = 5__14; ((Graphic)5__9).SetAllDirty(); <>2__current = null; <>1__state = 2; return true; } 5__9 = null; break; } ClearLoadingTarget(result); _loadingScreenFadeOutCoroutine = 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__98 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private float 5__1; private float 5__2; private float 5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__98(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; if ((Object)(object)_menuMusicSource == (Object)null) { StopMenuMusic(); _menuMusicFadeOutCoroutine = null; return false; } 5__1 = Mathf.Max(0.01f, MenuMusicFadeOutDuration.Value); 5__2 = _menuMusicSource.volume; 5__3 = 0f; break; case 1: <>1__state = -1; break; } if (5__3 < 5__1) { if ((Object)(object)_menuMusicSource == (Object)null) { _menuMusicFadeOutCoroutine = null; return false; } 5__3 += Time.unscaledDeltaTime; 5__4 = Mathf.Clamp01(5__3 / 5__1); _menuMusicSource.volume = Mathf.Lerp(5__2, 0f, 5__4); <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)_menuMusicSource != (Object)null) { _menuMusicSource.volume = 0f; } StopMenuMusic(); _menuMusicFadeOutCoroutine = 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__138 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LoadingTargetResult result; public Sprite sprite; private float 5__1; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__138(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__1 = Mathf.Max(0.5f, LoadingScreenForceDurationSeconds.Value); 5__2 = 0f; LogInfo("[Hardheim Main Menu] Loading force override aktív " + 5__1.ToString("0.00") + " mp-ig. Cél: " + result.ObjectName); break; case 1: <>1__state = -1; break; } if (5__2 < 5__1) { if (IsWorldFullyLoaded()) { LogInfo("[Hardheim Main Menu] Világ betöltve, loading target fade-out indul."); FadeOutAndClearLoadingTarget(result); return false; } if (!result.IsValid) { return false; } if (result.IsRaw) { if ((Object)(object)result.RawImage == (Object)null || (Object)(object)((Component)result.RawImage).gameObject == (Object)null) { return false; } ApplyLoadingRawImage(result.RawImage, sprite); } else { if ((Object)(object)result.Image == (Object)null || (Object)(object)((Component)result.Image).gameObject == (Object)null) { return false; } ApplyLoadingImage(result.Image, sprite); } 5__2 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 1; return true; } LogInfo("[Hardheim Main Menu] Loading force override lejárt."); 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__125 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__125(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 switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSecondsRealtime(1f); <>1__state = 1; return true; case 1: <>1__state = -1; HideQuickJoinOverlay(); 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__169 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private int 5__1; private float 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__169(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00ac; } <>1__state = -1; if ((Object)(object)Instance == (Object)null) { return false; } 5__1 = Mathf.Max(1, HideUiPasses.Value); 5__2 = Mathf.Max(0.05f, HideUiIntervalSeconds.Value); 5__3 = 0; goto IL_00bd; IL_00ac: 5__3++; goto IL_00bd; IL_00bd: if (5__3 < 5__1) { HideUnwantedMainMenuUi(); if (5__3 < 5__1 - 1) { <>2__current = (object)new WaitForSeconds(5__2); <>1__state = 1; return true; } goto IL_00ac; } 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__154 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private <>c__DisplayClass154_0 <>8__1; private string 5__2; private float 5__3; private float 5__4; private float 5__5; private float 5__6; private Transform 5__7; private float 5__8; private float 5__9; private float 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__154(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass154_0(); if ((Object)(object)_discordLogoImage == (Object)null) { return false; } 5__2 = GetDiscordLogoPath(); if (!File.Exists(5__2)) { return false; } <>8__1.loadedSprite = null; <>2__current = ((MonoBehaviour)Instance).StartCoroutine(LoadSpriteFromFileCoroutine(5__2, delegate(Sprite sprite) { <>8__1.loadedSprite = sprite; })); <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)<>8__1.loadedSprite == (Object)null) { return false; } _discordLogoSprite = <>8__1.loadedSprite; _discordLogoImage.sprite = _discordLogoSprite; ((Graphic)_discordLogoImage).color = Color.white; _discordLogoImage.preserveAspect = true; 5__3 = 340f; 5__4 = 200f; Rect rect = _discordLogoSprite.rect; 5__5 = ((Rect)(ref rect)).width; rect = _discordLogoSprite.rect; 5__6 = ((Rect)(ref rect)).height; if (5__5 > 0f && 5__6 > 0f && (Object)(object)_discordLogoLayout != (Object)null) { 5__8 = 5__5 / 5__6; 5__9 = 5__3; 5__10 = 5__9 / 5__8; if (5__10 > 5__4) { 5__10 = 5__4; 5__9 = 5__10 * 5__8; } _discordLogoLayout.preferredWidth = 5__9; _discordLogoLayout.preferredHeight = 5__10; LogInfo("[Hardheim Main Menu] Discord logó méretezve: " + 5__9.ToString("0.##") + " x " + 5__10.ToString("0.##")); } 5__7 = ((Component)_discordLogoImage).transform.Find("DiscordGlyph"); if ((Object)(object)5__7 != (Object)null) { ((Component)5__7).gameObject.SetActive(false); } LogInfo("[Hardheim Main Menu] Discord logó betöltve: " + 5__2); 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__153 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string filePath; public Action onLoaded; private string 5__1; private UnityWebRequest 5__2; private Texture2D 5__3; private Sprite 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__153(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Invalid comparison between Unknown and I4 //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) bool result2; try { switch (<>1__state) { default: result2 = false; break; case 0: <>1__state = -1; if (string.IsNullOrWhiteSpace(filePath) || !File.Exists(filePath)) { if (onLoaded != null) { onLoaded(null); } result2 = false; } else { 5__1 = "file:///" + filePath.Replace("\\", "/"); LogVerbose("[Hardheim Main Menu] Kép betöltése innen: " + 5__1); 5__2 = UnityWebRequestTexture.GetTexture(5__1); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result2 = true; } break; case 1: <>1__state = -3; if ((int)5__2.result != 1) { Result result = 5__2.result; LogError("[Hardheim Main Menu] Hiba a kép betöltése közben: " + ((object)(Result)(ref result)).ToString() + " | " + 5__2.error); if (onLoaded != null) { onLoaded(null); } result2 = false; } else { 5__3 = DownloadHandlerTexture.GetContent(5__2); if (!((Object)(object)5__3 == (Object)null)) { ((Object)5__3).name = Path.GetFileNameWithoutExtension(filePath); ((Texture)5__3).wrapMode = (TextureWrapMode)1; ((Texture)5__3).filterMode = (FilterMode)1; 5__4 = Sprite.Create(5__3, new Rect(0f, 0f, (float)((Texture)5__3).width, (float)((Texture)5__3).height), new Vector2(0.5f, 0.5f), 100f); ((Object)5__4).name = Path.GetFileNameWithoutExtension(filePath); LogInfo("[Hardheim Main Menu] Kép betöltve: " + ((Texture)5__3).width + "x" + ((Texture)5__3).height); if (onLoaded != null) { onLoaded(5__4); } 5__3 = null; 5__4 = null; <>m__Finally1(); 5__2 = null; result2 = false; break; } if (onLoaded != null) { onLoaded(null); } result2 = false; } <>m__Finally1(); break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result2; } 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__112 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; private float 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__112(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0f; break; case 1: <>1__state = -1; break; } if (5__1 < duration) { MuteVanillaMenuMusic(); 5__1 += 0.5f; <>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__155 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private float 5__1; private int 5__2; private float 5__3; private int 5__4; private bool 5__5; private int 5__6; private <>c__DisplayClass155_0 <>8__7; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__155(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)Instance == (Object)null || _replaceRoutineStarted) { return false; } _replaceRoutineStarted = true; 5__1 = Mathf.Max(0f, ReplaceDelaySeconds.Value); if (5__1 > 0f) { LogInfo("[Hardheim Main Menu] Várakozás " + 5__1.ToString("0.00") + " mp-ig az első logócsere előtt."); <>2__current = (object)new WaitForSeconds(5__1); <>1__state = 1; return true; } goto IL_00cf; case 1: <>1__state = -1; goto IL_00cf; case 2: <>1__state = -1; if (<>8__7.attemptSuccess) { 5__5 = true; LogInfo("[Hardheim Main Menu] A logócsere sikeres volt a(z) " + 5__6 + ". próbálkozásra."); break; } if (5__6 < 5__2) { <>2__current = (object)new WaitForSeconds(5__3); <>1__state = 3; return true; } goto IL_024a; case 3: { <>1__state = -1; goto IL_024a; } IL_0264: if (5__6 <= 5__2) { <>8__7 = new <>c__DisplayClass155_0(); LogInfo("[Hardheim Main Menu] Logócsere próbálkozás: " + 5__6 + "/" + 5__2); <>8__7.attemptSuccess = false; <>2__current = ((MonoBehaviour)Instance).StartCoroutine(TryReplaceLogoCoroutine(delegate(bool result) { <>8__7.attemptSuccess = result; }, 5__4)); <>1__state = 2; return true; } break; IL_00cf: 5__2 = GetRetryAttemptsByMode(); 5__3 = GetRetryIntervalByMode(); 5__4 = GetMinimumScoreByMode(); LogInfo("[Hardheim Main Menu] Logócsere indul. Próbálkozások száma: " + 5__2 + ", intervallum: " + 5__3.ToString("0.00") + " mp, minimum pontszám: " + 5__4); 5__5 = false; 5__6 = 1; goto IL_0264; IL_024a: <>8__7 = null; 5__6++; goto IL_0264; } if (!5__5) { LogWarning("[Hardheim Main Menu] A logócsere egyik próbálkozás során sem sikerült."); } _replaceRoutineStarted = 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__113 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private string 5__1; private string 5__2; private float 5__3; private float 5__4; private float 5__5; private float 5__6; private WWW 5__7; private AudioClip 5__8; private float 5__9; private float 5__10; private float 5__11; private float 5__12; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__113(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 2) <= 1u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; 5__7 = null; 5__8 = null; <>1__state = -2; } private bool MoveNext() { //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; if ((Object)(object)Instance == (Object)null) { result = false; } else if (EnableMenuMusic == null || !EnableMenuMusic.Value) { StopMenuMusic(); result = false; } else if (_menuMusicStarting) { result = false; } else if (IsMenuMusicPlaying()) { UpdateMenuMusicSettings(); result = false; } else { _menuMusicStarting = true; 5__1 = GetMusicPath(); if (string.IsNullOrWhiteSpace(5__1) || !File.Exists(5__1)) { LogWarning("[Hardheim Main Menu] Nem található a főmenü zene: " + 5__1); _menuMusicStarting = false; result = false; } else { EnsureMenuMusicObject(); UpdateMenuMusicSettings(); MuteVanillaMenuMusic(); if ((Object)(object)_menuMusicClip != (Object)null) { _menuMusicSource.clip = _menuMusicClip; _menuMusicSource.volume = 0f; _menuMusicSource.Play(); 5__3 = Mathf.Clamp01(MenuMusicVolume.Value); 5__4 = 1f; 5__5 = 0f; goto IL_01ec; } 5__2 = "file:///" + 5__1.Replace("\\", "/"); 5__7 = new WWW(5__2); <>1__state = -3; <>2__current = 5__7; <>1__state = 2; result = true; } } goto end_IL_0000; case 1: <>1__state = -1; goto IL_01ec; case 2: <>1__state = -3; if (!string.IsNullOrEmpty(5__7.error)) { LogError("[Hardheim Main Menu] Hiba a zene betöltésekor: " + 5__7.error); _menuMusicStarting = false; result = false; break; } 5__8 = 5__7.GetAudioClip(false, true, (AudioType)14); if ((Object)(object)5__8 == (Object)null) { LogError("[Hardheim Main Menu] AudioClip null."); _menuMusicStarting = false; result = false; break; } _menuMusicClip = 5__8; _menuMusicSource.clip = _menuMusicClip; _menuMusicSource.volume = 0f; _menuMusicSource.Play(); 5__9 = Mathf.Clamp01(MenuMusicVolume.Value); 5__10 = 1f; 5__11 = 0f; goto IL_03d6; case 3: { <>1__state = -3; goto IL_03d6; } IL_01ec: if (5__5 < 5__4) { 5__5 += Time.unscaledDeltaTime; 5__6 = Mathf.Clamp01(5__5 / 5__4); _menuMusicSource.volume = Mathf.Lerp(0f, 5__3, 5__6); <>2__current = null; <>1__state = 1; result = true; } else { _menuMusicSource.volume = 5__3; LogInfo("[Hardheim Main Menu] Főmenü zene elindítva cache-ből (fade-in)."); _menuMusicStarting = false; result = false; } goto end_IL_0000; IL_03d6: if (5__11 < 5__10) { 5__11 += Time.unscaledDeltaTime; 5__12 = Mathf.Clamp01(5__11 / 5__10); _menuMusicSource.volume = Mathf.Lerp(0f, 5__9, 5__12); <>2__current = null; <>1__state = 3; result = true; } else { _menuMusicSource.volume = 5__9; LogInfo("[Hardheim Main Menu] Főmenü zene elindítva (fade-in)."); 5__8 = null; <>m__Finally1(); 5__7 = null; _menuMusicStarting = false; result = false; } goto end_IL_0000; } <>m__Finally1(); 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; if (5__7 != null) { ((IDisposable)5__7).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__122 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public FejdStartup startup; private float 5__1; private float 5__2; private int 5__3; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__122(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)startup == (Object)null) { return false; } ShowQuickJoinOverlay(); 5__1 = 1.25f; 5__2 = 0f; goto IL_0096; case 1: <>1__state = -1; goto IL_0096; case 2: { <>1__state = -1; 5__3++; break; } IL_0096: if (5__2 < 5__1) { HideWorldSelectIfVisible(startup); 5__2 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 1; return true; } 5__3 = 0; break; } if (5__3 < 20) { HideWorldSelectIfVisible(startup); <>2__current = (object)new WaitForSecondsRealtime(0.02f); <>1__state = 2; 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__156 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Action onFinished; public int minimumScore; private <>c__DisplayClass156_0 <>8__1; private string 5__2; private Image[] 5__3; private Image 5__4; private int 5__5; private bool 5__6; private Image[] <>s__7; private int <>s__8; private Image 5__9; private int 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__156(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>s__7 = null; 5__9 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass156_0(); 5__2 = GetLogoPath(); <>8__1.customSprite = null; <>2__current = ((MonoBehaviour)Instance).StartCoroutine(LoadSpriteFromFileCoroutine(5__2, delegate(Sprite sprite) { <>8__1.customSprite = sprite; })); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>8__1.customSprite == (Object)null) { if (onFinished != null) { onFinished(obj: false); } return false; } 5__3 = Resources.FindObjectsOfTypeAll(); if (5__3 == null || 5__3.Length == 0) { if (onFinished != null) { onFinished(obj: false); } return false; } LogInfo("[Hardheim Main Menu] Talált Image objektumok száma: " + 5__3.Length); if (DumpAllImages.Value) { DumpImageCandidates(5__3); } 5__4 = null; 5__5 = int.MinValue; <>s__7 = 5__3; for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++) { 5__9 = <>s__7[<>s__8]; if (!((Object)(object)5__9 == (Object)null) && !((Object)(object)((Component)5__9).gameObject == (Object)null)) { 5__10 = CalculateImageScore(5__9); if (5__10 > 5__5) { 5__5 = 5__10; 5__4 = 5__9; } 5__9 = null; } } <>s__7 = null; if ((Object)(object)5__4 == (Object)null || 5__5 < minimumScore) { if (onFinished != null) { onFinished(obj: false); } return false; } ApplyLogo(5__4, <>8__1.customSprite); 5__6 = EnableFade.Value && !_fadeAlreadyPlayed; if (5__6) { _fadeAlreadyPlayed = true; <>2__current = ((MonoBehaviour)Instance).StartCoroutine(FadeInLogoCoroutine(5__4)); <>1__state = 2; return true; } break; case 2: <>1__state = -1; break; } _lastAppliedObjectName = ((Object)((Component)5__4).gameObject).name; LogInfo("[Hardheim Main Menu] A logó sikeresen lecserélve erre az objektumra: " + ((Object)((Component)5__4).gameObject).name + " | Pontszám: " + 5__5); if (onFinished != null) { onFinished(obj: 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__127 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private <>c__DisplayClass127_0 <>8__1; private float 5__2; private string 5__3; private float 5__4; private float 5__5; private float 5__6; private bool 5__7; private GameObject 5__8; private LoadingTargetResult 5__9; private bool 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__127(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 3u) { try { } finally { <>m__Finally1(); } } <>8__1 = null; 5__3 = null; 5__8 = null; 5__9 = default(LoadingTargetResult); <>1__state = -2; } private bool MoveNext() { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; goto end_IL_0000; case 0: <>1__state = -1; _loadingScreenWatcherRunning = true; _loadingGuiDumped = false; _loadingScreenLocked = false; _loadingScreenAppliedOnce = false; _lastAppliedLoadingObjectName = string.Empty; _lastAppliedLoadingPath = string.Empty; StopLoadingScreenForce(); StopLoadingScreenCleanup(); StopLoadingScreenFadeOut(); <>1__state = -3; <>8__1 = new <>c__DisplayClass127_0(); 5__2 = Mathf.Max(0f, LoadingScreenInitialDelaySeconds.Value); if (!(5__2 > 0f)) { LogInfo("[Hardheim Main Menu] Loading screen watcher azonnal indul."); goto IL_0122; } LogInfo("[Hardheim Main Menu] Loading screen watcher indul " + 5__2.ToString("0.00") + " mp késleltetéssel."); <>2__current = (object)new WaitForSecondsRealtime(5__2); <>1__state = 1; result = true; goto end_IL_0000; case 1: <>1__state = -3; goto IL_0122; case 2: <>1__state = -3; if ((Object)(object)<>8__1.customSprite == (Object)null) { LogWarning("[Hardheim Main Menu] A loading screen betöltése sikertelen: " + 5__3); result = false; break; } 5__4 = Mathf.Max(0f, LoadingScreenPostSceneDelaySeconds.Value); if (!(5__4 > 0f)) { goto IL_021d; } <>2__current = (object)new WaitForSecondsRealtime(5__4); <>1__state = 3; result = true; goto end_IL_0000; case 3: <>1__state = -3; goto IL_021d; case 4: { <>1__state = -3; 5__8 = null; goto IL_0407; } IL_0122: 5__3 = GetNextLoadingScreenPath(); if (string.IsNullOrWhiteSpace(5__3)) { result = false; break; } <>8__1.customSprite = null; <>2__current = ((MonoBehaviour)Instance).StartCoroutine(LoadSpriteFromFileCoroutine(5__3, delegate(Sprite sprite) { <>8__1.customSprite = sprite; })); <>1__state = 2; result = true; goto end_IL_0000; IL_021d: 5__5 = Mathf.Max(0.02f, LoadingScreenSearchIntervalSeconds.Value); 5__6 = Mathf.Max(5f, LoadingScreenHardTimeoutSeconds.Value); 5__7 = false; goto IL_0407; IL_0407: if (5__6 > 0f) { if (IsWorldFullyLoaded()) { LogInfo("[Hardheim Main Menu] A világ betöltött, loading watcher leáll."); result = false; break; } 5__8 = FindLoadingGuiObject(); if ((Object)(object)5__8 != (Object)null) { 5__7 = true; if (DumpLoadingGuiOnce.Value && !_loadingGuiDumped) { DumpLoadingGuiElements(); _loadingGuiDumped = true; } 5__9 = FindBestConnectedWorldLoadingTarget(); if (5__9.IsValid) { 5__10 = ApplyLoadingTargetResult(5__9, <>8__1.customSprite); if (5__10) { _loadingScreenAppliedOnce = true; _loadingScreenLocked = true; LogInfo("[Hardheim Main Menu] Loading screen cserélve és force override indul. Fájl: " + 5__3 + " | Cél objektum: " + 5__9.ObjectName + " | Pontszám: " + 5__9.Score + " | Path: " + 5__9.Path); StartForceKeepLoadingTarget(5__9, <>8__1.customSprite); StartLoadingScreenCleanup(5__9); result = false; break; } } 5__9 = default(LoadingTargetResult); } 5__6 -= 5__5; <>2__current = (object)new WaitForSecondsRealtime(5__5); <>1__state = 4; result = true; } else { if (!5__7) { LogWarning("[Hardheim Main Menu] A LoadingGUI nem jelent meg időben."); } else { LogWarning("[Hardheim Main Menu] Nem találtam megfelelő loading screen célobjektumot időben."); } <>8__1 = null; 5__3 = null; <>m__Finally1(); result = false; } goto end_IL_0000; } <>m__Finally1(); 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; _loadingScreenWatcherRunning = false; } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__131 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public LoadingTargetResult result; private float 5__1; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__131(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__1 = Mathf.Max(10f, LoadingScreenCleanupTimeoutSeconds.Value); 5__2 = 0f; LogVerbose("[Hardheim Main Menu] Loading cleanup watcher elindult. Cél: " + result.ObjectName); break; case 1: <>1__state = -1; break; } if (5__2 < 5__1) { if (IsWorldFullyLoaded()) { LogInfo("[Hardheim Main Menu] Világ betöltve, loading target fade-out indul cleanup watcherből."); FadeOutAndClearLoadingTarget(result); return false; } 5__2 += Time.unscaledDeltaTime; <>2__current = null; <>1__state = 1; return true; } LogWarning("[Hardheim Main Menu] A loading cleanup watcher időtúllépéssel leállt."); 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 = "h4nz0.valheim.hardheimmainmenu"; public const string ModName = "Hardheim Main Menu"; public const string ModVersion = "1.0.0"; public const string AssetFolderName = "HardheimMainMenu"; public const string LoadingScreensFolderName = "LoadingScreens"; public const string MusicFolderName = "Music"; private const string DiscordUrl = "https://discord.gg/T4BATaaxzQ"; private const string QuickJoinFixedButtonText = "Csatlakozás Hardheimre"; private const int LoadingScreenMinimumReplaceScore = 300; internal static HardheimMainMenuPlugin Instance; internal static ManualLogSource Log; private Harmony _harmony; internal static ConfigEntry ModEnabled; internal static ConfigEntry EnableLogging; internal static ConfigEntry VerboseLogging; internal static ConfigEntry LogoFileName; internal static ConfigEntry DiscordLogoFileName; internal static ConfigEntry ReplaceDelaySeconds; internal static ConfigEntry UseFixedSize; internal static ConfigEntry FixedWidth; internal static ConfigEntry FixedHeight; internal static ConfigEntry LogoScale; internal static ConfigEntry EnableFade; internal static ConfigEntry FadeDuration; internal static ConfigEntry CompatibilityMode; internal static ConfigEntry RetryCount; internal static ConfigEntry RetryIntervalSeconds; internal static ConfigEntry MinimumScoreThreshold; internal static ConfigEntry DumpLoadingGuiOnce; internal static ConfigEntry DumpAllImages; internal static ConfigEntry HidePatchNotes; internal static ConfigEntry HideModdedWarning; internal static ConfigEntry HideMerchStore; internal static ConfigEntry HideUiPasses; internal static ConfigEntry HideUiIntervalSeconds; internal static ConfigEntry EnableQuickJoinButton; internal static ConfigEntry QuickJoinServerAddress; internal static ConfigEntry QuickJoinServerPassword; internal static ConfigEntry QuickJoinButtonSpacing; internal static ConfigEntry EnableCustomLoadingScreens; internal static ConfigEntry RandomizeLoadingScreens; internal static ConfigEntry LoadingScreenWaitForConnectionSeconds; internal static ConfigEntry LoadingScreenSearchIntervalSeconds; internal static ConfigEntry LoadingScreenInitialDelaySeconds; internal static ConfigEntry LoadingScreenPostSceneDelaySeconds; internal static ConfigEntry LoadingScreenForceDurationSeconds; internal static ConfigEntry LoadingScreenHardTimeoutSeconds; internal static ConfigEntry LoadingScreenCleanupTimeoutSeconds; internal static ConfigEntry EnableLoadingScreenFadeOut; internal static ConfigEntry LoadingScreenFadeOutDuration; internal static ConfigEntry EnableMenuMusic; internal static ConfigEntry MenuMusicFileName; internal static ConfigEntry MenuMusicVolume; internal static ConfigEntry MenuMusicLoop; internal static ConfigEntry EnableMenuMusicFadeOut; internal static ConfigEntry MenuMusicFadeOutDuration; private static bool _replaceRoutineStarted; private static bool _fadeAlreadyPlayed; private static bool _quickJoinButtonCreated; private static bool _pendingQuickJoin; private static bool _loadingScreenWatcherRunning; private static bool _loadingGuiDumped; private static bool _loadingScreenLocked; private static bool _loadingScreenAppliedOnce; private static bool _menuMusicStarting; private static string _pendingServerAddress = string.Empty; private static string _pendingServerPassword = string.Empty; private static string _lastAppliedObjectName = string.Empty; private static string _lastAppliedLoadingObjectName = string.Empty; private static string _lastAppliedLoadingPath = string.Empty; private static int _lastLoadingScreenIndex = -1; private static Button _originalJoinButton; private static Button _quickJoinButton; private static GameObject _quickJoinOverlay; private static Canvas _quickJoinOverlayCanvas; private static GameObject _discordPanel; private static Button _discordButton; private static Image _discordLogoImage; private static Sprite _discordLogoSprite; private static LayoutElement _discordLogoLayout; private static Coroutine _loadingScreenForceCoroutine; private static Coroutine _loadingScreenCleanupCoroutine; private static Coroutine _loadingScreenFadeOutCoroutine; private static Coroutine _menuMusicCoroutine; private static GameObject _menuMusicObject; private static AudioSource _menuMusicSource; private static AudioClip _menuMusicClip; private static Coroutine _menuMusicFadeOutCoroutine; private static readonly List _mutedVanillaMenuSources = new List(); private void Awake() { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; InitConfig(); EnsureAssetFolders(); if (Chainloader.PluginInfos.ContainsKey("h4nz0.valheim.swaplogo")) { LogWarning("[Hardheim Main Menu] SwapLogo mod észlelve! Kérlek csak az egyiket használd."); } try { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { string text = pluginInfo.Key.ToLowerInvariant(); string name = pluginInfo.Value.Metadata.Name; if (!(text == "h4nz0.valheim.hardheimmainmenu".ToLowerInvariant()) && (text.Contains("ui") || text.Contains("menu") || text.Contains("hud") || text.Contains("gui") || text.Contains("interface"))) { LogWarning("[Hardheim Main Menu] Lehetséges UI mod detektálva: " + name + " (" + pluginInfo.Key + ")"); } } } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba UI modok ellenőrzésekor: " + ex); } if (!ModEnabled.Value) { LogInfo("[Hardheim Main Menu] A mod ki van kapcsolva a configban."); return; } _harmony = new Harmony("h4nz0.valheim.hardheimmainmenu"); _harmony.PatchAll(); LogInfo("[Hardheim Main Menu] Betöltve."); LogInfo("[Hardheim Main Menu] Asset mappa: " + GetAssetFolderPath()); LogInfo("[Hardheim Main Menu] Logó elérési út: " + GetLogoPath()); LogInfo("[Hardheim Main Menu] Discord logó elérési út: " + GetDiscordLogoPath()); LogInfo("[Hardheim Main Menu] Loading screen mappa: " + GetLoadingScreensFolderPath()); LogInfo("[Hardheim Main Menu] Music mappa: " + GetMusicFolderPath()); LogInfo("[Hardheim Main Menu] Kompatibilitási mód: " + CompatibilityMode.Value); } private void OnDestroy() { _quickJoinButtonCreated = false; _quickJoinButton = null; _originalJoinButton = null; _discordButton = null; _discordLogoImage = null; _discordLogoSprite = null; _discordLogoLayout = null; _loadingScreenWatcherRunning = false; _loadingGuiDumped = false; _loadingScreenLocked = false; _loadingScreenAppliedOnce = false; _lastAppliedLoadingObjectName = string.Empty; _lastAppliedLoadingPath = string.Empty; _menuMusicStarting = false; StopLoadingScreenForce(); StopLoadingScreenCleanup(); StopLoadingScreenFadeOut(); StopMenuMusic(); if (_menuMusicCoroutine != null && (Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StopCoroutine(_menuMusicCoroutine); _menuMusicCoroutine = null; } if (_menuMusicFadeOutCoroutine != null && (Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StopCoroutine(_menuMusicFadeOutCoroutine); _menuMusicFadeOutCoroutine = null; } if (_harmony != null) { _harmony.UnpatchSelf(); } HideQuickJoinOverlay(); } private void InitConfig() { ModEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "A mod be- vagy kikapcsolása."); EnableLogging = ((BaseUnityPlugin)this).Config.Bind("General", "EnableLogging", true, "Általános információs és figyelmeztető logok kiírása. Ha kikapcsolod, a mod sokkal csendesebb lesz."); VerboseLogging = ((BaseUnityPlugin)this).Config.Bind("General", "VerboseLogging", false, "Részletes, hibakereséshez hasznos plusz logok. Csak akkor kapcsold be, ha tesztelünk valamit."); LogoFileName = ((BaseUnityPlugin)this).Config.Bind("General", "LogoFileName", "logo.png", "A betöltendő logófájl neve a HardheimMainMenu mappából."); DiscordLogoFileName = ((BaseUnityPlugin)this).Config.Bind("General", "DiscordLogoFileName", "discord.png", "A betöltendő Discord logófájl neve a HardheimMainMenu mappából."); ReplaceDelaySeconds = ((BaseUnityPlugin)this).Config.Bind("General", "ReplaceDelaySeconds", 0.75f, "Ennyi másodpercet vár a főmenü indulása után, mielőtt megpróbálja lecserélni a logót."); UseFixedSize = ((BaseUnityPlugin)this).Config.Bind("Display", "UseFixedSize", true, "Fix UI méretet használjon a logóhoz."); FixedWidth = ((BaseUnityPlugin)this).Config.Bind("Display", "FixedWidth", 900f, "A logó fix szélessége UI egységben."); FixedHeight = ((BaseUnityPlugin)this).Config.Bind("Display", "FixedHeight", 260f, "A logó fix magassága UI egységben."); LogoScale = ((BaseUnityPlugin)this).Config.Bind("Display", "LogoScale", 1f, "A logó méretezése a fix méret után. 1.0 = alap, 0.8 = kisebb, 1.2 = nagyobb."); EnableFade = ((BaseUnityPlugin)this).Config.Bind("Animation", "EnableFade", true, "Áttűnéses animáció használata a logócsere után."); FadeDuration = ((BaseUnityPlugin)this).Config.Bind("Animation", "FadeDuration", 0.8f, "Az áttűnés animáció hossza másodpercben."); CompatibilityMode = ((BaseUnityPlugin)this).Config.Bind("Compatibility", "CompatibilityMode", "Auto", "Kompatibilitási mód. Lehetséges értékek: Strict, Auto, Aggressive."); RetryCount = ((BaseUnityPlugin)this).Config.Bind("Compatibility", "RetryCount", 4, "Hányszor próbálja meg újra a logócserét, ha elsőre nem sikerül."); RetryIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind("Compatibility", "RetryIntervalSeconds", 0.75f, "Ennyi időt vár két újrapróbálkozás között."); MinimumScoreThreshold = ((BaseUnityPlugin)this).Config.Bind("Compatibility", "MinimumScoreThreshold", 50, "A minimális pontszám, ami felett egy UI elem megfelelő jelöltnek számít."); DumpLoadingGuiOnce = ((BaseUnityPlugin)this).Config.Bind("Debug", "DumpLoadingGuiOnce", false, "Ha igaz, egyszer kilogolja a LoadingGUI alatti elemeket world loading közben."); DumpAllImages = ((BaseUnityPlugin)this).Config.Bind("Debug", "DumpAllImages", false, "Ha engedélyezve van, kilogolja az összes talált UI Image objektumot és pontszámukat."); HidePatchNotes = ((BaseUnityPlugin)this).Config.Bind("HideUI", "HidePatchNotes", true, "Elrejti a főmenü frissítési napló / patch notes / news elemeit."); HideModdedWarning = ((BaseUnityPlugin)this).Config.Bind("HideUI", "HideModdedWarning", true, "Elrejti a figyelmeztetést, hogy modolt Valheim klienst használsz."); HideMerchStore = ((BaseUnityPlugin)this).Config.Bind("HideUI", "HideMerchStore", true, "Elrejti a merch store / shop elemeket a főmenüből."); HideUiPasses = ((BaseUnityPlugin)this).Config.Bind("HideUI", "HideUiPasses", 8, "Hányszor próbálja meg újra elrejteni a főmenü nem kívánt elemeit."); HideUiIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind("HideUI", "HideUiIntervalSeconds", 0.5f, "Ennyi időt vár két UI-elrejtési próbálkozás között."); EnableQuickJoinButton = ((BaseUnityPlugin)this).Config.Bind("Hardheim", "EnableQuickJoinButton", true, "Megjelenítse-e a gyors csatlakozás gombot a főmenüben."); QuickJoinServerAddress = ((BaseUnityPlugin)this).Config.Bind("Hardheim", "ServerAddress", "62.113.194.164:11115", "A Hardheim szerver címe IP:PORT formában."); QuickJoinServerPassword = ((BaseUnityPlugin)this).Config.Bind("Hardheim", "ServerPassword", "hardheim", "A Hardheim szerver jelszava."); QuickJoinButtonSpacing = ((BaseUnityPlugin)this).Config.Bind("Hardheim", "ButtonSpacing", 14f, "A gyors csatlakozás gomb távolsága a referencia főmenü gombhoz képest."); EnableCustomLoadingScreens = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "EnableCustomLoadingScreens", true, "Engedélyezi az egyedi töltőképeket a világ betöltése közben."); RandomizeLoadingScreens = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "RandomizeLoadingScreens", true, "Ha több kép van a LoadingScreens mappában, véletlenszerűen választ közülük."); LoadingScreenWaitForConnectionSeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "WaitForConnectionSeconds", 20f, "Régi kompatibilitási beállítás. Az új watcher már nem erre épül, de kompatibilitási okból megmaradt."); LoadingScreenSearchIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "SearchIntervalSeconds", 0.03f, "Ennyi idő teljen el két loading screen keresés között. Kisebb érték gyorsabb reakciót ad, de sűrűbben fut."); LoadingScreenInitialDelaySeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "InitialDelaySeconds", 10f, "Ennyit vár az OnJoinStart után, mielőtt megpróbálja elkapni a loading screen UI-t. Ha túl korán indul, nem talál célobjektumot; ha túl későn, lemaradhat róla."); LoadingScreenPostSceneDelaySeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "PostSceneDelaySeconds", 0f, "Extra várakozás a scene-váltás után, mielőtt a loading target keresése elindul."); LoadingScreenForceDurationSeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "ForceDurationSeconds", 8f, "Ennyi ideig erőltesse vissza a kiválasztott loading képet ugyanarra a célobjektumra."); LoadingScreenHardTimeoutSeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "HardTimeoutSeconds", 25f, "Maximum ennyi ideig figyelje a loading UI-t, mielőtt feladja a keresést."); LoadingScreenCleanupTimeoutSeconds = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "CleanupTimeoutSeconds", 120f, "Maximum ennyi ideig várjon arra, hogy a világ ténylegesen betöltődjön, majd eltüntesse a loading screen célobjektumot."); EnableLoadingScreenFadeOut = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "EnableFadeOut", true, "A custom loading screen finoman tűnjön el, amikor a világ betöltött."); LoadingScreenFadeOutDuration = ((BaseUnityPlugin)this).Config.Bind("LoadingScreens", "FadeOutDuration", 0.6f, "A custom loading screen fade-out ideje másodpercben."); EnableMenuMusic = ((BaseUnityPlugin)this).Config.Bind("Music", "EnableMenuMusic", true, "Saját főmenü zene lejátszása."); MenuMusicFileName = ((BaseUnityPlugin)this).Config.Bind("Music", "MenuMusicFileName", "menu.ogg", "A lejátszandó zenefájl neve a HardheimMainMenu/Music mappából."); MenuMusicVolume = ((BaseUnityPlugin)this).Config.Bind("Music", "MenuMusicVolume", 0.55f, "A főmenü zene hangereje. 0.0 és 1.0 között."); MenuMusicLoop = ((BaseUnityPlugin)this).Config.Bind("Music", "MenuMusicLoop", true, "A főmenü zene újrainduljon, ha véget ér."); EnableMenuMusicFadeOut = ((BaseUnityPlugin)this).Config.Bind("Music", "EnableFadeOut", true, "A főmenü zene finoman halkuljon el, amikor csatlakozol a világhoz."); MenuMusicFadeOutDuration = ((BaseUnityPlugin)this).Config.Bind("Music", "FadeOutDuration", 1.5f, "A főmenü zene fade-out ideje másodpercben."); ((BaseUnityPlugin)this).Config.Save(); } internal static void LogInfo(string message) { if ((EnableLogging == null || EnableLogging.Value) && Log != null) { Log.LogInfo((object)message); } } internal static void LogWarning(string message) { if ((EnableLogging == null || EnableLogging.Value) && Log != null) { Log.LogWarning((object)message); } } internal static void LogError(string message) { if (Log != null) { Log.LogError((object)message); } } internal static void LogVerbose(string message) { if ((EnableLogging == null || EnableLogging.Value) && VerboseLogging != null && VerboseLogging.Value && Log != null) { Log.LogInfo((object)message); } } internal static void EnsureAssetFolders() { try { string assetFolderPath = GetAssetFolderPath(); string loadingScreensFolderPath = GetLoadingScreensFolderPath(); string musicFolderPath = GetMusicFolderPath(); if (!Directory.Exists(assetFolderPath)) { Directory.CreateDirectory(assetFolderPath); LogInfo("[Hardheim Main Menu] Asset mappa létrehozva: " + assetFolderPath); } if (!Directory.Exists(loadingScreensFolderPath)) { Directory.CreateDirectory(loadingScreensFolderPath); LogInfo("[Hardheim Main Menu] LoadingScreens mappa létrehozva: " + loadingScreensFolderPath); } if (!Directory.Exists(musicFolderPath)) { Directory.CreateDirectory(musicFolderPath); LogInfo("[Hardheim Main Menu] Music mappa létrehozva: " + musicFolderPath); } } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba az asset mappák létrehozásakor: " + ex); } } internal static void FadeOutAndStopMenuMusic() { if ((Object)(object)Instance == (Object)null) { StopMenuMusic(); return; } if ((Object)(object)_menuMusicSource == (Object)null || (Object)(object)_menuMusicObject == (Object)null) { StopMenuMusic(); return; } if (EnableMenuMusicFadeOut == null || !EnableMenuMusicFadeOut.Value) { StopMenuMusic(); return; } if (_menuMusicFadeOutCoroutine != null) { ((MonoBehaviour)Instance).StopCoroutine(_menuMusicFadeOutCoroutine); _menuMusicFadeOutCoroutine = null; } _menuMusicFadeOutCoroutine = ((MonoBehaviour)Instance).StartCoroutine(FadeOutAndStopMenuMusicCoroutine()); } [IteratorStateMachine(typeof(d__98))] internal static IEnumerator FadeOutAndStopMenuMusicCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__98(0); } internal static string GetPluginFolderPath() { try { if ((Object)(object)Instance == (Object)null || ((BaseUnityPlugin)Instance).Info == null || string.IsNullOrWhiteSpace(((BaseUnityPlugin)Instance).Info.Location)) { return Paths.PluginPath; } string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location); if (string.IsNullOrWhiteSpace(directoryName)) { return Paths.PluginPath; } return directoryName; } catch { return Paths.PluginPath; } } internal static string GetAssetFolderPath() { return Path.Combine(GetPluginFolderPath(), "HardheimMainMenu"); } internal static string GetLogoPath() { return Path.Combine(GetAssetFolderPath(), LogoFileName.Value); } internal static string GetDiscordLogoPath() { return Path.Combine(GetAssetFolderPath(), DiscordLogoFileName.Value); } internal static string GetLoadingScreensFolderPath() { return Path.Combine(GetAssetFolderPath(), "LoadingScreens"); } internal static string GetMusicFolderPath() { return Path.Combine(GetAssetFolderPath(), "Music"); } internal static string GetMusicPath() { return Path.Combine(GetMusicFolderPath(), MenuMusicFileName.Value); } internal static string[] GetLoadingScreenPaths() { try { string loadingScreensFolderPath = GetLoadingScreensFolderPath(); if (!Directory.Exists(loadingScreensFolderPath)) { return new string[0]; } List list = new List(); list.AddRange(Directory.GetFiles(loadingScreensFolderPath, "*.png", SearchOption.TopDirectoryOnly)); list.AddRange(Directory.GetFiles(loadingScreensFolderPath, "*.jpg", SearchOption.TopDirectoryOnly)); list.AddRange(Directory.GetFiles(loadingScreensFolderPath, "*.jpeg", SearchOption.TopDirectoryOnly)); list.Sort(StringComparer.OrdinalIgnoreCase); return list.ToArray(); } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a loading screen fájlok listázásakor: " + ex); return new string[0]; } } internal static string GetNextLoadingScreenPath() { try { string[] loadingScreenPaths = GetLoadingScreenPaths(); if (loadingScreenPaths == null || loadingScreenPaths.Length == 0) { LogWarning("[Hardheim Main Menu] Nem található loading screen a mappában: " + GetLoadingScreensFolderPath()); return null; } if (!RandomizeLoadingScreens.Value) { _lastLoadingScreenIndex++; if (_lastLoadingScreenIndex >= loadingScreenPaths.Length) { _lastLoadingScreenIndex = 0; } return loadingScreenPaths[_lastLoadingScreenIndex]; } if (loadingScreenPaths.Length == 1) { _lastLoadingScreenIndex = 0; return loadingScreenPaths[0]; } int num = Random.Range(0, loadingScreenPaths.Length); if (num == _lastLoadingScreenIndex) { num = (num + 1) % loadingScreenPaths.Length; } _lastLoadingScreenIndex = num; return loadingScreenPaths[num]; } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba loading screen kiválasztásakor: " + ex); return null; } } internal static AudioType GetAudioTypeFromPath(string path) { //IL_000d: 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_0076: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(path)) { return (AudioType)0; } string extension = Path.GetExtension(path); if (string.IsNullOrWhiteSpace(extension)) { return (AudioType)0; } return (AudioType)(extension.ToLowerInvariant() switch { ".ogg" => 14, ".wav" => 20, ".mp3" => 13, _ => 0, }); } internal static void EnsureMenuMusicObject() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if (!((Object)(object)_menuMusicObject != (Object)null) || !((Object)(object)_menuMusicSource != (Object)null)) { _menuMusicObject = new GameObject("HardheimMenuMusic"); Object.DontDestroyOnLoad((Object)(object)_menuMusicObject); _menuMusicSource = _menuMusicObject.AddComponent(); _menuMusicSource.playOnAwake = false; _menuMusicSource.loop = MenuMusicLoop != null && MenuMusicLoop.Value; _menuMusicSource.volume = ((MenuMusicVolume != null) ? Mathf.Clamp01(MenuMusicVolume.Value) : 0.55f); _menuMusicSource.spatialBlend = 0f; _menuMusicSource.priority = 0; } } internal static void UpdateMenuMusicSettings() { if (!((Object)(object)_menuMusicSource == (Object)null)) { _menuMusicSource.volume = ((MenuMusicVolume != null) ? Mathf.Clamp01(MenuMusicVolume.Value) : 0.55f); _menuMusicSource.loop = MenuMusicLoop != null && MenuMusicLoop.Value; } } internal static void MuteVanillaMenuMusic() { try { _mutedVanillaMenuSources.Clear(); AudioSource[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); if (array == null || array.Length == 0) { return; } AudioSource[] array2 = array; foreach (AudioSource val in array2) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && (!((Object)(object)_menuMusicSource != (Object)null) || !((Object)(object)val == (Object)(object)_menuMusicSource))) { string text = ((((Object)((Component)val).gameObject).name != null) ? ((Object)((Component)val).gameObject).name.ToLowerInvariant() : string.Empty); string text2 = (((Object)(object)val.clip != (Object)null && !string.IsNullOrWhiteSpace(((Object)val.clip).name)) ? ((Object)val.clip).name.ToLowerInvariant() : string.Empty); string text3 = 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(); _mutedVanillaMenuSources.Add(val); LogInfo("[Hardheim Main Menu] Eredeti menü zene leállítva: GO=" + ((Object)((Component)val).gameObject).name + " | Clip=" + (((Object)(object)val.clip != (Object)null) ? ((Object)val.clip).name : "")); } } } } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba az eredeti menü zene némításakor: " + ex); } } [IteratorStateMachine(typeof(d__112))] internal static IEnumerator MuteVanillaMenuMusicRepeatedCoroutine(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__112(0) { duration = duration }; } [IteratorStateMachine(typeof(d__113))] internal static IEnumerator StartMenuMusicCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__113(0); } internal static bool IsMenuMusicPlaying() { return (Object)(object)_menuMusicSource != (Object)null && (Object)(object)_menuMusicSource.clip != (Object)null && _menuMusicSource.isPlaying; } internal static void StartMenuMusic() { if (!((Object)(object)Instance == (Object)null)) { if (_menuMusicCoroutine != null) { ((MonoBehaviour)Instance).StopCoroutine(_menuMusicCoroutine); _menuMusicCoroutine = null; } _menuMusicCoroutine = ((MonoBehaviour)Instance).StartCoroutine(StartMenuMusicCoroutine()); } } internal static void StopMenuMusic() { if ((Object)(object)_menuMusicSource != (Object)null) { _menuMusicSource.Stop(); _menuMusicSource.clip = null; } if ((Object)(object)_menuMusicClip != (Object)null) { Object.Destroy((Object)(object)_menuMusicClip); _menuMusicClip = null; } if ((Object)(object)_menuMusicObject != (Object)null) { Object.Destroy((Object)(object)_menuMusicObject); _menuMusicObject = null; } _menuMusicSource = null; _menuMusicStarting = false; } internal static void SplitAddress(string address, out string host, out ushort port) { host = string.Empty; port = 2456; if (!string.IsNullOrWhiteSpace(address)) { string[] array = address.Split(new char[1] { ':' }); if (array.Length >= 1) { host = array[0].Trim(); } if (array.Length >= 2 && ushort.TryParse(array[1], out var result)) { port = result; } } } internal static void ClearPendingQuickJoin() { _pendingQuickJoin = false; _pendingServerAddress = string.Empty; _pendingServerPassword = string.Empty; } internal static bool IsButtonAlive(Button button) { return (Object)(object)button != (Object)null && (Object)(object)((Component)button).gameObject != (Object)null; } internal static bool ShouldHideWorldSelectObject(string objectName) { if (string.IsNullOrWhiteSpace(objectName)) { return false; } string text = objectName.ToLowerInvariant(); if (text == "startgui" || text == "menu") { return false; } return text.Contains("worldselect") || text.Contains("worldselection") || text.Contains("selectworld") || text.Contains("worldlist") || text.Contains("worldpanel") || text.Contains("newworld") || text.Contains("menuworld") || text == "world" || text == "worlds"; } internal static void HideWorldSelectIfVisible(FejdStartup startup) { if ((Object)(object)startup == (Object)null) { return; } try { string[] array = new string[1] { "m_worldListPanel" }; string[] array2 = array; foreach (string text in array2) { FieldInfo fieldInfo = AccessTools.Field(typeof(FejdStartup), text); if (fieldInfo == null) { continue; } object value = fieldInfo.GetValue(startup); GameObject val = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val != (Object)null) { if (ShouldHideWorldSelectObject(((Object)val).name)) { val.SetActive(false); } continue; } Component val2 = (Component)((value is Component) ? value : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.gameObject != (Object)null && ShouldHideWorldSelectObject(((Object)val2.gameObject).name)) { val2.gameObject.SetActive(false); } } Transform[] componentsInChildren = ((Component)startup).GetComponentsInChildren(true); Transform[] array3 = componentsInChildren; foreach (Transform val3 in array3) { if ((Object)(object)val3 != (Object)null && (Object)(object)((Component)val3).gameObject != (Object)null && ShouldHideWorldSelectObject(((Object)((Component)val3).gameObject).name)) { ((Component)val3).gameObject.SetActive(false); } } } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a világválasztó elrejtésekor: " + ex); } } [IteratorStateMachine(typeof(d__122))] internal static IEnumerator SuppressWorldSelectFlash(FejdStartup startup) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__122(0) { startup = startup }; } internal static void ShowQuickJoinOverlay() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00a8: 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_00c0: 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_00df: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_quickJoinOverlay != (Object)null) { _quickJoinOverlay.SetActive(true); return; } _quickJoinOverlay = new GameObject("HardheimQuickJoinOverlay"); Object.DontDestroyOnLoad((Object)(object)_quickJoinOverlay); _quickJoinOverlayCanvas = _quickJoinOverlay.AddComponent(); _quickJoinOverlayCanvas.renderMode = (RenderMode)0; _quickJoinOverlayCanvas.sortingOrder = 10000; _quickJoinOverlay.AddComponent(); _quickJoinOverlay.AddComponent(); GameObject val = new GameObject("OverlayImage"); val.transform.SetParent(_quickJoinOverlay.transform, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; Image val3 = val.AddComponent(); ((Graphic)val3).color = Color.black; _quickJoinOverlay.SetActive(true); } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a quick join overlay megjelenítésekor: " + ex); } } internal static void HideQuickJoinOverlay() { try { if ((Object)(object)_quickJoinOverlay != (Object)null) { _quickJoinOverlay.SetActive(false); } } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a quick join overlay elrejtésekor: " + ex); } } [IteratorStateMachine(typeof(d__125))] internal static IEnumerator HideQuickJoinOverlayDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__125(0); } internal static void TryHandlePendingQuickJoinAfterCharacterSelect() { if (!_pendingQuickJoin) { return; } if (string.IsNullOrWhiteSpace(_pendingServerAddress)) { ClearPendingQuickJoin(); HideQuickJoinOverlay(); return; } try { FejdStartup val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { HideQuickJoinOverlay(); return; } ShowQuickJoinOverlay(); HideWorldSelectIfVisible(val); if ((Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(SuppressWorldSelectFlash(val)); } MethodInfo methodInfo = AccessTools.Method(typeof(FejdStartup), "set_ServerPassword", new Type[1] { typeof(string) }, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(val, new object[1] { _pendingServerPassword ?? string.Empty }); } SplitAddress(_pendingServerAddress, out var host, out var port); if (string.IsNullOrWhiteSpace(host)) { ClearPendingQuickJoin(); HideQuickJoinOverlay(); return; } Type type = AccessTools.TypeByName("ServerJoinDataDedicated"); Type type2 = AccessTools.TypeByName("ServerJoinData"); if (type == null || type2 == null) { ClearPendingQuickJoin(); HideQuickJoinOverlay(); return; } ConstructorInfo constructorInfo = AccessTools.Constructor(type, new Type[2] { typeof(string), typeof(ushort) }, false); if (constructorInfo == null) { ClearPendingQuickJoin(); HideQuickJoinOverlay(); return; } object obj = constructorInfo.Invoke(new object[2] { host, port }); ConstructorInfo constructorInfo2 = AccessTools.Constructor(type2, new Type[1] { type }, false); if (constructorInfo2 == null) { ClearPendingQuickJoin(); HideQuickJoinOverlay(); return; } object obj2 = constructorInfo2.Invoke(new object[1] { obj }); MethodInfo methodInfo2 = AccessTools.Method(typeof(FejdStartup), "SetServerToJoin", new Type[1] { type2 }, (Type[])null); if (methodInfo2 == null) { ClearPendingQuickJoin(); HideQuickJoinOverlay(); return; } methodInfo2.Invoke(val, new object[1] { obj2 }); MethodInfo methodInfo3 = AccessTools.Method(typeof(FejdStartup), "OnJoinStart", (Type[])null, (Type[])null); if (methodInfo3 != null) { methodInfo3.Invoke(val, null); if ((Object)(object)Instance != (Object)null) { ((MonoBehaviour)Instance).StartCoroutine(HideQuickJoinOverlayDelayed()); } else { HideQuickJoinOverlay(); } } else { HideQuickJoinOverlay(); } ClearPendingQuickJoin(); } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a quick join során: " + ex); ClearPendingQuickJoin(); HideQuickJoinOverlay(); } } [IteratorStateMachine(typeof(d__127))] internal static IEnumerator WaitForConnectedWorldLoadAndReplaceCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__127(0); } internal static void StartLoadingScreenCleanup(LoadingTargetResult result) { if (!((Object)(object)Instance == (Object)null) && result.IsValid) { StopLoadingScreenCleanup(); _loadingScreenCleanupCoroutine = ((MonoBehaviour)Instance).StartCoroutine(WaitForWorldLoadAndClearLoadingTargetCoroutine(result)); } } internal static void StopLoadingScreenCleanup() { if ((Object)(object)Instance != (Object)null && _loadingScreenCleanupCoroutine != null) { ((MonoBehaviour)Instance).StopCoroutine(_loadingScreenCleanupCoroutine); } _loadingScreenCleanupCoroutine = null; } internal static void StopLoadingScreenFadeOut() { if ((Object)(object)Instance != (Object)null && _loadingScreenFadeOutCoroutine != null) { ((MonoBehaviour)Instance).StopCoroutine(_loadingScreenFadeOutCoroutine); } _loadingScreenFadeOutCoroutine = null; } [IteratorStateMachine(typeof(d__131))] internal static IEnumerator WaitForWorldLoadAndClearLoadingTargetCoroutine(LoadingTargetResult result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__131(0) { result = result }; } internal static GameObject FindLoadingGuiObject() { GameObject val = GameObject.Find("LoadingGUI"); if ((Object)(object)val != (Object)null) { return val; } Transform[] array = Object.FindObjectsByType((FindObjectsInactive)1, (FindObjectsSortMode)0); foreach (Transform val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)null) && string.Equals(((Object)((Component)val2).gameObject).name, "LoadingGUI", StringComparison.OrdinalIgnoreCase)) { return ((Component)val2).gameObject; } } return null; } 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; } } } if (result.Score > -1073741824) { LogVerbose("[Hardheim Main Menu] Aktuális legjobb loading target: " + result.ObjectName + " | Pontszám: " + result.Score + " | Path: " + result.Path); } return result; } internal 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); } _lastAppliedLoadingObjectName = result.ObjectName; _lastAppliedLoadingPath = result.Path; return true; } internal static void StartForceKeepLoadingTarget(LoadingTargetResult result, Sprite sprite) { if (!((Object)(object)Instance == (Object)null) && result.IsValid && !((Object)(object)sprite == (Object)null)) { StopLoadingScreenForce(); _loadingScreenForceCoroutine = ((MonoBehaviour)Instance).StartCoroutine(ForceKeepLoadingTargetCoroutine(result, sprite)); } } internal static void StopLoadingScreenForce() { if ((Object)(object)Instance != (Object)null && _loadingScreenForceCoroutine != null) { ((MonoBehaviour)Instance).StopCoroutine(_loadingScreenForceCoroutine); } _loadingScreenForceCoroutine = null; } [IteratorStateMachine(typeof(d__138))] internal static IEnumerator ForceKeepLoadingTargetCoroutine(LoadingTargetResult result, Sprite sprite) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__138(0) { result = result, sprite = sprite }; } internal static void FadeOutAndClearLoadingTarget(LoadingTargetResult result) { if (result.IsValid) { if ((Object)(object)Instance == (Object)null) { ClearLoadingTarget(result); return; } if (EnableLoadingScreenFadeOut == null || !EnableLoadingScreenFadeOut.Value) { ClearLoadingTarget(result); return; } StopLoadingScreenFadeOut(); _loadingScreenFadeOutCoroutine = ((MonoBehaviour)Instance).StartCoroutine(FadeOutAndClearLoadingTargetCoroutine(result)); } } [IteratorStateMachine(typeof(d__140))] internal static IEnumerator FadeOutAndClearLoadingTargetCoroutine(LoadingTargetResult result) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__140(0) { result = result }; } internal static int CalculateConnectedWorldLoadingImageScore(Image img) { //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)img == (Object)null || (Object)(object)((Component)img).gameObject == (Object)null) { return int.MinValue; } string text = (((Object)((Component)img).gameObject).name ?? string.Empty).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) { default: { if (text == "separator") { break; } 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; } case "backgroundback": case "buttonclose": case "button": case "border": case "bkg": case "bar": case "darken": case "handle": break; } } return int.MinValue; } internal static int CalculateConnectedWorldLoadingRawImageScore(RawImage raw) { //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: 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) //IL_034f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)raw == (Object)null || (Object)(object)((Component)raw).gameObject == (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 ClearLoadingTarget(LoadingTargetResult result) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (!result.IsValid) { return; } if (result.IsRaw) { if (!((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 (!((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(); } } internal static bool IsWorldFullyLoaded() { try { return (Object)(object)Player.m_localPlayer != (Object)null; } catch { return false; } } internal static bool IsFullscreenLike(RectTransform rt) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) if ((Object)(object)rt == (Object)null) { return false; } bool flag = Approximately(rt.anchorMin.x, 0f) && Approximately(rt.anchorMin.y, 0f) && Approximately(rt.anchorMax.x, 1f) && Approximately(rt.anchorMax.y, 1f); bool flag2 = Approximately(rt.offsetMin.x, 0f) && Approximately(rt.offsetMin.y, 0f) && Approximately(rt.offsetMax.x, 0f) && Approximately(rt.offsetMax.y, 0f); return flag && flag2; } internal static bool Approximately(float a, float b, float tolerance) { return Mathf.Abs(a - b) <= tolerance; } internal static bool Approximately(float a, float b) { return Mathf.Abs(a - b) <= 0.001f; } 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 void ApplyLoadingImage(Image target, Sprite customSprite) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null) && !((Object)(object)customSprite == (Object)null)) { 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(); } } internal static void ApplyLoadingRawImage(RawImage target, Sprite customSprite) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null) && !((Object)(object)customSprite == (Object)null)) { 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(); } } internal static void StretchToFullscreen(RectTransform rt) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) //IL_006e: 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 void DumpLoadingGuiElements() { //IL_011b: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = FindLoadingGuiObject(); if ((Object)(object)val == (Object)null) { LogInfo("[Hardheim Main Menu] LoadingGUI dump: a LoadingGUI objektum nem található."); return; } LogInfo("[Hardheim Main Menu] ===== LoadingGUI DUMP START ====="); LogInfo("[Hardheim Main Menu] LoadingGUI activeInHierarchy: " + val.activeInHierarchy); Image[] array = Resources.FindObjectsOfTypeAll(); Image[] array2 = array; Rect rect; foreach (Image val2 in array2) { if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null) { continue; } string hierarchyPath = GetHierarchyPath(((Component)val2).transform); if (hierarchyPath.Contains("LoadingGUI")) { RectTransform rectTransform = ((Graphic)val2).rectTransform; float num = (((Object)(object)((Graphic)val2).canvasRenderer != (Object)null) ? ((Graphic)val2).canvasRenderer.GetAlpha() : (-1f)); string text = (((Object)(object)val2.sprite != (Object)null) ? ((Object)val2.sprite).name : ""); object obj; if (!((Object)(object)rectTransform != (Object)null)) { obj = ""; } else { rect = rectTransform.rect; string text2 = ((Rect)(ref rect)).width.ToString("0.##"); rect = rectTransform.rect; obj = text2 + "x" + ((Rect)(ref rect)).height.ToString("0.##"); } string text3 = (string)obj; LogInfo("[Hardheim Main Menu] [LoadingGUI/Image] Name=" + ((Object)((Component)val2).gameObject).name + " | Path=" + hierarchyPath + " | Active=" + ((Component)val2).gameObject.activeInHierarchy + " | Enabled=" + ((Behaviour)val2).enabled + " | Alpha=" + num.ToString("0.###") + " | Sprite=" + text + " | Size=" + text3); } } RawImage[] array3 = Resources.FindObjectsOfTypeAll(); RawImage[] array4 = array3; foreach (RawImage val3 in array4) { if ((Object)(object)val3 == (Object)null || (Object)(object)((Component)val3).gameObject == (Object)null) { continue; } string hierarchyPath2 = GetHierarchyPath(((Component)val3).transform); if (hierarchyPath2.Contains("LoadingGUI")) { RectTransform rectTransform2 = ((Graphic)val3).rectTransform; string text4 = (((Object)(object)val3.texture != (Object)null) ? ((Object)val3.texture).name : ""); object obj2; if (!((Object)(object)rectTransform2 != (Object)null)) { obj2 = ""; } else { rect = rectTransform2.rect; string text5 = ((Rect)(ref rect)).width.ToString("0.##"); rect = rectTransform2.rect; obj2 = text5 + "x" + ((Rect)(ref rect)).height.ToString("0.##"); } string text6 = (string)obj2; LogInfo("[Hardheim Main Menu] [LoadingGUI/RawImage] Name=" + ((Object)((Component)val3).gameObject).name + " | Path=" + hierarchyPath2 + " | Active=" + ((Component)val3).gameObject.activeInHierarchy + " | Enabled=" + ((Behaviour)val3).enabled + " | Texture=" + text4 + " | Size=" + text6); } } LogInfo("[Hardheim Main Menu] ===== LoadingGUI DUMP END ====="); } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a LoadingGUI dump közben: " + ex); } } [IteratorStateMachine(typeof(d__153))] internal static IEnumerator LoadSpriteFromFileCoroutine(string filePath, Action onLoaded) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__153(0) { filePath = filePath, onLoaded = onLoaded }; } [IteratorStateMachine(typeof(d__154))] internal static IEnumerator LoadDiscordLogoCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__154(0); } [IteratorStateMachine(typeof(d__155))] internal static IEnumerator ReplaceLogoDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__155(0); } [IteratorStateMachine(typeof(d__156))] internal static IEnumerator TryReplaceLogoCoroutine(Action onFinished, int minimumScore) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__156(0) { onFinished = onFinished, minimumScore = minimumScore }; } internal static int CalculateImageScore(Image img) { //IL_0187: 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) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: 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_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)img == (Object)null || (Object)(object)((Component)img).gameObject == (Object)null) { return int.MinValue; } GameObject gameObject = ((Component)img).gameObject; RectTransform rectTransform = ((Graphic)img).rectTransform; string text = ((Object)gameObject).name ?? string.Empty; string text2 = text.ToLowerInvariant(); string text3 = (((Object)(object)img.sprite != (Object)null && !string.IsNullOrWhiteSpace(((Object)img.sprite).name)) ? ((Object)img.sprite).name.ToLowerInvariant() : string.Empty); int num = 0; if (text2.Contains("logo")) { num += 100; } if (text2.Contains("valheim")) { num += 80; } if (text2.Contains("title")) { num += 40; } if (text2.Contains("menu")) { num += 10; } if (text3.Contains("logo")) { num += 50; } if (text3.Contains("valheim")) { num += 40; } if (gameObject.activeInHierarchy) { num += 15; } if (((Behaviour)img).enabled) { num += 10; } if ((Object)(object)((Graphic)img).canvasRenderer != (Object)null && ((Graphic)img).canvasRenderer.GetAlpha() > 0.01f) { num += 10; } Rect rect; if ((Object)(object)rectTransform != (Object)null) { rect = rectTransform.rect; float width = ((Rect)(ref rect)).width; rect = rectTransform.rect; float num2 = Mathf.Abs(width * ((Rect)(ref rect)).height); if (num2 > 10000f) { num += 10; } if (num2 > 50000f) { num += 10; } if (num2 > 150000f) { num += 10; } Vector3 position = ((Transform)rectTransform).position; if (position.y > (float)Screen.height * 0.45f) { num += 10; } } string text4 = NormalizeMode(CompatibilityMode.Value); string text5 = text4; string text6 = text5; if (!(text6 == "STRICT")) { if (text6 == "AGGRESSIVE") { if ((Object)(object)rectTransform != (Object)null) { rect = rectTransform.rect; float width2 = ((Rect)(ref rect)).width; rect = rectTransform.rect; float num3 = Mathf.Abs(width2 * ((Rect)(ref rect)).height); if (num3 > 30000f) { num += 15; } } if (gameObject.activeInHierarchy) { num += 10; } } } else { if (!text2.Contains("logo") && !text3.Contains("logo")) { num -= 40; } if (!text2.Contains("valheim") && !text3.Contains("valheim")) { num -= 20; } } LogVerbose("[Hardheim Main Menu] Vizsgált objektum: " + text + " | Sprite: " + text3 + " | Pontszám: " + num); return num; } internal static void DumpImageCandidates(Image[] images) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (images == null || images.Length == 0) { return; } LogInfo("[Hardheim Main Menu] --- UI Image dump indul ---"); foreach (Image val in images) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null)) { string text = ((Object)((Component)val).gameObject).name ?? ""; string text2 = (((Object)(object)val.sprite != (Object)null) ? ((Object)val.sprite).name : ""); string hierarchyPath = GetHierarchyPath(((Component)val).transform); RectTransform rectTransform = ((Graphic)val).rectTransform; object obj; if (!((Object)(object)rectTransform != (Object)null)) { obj = "nincs RectTransform"; } else { string[] obj2 = new string[6] { "size=(", null, null, null, null, null }; Rect rect = rectTransform.rect; obj2[1] = ((Rect)(ref rect)).width.ToString("0.##"); obj2[2] = "x"; rect = rectTransform.rect; obj2[3] = ((Rect)(ref rect)).height.ToString("0.##"); obj2[4] = "), pos="; Vector2 anchoredPosition = rectTransform.anchoredPosition; obj2[5] = ((object)(Vector2)(ref anchoredPosition)).ToString(); obj = string.Concat(obj2); } string text3 = (string)obj; int num = CalculateImageScore(val); LogInfo("[Hardheim Main Menu] Image: " + text + " | Sprite: " + text2 + " | Active: " + ((Component)val).gameObject.activeInHierarchy + " | " + text3 + " | Score: " + num + " | Path: " + hierarchyPath); } } LogInfo("[Hardheim Main Menu] --- UI Image dump vége ---"); } internal static void ApplyLogo(Image targetImage, Sprite newSprite) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0107: 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) if ((Object)(object)targetImage == (Object)null || (Object)(object)newSprite == (Object)null) { return; } targetImage.sprite = newSprite; targetImage.overrideSprite = newSprite; ((Behaviour)targetImage).enabled = true; targetImage.preserveAspect = true; targetImage.type = (Type)0; ((Graphic)targetImage).material = null; Color white = Color.white; white.a = 1f; ((Graphic)targetImage).color = white; RectTransform rectTransform = ((Graphic)targetImage).rectTransform; if ((Object)(object)rectTransform != (Object)null) { if (UseFixedSize.Value) { rectTransform.sizeDelta = new Vector2(Mathf.Max(1f, FixedWidth.Value), Mathf.Max(1f, FixedHeight.Value)); } else { Rect rect = newSprite.rect; float num = Mathf.Max(1f, ((Rect)(ref rect)).width); rect = newSprite.rect; rectTransform.sizeDelta = new Vector2(num, Mathf.Max(1f, ((Rect)(ref rect)).height)); } ((Transform)rectTransform).localScale = Vector3.one * Mathf.Max(0.01f, LogoScale.Value); } } [IteratorStateMachine(typeof(d__160))] internal static IEnumerator FadeInLogoCoroutine(Image targetImage) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__160(0) { targetImage = targetImage }; } internal static string NormalizeMode(string mode) { if (string.IsNullOrWhiteSpace(mode)) { return "AUTO"; } return mode.Trim().ToUpperInvariant(); } internal static int GetRetryAttemptsByMode() { string text = NormalizeMode(CompatibilityMode.Value); int num = Mathf.Max(1, RetryCount.Value); string text2 = text; string text3 = text2; if (!(text3 == "STRICT")) { if (text3 == "AGGRESSIVE") { return Mathf.Max(num, 6); } return Mathf.Max(num, 4); } return Mathf.Max(1, num); } internal static float GetRetryIntervalByMode() { string text = NormalizeMode(CompatibilityMode.Value); float num = Mathf.Max(0.1f, RetryIntervalSeconds.Value); string text2 = text; string text3 = text2; if (!(text3 == "STRICT")) { if (text3 == "AGGRESSIVE") { return Mathf.Max(0.25f, num); } return num; } return num; } internal static int GetMinimumScoreByMode() { string text = NormalizeMode(CompatibilityMode.Value); int num = Mathf.Max(0, MinimumScoreThreshold.Value); string text2 = text; string text3 = text2; if (!(text3 == "STRICT")) { if (text3 == "AGGRESSIVE") { return Mathf.Min(num, 35); } return num; } return Mathf.Max(num, 80); } internal static bool ShouldNeverHideObject(string objectName) { if (string.IsNullOrWhiteSpace(objectName)) { return false; } switch (objectName) { case "startgui": case "menu": case "startgame": case "panel": case "worldpanel": case "joinpanel": case "topright": case "topleft": case "tooltips": return true; default: return false; } } internal static string GetOwnText(GameObject go) { if ((Object)(object)go == (Object)null) { return string.Empty; } 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 component2.text.Trim(); } return string.Empty; } internal static bool ShouldHideByNameOrOwnText(string objectName, string ownText) { if (HidePatchNotes.Value) { switch (objectName) { default: if (!(ownText == "frissítési napló")) { break; } goto case "canvas changelog"; case "canvas changelog": case "changelog": case "topic": case "patchlogscroll": return true; } } if (HideMerchStore.Value && (objectName.Contains("merch") || objectName == "valheim.shop" || objectName == "url" || ownText == "valheim.shop")) { return true; } if (HideModdedWarning.Value && (objectName == "modded_text" || ownText.Contains("jelenleg a valheim módosított változatával játszol") || ownText.Contains("currently playing a modded version") || ownText.Contains("modded version"))) { return true; } return false; } internal static void HideUnwantedMainMenuUi() { try { FejdStartup val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null) { return; } Transform[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); Transform[] array = componentsInChildren; foreach (Transform val2 in array) { if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null) { continue; } GameObject gameObject = ((Component)val2).gameObject; string objectName = (((Object)gameObject).name ?? string.Empty).ToLowerInvariant(); if (!ShouldNeverHideObject(objectName)) { string text = GetOwnText(gameObject).ToLowerInvariant(); if (ShouldHideByNameOrOwnText(objectName, text)) { gameObject.SetActive(false); LogInfo("[Hardheim Main Menu] Főmenü UI elem elrejtve: " + ((Object)gameObject).name + " | Saját szöveg: " + text); } } } } catch (Exception ex) { LogError("[Hardheim Main Menu] Hiba a nem kívánt főmenü UI elemek elrejtésekor: " + ex); } } [IteratorStateMachine(typeof(d__169))] internal static IEnumerator HideUnwantedMainMenuUiDelayed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__169(0); } internal static TextMeshProUGUI FindBestMenuTmpText(FejdStartup startup) { if ((Object)(object)startup == (Object)null) { return null; } TextMeshProUGUI[] componentsInChildren = ((Component)startup).GetComponentsInChildren(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return null; } TextMeshProUGUI result = null; int num = int.MinValue; TextMeshProUGUI[] array = componentsInChildren; foreach (TextMeshProUGUI val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null)) { string text = (((TMP_Text)val).text ?? string.Empty).ToLowerInvariant(); string text2 = (((Object)((Component)val).gameObject).name ?? string.Empty).ToLowerInvariant(); int num2 = 0; if (text.Contains("játék indítása")) { num2 += 300; } if (text.Contains("beállítások")) { num2 += 220; } if (text.Contains("kilépés")) { num2 += 220; } if (text.Contains("start game")) { num2 += 300; } 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)startup == (Object)null) { return null; } Button[] componentsInChildren = ((Component)startup).GetComponentsInChildren