Decompiled source of BossRush v0.1.5

BossRush.dll

Decompiled 8 hours 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.Bootstrap;
using BepInEx.Configuration;
using BossRush.Helpers;
using BossRush.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.SceneManagement;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class ExtensionMarkerAttribute : Attribute
	{
		private readonly string <Name>k__BackingField;

		public string Name => <Name>k__BackingField;

		public ExtensionMarkerAttribute(string name)
		{
			<Name>k__BackingField = name;
		}
	}
}
namespace BossRush
{
	public static class BossrushManager
	{
		public static bool IsBossrushActive;

		public static bool IsBossrushFinished;

		public static bool CheatsUsed;

		public static float Timer;

		public static int Restarts;

		public static int Kills;

		public static int Style;

		public static int Completes;

		public static bool IsBananaDifficulty;

		public static void StartBossrush()
		{
			IsBossrushActive = true;
			IsBossrushFinished = false;
			CheatsUsed = false;
			Timer = 0f;
			Restarts = 0;
			Kills = 0;
			Style = 0;
			Completes = 0;
			SceneHelper.LoadScene("Level 0-1", false);
		}

		public static void SceneLoad(string scene)
		{
			if (IsBossrushActive)
			{
				UpdateBossrushUI();
			}
			if (IsBossrushFinished && scene == "Main Menu")
			{
				IsBossrushFinished = false;
				CreateEndUI();
			}
		}

		public static void UpdateBossrushUI()
		{
			CreateBossrushUI();
		}

		public static void EndBossrush()
		{
			IsBossrushActive = false;
		}

		public static void FinishBossrush()
		{
			IsBossrushFinished = true;
			IsBossrushActive = false;
			SceneHelper.LoadScene("Main Menu", false);
		}

