Decompiled source of UltraClean v0.7.0

plugins/UltraClean/UltraClean.dll

Decompiled 3 weeks 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 HarmonyLib;
using JigglePhysics;
using TMPro;
using UltraClean;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
public class cleaneroo : MonoBehaviour
{
	[Serializable]
	public struct WordPair
	{
		public string wordToReplace;

		public string replacementWord;
	}

	private WordPair[] wordPairs = new WordPair[1]
	{
		new WordPair
		{
			wordToReplace = "lust",
			replacementWord = "excess"
		}
	};

	private float timer;

	private float checkInterval = 0.15f;

	private void Update()
	{
		timer += Time.deltaTime;
		if (timer < checkInterval)
		{
			return;
		}
		timer = 0f;
		TMP_Text[] array = Object.FindObjectsOfType<TMP_Text>();
		foreach (TMP_Text val in array)
		{
			if (!((Object)(object)val == (Object)null))
			{
				string text = val.text;
				string text2 = ReplaceWords(text);
				if (text2 != text)
				{
					Debug.Log((object)("[cleaneroo] Replaced in '" + ((Object)((Component)val).gameObject).name + "': \"" + text + "\" -> \"" + text2 + "\""));
					val.text = text2;
				}
			}
		}
		MapInfoBase[] array2 = Object.FindObjectsOfType<MapInfoBase>();
		foreach (MapInfoBase val2 in array2)
		{
			if (!((Object)(object)val2 == (Object)null))
			{
				string layerName = val2.layerName;
				string levelName = val2.levelName;
				string text3 = ReplaceWords(layerName);
				string text4 = ReplaceWords(levelName);
				if (text3 != layerName)
				{
					Debug.Log((object)("[cleaneroo] Replaced in MapInfoBase.layerName: \"" + layerName + "\" -> \"" + text3 + "\""));
					val2.layerName = text3;
				}
				if (text4 != levelName)
				{
					Debug.Log((object)("[cleaneroo] Replaced in MapInfoBase.levelName: \"" + levelName + "\" -> \"" + text4 + "\""));
					val2.levelName = text4;
				}
			}
		}
	}

	private string ReplaceWords(string text)
	{
		string text2 = text;
		WordPair[] array = wordPairs;
		for (int i = 0; i < array.Length; i++)
		{
			WordPair wordPair = array[i];
			text2 = ReplaceCaseInsensitive(text2, wordPair.wordToReplace, wordPair.replacementWord);
		}
		return text2;
	}

	private string ReplaceCaseInsensitive(string input, string search, string replacement)
	{
		int startIndex = 0;
		while (true)
		{
			startIndex = input.IndexOf(search, startIndex, StringComparison.OrdinalIgnoreCase);
			if (startIndex == -1)
			{
				break;
			}
			string original = input.Substring(startIndex, search.Length);
			string text = MatchCapitalization(original, replacement);
			input = input.Remove(startIndex, search.Length).Insert(startIndex, text);
			startIndex += text.Length;
		}
		return input;
	}

	private string MatchCapitalization(string original, string replacement)
	{
		if (IsAllUpper(original))
		{
			return replacement.ToUpper();
		}
		if (IsAllLower(original))
		{
			return replacement.ToLower();
		}
		if (IsCapitalized(original))
		{
			return Capitalize(replacement);
		}
		return replacement.ToLower();
	}

	private bool IsAllUpper(string s)
	{
		for (int i = 0; i < s.Length; i++)
		{
			if (!char.IsUpper(s[i]))
			{
				return false;
			}
		}
		return true;
	}

	private bool IsAllLower(string s)
	{
		for (int i = 0; i < s.Length; i++)
		{
			if (!char.IsLower(s[i]))
			{
				return false;
			}
		}
		return true;
	}

	private bool IsCapitalized(string s)
	{
		if (s.Length == 0)
		{
			return false;
		}
		if (char.IsUpper(s[0]))
		{
			return s.Substring(1).ToLower() == s.Substring(1);
		}
		return false;
	}

