Decompiled source of Repo WiiMenu v1.0.1

MenuParty.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MenuParty")]
[assembly: AssemblyTitle("MenuParty")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("omni.repo.harmony.mainmenu.swap", "MainMenu Prefab+Music Swap", "1.1.1")]
public class MainMenuPrefabSwapPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("omni.repo.harmony.mainmenu.swap");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"MainMenu Prefab+Music Swap loaded");
	}
}
[HarmonyPatch(typeof(LevelGenerator), "StartRoomGeneration")]
public static class Patch_LevelGenerator_StartRoomGeneration
{
	[CompilerGenerated]
	private sealed class <ReplacementCoroutine>d__13 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public LevelGenerator gen;

		public GameObject customPrefab;

		public AudioClip music;

		private GameObject <go>5__1;

		private Camera[] <>s__2;

		private int <>s__3;

		private Camera <cam>5__4;

		private GameObject <musicGO>5__5;

		private AudioSource <audio>5__6;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<go>5__1 = null;
			<>s__2 = null;
			<cam>5__4 = null;
			<musicGO>5__5 = null;
			<audio>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (WaitingFlag != null)
				{
					WaitingFlag.SetValue(gen, true);
				}
				gen.State = (LevelState)3;
				YeetGamesMenuMusic();
				<go>5__1 = Object.Instantiate<GameObject>(customPrefab, Vector3.zero, Quaternion.identity);
				<>s__2 = <go>5__1.GetComponentsInChildren<Camera>(true);
				for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++)
				{
					<cam>5__4 = <>s__2[<>s__3];
					if ((Object)(object)<cam>5__4 != (Object)null && (Object)(object)<cam>5__4.targetTexture != (Object)null)
					{
						<cam>5__4.targetTexture = null;
					}
					<cam>5__4 = null;
				}
				<>s__2 = null;
				if ((Object)(object)gen.LevelParent != (Object)null)
				{
					<go>5__1.transform.parent = gen.LevelParent.transform;
				}
				if ((Object)(object)music != (Object)null)
				{
					<musicGO>5__5 = new GameObject("MainMenuMusic_Swap");
					<musicGO>5__5.transform.SetParent(<go>5__1.transform, false);
					<audio>5__6 = <musicGO>5__5.AddComponent<AudioSource>();
					<audio>5__6.clip = music;
					<audio>5__6.loop = true;
					<audio>5__6.playOnAwake = true;
					<audio>5__6.spatialBlend = 0f;
					<audio>5__6.volume = 1f;
					<audio>5__6.priority = 128;
					<audio>5__6.Play();
					<musicGO>5__5 = null;
					<audio>5__6 = null;
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (WaitingFlag != null)
				{
					WaitingFlag.SetValue(gen, 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();
		}
	}

	private const string BundleStem = "omnilikeag6";

	private const string PreferredFolder = "Omniscye-SemiBotMenu";

	private const string PrefabName = "Start Room - Main Menu";

	private const string MusicAssetName = "Constant Music - Main Menu";

	private const string GameMusicClipName = "msc main menu";

	private const string GameMusicSOName = "Constant Music - Main Menu";

	private static AssetBundle _bundle;

	private static GameObject _cachedPrefab;

	private static AudioClip _cachedMusic;

	private static bool _attemptedLoad;

	private static readonly FieldInfo WaitingFlag = AccessTools.Field(typeof(LevelGenerator), "waitingForSubCoroutine");

	private static bool InMainMenu()
	{
		RunManager instance = RunManager.instance;
		return (Object)(object)instance != (Object)null && (Object)(object)instance.levelCurrent == (Object)(object)instance.levelMainMenu;
	}

	private static bool Prefix(LevelGenerator __instance, ref IEnumerator __result)
	{
		if (!InMainMenu())
		{
			return true;
		}
		if (!EnsureAssetsLoaded())
		{
			return true;
		}
		__result = ReplacementCoroutine(__instance, _cachedPrefab, _cachedMusic);
		return false;
	}

	[IteratorStateMachine(typeof(<ReplacementCoroutine>d__13))]
	private static IEnumerator ReplacementCoroutine(LevelGenerator gen, GameObject customPrefab, AudioClip music)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ReplacementCoroutine>d__13(0)
		{
			gen = gen,
			customPrefab = customPrefab,
			music = music
		};
	}

	private static void YeetGamesMenuMusic()
	{
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		int num2 = 0;
		int num3 = 0;
		try
		{
			AudioSource[] array = Object.FindObjectsOfType<AudioSource>(true);
			AudioSource[] array2 = array;
			foreach (AudioSource val in array2)
			{
				AudioClip val2 = (((Object)(object)val != (Object)null) ? val.clip : null);
				if ((Object)(object)val2 != (Object)null && StringEquals(((Object)val2).name, "msc main menu"))
				{
					try
					{
						val.Stop();
						val.mute = true;
						val.loop = false;
						val.clip = null;
						num++;
					}
					catch
					{
					}
				}
			}
		}
		catch
		{
		}
		try
		{
			AudioClip[] array3 = Resources.FindObjectsOfTypeAll<AudioClip>();
			AudioClip[] array4 = array3;
			foreach (AudioClip val3 in array4)
			{
				if ((Object)(object)val3 != (Object)null && StringEquals(((Object)val3).name, "msc main menu"))
				{
					try
					{
						Resources.UnloadAsset((Object)(object)val3);
						num2++;
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("[MainMenuSwap] Couldn't UnloadAsset for 'msc main menu': " + ex.Message));
					}
				}
			}
		}
		catch
		{
		}
		try
		{
			ScriptableObject[] array5 = Resources.FindObjectsOfTypeAll<ScriptableObject>();
			ScriptableObject[] array6 = array5;
			foreach (ScriptableObject val4 in array6)
			{
				if ((Object)(object)val4 == (Object)null || !StringEquals(((Object)val4).name, "Constant Music - Main Menu"))
				{
					continue;
				}
				Type type = ((object)val4).GetType();
				bool flag = false;
				PropertyInfo property = type.GetProperty("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && typeof(AudioClip).IsAssignableFrom(property.PropertyType))
				{
					try
					{
						property.SetValue(val4, null);
						flag = true;
					}
					catch
					{
					}
				}
				FieldInfo field = type.GetField("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (!flag && field != null && typeof(AudioClip).IsAssignableFrom(field.FieldType))
				{
					try
					{
						field.SetValue(val4, null);
						flag = true;
					}
					catch
					{
					}
				}
				FieldInfo field2 = type.GetField("music", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (!flag && field2 != null && typeof(AudioClip).IsAssignableFrom(field2.FieldType))
				{
					try
					{
						field2.SetValue(val4, null);
						flag = true;
					}
					catch
					{
					}
				}
				if (flag)
				{
					((Object)val4).hideFlags = (HideFlags)(((Object)val4).hideFlags | 0x37);
					num3++;
				}
			}
		}
		catch
		{
		}
		Debug.Log((object)string.Format("[MainMenuSwap] Stopped {0} source(s), unloaded {1} clip(s), neutered {2} SO(s) for '{3}'.", num, num2, num3, "msc main menu"));
	}

	private static bool EnsureAssetsLoaded()
	{
		if (_attemptedLoad)
		{
			return (Object)(object)_cachedPrefab != (Object)null;
		}
		_attemptedLoad = true;
		try
		{
			string text = FindBundlePath(Paths.PluginPath, "omnilikeag6", "Omniscye-SemiBotMenu");
			if (text == null)
			{
				Debug.LogError((object)"[MainMenuSwap] Could not find asset bundle starting with 'omnilikeag6' under plugins (searched recursively).");
				return false;
			}
			_bundle = AssetBundle.LoadFromFile(text);
			if ((Object)(object)_bundle == (Object)null)
			{
				Debug.LogError((object)("[MainMenuSwap] Failed to load AssetBundle at: " + text));
				return false;
			}
			_cachedPrefab = _bundle.LoadAsset<GameObject>("Start Room - Main Menu");
			if ((Object)(object)_cachedPrefab == (Object)null)
			{
				Debug.LogError((object)("[MainMenuSwap] Prefab 'Start Room - Main Menu' not found in bundle: " + text));
				return false;
			}
			Debug.Log((object)("[MainMenuSwap] Loaded 'Start Room - Main Menu' from: " + text));
			_cachedMusic = TryLoadMusicClip(_bundle, "Constant Music - Main Menu");
			if ((Object)(object)_cachedMusic != (Object)null)
			{
				Debug.Log((object)"[MainMenuSwap] Loaded music 'Constant Music - Main Menu'.");
			}
			else
			{
				Debug.LogWarning((object)"[MainMenuSwap] Music asset 'Constant Music - Main Menu' not found or not an AudioClip; continuing without music swap.");
			}
		}
		catch (Exception arg)
		{
			Debug.LogError((object)$"[MainMenuSwap] Exception loading assets: {arg}");
			return false;
		}
		return true;
	}

	private static AudioClip TryLoadMusicClip(AssetBundle bundle, string name)
	{
		AudioClip val = bundle.LoadAsset<AudioClip>(name);
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		Object val2 = bundle.LoadAsset(name);
		if (val2 == (Object)null)
		{
			return null;
		}
		Type type = ((object)val2).GetType();
		PropertyInfo property = type.GetProperty("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (property != null && typeof(AudioClip).IsAssignableFrom(property.PropertyType))
		{
			try
			{
				object? value = property.GetValue(val2);
				return (AudioClip)((value is AudioClip) ? value : null);
			}
			catch
			{
			}
		}
		FieldInfo field = type.GetField("clip", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
		if (field != null && typeof(AudioClip).IsAssignableFrom(field.FieldType))
		{
			try
			{
				object? value2 = field.GetValue(val2);
				return (AudioClip)((value2 is AudioClip) ? value2 : null);
			}
			catch
			{
			}
		}
		return null;
	}

	private static string FindBundlePath(string pluginsRoot, string stem, string preferredFolder)
	{
		string stem2 = stem;
		string preferredFolder2 = preferredFolder;
		if (string.IsNullOrEmpty(pluginsRoot) || !Directory.Exists(pluginsRoot))
		{
			Debug.LogError((object)("[MainMenuSwap] Plugins folder not found: '" + pluginsRoot + "'"));
			return null;
		}
		List<string> list = (from p in Directory.EnumerateFiles(pluginsRoot, "*", SearchOption.AllDirectories)
			where Path.GetFileName(p)?.StartsWith(stem2, StringComparison.OrdinalIgnoreCase) ?? false
			select p).ToList();
		if (list.Count == 0)
		{
			return null;
		}
		return Pick(list.ToArray());
		string Pick(string[] arr)
		{
			return (from p in arr
				orderby p.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Any((string seg) => seg.Equals(preferredFolder2, StringComparison.OrdinalIgnoreCase)) descending, p.Count((char ch) => ch == Path.DirectorySeparatorChar || ch == Path.AltDirectorySeparatorChar), Path.GetFileName(p).Length
				select p).First();
		}
	}

	private static bool StringEquals(string a, string b)
	{
		return string.Equals(a?.Trim(), b?.Trim(), StringComparison.OrdinalIgnoreCase);
	}
}
namespace MenuParty
{
	[BepInPlugin("Omniscye.MenuParty", "MenuParty", "1.0")]
	public class MenuParty : BaseUnityPlugin
	{
		internal static MenuParty Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}

WiiiMenu2.dll

Decompiled a month 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WiiiMenu2")]
[assembly: AssemblyTitle("WiiiMenu2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Empress.WiiMainMenu
{
	[BepInPlugin("Empress.WiiMainMenu", "WiiMainMenu", "1.1.0")]
	public class WiiMainMenuPlugin : BaseUnityPlugin
	{
		internal static WiiMainMenuPlugin Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; private set; }

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			Harmony.PatchAll(Assembly.GetExecutingAssembly());
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded");
		}
	}
	[HarmonyPatch(typeof(MenuManager), "PageOpen")]
	internal static class Patch_MenuManager_PageOpen
	{
		private static void Postfix(MenuPageIndex menuPageIndex, ref MenuPage __result)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			if (!((Object)(object)__result == (Object)null) && (int)menuPageIndex <= 0 && (Object)(object)((Component)__result).gameObject.GetComponent<WiiMainMenuController>() == (Object)null)
			{
				WiiMainMenuPlugin.Logger.LogInfo((object)"[WiiMainMenu] Attaching Controller...");
				((Component)__result).gameObject.AddComponent<WiiMainMenuController>();
			}
		}
	}
	[RequireComponent(typeof(MenuPage))]
	internal class WiiMainMenuController : MonoBehaviour
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<MenuPageMain> <>9__19_6;

			public static Action<MenuPageMain> <>9__19_7;

			public static Action<MenuPageMain> <>9__19_8;

			public static Action<MenuPageMain> <>9__19_9;

			public static Action<MenuPageMain> <>9__19_10;

			public static Action<MenuPageMain> <>9__19_11;

			public static EventHandler <>9__30_0;

			internal void <InitRoutine>b__19_6(MenuPageMain m)
			{
				m.ButtonEventSinglePlayer();
			}

			internal void <InitRoutine>b__19_7(MenuPageMain m)
			{
				m.ButtonEventHostGame();
			}

			internal void <InitRoutine>b__19_8(MenuPageMain m)
			{
				m.ButtonEventPlayRandom();
			}

			internal void <InitRoutine>b__19_9(MenuPageMain m)
			{
				m.ButtonEventTutorial();
			}

			internal void <InitRoutine>b__19_10(MenuPageMain m)
			{
				m.ButtonEventSettings();
			}

			internal void <InitRoutine>b__19_11(MenuPageMain m)
			{
				m.ButtonEventQuit();
			}

			internal void <TryLoadVideo>b__30_0(VideoPlayer source)
			{
				source.Play();
				source.Pause();
				source.time = 0.0;
			}
		}

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

			private object <>2__current;

			public WiiMainMenuController <>4__this;

			private Exception <ex>5__1;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<ex>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = <>4__this.LoadAudio();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this._attachedPage = ((Component)<>4__this).GetComponent<MenuPage>();
					<>4__this._pageStateField = AccessTools.Field(typeof(MenuPage), "currentPageState");
					<>4__this._initialized = true;
					<>4__this.HideVanillaMain();
					<>4__this.BuildOverlayCanvas();
					<>4__this.BuildBackground();
					<>4__this.BuildBubbles();
					<>4__this.BuildChannelGrid();
					try
					{
						<>4__this.CreateChannel("Single Player", "channel_singleplayer.mp4", delegate
						{
							<>4__this.ClickWithAnimation(delegate(MenuPageMain m)
							{
								m.ButtonEventSinglePlayer();
							});
						});
						<>4__this.CreateChannel("Host Game", "channel_hostgame.mp4", delegate
						{
							<>4__this.ClickWithAnimation(delegate(MenuPageMain m)
							{
								m.ButtonEventHostGame();
							});
						});
						<>4__this.CreateChannel("Quick Play", "channel_playrandom.mp4", delegate
						{
							<>4__this.ClickWithAnimation(delegate(MenuPageMain m)
							{
								m.ButtonEventPlayRandom();
							});
						});
						<>4__this.CreateChannel("Tutorial", "channel_tutorial.mp4", delegate
						{
							<>4__this.ClickWithAnimation(delegate(MenuPageMain m)
							{
								m.ButtonEventTutorial();
							});
						});
						<>4__this.CreateChannel("Settings", "channel_settings.mp4", delegate
						{
							<>4__this.ClickWithAnimation(delegate(MenuPageMain m)
							{
								m.ButtonEventSettings();
							});
						});
						<>4__this.CreateChannel("Quit Game", "channel_quit.mp4", delegate
						{
							<>4__this.ClickWithAnimation(delegate(MenuPageMain m)
							{
								m.ButtonEventQuit();
							});
						});
						WiiMainMenuPlugin.Logger.LogInfo((object)"[WiiMainMenu] UI Built Successfully.");
					}
					catch (Exception ex)
					{
						<ex>5__1 = ex;
						WiiMainMenuPlugin.Logger.LogError((object)$"[WiiMainMenu] Error building channels: {<ex>5__1}");
					}
					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 <LoadAudio>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public WiiMainMenuController <>4__this;

			private string <folder>5__1;

			private string <pathHover>5__2;

			private string <pathSelect>5__3;

			private UnityWebRequest <uwr>5__4;

			private UnityWebRequest <uwr>5__5;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				switch (<>1__state)
				{
				case -3:
				case 1:
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
					break;
				case -4:
				case 2:
					try
					{
					}
					finally
					{
						<>m__Finally2();
					}
					break;
				}
				<folder>5__1 = null;
				<pathHover>5__2 = null;
				<pathSelect>5__3 = null;
				<uwr>5__4 = null;
				<uwr>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Invalid comparison between Unknown and I4
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<folder>5__1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
						<pathHover>5__2 = Path.Combine(<folder>5__1, "hover.ogg");
						if (File.Exists(<pathHover>5__2))
						{
							<uwr>5__4 = UnityWebRequestMultimedia.GetAudioClip("file://" + <pathHover>5__2, (AudioType)14);
							<>1__state = -3;
							<>2__current = <uwr>5__4.SendWebRequest();
							<>1__state = 1;
							return true;
						}
						goto IL_00fb;
					case 1:
						<>1__state = -3;
						if ((int)<uwr>5__4.result == 1)
						{
							<>4__this._hoverSoundClip = DownloadHandlerAudioClip.GetContent(<uwr>5__4);
						}
						<>m__Finally1();
						<uwr>5__4 = null;
						goto IL_00fb;
					case 2:
						{
							<>1__state = -4;
							if ((int)<uwr>5__5.result == 1)
							{
								<>4__this._selectSoundClip = DownloadHandlerAudioClip.GetContent(<uwr>5__5);
							}
							<>m__Finally2();
							<uwr>5__5 = null;
							break;
						}
						IL_00fb:
						<pathSelect>5__3 = Path.Combine(<folder>5__1, "select.ogg");
						if (File.Exists(<pathSelect>5__3))
						{
							<uwr>5__5 = UnityWebRequestMultimedia.GetAudioClip("file://" + <pathSelect>5__3, (AudioType)14);
							<>1__state = -4;
							<>2__current = <uwr>5__5.SendWebRequest();
							<>1__state = 2;
							return true;
						}
						break;
					}
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			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 (<uwr>5__4 != null)
				{
					((IDisposable)<uwr>5__4).Dispose();
				}
			}

			private void <>m__Finally2()
			{
				<>1__state = -1;
				if (<uwr>5__5 != null)
				{
					((IDisposable)<uwr>5__5).Dispose();
				}
			}

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

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

			private object <>2__current;

			public RectTransform target;

			public Action<MenuPageMain> action;

			public WiiMainMenuController <>4__this;

			private float <timer>5__1;

			private float <duration>5__2;

			private Vector3 <startScale>5__3;

			private Vector3 <endScale>5__4;

			private CanvasGroup <cg>5__5;

			private float <t>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<cg>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<timer>5__1 = 0f;
					<duration>5__2 = 0.5f;
					<startScale>5__3 = ((Transform)target).localScale;
					<endScale>5__4 = new Vector3(8f, 8f, 8f);
					<cg>5__5 = ((Component)target).GetComponent<CanvasGroup>();
					if ((Object)(object)<cg>5__5 == (Object)null)
					{
						<cg>5__5 = ((Component)target).gameObject.AddComponent<CanvasGroup>();
					}
					<>4__this._overlayObj.GetComponent<Canvas>().sortingOrder = 32000;
					goto IL_0150;
				case 1:
					<>1__state = -1;
					goto IL_0150;
				case 2:
					{
						<>1__state = -1;
						if ((Object)(object)target != (Object)null)
						{
							((Transform)target).localScale = Vector3.one;
							if ((Object)(object)<cg>5__5 != (Object)null)
							{
								Object.Destroy((Object)(object)<cg>5__5);
							}
						}
						<>4__this._overlayObj.GetComponent<Canvas>().sortingOrder = 30000;
						return false;
					}
					IL_0150:
					if (<timer>5__1 < <duration>5__2)
					{
						<timer>5__1 += Time.unscaledDeltaTime;
						<t>5__6 = <timer>5__1 / <duration>5__2;
						<t>5__6 = <t>5__6 * <t>5__6 * (3f - 2f * <t>5__6);
						((Transform)target).localScale = Vector3.Lerp(<startScale>5__3, <endScale>5__4, <t>5__6);
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>4__this.SafeClick(action);
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

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

		private GameObject _overlayObj;

		private Transform _channelGridRoot;

		private Transform _bubbleContainer;

		private bool _initialized;

		private AudioClip _hoverSoundClip;

		private AudioClip _selectSoundClip;

		private MenuPage _attachedPage;

		private FieldInfo _pageStateField;

		private const string VideoSinglePlayer = "channel_singleplayer.mp4";

		private const string VideoHostGame = "channel_hostgame.mp4";

		private const string VideoPlayRandom = "channel_playrandom.mp4";

		private const string VideoTutorial = "channel_tutorial.mp4";

		private const string VideoSettings = "channel_settings.mp4";

		private const string VideoQuit = "channel_quit.mp4";

		private const string SoundHover = "hover.ogg";

		private const string SoundSelect = "select.ogg";

		private void Start()
		{
			if (!_initialized)
			{
				((MonoBehaviour)this).StartCoroutine(InitRoutine());
			}
		}

		private void Update()
		{
			if (_initialized && !((Object)(object)_overlayObj == (Object)null) && !((Object)(object)_attachedPage == (Object)null))
			{
				int num = (int)_pageStateField.GetValue(_attachedPage);
				bool flag = num == 0 || num == 1 || num == 4;
				if (_overlayObj.activeSelf != flag)
				{
					_overlayObj.SetActive(flag);
				}
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_overlayObj != (Object)null)
			{
				Object.Destroy((Object)(object)_overlayObj);
			}
		}

		[IteratorStateMachine(typeof(<InitRoutine>d__19))]
		private IEnumerator InitRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitRoutine>d__19(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<LoadAudio>d__20))]
		private IEnumerator LoadAudio()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadAudio>d__20(0)
			{
				<>4__this = this
			};
		}

		private void ClickWithAnimation(Action<MenuPageMain> action)
		{
			GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
			if ((Object)(object)currentSelectedGameObject != (Object)null)
			{
				WiiChannelHover component = currentSelectedGameObject.GetComponent<WiiChannelHover>();
				if ((Object)(object)component != (Object)null)
				{
					if ((Object)(object)_selectSoundClip != (Object)null)
					{
						component.PlaySound(_selectSoundClip);
					}
					component.IsAnimatingClick = true;
					((MonoBehaviour)this).StartCoroutine(ZoomAnimationRoutine(currentSelectedGameObject.GetComponent<RectTransform>(), action));
					return;
				}
			}
			SafeClick(action);
		}

		[IteratorStateMachine(typeof(<ZoomAnimationRoutine>d__22))]
		private IEnumerator ZoomAnimationRoutine(RectTransform target, Action<MenuPageMain> action)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ZoomAnimationRoutine>d__22(0)
			{
				<>4__this = this,
				target = target,
				action = action
			};
		}

		private void BuildOverlayCanvas()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			_overlayObj = new GameObject("WiiOverlayCanvas");
			Object.DontDestroyOnLoad((Object)(object)_overlayObj);
			Canvas val = _overlayObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 30000;
			CanvasScaler val2 = _overlayObj.AddComponent<CanvasScaler>();
			val2.uiScaleMode = (ScaleMode)1;
			val2.referenceResolution = new Vector2(1920f, 1080f);
			_overlayObj.AddComponent<GraphicRaycaster>();
		}

		private void BuildBackground()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("BlackBackground", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(_overlayObj.transform, false);
			val.transform.SetAsFirstSibling();
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			Image component2 = val.GetComponent<Image>();
			((Graphic)component2).color = Color.black;
			((Graphic)component2).raycastTarget = true;
		}

		private void BuildBubbles()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("BubbleContainer", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(_overlayObj.transform, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			_bubbleContainer = val.transform;
			Texture2D val2 = CreateBubbleTexture();
			Sprite sprite = Sprite.Create(val2, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f));
			for (int i = 0; i < 40; i++)
			{
				SpawnBubble(sprite);
			}
		}

		private void SpawnBubble(Sprite sprite)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Bubble", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(BubbleBehaviour)
			});
			val.transform.SetParent(_bubbleContainer, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.zero;
			component.pivot = new Vector2(0.5f, 0.5f);
			Image component2 = val.GetComponent<Image>();
			component2.sprite = sprite;
			Color color = Color.HSVToRGB(Random.Range(0f, 1f), 0.8f, 1f);
			color.a = Random.Range(0.3f, 0.6f);
			((Graphic)component2).color = color;
			((Graphic)component2).raycastTarget = false;
			float num = Random.Range(40f, 150f);
			component.sizeDelta = new Vector2(num, num);
			BubbleBehaviour component3 = val.GetComponent<BubbleBehaviour>();
			component3.Setup(Random.Range(0, 1920), Random.Range(0, 1080));
		}

		private Texture2D CreateBubbleTexture()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			int num = 64;
			Texture2D val = new Texture2D(num, num, (TextureFormat)5, false);
			Color[] array = (Color[])(object)new Color[num * num];
			float num2 = (float)num / 2f;
			float num3 = (float)num / 2f;
			float num4 = (float)num / 2f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num5 = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(num2, num3));
					float num6 = Mathf.Clamp01(1f - num5 / num4);
					num6 = Mathf.Pow(num6, 2f);
					array[i * num + j] = new Color(1f, 1f, 1f, num6);
				}
			}
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private void BuildChannelGrid()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("WiiGrid", new Type[2]
			{
				typeof(RectTransform),
				typeof(GridLayoutGroup)
			});
			val.transform.SetParent(_overlayObj.transform, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.15f, 0.15f);
			component.anchorMax = new Vector2(0.85f, 0.85f);
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			GridLayoutGroup component2 = val.GetComponent<GridLayoutGroup>();
			component2.cellSize = new Vector2(420f, 280f);
			component2.spacing = new Vector2(50f, 50f);
			component2.startCorner = (Corner)0;
			component2.startAxis = (Axis)0;
			((LayoutGroup)component2).childAlignment = (TextAnchor)4;
			component2.constraint = (Constraint)1;
			component2.constraintCount = 3;
			_channelGridRoot = val.transform;
		}

		private void CreateChannel(string title, string videoFile, Action onClick)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: 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_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: 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_032a: Expected O, but got Unknown
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Expected O, but got Unknown
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			Action onClick2 = onClick;
			GameObject val = new GameObject("Btn_" + title, new Type[5]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button),
				typeof(Outline),
				typeof(Shadow)
			});
			val.transform.SetParent(_channelGridRoot, false);
			Image component = val.GetComponent<Image>();
			((Graphic)component).color = new Color(0.95f, 0.95f, 0.95f, 1f);
			Outline component2 = val.GetComponent<Outline>();
			((Shadow)component2).effectColor = new Color(0.6f, 0.6f, 0.7f, 0.8f);
			((Shadow)component2).effectDistance = new Vector2(3f, -3f);
			Shadow component3 = val.GetComponent<Shadow>();
			component3.effectColor = new Color(0f, 0f, 0f, 0.3f);
			component3.effectDistance = new Vector2(5f, -5f);
			Button component4 = val.GetComponent<Button>();
			((UnityEvent)component4.onClick).AddListener((UnityAction)delegate
			{
				onClick2?.Invoke();
			});
			ColorBlock colors = ((Selectable)component4).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).highlightedColor = new Color(0.65f, 0.85f, 1f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.4f, 0.6f, 0.9f);
			((Selectable)component4).colors = colors;
			GameObject val2 = new GameObject("VideoFrame", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val2.transform.SetParent(val.transform, false);
			RectTransform component5 = val2.GetComponent<RectTransform>();
			component5.anchorMin = new Vector2(0.03f, 0.25f);
			component5.anchorMax = new Vector2(0.97f, 0.97f);
			component5.offsetMin = Vector2.zero;
			component5.offsetMax = Vector2.zero;
			((Graphic)val2.GetComponent<Image>()).color = new Color(0.1f, 0.1f, 0.1f, 1f);
			GameObject val3 = new GameObject("RawImage", new Type[2]
			{
				typeof(RectTransform),
				typeof(RawImage)
			});
			val3.transform.SetParent(val2.transform, false);
			RectTransform component6 = val3.GetComponent<RectTransform>();
			component6.anchorMin = Vector2.zero;
			component6.anchorMax = Vector2.one;
			component6.offsetMin = new Vector2(2f, 2f);
			component6.offsetMax = new Vector2(-2f, -2f);
			RawImage component7 = val3.GetComponent<RawImage>();
			((Graphic)component7).color = Color.white;
			((Graphic)component7).raycastTarget = false;
			GameObject val4 = new GameObject("TextBar", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.transform.SetParent(val.transform, false);
			RectTransform component8 = val4.GetComponent<RectTransform>();
			component8.anchorMin = new Vector2(0.03f, 0.03f);
			component8.anchorMax = new Vector2(0.97f, 0.23f);
			component8.offsetMin = Vector2.zero;
			component8.offsetMax = Vector2.zero;
			((Graphic)val4.GetComponent<Image>()).color = new Color(0.85f, 0.85f, 0.85f, 1f);
			GameObject val5 = new GameObject("Label", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val5.transform.SetParent(val4.transform, false);
			RectTransform component9 = val5.GetComponent<RectTransform>();
			component9.anchorMin = Vector2.zero;
			component9.anchorMax = Vector2.one;
			component9.offsetMin = new Vector2(5f, 0f);
			component9.offsetMax = new Vector2(-5f, 0f);
			TextMeshProUGUI component10 = val5.GetComponent<TextMeshProUGUI>();
			((TMP_Text)component10).text = title;
			((TMP_Text)component10).alignment = (TextAlignmentOptions)4098;
			((Graphic)component10).color = new Color(0.2f, 0.2f, 0.2f, 1f);
			((TMP_Text)component10).fontSize = 24f;
			((TMP_Text)component10).fontStyle = (FontStyles)1;
			((TMP_Text)component10).enableAutoSizing = true;
			((TMP_Text)component10).fontSizeMin = 14f;
			((TMP_Text)component10).fontSizeMax = 28f;
			WiiChannelHover wiiChannelHover = val.AddComponent<WiiChannelHover>();
			wiiChannelHover.SetOutline(component2);
			wiiChannelHover.HoverClip = _hoverSoundClip;
			TryLoadVideo(val, component7, videoFile, wiiChannelHover);
		}

		private void TryLoadVideo(GameObject btnObj, RawImage rawImg, string fileName, WiiChannelHover hover)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00cd: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, fileName);
			if (!File.Exists(text))
			{
				((Graphic)rawImg).color = new Color(0.15f, 0.15f, 0.15f, 1f);
				return;
			}
			VideoPlayer val = btnObj.AddComponent<VideoPlayer>();
			val.playOnAwake = false;
			val.isLooping = true;
			val.renderMode = (VideoRenderMode)2;
			val.source = (VideoSource)1;
			val.url = text;
			val.audioOutputMode = (VideoAudioOutputMode)0;
			RenderTexture rt = (RenderTexture)(object)(rawImg.texture = (Texture)(object)(val.targetTexture = new RenderTexture(320, 240, 0)));
			val.Prepare();
			object obj = <>c.<>9__30_0;
			if (obj == null)
			{
				EventHandler val4 = delegate(VideoPlayer source)
				{
					source.Play();
					source.Pause();
					source.time = 0.0;
				};
				<>c.<>9__30_0 = val4;
				obj = (object)val4;
			}
			val.prepareCompleted += (EventHandler)obj;
			hover.SetupVideo(val, rawImg, rt);
		}

		private void HideVanillaMain()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < ((Component)this).transform.childCount; i++)
			{
				Transform child = ((Component)this).transform.GetChild(i);
				if ((Object)(object)((Component)child).GetComponent<WiiMainMenuController>() == (Object)null)
				{
					child.localScale = Vector3.zero;
					child.localPosition = new Vector3(99999f, 99999f, 0f);
				}
			}
		}

		private void SafeClick(Action<MenuPageMain> action)
		{
			MenuPageMain val = MenuPageMain.instance ?? Object.FindObjectOfType<MenuPageMain>();
			if ((Object)(object)val != (Object)null)
			{
				action(val);
			}
		}
	}
	public class WiiChannelHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public bool IsAnimatingClick;

		public AudioClip HoverClip;

		private VideoPlayer _vp;

		private RawImage _raw;

		private RenderTexture _rt;

		private Outline _outline;

		private AudioSource _audio;

		private bool _hasVideo;

		private bool _hover;

		private Color _originalOutlineColor;

		private void Awake()
		{
			_audio = ((Component)this).gameObject.AddComponent<AudioSource>();
			_audio.playOnAwake = false;
			_audio.volume = 0.5f;
		}

		public void SetOutline(Outline outline)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			_outline = outline;
			if ((Object)(object)_outline != (Object)null)
			{
				_originalOutlineColor = ((Shadow)_outline).effectColor;
			}
		}

		public void SetupVideo(VideoPlayer vp, RawImage raw, RenderTexture rt)
		{
			_vp = vp;
			_raw = raw;
			_rt = rt;
			_hasVideo = true;
		}

		public void PlaySound(AudioClip clip)
		{
			if ((Object)(object)clip != (Object)null)
			{
				_audio.PlayOneShot(clip);
			}
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (!IsAnimatingClick)
			{
				_hover = true;
				if ((Object)(object)_outline != (Object)null)
				{
					((Shadow)_outline).effectColor = new Color(0.2f, 0.6f, 1f, 1f);
				}
				if (_hasVideo)
				{
					_vp.Play();
				}
				if ((Object)(object)HoverClip != (Object)null)
				{
					_audio.PlayOneShot(HoverClip);
				}
			}
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (!IsAnimatingClick)
			{
				_hover = false;
				if ((Object)(object)_outline != (Object)null)
				{
					((Shadow)_outline).effectColor = _originalOutlineColor;
				}
				if (_hasVideo)
				{
					_vp.Pause();
				}
			}
		}

		private void Update()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (!IsAnimatingClick)
			{
				float num = (_hover ? 1.08f : 1f);
				((Component)this).transform.localScale = Vector3.Lerp(((Component)this).transform.localScale, Vector3.one * num, Time.unscaledDeltaTime * 15f);
			}
		}

		private void OnDestroy()
		{
			if ((Object)(object)_rt != (Object)null)
			{
				_rt.Release();
			}
		}
	}
	public class BubbleBehaviour : MonoBehaviour
	{
		private float _speed;

		private float _wobbleFreq;

		private float _wobbleAmp;

		private float _xOffset;

		private RectTransform _rt;

		public void Setup(float startX, float startY)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			_rt = ((Component)this).GetComponent<RectTransform>();
			_rt.anchoredPosition = new Vector2(startX, startY);
			_speed = Random.Range(20f, 60f);
			_wobbleFreq = Random.Range(1f, 3f);
			_wobbleAmp = Random.Range(10f, 30f);
			_xOffset = startX;
		}

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			float num = _rt.anchoredPosition.y + _speed * Time.unscaledDeltaTime;
			float num2 = _xOffset + Mathf.Sin(Time.unscaledTime * _wobbleFreq) * _wobbleAmp;
			if (num > 1200f)
			{
				num = -100f;
			}
			_rt.anchoredPosition = new Vector2(num2, num);
		}
	}
}