		public static void CreateBossrushUI()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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)
			//IL_0084: 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)
			Canvas val = Builder.Canvas();
			Image val2 = Builder.Image(((Component)val).gameObject, new Vector2(25f, -500f), new Vector2(200f, 100f), (Color?)new Color(0f, 0f, 0f, 0.2f), (Vector2?)null, (Vector2?)null, (Vector2?)null);
			TMP_Text val3 = Builder.Text(((Component)val).gameObject, new Vector2(25f, -500f), new Vector2(200f, 100f), "Hi im text lmao", 26f, (TextAlignmentOptions)257);
			((Component)val3).gameObject.AddComponent<BossrushUI>();
		}

		public static void CreateEndUI()
		{
			//IL_0078: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Expected O, but got Unknown
			float num = Timer;
			float num2 = 0f;
			while (num >= 60f)
			{
				num -= 60f;
				num2 += 1f;
			}
			string text = num2 + ":" + num.ToString("00.000");
			Canvas canvas = Builder.Canvas();
			Image val = Builder.Image(((Component)canvas).gameObject, default(Vector2), new Vector2(1920f, 1080f), (Color?)new Color(0f, 0f, 0f, 0.98f), (Vector2?)null, (Vector2?)null, (Vector2?)null);
			TMP_Text val2 = Builder.Text(((Component)canvas).gameObject, new Vector2(0f, 0f), new Vector2(1920f, 1080f), string.Format("<b>BOSSRUSH BEATEN!\n{0}</b>\n\nTIME: <color=yellow>{1}</color>\nKILLS: <color=yellow>{2}</color>\nSTYLE: <color=yellow>{3}</color>\nRESTARTS: <color=red>{4}</color>\n{5}", GetDifficulty(), text, Kills, Style, Restarts, CheatsUsed ? "<color=#4C99E6>CHEATED</color>\n" : ""), 50f, (TextAlignmentOptions)514);
			Button val3 = Builder.Button(((Component)canvas).gameObject, new Vector2(860f, -980f), new Vector2(200f, 70f), "Yay!", 40f, (TextAlignmentOptions)514);
			Image val4 = Builder.Image(((Component)canvas).gameObject, default(Vector2), new Vector2(1920f, 1080f), (Color?)new Color(1f, 1f, 1f, 1f), (Vector2?)null, (Vector2?)null, (Vector2?)null);
			((Component)val4).gameObject.AddComponent<FlashLmao>();
			AudioSource val5 = ((Component)canvas).gameObject.AddComponent<AudioSource>();
			val5.clip = BundleLoader.bundle.LoadAsset<AudioClip>("BeatBossrush");
			val5.Play();
			((UnityEvent)val3.onClick).AddListener((UnityAction)delegate
			{
				((Component)canvas).gameObject.SetActive(false);
			});
		}

		public static string GetDifficulty()
		{
			return MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0) switch
			{
				0 => "Lenient", 
				1 => "Harmless", 
				2 => "Standard", 
				3 => "Violent", 
				4 => "Brutal", 
				5 => IsBananaDifficulty ? "Banana" : "UKMD", 
				19 => "Billion", 
				_ => "Error", 
			};
		}
	}
	public class FlashLmao : MonoBehaviour
	{
		private Image image;

		private float tt = 0f;

		public void Start()
		{
			image = ((Component)this).GetComponent<Image>();
		}

		public void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			Color color = ((Graphic)image).color;
			float deltaTime = Time.deltaTime;
			tt += deltaTime;
			if (!(tt < 0.1f))
			{
				((Color)(ref color))..ctor(color.r, color.g, color.b, color.a - deltaTime);
				if (color.a <= 0f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				else
				{
					((Graphic)image).color = color;
				}
			}
		}
	}
	public class BossrushUI : MonoBehaviour
	{
		private TMP_Text text;

		private string s;

		private string d;

		public void Start()
		{
			text = ((Component)this).GetComponent<TMP_Text>();
			s = SceneHelper.CurrentScene;
			d = BossrushManager.GetDifficulty();
		}

		public void Update()
		{
			float num = BossrushManager.Timer;
			float num2 = 0f;
			while (num >= 60f)
			{
				num -= 60f;
				num2 += 1f;
			}
			string text = num2 + ":" + num.ToString("00.000");
			this.text.text = s + "\n" + d + "\n<color=yellow>" + text + "</color>\n" + (BossrushManager.CheatsUsed ? "<color=#4C99E6>CHEATS</color>\n" : $"<color=red>{BossrushManager.Restarts}</color>");
			CheckForCheats();
		}

		public void CheckForCheats()
		{
			if (MonoSingleton<CheatsController>.Instance.cheatsEnabled || MonoSingleton<StatsManager>.Instance.majorUsed)
			{
				BossrushManager.CheatsUsed = true;
			}
		}
	}
	[HarmonyPatch]
	public static class Patches
	{
		public static void TeleportTo(Vector3 pos, Vector3 rot)
		{
			//IL_001e: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			CameraController cc = MonoSingleton<NewMovement>.Instance.cc;
			PhysicsExtensions.SetCustomGravityMode(MonoSingleton<NewMovement>.Instance.rb, false);
			cc.gravityRotation = Quaternion.identity;
			Vector3 gravity = Physics.gravity;
			cc.gravityVec = ((Vector3)(ref gravity)).normalized;
			cc.rotationOffset = Quaternion.identity;
			cc.transitionRotationZ = 0f;
			cc.transitionRotationZSmooth = 0f;
			cc.tiltRotationZ = 0f;
			cc.tiltRotationZSmooth = 0f;
			((Component)MonoSingleton<NewMovement>.Instance).transform.position = pos;
			MonoSingleton<NewMovement>.Instance.rb.position = pos;
			MonoSingleton<NewMovement>.Instance.rb.velocity = Vector3.zero;
			((Component)MonoSingleton<NewMovement>.Instance).transform.eulerAngles = rot;
			cc.ResetCamera(rot.y, rot.x);
			cc.ApplyRotations(false);
			MonoSingleton<StatsManager>.Instance.seconds = 50000f;
		}

		public static void TeleportToDelayed(Vector3 pos, Vector3 rot, int f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)Plugin.instance).StartCoroutine(TeleportToDelayedIE(pos, rot, f));
		}

		public static IEnumerator TeleportToDelayedIE(Vector3 pos, Vector3 rot, int f = 0)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < f; i++)
			{
				yield return null;
			}
			TeleportTo(pos, rot);
		}

		[HarmonyPatch(typeof(StatsManager), "StartTimer")]
		[HarmonyPostfix]
		public static void StartTimer(StatsManager __instance)
		{
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: 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)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			if (!BossrushManager.IsBossrushActive)
			{
				return;
			}
			switch (SceneHelper.CurrentScene)
			{
			case "Level 0-1":
				TeleportTo(new Vector3(202f, 54.5f, 453.8f), new Vector3(0f, 180f, 0f));
				break;
			case "Level 0-3":
				TeleportTo(new Vector3(-16.5f, 71.5f, 315f), new Vector3(0f, 270f, 0f));
				break;
			case "Level 0-5":
				TeleportTo(new Vector3(131.75f, -4.5f, 382f), new Vector3(0f, 90f, 0f));
				break;
			case "Level 1-3":
				TeleportTo(new Vector3(0f, -9f, 391f), new Vector3(0f, 90f, 0f));
				TeleportToDelayed(new Vector3(0f, -9f, 405f), new Vector3(0f, 0f, 0f), 1);
				break;
			case "Level 1-4":
				break;
			case "Level 2-4":
				TeleportTo(new Vector3(60f, -18.5f, 359.7f), new Vector3(0f, 180f, 0f));
				break;
			case "Level 3-2":
				break;
			case "Level 4-2":
				break;
			case "Level 4-4":
				break;
			case "Level 5-2":
				TeleportTo(new Vector3(52.5f, -1.5f, 940.3f), new Vector3(0f, 0f, 0f));
				break;
			case "Level 5-4":
				break;
			case "Level 6-1":
				TeleportTo(new Vector3(168.5f, -163.5f, -159f), new Vector3(0f, 180f, 0f));
				break;
			case "Level 6-2":
				break;
			case "Level 7-1":
			{
				TeleportTo(new Vector3(-242.5f, -112.5f, -329f), new Vector3(0f, 0f, 0f));
				Scene activeScene = SceneManager.GetActiveScene();
				((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "Third Section")).SetActive(true);
				break;
			}
			case "Level 7-4":
				break;
			case "Level 8-2":
				TeleportTo(new Vector3(422.15f, 81.5f, 519.75f), new Vector3(0f, 0f, 0f));
				break;
			case "Level 8-4":
				break;
			case "Level P-1":
				break;
			case "Level P-2":
				break;
			case "Level 0-E":
				TeleportTo(new Vector3(0f, -8.5f, 360f), new Vector3(0f, 0f, 0f));
				break;
			case "Level 1-E":
				TeleportTo(new Vector3(345.75f, 36.5f, 454.75f), new Vector3(0f, 0f, 0f));
				break;
			}
		}

		[HarmonyPatch(typeof(NewMovement), "GetHurt")]
		[HarmonyPostfix]
		public static void Damage(NewMovement __instance)
		{
			if (__instance.dead && BossrushManager.IsBossrushActive)
			{
				BossrushManager.Restarts++;
			}
		}

		[HarmonyPatch(typeof(NewMovement), "Respawn")]
		[HarmonyPrefix]
		public static void Respawn(NewMovement __instance)
		{
			if (!__instance.dead && BossrushManager.IsBossrushActive)
			{
				BossrushManager.Restarts++;
			}
		}

		[HarmonyPatch(typeof(SceneHelper), "LoadSceneAsync")]
		[HarmonyPrefix]
		public static void LoadScene(string sceneName, SceneHelper __instance)
		{
			if (!(sceneName != SceneHelper.CurrentScene) && Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance) && !MonoSingleton<NewMovement>.Instance.dead && BossrushManager.IsBossrushActive)
			{
				BossrushManager.Restarts++;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StatsManager), "Update")]
		public static void StatsManager_Update_Prefix(StatsManager __instance)
		{
			if (__instance.timer)
			{
				BossrushManager.Timer += Time.deltaTime * GameStateManager.Instance.TimerModifier;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(FinalRank), "LevelChange")]
		public static bool LevelChange_Prefix(FinalRank __instance)
		{
			if (BossrushManager.IsBossrushActive)
			{
				BossrushManager.Kills += MonoSingleton<StatsManager>.Instance.kills;
				BossrushManager.Style += MonoSingleton<StatsManager>.Instance.stylePoints;
				BossrushManager.Completes++;
				switch (SceneHelper.CurrentScene)
				{
				case "Level 0-1":
					SceneHelper.LoadScene("Level 0-3", false);
					break;
				case "Level 0-3":
					SceneHelper.LoadScene("Level 0-5", false);
					break;
				case "Level 0-5":
					SceneHelper.LoadScene("Level 1-3", false);
					break;
				case "Level 1-3":
					SceneHelper.LoadScene("Level 1-4", false);
					break;
				case "Level 1-4":
					SceneHelper.LoadScene("Level 2-4", false);
					break;
				case "Level 2-4":
					SceneHelper.LoadScene("Level 3-2", false);
					break;
				case "Level 3-2":
					SceneHelper.LoadScene("Level 4-2", false);
					break;
				case "Level 4-2":
					SceneHelper.LoadScene("Level 4-4", false);
					break;
				case "Level 4-4":
					SceneHelper.LoadScene("Level 5-2", false);
					break;
				case "Level 5-2":
					SceneHelper.LoadScene("Level 5-4", false);
					break;
				case "Level 5-4":
					SceneHelper.LoadScene("Level 6-1", false);
					break;
				case "Level 6-1":
					SceneHelper.LoadScene("Level 6-2", false);
					break;
				case "Level 6-2":
					SceneHelper.LoadScene("Level 7-1", false);
					break;
				case "Level 7-1":
					SceneHelper.LoadScene("Level 7-4", false);
					break;
				case "Level 7-4":
					SceneHelper.LoadScene("Level 8-2", false);
					break;
				case "Level 8-2":
					SceneHelper.LoadScene("Level 8-4", false);
					break;
				case "Level 8-4":
					SceneHelper.LoadScene("Level P-1", false);
					break;
				case "Level P-1":
					SceneHelper.LoadScene("Level P-2", false);
					break;
				case "Level P-2":
					SceneHelper.LoadScene("Level 0-E", false);
					break;
				case "Level 0-E":
					SceneHelper.LoadScene("Level 1-E", false);
					break;
				case "Level 1-E":
					BossrushManager.FinishBossrush();
					break;
				default:
					return true;
				}
				return false;
			}
			return true;
		}
	}
	[BepInPlugin("duviz.BossRush", "BossRush", "0.1.4")]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<GameObject, bool> <>9__5_0;

			public static UnityAction <>9__5_1;

			internal bool <SpawnBossrushButton>b__5_0(GameObject x)
			{
				return ((Object)x).name == "Canvas";
			}

			internal void <SpawnBossrushButton>b__5_1()
			{
				BossrushManager.StartBossrush();
			}
		}

		public static Plugin instance;

		public static ConfigFile config;

		public void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			config = ((BaseUnityPlugin)this).Config;
			new Harmony("duviz.BossRush").PatchAll();
			BundleLoader.LoadBundle("Assets.bossrush.bundle");
		}

		public void Start()
		{
			Builder.LoadFont();
			SceneManager.sceneLoaded += delegate
			{
				OnSceneLoad(SceneHelper.CurrentScene);
			};
			BossrushManager.IsBananaDifficulty = Chainloader.PluginInfos.ContainsKey("com.banana.BananaDifficulty");
		}

		public void OnSceneLoad(string scene)
		{
			if (scene == "Main Menu")
			{
				BossrushManager.EndBossrush();
				SpawnBossrushButton();
			}
			BossrushManager.SceneLoad(scene);
		}

		public void SpawnBossrushButton()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			GameObject val = BundleLoader.bundle.LoadAsset<GameObject>("BossrushButton");
			Scene activeScene = SceneManager.GetActiveScene();
			Transform val2 = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "Canvas")).transform.Find("Main Menu (1)/LeftSide");
			GameObject val3 = Object.Instantiate<GameObject>(val, val2);
			Vector2 anchoredPosition = default(Vector2);
			((Vector2)(ref anchoredPosition))..ctor(410f, -205f);
			if (Chainloader.PluginInfos.ContainsKey("com.github.end-4.titleScreenQuickAccess"))
			{
				((Vector2)(ref anchoredPosition))..ctor(410f, -430f);
			}
			Extensions.get_rectTransform(val3).anchoredPosition = anchoredPosition;
			ButtonClickedEvent onClick = val3.GetComponent<Button>().onClick;
			object obj = <>c.<>9__5_1;
			if (obj == null)
			{
				UnityAction val4 = delegate
				{
					BossrushManager.StartBossrush();
				};
				<>c.<>9__5_1 = val4;
				obj = (object)val4;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		public static T Ass<T>(string path)
		{
			return AssHelper.Ass<T>(path);
		}

		public static void LogInfo(object msg)
		{
			((BaseUnityPlugin)instance).Logger.LogInfo(msg);
		}

		public static void LogWarning(object msg)
		{
			((BaseUnityPlugin)instance).Logger.LogWarning(msg);
		}

		public static void LogError(object msg)
		{
			((BaseUnityPlugin)instance).Logger.LogError(msg);
		}
	}
	public class PluginInfo
	{
		public const string GUID = "duviz.BossRush";

		public const string Name = "BossRush";

		public const string Version = "0.1.4";
	}
}
namespace BossRush.UI
{
	public static class Builder
	{
		private static TMP_FontAsset _font;