	private string Capitalize(string s)
	{
		if (string.IsNullOrEmpty(s))
		{
			return s;
		}
		return char.ToUpper(s[0]) + s.Substring(1).ToLower();
	}
}
public class UltraCleanSwapper : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <SwapRoutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Invalid comparison between Unknown and I4
			int num = <>1__state;
			if (num != 0)
			{
				if (num != 1)
				{
					return false;
				}
				<>1__state = -1;
			}
			else
			{
				<>1__state = -1;
			}
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			foreach (Material val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Shader shader = val.shader;
				int propertyCount = shader.GetPropertyCount();
				for (int j = 0; j < propertyCount; j++)
				{
					if ((int)shader.GetPropertyType(j) != 4)
					{
						continue;
					}
					string propertyName = shader.GetPropertyName(j);
					Texture texture = val.GetTexture(propertyName);
					if ((Object)(object)texture == (Object)null)
					{
						continue;
					}
					foreach (UltraCleanPlugin.TextureSwapEntry swap in UltraCleanPlugin.swaps)
					{
						if (((Object)texture).name == swap.originalName && (Object)(object)swap.replacement != (Object)null)
						{
							val.SetTexture(propertyName, (Texture)(object)swap.replacement);
						}
					}
				}
			}
			<>2__current = (object)new WaitForSeconds(0.25f);
			<>1__state = 1;
			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 void Start()
	{
		((MonoBehaviour)this).StartCoroutine(SwapRoutine());
	}

	[IteratorStateMachine(typeof(<SwapRoutine>d__1))]
	private IEnumerator SwapRoutine()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <SwapRoutine>d__1(0);
	}
}
namespace UltraClean
{
	[BepInPlugin("com.fuckyou.ultraclean", "UltraClean", "1.0.0")]
	public class UltraCleanPlugin : BaseUnityPlugin
	{
		[Serializable]
		public struct TextureSwapEntry
		{
			public string originalName;

			public Texture2D replacement;
		}

		public class CoroutineRunner : MonoBehaviour
		{
			private static CoroutineRunner _instance;

			public static CoroutineRunner Instance
			{
				get
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Expected O, but got Unknown
					if ((Object)(object)_instance == (Object)null)
					{
						GameObject val = new GameObject("CoroutineRunner");
						Object.DontDestroyOnLoad((Object)val);
						_instance = val.AddComponent<CoroutineRunner>();
					}
					return _instance;
				}
			}
		}

		[HarmonyPatch(typeof(JiggleRigBuilder), "Awake")]
		internal class lol7
		{
			private static void Postfix(JiggleRigBuilder __instance)
			{
				if (!((Object)(object)__instance == (Object)null))
				{
					Debug.LogWarning((object)"bye");
					Object.Destroy((Object)(object)__instance);
				}
			}
		}

		[HarmonyPatch(typeof(Mindflayer), "Awake")]
		internal class lol2
		{
			private static void Postfix(Mindflayer __instance)
			{
				if ((Object)(object)__instance.smr != (Object)null && (Object)(object)__instance.ensim != (Object)null)
				{
					if ((Object)(object)_texNormal != (Object)null)
					{
						__instance.maleMaterial.SetTexture("_MainTex", (Texture)(object)_texNormal);
					}
					if ((Object)(object)_texEnraged != (Object)null)
					{
						__instance.maleMaterialEnraged.SetTexture("_MainTex", (Texture)(object)_texEnraged);
					}
					__instance.smr.sharedMesh = __instance.maleMesh;
					((Renderer)__instance.smr).material = __instance.maleMaterial;
					__instance.ensim.enragedMaterial = __instance.maleMaterialEnraged;
				}
			}
		}

