Decompiled source of HardheimMainMenu v1.0.0

plugins/HardheimMainMenu.dll

Decompiled 2 months ago
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 <CreateQuickJoinButton>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 <CreateDiscordPanel>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 <WaitForConnectedWorldLoadAndReplaceCoroutine>b__0(Sprite sprite)
		{
			customSprite = sprite;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass154_0
	{
		public Sprite loadedSprite;

		internal void <LoadDiscordLogoCoroutine>b__0(Sprite sprite)
		{
			loadedSprite = sprite;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass155_0
	{
		public bool attemptSuccess;

		internal void <ReplaceLogoDelayed>b__0(bool result)
		{
			attemptSuccess = result;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass156_0
	{
		public Sprite customSprite;

		internal void <TryReplaceLogoCoroutine>b__0(Sprite sprite)
		{
			customSprite = sprite;
		}
	}

	[CompilerGenerated]
	private sealed class <CreateQuickJoinButtonDelayed>d__175 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private int <attempts>5__1;

		private float <interval>5__2;

		private int <i>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CreateQuickJoinButtonDelayed>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;
			}
			<attempts>5__1 = Mathf.Max(1, RetryCount.Value);
			<interval>5__2 = Mathf.Max(0.1f, RetryIntervalSeconds.Value);
			<i>5__3 = 1;
			goto IL_00d5;
			IL_00c2:
			<i>5__3++;
			goto IL_00d5;
			IL_00d5:
			if (<i>5__3 <= <attempts>5__1)
			{
				if (CreateQuickJoinButton())
				{
					return false;
				}
				if (<i>5__3 < <attempts>5__1)
				{
					<>2__current = (object)new WaitForSeconds(<interval>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 <FadeInLogoCoroutine>d__160 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Image targetImage;

		private float <duration>5__1;

		private Color <color>5__2;

		private float <elapsed>5__3;

		private float <t>5__4;

		private float <smooth>5__5;

		private Color <newColor>5__6;

		private Color <finalColor>5__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FadeInLogoCoroutine>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;
				}
				<duration>5__1 = Mathf.Max(0.01f, FadeDuration.Value);
				<color>5__2 = ((Graphic)targetImage).color;
				<color>5__2.a = 0f;
				((Graphic)targetImage).color = <color>5__2;
				<elapsed>5__3 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<elapsed>5__3 < <duration>5__1)
			{
				if ((Object)(object)targetImage == (Object)null || (Object)(object)((Component)targetImage).gameObject == (Object)null)
				{
					return false;
				}
				<elapsed>5__3 += Time.unscaledDeltaTime;
				<t>5__4 = Mathf.Clamp01(<elapsed>5__3 / <duration>5__1);
				<smooth>5__5 = Mathf.SmoothStep(0f, 1f, <t>5__4);
				<newColor>5__6 = ((Graphic)targetImage).color;
				<newColor>5__6.a = <smooth>5__5;
				((Graphic)targetImage).color = <newColor>5__6;
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			if ((Object)(object)targetImage != (Object)null)
			{
				<finalColor>5__7 = ((Graphic)targetImage).color;
				<finalColor>5__7.a = 1f;
				((Graphic)targetImage).color = <finalColor>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 <FadeOutAndClearLoadingTargetCoroutine>d__140 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public LoadingTargetResult result;

		private float <duration>5__1;

		private float <elapsed>5__2;

		private RawImage <raw>5__3;

		private Color <startColor>5__4;

		private float <startAlpha>5__5;

		private float <t>5__6;

		private float <alpha>5__7;

		private Color <c>5__8;

		private Image <img>5__9;

		private Color <startColor>5__10;

		private float <startAlpha>5__11;

		private float <t>5__12;

		private float <alpha>5__13;

		private Color <c>5__14;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FadeOutAndClearLoadingTargetCoroutine>d__140(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<raw>5__3 = null;
			<img>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;
				<duration>5__1 = Mathf.Max(0.01f, LoadingScreenFadeOutDuration.Value);
				<elapsed>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;
					}
					<raw>5__3 = result.RawImage;
					((Behaviour)<raw>5__3).enabled = true;
					<startColor>5__4 = ((Graphic)<raw>5__3).color;
					<startAlpha>5__5 = Mathf.Clamp01(<startColor>5__4.a);
					if (<startAlpha>5__5 < 0.01f)
					{
						<startAlpha>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;
				}
				<img>5__9 = result.Image;
				((Behaviour)<img>5__9).enabled = true;
				<startColor>5__10 = ((Graphic)<img>5__9).color;
				<startAlpha>5__11 = Mathf.Clamp01(<startColor>5__10.a);
				if (<startAlpha>5__11 < 0.01f)
				{
					<startAlpha>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 (<elapsed>5__2 < <duration>5__1)
				{
					if ((Object)(object)<raw>5__3 == (Object)null || (Object)(object)((Component)<raw>5__3).gameObject == (Object)null)
					{
						_loadingScreenFadeOutCoroutine = null;
						return false;
					}
					<elapsed>5__2 += Time.unscaledDeltaTime;
					<t>5__6 = Mathf.Clamp01(<elapsed>5__2 / <duration>5__1);
					<alpha>5__7 = Mathf.Lerp(<startAlpha>5__5, 0f, <t>5__6);
					<c>5__8 = ((Graphic)<raw>5__3).color;
					<c>5__8.a = <alpha>5__7;
					((Graphic)<raw>5__3).color = <c>5__8;
					((Graphic)<raw>5__3).SetAllDirty();
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<raw>5__3 = null;
				break;
				IL_0374:
				if (<elapsed>5__2 < <duration>5__1)
				{
					if ((Object)(object)<img>5__9 == (Object)null || (Object)(object)((Component)<img>5__9).gameObject == (Object)null)
					{
						_loadingScreenFadeOutCoroutine = null;
						return false;
					}
					<elapsed>5__2 += Time.unscaledDeltaTime;
					<t>5__12 = Mathf.Clamp01(<elapsed>5__2 / <duration>5__1);
					<alpha>5__13 = Mathf.Lerp(<startAlpha>5__11, 0f, <t>5__12);
					<c>5__14 = ((Graphic)<img>5__9).color;
					<c>5__14.a = <alpha>5__13;
					((Graphic)<img>5__9).color = <c>5__14;
					((Graphic)<img>5__9).SetAllDirty();
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				<img>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 <FadeOutAndStopMenuMusicCoroutine>d__98 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private float <duration>5__1;

		private float <startVolume>5__2;

		private float <elapsed>5__3;

		private float <t>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FadeOutAndStopMenuMusicCoroutine>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;
				}
				<duration>5__1 = Mathf.Max(0.01f, MenuMusicFadeOutDuration.Value);
				<startVolume>5__2 = _menuMusicSource.volume;
				<elapsed>5__3 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<elapsed>5__3 < <duration>5__1)
			{
				if ((Object)(object)_menuMusicSource == (Object)null)
				{
					_menuMusicFadeOutCoroutine = null;
					return false;
				}
				<elapsed>5__3 += Time.unscaledDeltaTime;
				<t>5__4 = Mathf.Clamp01(<elapsed>5__3 / <duration>5__1);
				_menuMusicSource.volume = Mathf.Lerp(<startVolume>5__2, 0f, <t>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 <ForceKeepLoadingTargetCoroutine>d__138 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public LoadingTargetResult result;

		public Sprite sprite;

		private float <duration>5__1;

		private float <elapsed>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ForceKeepLoadingTargetCoroutine>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;
				<duration>5__1 = Mathf.Max(0.5f, LoadingScreenForceDurationSeconds.Value);
				<elapsed>5__2 = 0f;
				LogInfo("[Hardheim Main Menu] Loading force override aktív " + <duration>5__1.ToString("0.00") + " mp-ig. Cél: " + result.ObjectName);
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<elapsed>5__2 < <duration>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);
				}
				<elapsed>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 <HideQuickJoinOverlayDelayed>d__125 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <HideQuickJoinOverlayDelayed>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 <HideUnwantedMainMenuUiDelayed>d__169 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private int <passes>5__1;

		private float <interval>5__2;

		private int <i>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <HideUnwantedMainMenuUiDelayed>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;
			}
			<passes>5__1 = Mathf.Max(1, HideUiPasses.Value);
			<interval>5__2 = Mathf.Max(0.05f, HideUiIntervalSeconds.Value);
			<i>5__3 = 0;
			goto IL_00bd;
			IL_00ac:
			<i>5__3++;
			goto IL_00bd;
			IL_00bd:
			if (<i>5__3 < <passes>5__1)
			{
				HideUnwantedMainMenuUi();
				if (<i>5__3 < <passes>5__1 - 1)
				{
					<>2__current = (object)new WaitForSeconds(<interval>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 <LoadDiscordLogoCoroutine>d__154 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private <>c__DisplayClass154_0 <>8__1;

		private string <logoPath>5__2;

		private float <maxWidth>5__3;

		private float <maxHeight>5__4;

		private float <spriteWidth>5__5;

		private float <spriteHeight>5__6;

		private Transform <glyphTransform>5__7;

		private float <aspect>5__8;

		private float <targetWidth>5__9;

		private float <targetHeight>5__10;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <LoadDiscordLogoCoroutine>d__154(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<logoPath>5__2 = null;
			<glyphTransform>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;
				}
				<logoPath>5__2 = GetDiscordLogoPath();
				if (!File.Exists(<logoPath>5__2))
				{
					return false;
				}
				<>8__1.loadedSprite = null;
				<>2__current = ((MonoBehaviour)Instance).StartCoroutine(LoadSpriteFromFileCoroutine(<logoPath>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;
				<maxWidth>5__3 = 340f;
				<maxHeight>5__4 = 200f;
				Rect rect = _discordLogoSprite.rect;
				<spriteWidth>5__5 = ((Rect)(ref rect)).width;
				rect = _discordLogoSprite.rect;
				<spriteHeight>5__6 = ((Rect)(ref rect)).height;
				if (<spriteWidth>5__5 > 0f && <spriteHeight>5__6 > 0f && (Object)(object)_discordLogoLayout != (Object)null)
				{
					<aspect>5__8 = <spriteWidth>5__5 / <spriteHeight>5__6;
					<targetWidth>5__9 = <maxWidth>5__3;
					<targetHeight>5__10 = <targetWidth>5__9 / <aspect>5__8;
					if (<targetHeight>5__10 > <maxHeight>5__4)
					{
						<targetHeight>5__10 = <maxHeight>5__4;
						<targetWidth>5__9 = <targetHeight>5__10 * <aspect>5__8;
					}
					_discordLogoLayout.preferredWidth = <targetWidth>5__9;
					_discordLogoLayout.preferredHeight = <targetHeight>5__10;
					LogInfo("[Hardheim Main Menu] Discord logó méretezve: " + <targetWidth>5__9.ToString("0.##") + " x " + <targetHeight>5__10.ToString("0.##"));
				}
				<glyphTransform>5__7 = ((Component)_discordLogoImage).transform.Find("DiscordGlyph");
				if ((Object)(object)<glyphTransform>5__7 != (Object)null)
				{
					((Component)<glyphTransform>5__7).gameObject.SetActive(false);
				}
				LogInfo("[Hardheim Main Menu] Discord logó betöltve: " + <logoPath>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 <LoadSpriteFromFileCoroutine>d__153 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public string filePath;

		public Action<Sprite> onLoaded;

		private string <url>5__1;

		private UnityWebRequest <request>5__2;

		private Texture2D <texture>5__3;

		private Sprite <sprite>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <LoadSpriteFromFileCoroutine>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();
				}
			}
			<url>5__1 = null;
			<request>5__2 = null;
			<texture>5__3 = null;
			<sprite>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
					{
						<url>5__1 = "file:///" + filePath.Replace("\\", "/");
						LogVerbose("[Hardheim Main Menu] Kép betöltése innen: " + <url>5__1);
						<request>5__2 = UnityWebRequestTexture.GetTexture(<url>5__1);
						<>1__state = -3;
						<>2__current = <request>5__2.SendWebRequest();
						<>1__state = 1;
						result2 = true;
					}
					break;
				case 1:
					<>1__state = -3;
					if ((int)<request>5__2.result != 1)
					{
						Result result = <request>5__2.result;
						LogError("[Hardheim Main Menu] Hiba a kép betöltése közben: " + ((object)(Result)(ref result)).ToString() + " | " + <request>5__2.error);
						if (onLoaded != null)
						{
							onLoaded(null);
						}
						result2 = false;
					}
					else
					{
						<texture>5__3 = DownloadHandlerTexture.GetContent(<request>5__2);
						if (!((Object)(object)<texture>5__3 == (Object)null))
						{
							((Object)<texture>5__3).name = Path.GetFileNameWithoutExtension(filePath);
							((Texture)<texture>5__3).wrapMode = (TextureWrapMode)1;
							((Texture)<texture>5__3).filterMode = (FilterMode)1;
							<sprite>5__4 = Sprite.Create(<texture>5__3, new Rect(0f, 0f, (float)((Texture)<texture>5__3).width, (float)((Texture)<texture>5__3).height), new Vector2(0.5f, 0.5f), 100f);
							((Object)<sprite>5__4).name = Path.GetFileNameWithoutExtension(filePath);
							LogInfo("[Hardheim Main Menu] Kép betöltve: " + ((Texture)<texture>5__3).width + "x" + ((Texture)<texture>5__3).height);
							if (onLoaded != null)
							{
								onLoaded(<sprite>5__4);
							}
							<texture>5__3 = null;
							<sprite>5__4 = null;
							<>m__Finally1();
							<request>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 (<request>5__2 != null)
			{
				((IDisposable)<request>5__2).Dispose();
			}
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <MuteVanillaMenuMusicRepeatedCoroutine>d__112 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public float duration;

		private float <elapsed>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <MuteVanillaMenuMusicRepeatedCoroutine>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;
				<elapsed>5__1 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<elapsed>5__1 < duration)
			{
				MuteVanillaMenuMusic();
				<elapsed>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 <ReplaceLogoDelayed>d__155 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private float <initialDelay>5__1;

		private int <attempts>5__2;

		private float <interval>5__3;

		private int <minScore>5__4;

		private bool <success>5__5;

		private int <i>5__6;

		private <>c__DisplayClass155_0 <>8__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ReplaceLogoDelayed>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;
				<initialDelay>5__1 = Mathf.Max(0f, ReplaceDelaySeconds.Value);
				if (<initialDelay>5__1 > 0f)
				{
					LogInfo("[Hardheim Main Menu] Várakozás " + <initialDelay>5__1.ToString("0.00") + " mp-ig az első logócsere előtt.");
					<>2__current = (object)new WaitForSeconds(<initialDelay>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)
				{
					<success>5__5 = true;
					LogInfo("[Hardheim Main Menu] A logócsere sikeres volt a(z) " + <i>5__6 + ". próbálkozásra.");
					break;
				}
				if (<i>5__6 < <attempts>5__2)
				{
					<>2__current = (object)new WaitForSeconds(<interval>5__3);
					<>1__state = 3;
					return true;
				}
				goto IL_024a;
			case 3:
				{
					<>1__state = -1;
					goto IL_024a;
				}
				IL_0264:
				if (<i>5__6 <= <attempts>5__2)
				{
					<>8__7 = new <>c__DisplayClass155_0();
					LogInfo("[Hardheim Main Menu] Logócsere próbálkozás: " + <i>5__6 + "/" + <attempts>5__2);
					<>8__7.attemptSuccess = false;
					<>2__current = ((MonoBehaviour)Instance).StartCoroutine(TryReplaceLogoCoroutine(delegate(bool result)
					{
						<>8__7.attemptSuccess = result;
					}, <minScore>5__4));
					<>1__state = 2;
					return true;
				}
				break;
				IL_00cf:
				<attempts>5__2 = GetRetryAttemptsByMode();
				<interval>5__3 = GetRetryIntervalByMode();
				<minScore>5__4 = GetMinimumScoreByMode();
				LogInfo("[Hardheim Main Menu] Logócsere indul. Próbálkozások száma: " + <attempts>5__2 + ", intervallum: " + <interval>5__3.ToString("0.00") + " mp, minimum pontszám: " + <minScore>5__4);
				<success>5__5 = false;
				<i>5__6 = 1;
				goto IL_0264;
				IL_024a:
				<>8__7 = null;
				<i>5__6++;
				goto IL_0264;
			}
			if (!<success>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 <StartMenuMusicCoroutine>d__113 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private string <musicPath>5__1;

		private string <url>5__2;

		private float <targetVolume>5__3;

		private float <fadeDuration>5__4;

		private float <t>5__5;

		private float <normalized>5__6;

		private WWW <www>5__7;

		private AudioClip <clip>5__8;

		private float <targetVolume>5__9;

		private float <fadeDuration>5__10;

		private float <t>5__11;

		private float <normalized>5__12;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <StartMenuMusicCoroutine>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();
				}
			}
			<musicPath>5__1 = null;
			<url>5__2 = null;
			<www>5__7 = null;
			<clip>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;
						<musicPath>5__1 = GetMusicPath();
						if (string.IsNullOrWhiteSpace(<musicPath>5__1) || !File.Exists(<musicPath>5__1))
						{
							LogWarning("[Hardheim Main Menu] Nem található a főmenü zene: " + <musicPath>5__1);
							_menuMusicStarting = false;
							result = false;
						}
						else
						{
							EnsureMenuMusicObject();
							UpdateMenuMusicSettings();
							MuteVanillaMenuMusic();
							if ((Object)(object)_menuMusicClip != (Object)null)
							{
								_menuMusicSource.clip = _menuMusicClip;
								_menuMusicSource.volume = 0f;
								_menuMusicSource.Play();
								<targetVolume>5__3 = Mathf.Clamp01(MenuMusicVolume.Value);
								<fadeDuration>5__4 = 1f;
								<t>5__5 = 0f;
								goto IL_01ec;
							}
							<url>5__2 = "file:///" + <musicPath>5__1.Replace("\\", "/");
							<www>5__7 = new WWW(<url>5__2);
							<>1__state = -3;
							<>2__current = <www>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(<www>5__7.error))
					{
						LogError("[Hardheim Main Menu] Hiba a zene betöltésekor: " + <www>5__7.error);
						_menuMusicStarting = false;
						result = false;
						break;
					}
					<clip>5__8 = <www>5__7.GetAudioClip(false, true, (AudioType)14);
					if ((Object)(object)<clip>5__8 == (Object)null)
					{
						LogError("[Hardheim Main Menu] AudioClip null.");
						_menuMusicStarting = false;
						result = false;
						break;
					}
					_menuMusicClip = <clip>5__8;
					_menuMusicSource.clip = _menuMusicClip;
					_menuMusicSource.volume = 0f;
					_menuMusicSource.Play();
					<targetVolume>5__9 = Mathf.Clamp01(MenuMusicVolume.Value);
					<fadeDuration>5__10 = 1f;
					<t>5__11 = 0f;
					goto IL_03d6;
				case 3:
					{
						<>1__state = -3;
						goto IL_03d6;
					}
					IL_01ec:
					if (<t>5__5 < <fadeDuration>5__4)
					{
						<t>5__5 += Time.unscaledDeltaTime;
						<normalized>5__6 = Mathf.Clamp01(<t>5__5 / <fadeDuration>5__4);
						_menuMusicSource.volume = Mathf.Lerp(0f, <targetVolume>5__3, <normalized>5__6);
						<>2__current = null;
						<>1__state = 1;
						result = true;
					}
					else
					{
						_menuMusicSource.volume = <targetVolume>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 (<t>5__11 < <fadeDuration>5__10)
					{
						<t>5__11 += Time.unscaledDeltaTime;
						<normalized>5__12 = Mathf.Clamp01(<t>5__11 / <fadeDuration>5__10);
						_menuMusicSource.volume = Mathf.Lerp(0f, <targetVolume>5__9, <normalized>5__12);
						<>2__current = null;
						<>1__state = 3;
						result = true;
					}
					else
					{
						_menuMusicSource.volume = <targetVolume>5__9;
						LogInfo("[Hardheim Main Menu] Főmenü zene elindítva (fade-in).");
						<clip>5__8 = null;
						<>m__Finally1();
						<www>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 (<www>5__7 != null)
			{
				((IDisposable)<www>5__7).Dispose();
			}
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <SuppressWorldSelectFlash>d__122 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public FejdStartup startup;

		private float <duration>5__1;

		private float <elapsed>5__2;

		private int <i>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <SuppressWorldSelectFlash>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();
				<duration>5__1 = 1.25f;
				<elapsed>5__2 = 0f;
				goto IL_0096;
			case 1:
				<>1__state = -1;
				goto IL_0096;
			case 2:
				{
					<>1__state = -1;
					<i>5__3++;
					break;
				}
				IL_0096:
				if (<elapsed>5__2 < <duration>5__1)
				{
					HideWorldSelectIfVisible(startup);
					<elapsed>5__2 += Time.unscaledDeltaTime;
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				<i>5__3 = 0;
				break;
			}
			if (<i>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 <TryReplaceLogoCoroutine>d__156 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Action<bool> onFinished;

		public int minimumScore;

		private <>c__DisplayClass156_0 <>8__1;

		private string <logoPath>5__2;

		private Image[] <images>5__3;

		private Image <bestMatch>5__4;

		private int <bestScore>5__5;

		private bool <shouldAnimate>5__6;

		private Image[] <>s__7;

		private int <>s__8;

		private Image <img>5__9;

		private int <score>5__10;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <TryReplaceLogoCoroutine>d__156(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<logoPath>5__2 = null;
			<images>5__3 = null;
			<bestMatch>5__4 = null;
			<>s__7 = null;
			<img>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();
				<logoPath>5__2 = GetLogoPath();
				<>8__1.customSprite = null;
				<>2__current = ((MonoBehaviour)Instance).StartCoroutine(LoadSpriteFromFileCoroutine(<logoPath>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;
				}
				<images>5__3 = Resources.FindObjectsOfTypeAll<Image>();
				if (<images>5__3 == null || <images>5__3.Length == 0)
				{
					if (onFinished != null)
					{
						onFinished(obj: false);
					}
					return false;
				}
				LogInfo("[Hardheim Main Menu] Talált Image objektumok száma: " + <images>5__3.Length);
				if (DumpAllImages.Value)
				{
					DumpImageCandidates(<images>5__3);
				}
				<bestMatch>5__4 = null;
				<bestScore>5__5 = int.MinValue;
				<>s__7 = <images>5__3;
				for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
				{
					<img>5__9 = <>s__7[<>s__8];
					if (!((Object)(object)<img>5__9 == (Object)null) && !((Object)(object)((Component)<img>5__9).gameObject == (Object)null))
					{
						<score>5__10 = CalculateImageScore(<img>5__9);
						if (<score>5__10 > <bestScore>5__5)
						{
							<bestScore>5__5 = <score>5__10;
							<bestMatch>5__4 = <img>5__9;
						}
						<img>5__9 = null;
					}
				}
				<>s__7 = null;
				if ((Object)(object)<bestMatch>5__4 == (Object)null || <bestScore>5__5 < minimumScore)
				{
					if (onFinished != null)
					{
						onFinished(obj: false);
					}
					return false;
				}
				ApplyLogo(<bestMatch>5__4, <>8__1.customSprite);
				<shouldAnimate>5__6 = EnableFade.Value && !_fadeAlreadyPlayed;
				if (<shouldAnimate>5__6)
				{
					_fadeAlreadyPlayed = true;
					<>2__current = ((MonoBehaviour)Instance).StartCoroutine(FadeInLogoCoroutine(<bestMatch>5__4));
					<>1__state = 2;
					return true;
				}
				break;
			case 2:
				<>1__state = -1;
				break;
			}
			_lastAppliedObjectName = ((Object)((Component)<bestMatch>5__4).gameObject).name;
			LogInfo("[Hardheim Main Menu] A logó sikeresen lecserélve erre az objektumra: " + ((Object)((Component)<bestMatch>5__4).gameObject).name + " | Pontszám: " + <bestScore>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 <WaitForConnectedWorldLoadAndReplaceCoroutine>d__127 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		private <>c__DisplayClass127_0 <>8__1;

		private float <initialDelay>5__2;

		private string <selectedPath>5__3;

		private float <postSceneDelay>5__4;

		private float <interval>5__5;

		private float <hardTimeout>5__6;

		private bool <foundLoadingGuiAtLeastOnce>5__7;

		private GameObject <loadingGui>5__8;

		private LoadingTargetResult <bestTarget>5__9;

		private bool <applied>5__10;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <WaitForConnectedWorldLoadAndReplaceCoroutine>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;
			<selectedPath>5__3 = null;
			<loadingGui>5__8 = null;
			<bestTarget>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();
					<initialDelay>5__2 = Mathf.Max(0f, LoadingScreenInitialDelaySeconds.Value);
					if (!(<initialDelay>5__2 > 0f))
					{
						LogInfo("[Hardheim Main Menu] Loading screen watcher azonnal indul.");
						goto IL_0122;
					}
					LogInfo("[Hardheim Main Menu] Loading screen watcher indul " + <initialDelay>5__2.ToString("0.00") + " mp késleltetéssel.");
					<>2__current = (object)new WaitForSecondsRealtime(<initialDelay>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: " + <selectedPath>5__3);
						result = false;
						break;
					}
					<postSceneDelay>5__4 = Mathf.Max(0f, LoadingScreenPostSceneDelaySeconds.Value);
					if (!(<postSceneDelay>5__4 > 0f))
					{
						goto IL_021d;
					}
					<>2__current = (object)new WaitForSecondsRealtime(<postSceneDelay>5__4);
					<>1__state = 3;
					result = true;
					goto end_IL_0000;
				case 3:
					<>1__state = -3;
					goto IL_021d;
				case 4:
					{
						<>1__state = -3;
						<loadingGui>5__8 = null;
						goto IL_0407;
					}
					IL_0122:
					<selectedPath>5__3 = GetNextLoadingScreenPath();
					if (string.IsNullOrWhiteSpace(<selectedPath>5__3))
					{
						result = false;
						break;
					}
					<>8__1.customSprite = null;
					<>2__current = ((MonoBehaviour)Instance).StartCoroutine(LoadSpriteFromFileCoroutine(<selectedPath>5__3, delegate(Sprite sprite)
					{
						<>8__1.customSprite = sprite;
					}));
					<>1__state = 2;
					result = true;
					goto end_IL_0000;
					IL_021d:
					<interval>5__5 = Mathf.Max(0.02f, LoadingScreenSearchIntervalSeconds.Value);
					<hardTimeout>5__6 = Mathf.Max(5f, LoadingScreenHardTimeoutSeconds.Value);
					<foundLoadingGuiAtLeastOnce>5__7 = false;
					goto IL_0407;
					IL_0407:
					if (<hardTimeout>5__6 > 0f)
					{
						if (IsWorldFullyLoaded())
						{
							LogInfo("[Hardheim Main Menu] A világ betöltött, loading watcher leáll.");
							result = false;
							break;
						}
						<loadingGui>5__8 = FindLoadingGuiObject();
						if ((Object)(object)<loadingGui>5__8 != (Object)null)
						{
							<foundLoadingGuiAtLeastOnce>5__7 = true;
							if (DumpLoadingGuiOnce.Value && !_loadingGuiDumped)
							{
								DumpLoadingGuiElements();
								_loadingGuiDumped = true;
							}
							<bestTarget>5__9 = FindBestConnectedWorldLoadingTarget();
							if (<bestTarget>5__9.IsValid)
							{
								<applied>5__10 = ApplyLoadingTargetResult(<bestTarget>5__9, <>8__1.customSprite);
								if (<applied>5__10)
								{
									_loadingScreenAppliedOnce = true;
									_loadingScreenLocked = true;
									LogInfo("[Hardheim Main Menu] Loading screen cserélve és force override indul. Fájl: " + <selectedPath>5__3 + " | Cél objektum: " + <bestTarget>5__9.ObjectName + " | Pontszám: " + <bestTarget>5__9.Score + " | Path: " + <bestTarget>5__9.Path);
									StartForceKeepLoadingTarget(<bestTarget>5__9, <>8__1.customSprite);
									StartLoadingScreenCleanup(<bestTarget>5__9);
									result = false;
									break;
								}
							}
							<bestTarget>5__9 = default(LoadingTargetResult);
						}
						<hardTimeout>5__6 -= <interval>5__5;
						<>2__current = (object)new WaitForSecondsRealtime(<interval>5__5);
						<>1__state = 4;
						result = true;
					}
					else
					{
						if (!<foundLoadingGuiAtLeastOnce>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;
						<selectedPath>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 <WaitForWorldLoadAndClearLoadingTargetCoroutine>d__131 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public LoadingTargetResult result;

		private float <timeout>5__1;

		private float <elapsed>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <WaitForWorldLoadAndClearLoadingTargetCoroutine>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;
				<timeout>5__1 = Mathf.Max(10f, LoadingScreenCleanupTimeoutSeconds.Value);
				<elapsed>5__2 = 0f;
				LogVerbose("[Hardheim Main Menu] Loading cleanup watcher elindult. Cél: " + result.ObjectName);
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<elapsed>5__2 < <timeout>5__1)
			{
				if (IsWorldFullyLoaded())
				{
					LogInfo("[Hardheim Main Menu] Világ betöltve, loading target fade-out indul cleanup watcherből.");
					FadeOutAndClearLoadingTarget(result);
					return false;
				}
				<elapsed>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<bool> ModEnabled;

	internal static ConfigEntry<bool> EnableLogging;

	internal static ConfigEntry<bool> VerboseLogging;

	internal static ConfigEntry<string> LogoFileName;

	internal static ConfigEntry<string> DiscordLogoFileName;

	internal static ConfigEntry<float> ReplaceDelaySeconds;

	internal static ConfigEntry<bool> UseFixedSize;

	internal static ConfigEntry<float> FixedWidth;

	internal static ConfigEntry<float> FixedHeight;

	internal static ConfigEntry<float> LogoScale;

	internal static ConfigEntry<bool> EnableFade;

	internal static ConfigEntry<float> FadeDuration;

	internal static ConfigEntry<string> CompatibilityMode;

	internal static ConfigEntry<int> RetryCount;

	internal static ConfigEntry<float> RetryIntervalSeconds;

	internal static ConfigEntry<int> MinimumScoreThreshold;

	internal static ConfigEntry<bool> DumpLoadingGuiOnce;

	internal static ConfigEntry<bool> DumpAllImages;

	internal static ConfigEntry<bool> HidePatchNotes;

	internal static ConfigEntry<bool> HideModdedWarning;

	internal static ConfigEntry<bool> HideMerchStore;

	internal static ConfigEntry<int> HideUiPasses;

	internal static ConfigEntry<float> HideUiIntervalSeconds;

	internal static ConfigEntry<bool> EnableQuickJoinButton;

	internal static ConfigEntry<string> QuickJoinServerAddress;

	internal static ConfigEntry<string> QuickJoinServerPassword;

	internal static ConfigEntry<float> QuickJoinButtonSpacing;

	internal static ConfigEntry<bool> EnableCustomLoadingScreens;

	internal static ConfigEntry<bool> RandomizeLoadingScreens;

	internal static ConfigEntry<float> LoadingScreenWaitForConnectionSeconds;

	internal static ConfigEntry<float> LoadingScreenSearchIntervalSeconds;

	internal static ConfigEntry<float> LoadingScreenInitialDelaySeconds;

	internal static ConfigEntry<float> LoadingScreenPostSceneDelaySeconds;

	internal static ConfigEntry<float> LoadingScreenForceDurationSeconds;

	internal static ConfigEntry<float> LoadingScreenHardTimeoutSeconds;

	internal static ConfigEntry<float> LoadingScreenCleanupTimeoutSeconds;

	internal static ConfigEntry<bool> EnableLoadingScreenFadeOut;

	internal static ConfigEntry<float> LoadingScreenFadeOutDuration;

	internal static ConfigEntry<bool> EnableMenuMusic;

	internal static ConfigEntry<string> MenuMusicFileName;

	internal static ConfigEntry<float> MenuMusicVolume;

	internal static ConfigEntry<bool> MenuMusicLoop;

	internal static ConfigEntry<bool> EnableMenuMusicFadeOut;

	internal static ConfigEntry<float> 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<AudioSource> _mutedVanillaMenuSources = new List<AudioSource>();

	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<string, PluginInfo> 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<bool>("General", "Enabled", true, "A mod be- vagy kikapcsolása.");
		EnableLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("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<bool>("General", "VerboseLogging", false, "Részletes, hibakereséshez hasznos plusz logok. Csak akkor kapcsold be, ha tesztelünk valamit.");
		LogoFileName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "LogoFileName", "logo.png", "A betöltendő logófájl neve a HardheimMainMenu mappából.");
		DiscordLogoFileName = ((BaseUnityPlugin)this).Config.Bind<string>("General", "DiscordLogoFileName", "discord.png", "A betöltendő Discord logófájl neve a HardheimMainMenu mappából.");
		ReplaceDelaySeconds = ((BaseUnityPlugin)this).Config.Bind<float>("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<bool>("Display", "UseFixedSize", true, "Fix UI méretet használjon a logóhoz.");
		FixedWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "FixedWidth", 900f, "A logó fix szélessége UI egységben.");
		FixedHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "FixedHeight", 260f, "A logó fix magassága UI egységben.");
		LogoScale = ((BaseUnityPlugin)this).Config.Bind<float>("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<bool>("Animation", "EnableFade", true, "Áttűnéses animáció használata a logócsere után.");
		FadeDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Animation", "FadeDuration", 0.8f, "Az áttűnés animáció hossza másodpercben.");
		CompatibilityMode = ((BaseUnityPlugin)this).Config.Bind<string>("Compatibility", "CompatibilityMode", "Auto", "Kompatibilitási mód. Lehetséges értékek: Strict, Auto, Aggressive.");
		RetryCount = ((BaseUnityPlugin)this).Config.Bind<int>("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<float>("Compatibility", "RetryIntervalSeconds", 0.75f, "Ennyi időt vár két újrapróbálkozás között.");
		MinimumScoreThreshold = ((BaseUnityPlugin)this).Config.Bind<int>("Compatibility", "MinimumScoreThreshold", 50, "A minimális pontszám, ami felett egy UI elem megfelelő jelöltnek számít.");
		DumpLoadingGuiOnce = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DumpLoadingGuiOnce", false, "Ha igaz, egyszer kilogolja a LoadingGUI alatti elemeket world loading közben.");
		DumpAllImages = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DumpAllImages", false, "Ha engedélyezve van, kilogolja az összes talált UI Image objektumot és pontszámukat.");
		HidePatchNotes = ((BaseUnityPlugin)this).Config.Bind<bool>("HideUI", "HidePatchNotes", true, "Elrejti a főmenü frissítési napló / patch notes / news elemeit.");
		HideModdedWarning = ((BaseUnityPlugin)this).Config.Bind<bool>("HideUI", "HideModdedWarning", true, "Elrejti a figyelmeztetést, hogy modolt Valheim klienst használsz.");
		HideMerchStore = ((BaseUnityPlugin)this).Config.Bind<bool>("HideUI", "HideMerchStore", true, "Elrejti a merch store / shop elemeket a főmenüből.");
		HideUiPasses = ((BaseUnityPlugin)this).Config.Bind<int>("HideUI", "HideUiPasses", 8, "Hányszor próbálja meg újra elrejteni a főmenü nem kívánt elemeit.");
		HideUiIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("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<bool>("Hardheim", "EnableQuickJoinButton", true, "Megjelenítse-e a gyors csatlakozás gombot a főmenüben.");
		QuickJoinServerAddress = ((BaseUnityPlugin)this).Config.Bind<string>("Hardheim", "ServerAddress", "62.113.194.164:11115", "A Hardheim szerver címe IP:PORT formában.");
		QuickJoinServerPassword = ((BaseUnityPlugin)this).Config.Bind<string>("Hardheim", "ServerPassword", "hardheim", "A Hardheim szerver jelszava.");
		QuickJoinButtonSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("Hardheim", "ButtonSpacing", 14f, "A gyors csatlakozás gomb távolsága a referencia főmenü gombhoz képest.");
		EnableCustomLoadingScreens = ((BaseUnityPlugin)this).Config.Bind<bool>("LoadingScreens", "EnableCustomLoadingScreens", true, "Engedélyezi az egyedi töltőképeket a világ betöltése közben.");
		RandomizeLoadingScreens = ((BaseUnityPlugin)this).Config.Bind<bool>("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<float>("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<float>("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<float>("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<float>("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<float>("LoadingScreens", "ForceDurationSeconds", 8f, "Ennyi ideig erőltesse vissza a kiválasztott loading képet ugyanarra a célobjektumra.");
		LoadingScreenHardTimeoutSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("LoadingScreens", "HardTimeoutSeconds", 25f, "Maximum ennyi ideig figyelje a loading UI-t, mielőtt feladja a keresést.");
		LoadingScreenCleanupTimeoutSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("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<bool>("LoadingScreens", "EnableFadeOut", true, "A custom loading screen finoman tűnjön el, amikor a világ betöltött.");
		LoadingScreenFadeOutDuration = ((BaseUnityPlugin)this).Config.Bind<float>("LoadingScreens", "FadeOutDuration", 0.6f, "A custom loading screen fade-out ideje másodpercben.");
		EnableMenuMusic = ((BaseUnityPlugin)this).Config.Bind<bool>("Music", "EnableMenuMusic", true, "Saját főmenü zene lejátszása.");
		MenuMusicFileName = ((BaseUnityPlugin)this).Config.Bind<string>("Music", "MenuMusicFileName", "menu.ogg", "A lejátszandó zenefájl neve a HardheimMainMenu/Music mappából.");
		MenuMusicVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Music", "MenuMusicVolume", 0.55f, "A főmenü zene hangereje. 0.0 és 1.0 között.");
		MenuMusicLoop = ((BaseUnityPlugin)this).Config.Bind<bool>("Music", "MenuMusicLoop", true, "A főmenü zene újrainduljon, ha véget ér.");
		EnableMenuMusicFadeOut = ((BaseUnityPlugin)this).Config.Bind<bool>("Music", "EnableFadeOut", true, "A főmenü zene finoman halkuljon el, amikor csatlakozol a világhoz.");
		MenuMusicFadeOutDuration = ((BaseUnityPlugin)this).Config.Bind<float>("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(<FadeOutAndStopMenuMusicCoroutine>d__98))]
	internal static IEnumerator FadeOutAndStopMenuMusicCoroutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <FadeOutAndStopMenuMusicCoroutine>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<string> list = new List<string>();
			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<AudioSource>();
			_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<AudioSource>((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 : "<null>"));
					}
				}
			}
		}
		catch (Exception ex)
		{
			LogError("[Hardheim Main Menu] Hiba az eredeti menü zene némításakor: " + ex);
		}
	}

	[IteratorStateMachine(typeof(<MuteVanillaMenuMusicRepeatedCoroutine>d__112))]
	internal static IEnumerator MuteVanillaMenuMusicRepeatedCoroutine(float duration)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <MuteVanillaMenuMusicRepeatedCoroutine>d__112(0)
		{
			duration = duration
		};
	}

	[IteratorStateMachine(typeof(<StartMenuMusicCoroutine>d__113))]
	internal static IEnumerator StartMenuMusicCoroutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <StartMenuMusicCoroutine>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<Transform>(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(<SuppressWorldSelectFlash>d__122))]
	internal static IEnumerator SuppressWorldSelectFlash(FejdStartup startup)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SuppressWorldSelectFlash>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<Canvas>();
			_quickJoinOverlayCanvas.renderMode = (RenderMode)0;
			_quickJoinOverlayCanvas.sortingOrder = 10000;
			_quickJoinOverlay.AddComponent<CanvasScaler>();
			_quickJoinOverlay.AddComponent<GraphicRaycaster>();
			GameObject val = new GameObject("OverlayImage");
			val.transform.SetParent(_quickJoinOverlay.transform, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			Image val3 = val.AddComponent<Image>();
			((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(<HideQuickJoinOverlayDelayed>d__125))]
	internal static IEnumerator HideQuickJoinOverlayDelayed()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <HideQuickJoinOverlayDelayed>d__125(0);
	}

	internal static void TryHandlePendingQuickJoinAfterCharacterSelect()
	{
		if (!_pendingQuickJoin)
		{
			return;
		}
		if (string.IsNullOrWhiteSpace(_pendingServerAddress))
		{
			ClearPendingQuickJoin();
			HideQuickJoinOverlay();
			return;
		}
		try
		{
			FejdStartup val = Object.FindFirstObjectByType<FejdStartup>();
			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(<WaitForConnectedWorldLoadAndReplaceCoroutine>d__127))]
	internal static IEnumerator WaitForConnectedWorldLoadAndReplaceCoroutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <WaitForConnectedWorldLoadAndReplaceCoroutine>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(<WaitForWorldLoadAndClearLoadingTargetCoroutine>d__131))]
	internal static IEnumerator WaitForWorldLoadAndClearLoadingTargetCoroutine(LoadingTargetResult result)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <WaitForWorldLoadAndClearLoadingTargetCoroutine>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<Transform>((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<Image>();
		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<RawImage>();
		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(<ForceKeepLoadingTargetCoroutine>d__138))]
	internal static IEnumerator ForceKeepLoadingTargetCoroutine(LoadingTargetResult result, Sprite sprite)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ForceKeepLoadingTargetCoroutine>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(<FadeOutAndClearLoadingTargetCoroutine>d__140))]
	internal static IEnumerator FadeOutAndClearLoadingTargetCoroutine(LoadingTargetResult result)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <FadeOutAndClearLoadingTargetCoroutine>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/")