		public static TMP_FontAsset font
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_font))
				{
					LoadFont();
				}
				return _font;
			}
		}

		public static void LoadFont()
		{
			_font = Plugin.Ass<TMP_FontAsset>("Assets/Fonts/VCR_OSD_MONO_UI.asset");
		}

		public static Canvas Canvas(float width = 1920f, float height = 1080f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("RuntimeCanvas")
			{
				layer = LayerMask.NameToLayer("UI")
			};
			Canvas val2 = val.AddComponent<Canvas>();
			val2.renderMode = (RenderMode)0;
			val2.pixelPerfect = true;
			val2.sortingOrder = 10000;
			CanvasScaler val3 = val.AddComponent<CanvasScaler>();
			val3.uiScaleMode = (ScaleMode)1;
			val3.referenceResolution = new Vector2(width, height);
			val3.screenMatchMode = (ScreenMatchMode)2;
			val.AddComponent<GraphicRaycaster>();
			Plugin.LogInfo("Canvas created!");
			return val2;
		}

		public static TMP_Text Text(GameObject container, Vector2 position, Vector2 sizeDelta, string defaultText = "Ella jura", float size = 20f, TextAlignmentOptions alignment = (TextAlignmentOptions)257, Color? color = null, Vector2? anchorMin = null, Vector2? anchorMax = null, Vector2? pivot = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_009c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Text");
			val.transform.SetParent(container.transform, false);
			RectTransform orAddComponent = GameObjectExtensions.GetOrAddComponent<RectTransform>(val);
			orAddComponent.anchorMin = (Vector2)(((??)anchorMin) ?? new Vector2(0f, 1f));
			orAddComponent.anchorMax = (Vector2)(((??)anchorMax) ?? new Vector2(0f, 1f));
			orAddComponent.pivot = (Vector2)(((??)pivot) ?? new Vector2(0f, 1f));
			orAddComponent.anchoredPosition = position;
			orAddComponent.sizeDelta = sizeDelta;
			TMP_Text val2 = (TMP_Text)(object)val.AddComponent<TextMeshProUGUI>();
			val2.text = defaultText;
			val2.font = font;
			val2.fontSize = size;
			val2.alignment = alignment;
			((Graphic)val2).raycastTarget = false;
			((Graphic)val2).color = (Color)(((??)color) ?? Color.white);
			return val2;
		}

		public static Button Button(GameObject container, Vector2 position, Vector2 sizeDelta, string defaultText = "Ella jura", float size = 20f, TextAlignmentOptions alignment = (TextAlignmentOptions)257, Vector2? anchorMin = null, Vector2? anchorMax = null, Vector2? pivot = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Button");
			val.transform.SetParent(container.transform, false);
			RectTransform orAddComponent = GameObjectExtensions.GetOrAddComponent<RectTransform>(val);
			orAddComponent.anchorMin = (Vector2)(((??)anchorMin) ?? new Vector2(0f, 1f));
			orAddComponent.anchorMax = (Vector2)(((??)anchorMax) ?? new Vector2(0f, 1f));
			orAddComponent.pivot = (Vector2)(((??)pivot) ?? new Vector2(0f, 1f));
			orAddComponent.anchoredPosition = position;
			orAddComponent.sizeDelta = sizeDelta;
			Button val2 = val.AddComponent<Button>();
			Image targetGraphic = Image(val, Vector2.zero, sizeDelta);
			((Selectable)val2).targetGraphic = (Graphic)(object)targetGraphic;
			Text(val, Vector2.zero, sizeDelta, defaultText, size, alignment, Color.black);
			return val2;
		}

		public static Image Image(GameObject container, Vector2 position, Vector2 sizeDelta, Color? color = null, Vector2? anchorMin = null, Vector2? anchorMax = null, Vector2? pivot = null)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_009c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Image");
			val.transform.SetParent(container.transform, false);
			RectTransform orAddComponent = GameObjectExtensions.GetOrAddComponent<RectTransform>(val);
			orAddComponent.anchorMin = (Vector2)(((??)anchorMin) ?? new Vector2(0f, 1f));
			orAddComponent.anchorMax = (Vector2)(((??)anchorMax) ?? new Vector2(0f, 1f));
			orAddComponent.pivot = (Vector2)(((??)pivot) ?? new Vector2(0f, 1f));
			orAddComponent.anchoredPosition = position;
			orAddComponent.sizeDelta = sizeDelta;
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = (Color)(((??)color) ?? new Color(1f, 1f, 1f));
			return val2;
		}
	}
}
namespace BossRush.Helpers
{
	public static class AssHelper
	{
		[SpecialName]
		public sealed class <G>$34505F560D9EACF86A87F3ED1F85E448
		{
			[SpecialName]
			public static class <M>$69FE22D2D9367C6033D7C9FA04F1ABE9
			{
			}