		[HarmonyPatch(typeof(StockMapInfo), "Awake")]
		internal class lol
		{
			private static void Postfix(StockMapInfo __instance)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				string name = ((Scene)(ref activeScene)).name;
				if (name.StartsWith("6440445"))
				{
					Debug.LogError((object)"UltraClean: Booted into 2-2");
					string[] pathParts = new string[3] { "1 Nonstuff", "Building with Interior", "Skeleton 1" };
					string[] pathParts2 = new string[3] { "1 Nonstuff", "Building with Interior", "Skeleton 1 (1)" };
					GameObject val = FindInactive("1 - First District");
					if ((Object)(object)val != (Object)null)
					{
						Transform transform = val.transform;
						Transform val2 = FindDeepChildPath(transform, pathParts);
						Transform val3 = FindDeepChildPath(transform, pathParts2);
						if ((Object)(object)val2 != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)val2).gameObject);
						}
						if ((Object)(object)val3 != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)val3).gameObject);
						}
					}
					else
					{
						Debug.LogError((object)"UltraClean: Root '1 - First District' not found!");
					}
				}
				if (name.StartsWith("9dcce8"))
				{
					Debug.LogError((object)"UltraClean: im gonna skip this whole fucking level");
					GameObject val4 = FindInactive("Canvas");
					if ((Object)(object)val4 != (Object)null)
					{
						Transform val5 = FindInChildrenRecursive(val4.transform, "PowerUpVignette");
						if ((Object)(object)val5 != (Object)null)
						{
							Object.Destroy((Object)(object)((Component)val5).gameObject);
						}
						SkipRunner skipRunner = val4.AddComponent<SkipRunner>();
						skipRunner._intermission = _intermissionVid;
						skipRunner.RunWaitAndRankless();
					}
					else
					{
						Debug.LogError((object)"UltraClean: oh shit canvas not found");
					}
				}
				if (name.StartsWith("e6c104"))
				{
					Debug.LogError((object)"UltraClean: Booted into 6-1");
					string[] pathParts3 = new string[2] { "14", "Cube (2)" };
					GameObject val6 = FindInactive("Exteriors");
					if ((Object)(object)val6 != (Object)null)
					{
						Transform val7 = FindDeepChildPath(val6.transform, pathParts3);
						if ((Object)(object)val7 != (Object)null)
						{
							MeshRenderer component = ((Component)val7).GetComponent<MeshRenderer>();
							if ((Object)(object)component != (Object)null)
							{
								Material[] materialArray = ((Renderer)component).GetMaterialArray();
								materialArray[1] = materialArray[0];
								((Renderer)component).SetMaterialArray(materialArray);
							}
						}
					}
					else
					{
						Debug.LogError((object)"UltraClean: Root 'Exteriors' not found!");
					}
				}
				FishObject[] array = Resources.FindObjectsOfTypeAll<FishObject>();
				foreach (FishObject val8 in array)
				{
					if ((Object)(object)val8 != (Object)null && val8.fishName.Contains("Shark"))
					{
						val8.description = "The great white shark (Carcharodon carcharias), also known as the white shark, white pointer, or simply great white, is a species of large mackerel shark.\r\n\r\nLives in huge bodies of water and avoids land, though it may swim close to shore to feed.";
					}
				}
			}

			private static GameObject FindInactive(string name)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
				for (int i = 0; i < rootGameObjects.Length; i++)
				{
					Transform val = FindInChildrenRecursive(rootGameObjects[i].transform, name);
					if ((Object)(object)val != (Object)null)
					{
						return ((Component)val).gameObject;
					}
				}
				return null;
			}

			private static Transform FindInChildrenRecursive(Transform parent, string targetName)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Expected O, but got Unknown
				if (((Object)parent).name == targetName)
				{
					return parent;
				}
				foreach (Transform item in parent)
				{
					Transform val = FindInChildrenRecursive(item, targetName);
					if ((Object)(object)val != (Object)null)
					{
						return val;
					}
				}
				return null;
			}

			private static Transform FindDeepChild(Transform parent, string[] pathParts, int index = 0)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Expected O, but got Unknown
				if (index >= pathParts.Length)
				{
					return parent;
				}
				foreach (Transform item in parent)
				{
					Transform val = item;
					if (((Object)val).name == pathParts[index])
					{
						Transform val2 = FindDeepChild(val, pathParts, index + 1);
						if ((Object)(object)val2 != (Object)null)
						{
							return val2;
						}
					}
				}
				return null;
			}
		}

		internal static List<TextureSwapEntry> swaps = new List<TextureSwapEntry>();

		private static AssetBundle _bundle;

		internal static Texture2D _texNormal;

		internal static Texture2D _texEnraged;

		internal static Texture2D _texMannequin;

		internal static Texture2D _texMinos;

		internal static Texture2D _texSisyphus;

		internal static Texture2D _texSchism;

		internal static Texture2D _texAttention;

		internal static VideoClip _intermissionVid;

		public static UltraCleanPlugin Instance { get; private set; }

		private static GameObject FindInactive(string name)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
			for (int i = 0; i < rootGameObjects.Length; i++)
			{
				Transform val = FindInChildrenRecursive(rootGameObjects[i].transform, name);
				if ((Object)(object)val != (Object)null)
				{
					return ((Component)val).gameObject;
				}
			}
			return null;
		}

		private static Transform FindInChildrenRecursive(Transform parent, string targetName)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (((Object)parent).name == targetName)
			{
				return parent;
			}
			foreach (Transform item in parent)
			{
				Transform val = FindInChildrenRecursive(item, targetName);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private static Transform FindDeepChild(Transform parent, string name)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (((Object)parent).name == name)
			{
				return parent;
			}
			foreach (Transform item in parent)
			{
				Transform val = FindDeepChild(item, name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private void ReplaceMaterials()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			foreach (Material val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Shader shader = val.shader;
				int propertyCount = shader.GetPropertyCount();
				for (int j = 0; j < propertyCount; j++)
				{
					if ((int)shader.GetPropertyType(j) != 4)
					{
						continue;
					}
					string propertyName = shader.GetPropertyName(j);
					Texture texture = val.GetTexture(propertyName);
					if ((Object)(object)texture == (Object)null)
					{
						continue;
					}
					foreach (TextureSwapEntry swap in swaps)
					{
						if (((Object)texture).name == swap.originalName && (Object)(object)swap.replacement != (Object)null)
						{
							val.SetTexture(propertyName, (Texture)(object)swap.replacement);
						}
					}
				}
			}
		}

		private static Transform FindDeepChildPath(Transform parent, string[] pathParts, int index = 0)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (index >= pathParts.Length)
			{
				return parent;
			}
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name == pathParts[index])
				{
					Transform val2 = FindDeepChildPath(val, pathParts, index + 1);
					if ((Object)(object)val2 != (Object)null)
					{
						return val2;
					}
				}
			}
			return null;
		}

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			new Harmony("com.fuckyou.ultraclean").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"UltraClean: Harmony patches applied.");
			_bundle = AssetBundle.LoadFromFile(Path.Combine(ModPath(), "ultraclean.bundle"));
			if ((Object)(object)_bundle == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"UltraClean: Failed to load ultraclean.bundle!");
			}
			else
			{
				_texNormal = _bundle.LoadAsset<Texture2D>("midflayer_m");
				_texEnraged = _bundle.LoadAsset<Texture2D>("midflayer_m_enr");
				_texMannequin = _bundle.LoadAsset<Texture2D>("mannegood");
				_texMinos = _bundle.LoadAsset<Texture2D>("minosbutgood");
				_texSisyphus = _bundle.LoadAsset<Texture2D>("sisyphusbutgood");
				_texSchism = _bundle.LoadAsset<Texture2D>("schismbutgood");
				_texAttention = _bundle.LoadAsset<Texture2D>("attentionbutgood");
				_intermissionVid = _bundle.LoadAsset<VideoClip>("ultraclean_inter");
				if ((Object)(object)_texNormal == (Object)null || (Object)(object)_texEnraged == (Object)null || (Object)(object)_texMannequin == (Object)null || (Object)(object)_texMinos == (Object)null || (Object)(object)_texSisyphus == (Object)null || (Object)(object)_texSchism == (Object)null || (Object)(object)_texAttention == (Object)null || (Object)(object)_intermissionVid == (Object)null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"UltraClean: Missing expected textures in ultraclean.bundle");
				}
			}
			SceneManager.sceneLoaded += OnSceneLoaded;
			swaps.Add(new TextureSwapEntry
			{
				originalName = "T_Mannequin 1",
				replacement = _texMannequin
			});
			swaps.Add(new TextureSwapEntry
			{
				originalName = "T_Mannequin",
				replacement = _texMannequin
			});
			swaps.Add(new TextureSwapEntry
			{
				originalName = "MinosPrime 1",
				replacement = _texMinos
			});
			swaps.Add(new TextureSwapEntry
			{
				originalName = "T_SisyphusBody_Pattern4",
				replacement = _texSisyphus
			});
			swaps.Add(new TextureSwapEntry
			{
				originalName = "T_GreyHuskPaint2png",
				replacement = _texSchism
			});
			swaps.Add(new TextureSwapEntry
			{
				originalName = "WaterProcessingAttention",
				replacement = _texAttention
			});
		}

		private void OnDestroy()
		{
			if ((Object)(object)_bundle != (Object)null)
			{
				_bundle.Unload(false);
				_bundle = null;
			}
			Instance = null;
		}

		public static string ModPath()
		{
			return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar));
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new GameObject("cleaneroo").AddComponent<cleaneroo>();
			ReplaceMaterials();
		}
	}
	public class SkipRunner : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass2_0
		{
			public bool finished;

			internal void <PlayIntermissionThenExit>b__0(VideoPlayer source)
			{
				finished = true;
			}
		}

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

			private object <>2__current;

			public SkipRunner <>4__this;

			private <>c__DisplayClass2_0 <>8__1;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				//IL_005b: 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_007e: 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_009e: 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_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Expected O, but got Unknown
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Expected O, but got Unknown
				int num = <>1__state;
				SkipRunner skipRunner = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					<>8__1 = new <>c__DisplayClass2_0();
					GameObject val = new GameObject("IntermissionCanvas");
					val.AddComponent<Canvas>().renderMode = (RenderMode)0;
					val.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)1;
					val.AddComponent<GraphicRaycaster>();
					GameObject val2 = new GameObject("VideoPlayerOutput");
					val2.transform.SetParent(val.transform, false);
					RawImage val3 = val2.AddComponent<RawImage>();
					((Graphic)val3).rectTransform.anchorMin = Vector2.zero;
					((Graphic)val3).rectTransform.anchorMax = Vector2.one;
					((Graphic)val3).rectTransform.offsetMin = Vector2.zero;
					((Graphic)val3).rectTransform.offsetMax = Vector2.zero;
					VideoPlayer obj = val.AddComponent<VideoPlayer>();
					obj.playOnAwake = false;
					obj.renderMode = (VideoRenderMode)2;
					obj.aspectRatio = (VideoAspectRatio)5;
					RenderTexture texture = (obj.targetTexture = new RenderTexture(Screen.width, Screen.height, 0));
					val3.texture = (Texture)(object)texture;
					obj.clip = skipRunner._intermission;
					obj.isLooping = false;
					obj.audioOutputMode = (VideoAudioOutputMode)1;
					AudioSource val5 = val.AddComponent<AudioSource>();
					val5.playOnAwake = false;
					obj.EnableAudioTrack((ushort)0, true);
					obj.SetTargetAudioSource((ushort)0, val5);
					<>8__1.finished = false;
					obj.loopPointReached += (EventHandler)delegate
					{
						<>8__1.finished = true;
					};
					obj.Play();
					val5.Play();
					break;
				}
				case 1:
					<>1__state = -1;
					break;
				}
				if (!<>8__1.finished)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				((MonoBehaviour)skipRunner).StartCoroutine(skipRunner.WaitAndRanklessNextLevel());
				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 <WaitAndRanklessNextLevel>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SkipRunner <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				SkipRunner skipRunner = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					MonoSingleton<StatsManager>.Instance.fr.RanklessNextLevel("Main Menu");
					Object.Destroy((Object)(object)skipRunner);
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -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();
			}
		}

		public VideoClip _intermission;

		public void RunWaitAndRankless()
		{
			if ((Object)(object)_intermission != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(PlayIntermissionThenExit());
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(WaitAndRanklessNextLevel());
			}
		}

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

		[IteratorStateMachine(typeof(<WaitAndRanklessNextLevel>d__3))]
		private IEnumerator WaitAndRanklessNextLevel()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <WaitAndRanklessNextLevel>d__3(0)
			{
				<>4__this = this
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}