			[ExtensionMarker("<M>$69FE22D2D9367C6033D7C9FA04F1ABE9")]
			public int Occurrences(char lookUp)
			{
				throw new NotSupportedException();
			}

			[ExtensionMarker("<M>$69FE22D2D9367C6033D7C9FA04F1ABE9")]
			public IEnumerable<int> Occurences(char lookUp)
			{
				throw new NotSupportedException();
			}
		}

		private static List<string> cache_PrefabKeys = null;

		public static Dictionary<string, object> CachedAddressableAssets = new Dictionary<string, object>();

		public static IResourceLocator MainAddressablesLocator => Addressables.ResourceLocators.FirstOrDefault((Func<IResourceLocator, bool>)((IResourceLocator loc) => loc.LocatorId == "AddressablesMainContentCatalog"));

		public static IEnumerable<object> GetAddressableKeys()
		{
			IResourceLocator mainAddressablesLocator = MainAddressablesLocator;
			return ((mainAddressablesLocator != null) ? mainAddressablesLocator.Keys : null) ?? Array.Empty<object>();
		}

		public static List<string> GetPrefabAddressableKeys(Func<string, bool> Search = null)
		{
			if (cache_PrefabKeys != null)
			{
				return cache_PrefabKeys.Where(Search).ToList();
			}
			List<string> list = new List<string>();
			IList<IResourceLocation> list2 = default(IList<IResourceLocation>);
			foreach (object addressableKey in GetAddressableKeys())
			{
				if (MainAddressablesLocator.Locate(addressableKey, typeof(GameObject), ref list2) && !list.Contains(list2[0].PrimaryKey))
				{
					list.Add(list2[0].PrimaryKey);
				}
			}
			list.Sort();
			cache_PrefabKeys = list;
			return list.Where(Search).ToList();
		}

		public static T Ass<T>(string key)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (CachedAddressableAssets.TryGetValue(key + typeof(T).Name, out var value))
			{
				return (T)value;
			}
			T val = Addressables.LoadAssetAsync<T>((object)key).WaitForCompletion();
			if (val != null)
			{
				CachedAddressableAssets.Add(key + typeof(T).Name, val);
			}
			else
			{
				Plugin.LogError("Failed to load asset: " + key);
			}
			return val;
		}

		public static int Occurrences(this string str, char lookUp)
		{
			int num = 0;
			foreach (char c in str)
			{
				if (c == lookUp)
				{
					num++;
				}
			}
			return num;
		}

		public static IEnumerable<int> Occurences(this string str, char lookUp)
		{
			for (int i = 0; i < str.Length; i++)
			{
				if (str[i] == lookUp)
				{
					yield return i;
				}
			}
		}
	}
	public static class BundleLoader
	{
		public static AssetBundle bundle { get; private set; }

		public static void LoadBundle(string path)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string text = "BossRush." + path;
			using Stream stream = executingAssembly.GetManifestResourceStream(text);
			if (stream == null)
			{
				Plugin.LogError("Bundle not found: " + text);
				return;
			}
			using MemoryStream memoryStream = new MemoryStream();
			stream.CopyTo(memoryStream);
			UnloadBundle();
			bundle = AssetBundle.LoadFromMemory(memoryStream.ToArray());
		}

		public static void UnloadBundle()
		{
			AssetBundle obj = bundle;
			if (obj != null)
			{
				obj.Unload(false);
			}
		}
	}
	public static class Extensions
	{
		[SpecialName]
		public sealed class <G>$D50C47355EFA71DA0F6DB3230FE5D4AD
		{
			[SpecialName]
			public static class <M>$D68147830E85447C80ED888358DB7BFB
			{
			}

			[ExtensionMarker("<M>$D68147830E85447C80ED888358DB7BFB")]
			public void ApplyDefaults()
			{
				throw new NotSupportedException();
			}
		}

		[SpecialName]
		public sealed class <G>$5E80EE1F91F68F4C0C8D9D82C38C5E67
		{
			[SpecialName]
			public static class <M>$24BC8566157842FEB6EA2D06D7BBA5FC
			{
			}

			[ExtensionMarker("<M>$24BC8566157842FEB6EA2D06D7BBA5FC")]
			public RectTransform rectTransform
			{
				[ExtensionMarker("<M>$24BC8566157842FEB6EA2D06D7BBA5FC")]
				get
				{
					throw new NotSupportedException();
				}
			}
		}

		public static void ApplyDefaults(this RectTransform rect)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			rect.anchorMin = new Vector2(0f, 1f);
			rect.anchorMax = new Vector2(0f, 1f);
			rect.pivot = new Vector2(0f, 1f);
		}

		public static RectTransform get_rectTransform(GameObject obj)
		{
			return obj.GetComponent<RectTransform>();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}