Decompiled source of BossChallengeMod v0.2.6

BossChallengeMod.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BossChallengeMod.BossPatches;
using BossChallengeMod.BossPatches.TargetPatches;
using BossChallengeMod.Configuration;
using BossChallengeMod.Configuration.BackwardCompability;
using BossChallengeMod.Configuration.Repositories;
using BossChallengeMod.CustomActions;
using BossChallengeMod.CustomMonsterStates;
using BossChallengeMod.CustomMonsterStates.Configuration;
using BossChallengeMod.Extensions;
using BossChallengeMod.Global;
using BossChallengeMod.Helpers;
using BossChallengeMod.KillCounting;
using BossChallengeMod.Modifiers;
using BossChallengeMod.Modifiers.Managers;
using BossChallengeMod.ObjectProviders;
using BossChallengeMod.Preloading;
using BossChallengeMod.UI;
using HarmonyLib;
using I2.Loc;
using Microsoft.CodeAnalysis;
using MonoMod.Utils;
using MonsterLove.StateMachine;
using NineSolsAPI;
using NineSolsAPI.Utils;
using RCGFSM.Monster;
using RCGMaker.Core;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BossChallengeMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Bosses don't die")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9f6a570abaae4b5a836a755bb60f165cafa78272")]
[assembly: AssemblyProduct("BossChallengeMod")]
[assembly: AssemblyTitle("BossChallengeMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 BossChallengeMod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("BossChallengeMod", "BossChallengeMod", "1.0.0")]
	public class BossChallengeMod : BaseUnityPlugin
	{
		private ConfigEntry<bool> isCyclingEnabled;

		private ConfigEntry<bool> useSingleRecordsKey;

		private ConfigEntry<int> maxCycles;

		private ConfigEntry<bool> isSpeedScalingEnabled;

		private ConfigEntry<float> minSpeedScalingValue;

		private ConfigEntry<float> maxSpeedScalingValue;

		private ConfigEntry<int> maxSpeedScalingCycleValue;

		private ConfigEntry<bool> isModifiersScalingEnabled;

		private ConfigEntry<int> maxModifiersNumber;

		private ConfigEntry<int> maxModifiersNumberScalingValue;

		private ConfigEntry<bool> isModifiersEnabled;

		private ConfigEntry<int> modifiersStartDeathValue;

		private ConfigEntry<bool> isModifiersRepeatingEnabled;

		private ConfigEntry<bool> isSpeedModifierEnabled;

		private ConfigEntry<bool> isTimerModifierEnabled;

		private ConfigEntry<bool> isParryDamageModifierEnabled;

		private ConfigEntry<bool> isDamageBuildupModifierEnabled;

		private ConfigEntry<bool> isRegenerationModifierEnabled;

		private ConfigEntry<bool> isKnockbackModifierEnabled;

		private ConfigEntry<bool> isRandomArrowModifierEnabled;

		private ConfigEntry<bool> isRandomTalismanModifierEnabled;

		private ConfigEntry<bool> isEnduranceModifierEnabled;

		private ConfigEntry<bool> isQiShieldModifierEnabled;

		private ConfigEntry<bool> isTimedShieldModifierEnabled;

		private ConfigEntry<bool> isQiOverloadModifierEnabled;

		private ConfigEntry<bool> isDistanceShieldModifierEnabled;

		private ConfigEntry<bool> isYanlaoGunModifierEnabled;

		private ConfigEntry<bool> isCounterUIEnabled;

		private ConfigEntry<bool> useCustomCounterPosition;

		private ConfigEntry<float> counterCustomXPosition;

		private ConfigEntry<float> counterCustomYPosition;

		private ConfigEntry<float> counterScale;

		private ConfigEntry<bool> isTimerUIEnabled;

		private ConfigEntry<bool> useCustomTimerPosition;

		private ConfigEntry<float> timerCustomXPosition;

		private ConfigEntry<float> timerCustomYPosition;

		private ConfigEntry<float> timerScale;

		private ConfigEntry<bool> isTalismanModeUIEnabled;

		private ConfigEntry<bool> useCustomTalismanModePosition;

		private ConfigEntry<float> talismanModeCustomXPosition;

		private ConfigEntry<float> talismanModeCustomYPosition;

		private ConfigEntry<float> talismanModeScale;

		private bool isToastsDisplayed;

		private bool UnloadRequested;

		private Harmony harmony;

		public CustomMonsterStateValuesResolver MonsterStateValuesResolver { get; private set; }

		public EventTypesResolver EventTypesResolver { get; private set; }

		public Dictionary<string, GeneralBossPatch> BossPatches { get; private set; } = new Dictionary<string, GeneralBossPatch>();


		private ConfigEntry<bool> IsRandomSpeedScalingEnabled { get; set; }

		private ConfigEntry<int> StartRandomSpeedScalingDeath { get; set; }

		private ConfigEntry<float> MinRandomSpeedScalingValue { get; set; }

		private ConfigEntry<float> MaxRandomSpeedScalingValue { get; set; }

		private ConfigEntry<bool> IsRandomModifiersScalingEnabled { get; set; }

		private ConfigEntry<int> StartRandomModifiersScalingDeath { get; set; }

		private ConfigEntry<int> MinRandomModifiersScalingValue { get; set; }

		private ConfigEntry<int> MaxRandomModifiersScalingValue { get; set; }

		public UIController UIController { get; private set; }

		public MonsterUIController MonsterUIController { get; private set; }

		public LocalizationResolver LocalizationResolver { get; private set; }

		public ChallengeConfigurationManager ChallengeConfigurationManager { get; private set; }

		public GlobalModifiersController GlobalModifiersFlags { get; private set; }

		public UIConfiguration UIConfiguration { get; private set; }

		private Preloader Preloader { get; set; }

		public ShieldProvider ShieldProvider { get; private set; }

		public YanlaoGunProvider YanlaoGunProvider { get; private set; }

		public static BossChallengeMod Instance { get; private set; }

		public BossChallengeMod()
		{
			MonsterStateValuesResolver = new CustomMonsterStateValuesResolver();
			EventTypesResolver = new EventTypesResolver();
		}

		private void Awake()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
			Preloader = new Preloader();
			ShieldProvider = new ShieldProvider();
			YanlaoGunProvider = new YanlaoGunProvider();
			AssignPreloadingTargets();
			LocalizationResolver = new LocalizationResolver();
			LocalizationResolver.LoadLanguage(GetLanguageCode());
			IRecordsRepository recordsRepository = new JsonRecordsRepository();
			ChallengeConfigurationManager = new ChallengeConfigurationManager(recordsRepository);
			GlobalModifiersFlags = new GlobalModifiersController();
			InitializeChallengeConfiguration();
			HandleConfigurationValues();
			LocalizationManager.OnLocalizeEvent += new OnLocalizeCallback(OnLocalizationChange);
			InitializeUIConfiguration();
			UIController = new UIController(UIConfiguration);
			HandleUIConfigurationValues();
			MonsterUIController = new MonsterUIController();
			InitializePatches();
			SceneManager.sceneLoaded += OnSceneLoaded;
			harmony = Harmony.CreateAndPatchAll(typeof(BossChallengeMod).Assembly, (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BossChallengeMod is loaded1!");
		}

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(Preloader.Preload());
		}

		private void AssignPreloadingTargets()
		{
			string scene = "A5_S5_JieChuanHall";
			string path = "Shield(Effect Receiver)_Shield Sphere Version";
			Preloader.AddPreload(scene, path, ShieldProvider);
			string scene2 = "A4_S4_Container_Final";
			string path2 = "ZGun FSM Object Variant";
			Preloader.AddPreload(scene2, path2, YanlaoGunProvider);
		}

		private string GetLanguageCode()
		{
			return LocalizationManager.CurrentLanguageCode switch
			{
				"ru" => "ru-ru", 
				"en-US" => "en-us", 
				"zh-CN" => "zh-cn", 
				"zh-TW" => "zh-tw", 
				_ => "en-us", 
			};
		}

		private void OnLocalizationChange()
		{
			LocalizationResolver.LoadLanguage(GetLanguageCode());
			InitializeChallengeConfiguration();
		}

		private void OnDestroy()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			UnloadRequested = true;
			UIController.Unload();
			LocalizationManager.OnLocalizeEvent -= new OnLocalizeCallback(OnLocalizationChange);
			SceneManager.sceneLoaded -= OnSceneLoaded;
			harmony.UnpatchSelf();
		}

		private void InitializePatches()
		{
			BossPatches.Add("StealthGameMonster_SpearHorseMan", GetHorseBossPatch());
			BossPatches.Add("StealthGameMonster_伏羲_新", GetFuxiBossPatch());
			BossPatches.Add("StealthGameMonster_新女媧 Variant", GetNuwaBossPatch());
			BossPatches.Add("StealthGameMonster_GouMang Variant", GetGoumangBossPatch());
			BossPatches.Add("Monster_GiantMechClaw", GetClawBossPatch());
			ButterflyBossPatch butterflyBossPatch = GetButterflyBossPatch();
			BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant", butterflyBossPatch);
			BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (1)", new RevivalChallengeBossClonePatch());
			BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (2)", new RevivalChallengeBossClonePatch());
			BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (3)", new RevivalChallengeBossClonePatch());
			BossPatches.Add("StealthGameMonster_Boss_ButterFly Variant (4)", new RevivalChallengeBossClonePatch());
			BossPatches.Add("Boss_Yi Gung", GetEigongBossPatch());
			BossPatches.Add("Default", GetDefaultBossPatch());
		}

		private FuxiBossPatch GetFuxiBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			FuxiBossPatch obj = new FuxiBossPatch
			{
				DieStates = new List<States>(3)
				{
					(States)131,
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.ExitState = (States)3;
			resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" };
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private GeneralBossPatch GetNuwaBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch
			{
				DieStates = new List<States>(3)
				{
					(States)131,
					(States)169,
					(States)110
				},
				UseKillCounter = false,
				UseModifiers = false,
				UseRecording = false
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.ExitState = (States)3;
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private GeneralBossPatch GetGoumangBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			GoumangBossPatch obj = new GoumangBossPatch
			{
				DieStates = new List<States>(2)
				{
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.ExitState = (States)103;
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private GeneralBossPatch GetClawBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0069: 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)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			ClawBossPatch obj = new ClawBossPatch
			{
				DieStates = new List<States>(3)
				{
					(States)131,
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" };
			resetStateConfiguration.ExitState = (States)129;
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private ButterflyBossPatch GetButterflyBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			ButterflyBossPatch obj = new ButterflyBossPatch
			{
				DieStates = new List<States>(3)
				{
					state,
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.Animations = new List<string>(1) { "Hurt" };
			resetStateConfiguration.ExitState = (States)3;
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private GeneralBossPatch GetEigongBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0070: 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)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch
			{
				DieStates = new List<States>(4)
				{
					(States)131,
					(States)146,
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.ExitState = (States)3;
			resetStateConfiguration.Animations = new List<string>(1) { "BossAngry" };
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private GeneralBossPatch GetHorseBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			HorseBossPatch obj = new HorseBossPatch
			{
				DieStates = new List<States>(3)
				{
					(States)131,
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.ExitState = (States)3;
			resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" };
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private GeneralBossPatch GetDefaultBossPatch()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			States state = MonsterStateValuesResolver.GetState("BossRevive");
			RevivalChallengeBossPatch obj = new RevivalChallengeBossPatch
			{
				DieStates = new List<States>(3)
				{
					(States)131,
					(States)169,
					(States)110
				}
			};
			ResetBossStateConfiguration resetStateConfiguration = obj.ResetStateConfiguration;
			resetStateConfiguration.ExitState = (States)3;
			resetStateConfiguration.Animations = new List<string>(1) { "PostureBreak" };
			resetStateConfiguration.StateType = state;
			resetStateConfiguration.TargetDamageReceivers = new List<string>(3) { "Attack", "Foo", "JumpKick" };
			return obj;
		}

		private void InitializeChallengeConfiguration()
		{
			isCyclingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "1.1 Enable Boss Revival", true, LocalizationResolver.Localize("config_cycling_enabled_description"));
			isCyclingEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration35 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration35.EnableRestoration = isCyclingEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration35;
			};
			useSingleRecordsKey = ((BaseUnityPlugin)this).Config.Bind<bool>("1. General", "1.2 Record regardless of configuration", false, LocalizationResolver.Localize("config_single_recording_enabled_description"));
			useSingleRecordsKey.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration34 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration34.UseSingleRecordKey = useSingleRecordsKey.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration34;
			};
			maxCycles = ((BaseUnityPlugin)this).Config.Bind<int>("1. General", "1.3 Boss deaths number", -1, LocalizationResolver.Localize("config_cycles_number_description"));
			maxCycles.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration33 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration33.MaxCycles = maxCycles.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration33;
			};
			isSpeedScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Scaling", "2.1 Enable Speed Scaling", false, LocalizationResolver.Localize("config_scaling_enabled_description"));
			isSpeedScalingEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration32 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration32.EnableSpeedScaling = isSpeedScalingEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration32;
			};
			minSpeedScalingValue = ((BaseUnityPlugin)this).Config.Bind<float>("2. Scaling", "2.1.1 Scaling: Initial Speed", 1f, LocalizationResolver.Localize("config_scaling_minspeed_description"));
			minSpeedScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration31 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration31.MinSpeedScalingValue = minSpeedScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration31;
			};
			maxSpeedScalingValue = ((BaseUnityPlugin)this).Config.Bind<float>("2. Scaling", "2.1.2 Scaling: Maximum Speed", 1.35f, LocalizationResolver.Localize("config_scaling_maxspeed_description"));
			maxSpeedScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration30 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration30.MaxSpeedScalingValue = maxSpeedScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration30;
			};
			maxSpeedScalingCycleValue = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.1.3 Maximum Speed Scaling After Deaths", 5, LocalizationResolver.Localize("config_scaling_scaling_cycle_description"));
			maxSpeedScalingCycleValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration29 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration29.MaxSpeedScalingCycle = maxSpeedScalingCycleValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration29;
			};
			isModifiersScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Scaling", "2.2 Enable Modifiers Scaling", false, LocalizationResolver.Localize("config_scaling_modifiers_enabled_description"));
			isModifiersScalingEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration28 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration28.EnableModifiersScaling = isModifiersScalingEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration28;
			};
			maxModifiersNumber = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.2.1 Scaling: Maximum Modifiers Number", 3, LocalizationResolver.Localize("config_scaling_maxmodifiers_description"));
			maxModifiersNumber.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration27 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration27.MaxModifiersNumber = maxModifiersNumber.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration27;
			};
			maxModifiersNumberScalingValue = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.2.2 Maximum Modifiers Number Scaling After Deaths", 3, LocalizationResolver.Localize("config_scaling_modifiers_scaling_cycle_description"));
			maxModifiersNumberScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration26 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration26.MaxModifiersScalingCycle = maxModifiersNumberScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration26;
			};
			IsRandomSpeedScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Scaling", "2.3 Enable Random Speed Scaling", false, LocalizationResolver.Localize("config_rand_speed_scaling_enabled_description"));
			IsRandomSpeedScalingEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration25 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration25.EnableRandomSpeedScaling = IsRandomSpeedScalingEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration25;
			};
			StartRandomSpeedScalingDeath = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.3.1 Random Speed Scaling After Deaths", 1, LocalizationResolver.Localize("config_rand_speed_scaling_start_death_description"));
			StartRandomSpeedScalingDeath.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration24 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration24.RandomSpeedScalingStartDeath = StartRandomSpeedScalingDeath.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration24;
			};
			MinRandomSpeedScalingValue = ((BaseUnityPlugin)this).Config.Bind<float>("2. Scaling", "2.3.2 Random Scaling: Minimal Speed", 1f, LocalizationResolver.Localize("config_rand_speed_scaling_minspeed_description"));
			MinRandomSpeedScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration23 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration23.MinRandomSpeedScalingValue = MinRandomSpeedScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration23;
			};
			MaxRandomSpeedScalingValue = ((BaseUnityPlugin)this).Config.Bind<float>("2. Scaling", "2.3.3 Random Scaling: Maximum Speed", 1.5f, LocalizationResolver.Localize("config_rand_speed_scaling_maxspeed_description"));
			MaxRandomSpeedScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration22 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration22.MaxRandomSpeedScalingValue = MaxRandomSpeedScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration22;
			};
			IsRandomModifiersScalingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. Scaling", "2.4 Enable Random Modifiers Scaling", false, LocalizationResolver.Localize("config_rand_modifiers_scaling_enabled_description"));
			IsRandomModifiersScalingEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration21 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration21.EnableRandomModifiersScaling = IsRandomModifiersScalingEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration21;
			};
			StartRandomModifiersScalingDeath = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.4.1 Random Modifiers Scaling After Deaths", 1, LocalizationResolver.Localize("config_rand_modifiers_scaling_start_death_description"));
			StartRandomModifiersScalingDeath.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration20 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration20.RandomModifiersScalingStartDeath = StartRandomModifiersScalingDeath.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration20;
			};
			MinRandomModifiersScalingValue = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.4.2 Random Scaling: Min Modifiers Number", 1, LocalizationResolver.Localize("config_rand_modifiers_scaling_min_description"));
			MinRandomModifiersScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration19 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration19.MinRandomModifiersNumber = MinRandomModifiersScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration19;
			};
			MaxRandomModifiersScalingValue = ((BaseUnityPlugin)this).Config.Bind<int>("2. Scaling", "2.4.3 Random Scaling: Max Modifiers Number", 4, LocalizationResolver.Localize("config_rand_modifiers_scaling_max_description"));
			MaxRandomModifiersScalingValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration18 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration18.MaxRandomModifiersNumber = MaxRandomModifiersScalingValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration18;
			};
			isModifiersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.1 Enable Modifiers", false, LocalizationResolver.Localize("config_modifiers_enabled_description"));
			isModifiersEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration17 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration17.ModifiersEnabled = isModifiersEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration17;
			};
			modifiersStartDeathValue = ((BaseUnityPlugin)this).Config.Bind<int>("3. Modifiers", "3.2 Modifiers Start Death", 1, LocalizationResolver.Localize("config_modifiers_start_death_description"));
			modifiersStartDeathValue.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration16 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration16.ModifiersStartFromDeath = modifiersStartDeathValue.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration16;
			};
			isModifiersRepeatingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.3 Enable Modifiers Repeating", false, LocalizationResolver.Localize("config_repeating_enabled_description"));
			isModifiersRepeatingEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration15 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration15.ModifiersEnabled = isModifiersRepeatingEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration15;
			};
			isSpeedModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Speed Modifier", true, LocalizationResolver.Localize("config_modifiers_speed_enabled_description"));
			isSpeedModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration14 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration14.SpeedModifierEnabled = isSpeedModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration14;
			};
			isTimerModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Timer Modifier", true, LocalizationResolver.Localize("config_modifiers_timer_enabled_description"));
			isTimerModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration13 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration13.TimerModifierEnabled = isTimerModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration13;
			};
			isParryDamageModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Precice parry only modifier", true, LocalizationResolver.Localize("config_modifiers_parry_damage_enabled_description"));
			isParryDamageModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration12 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration12.ParryDirectDamageModifierEnabled = isParryDamageModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration12;
			};
			isDamageBuildupModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Internal damage buildup modifier", true, LocalizationResolver.Localize("config_modifiers_internal_damage_enabled_description"));
			isDamageBuildupModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration11 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration11.DamageBuildupModifierEnabled = isDamageBuildupModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration11;
			};
			isRegenerationModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Regeneration modiifer", true, LocalizationResolver.Localize("config_modifiers_regeneration_enabled_description"));
			isRegenerationModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration10 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration10.RegenerationModifierEnabled = isRegenerationModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration10;
			};
			isKnockbackModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Knockback modiifer", true, LocalizationResolver.Localize("config_modifiers_knockback_enabled_description"));
			isKnockbackModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration9 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration9.KnockbackModifierEnabled = isKnockbackModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration9;
			};
			isRandomArrowModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Random arrow modiifer", true, LocalizationResolver.Localize("config_modifiers_random_arrow_enabled_description"));
			isRandomArrowModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration8 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration8.RandomArrowModifierEnabled = isRandomArrowModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration8;
			};
			isRandomTalismanModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Random talisman modiifer", true, LocalizationResolver.Localize("config_modifiers_random_talisman_enabled_description"));
			isRandomTalismanModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration7 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration7.RandomTalismanModifierEnabled = isRandomTalismanModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration7;
			};
			isEnduranceModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Endurance modiifer", true, LocalizationResolver.Localize("config_modifiers_endurance_enabled_description"));
			isEnduranceModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration6 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration6.EnduranceModifierEnabled = isEnduranceModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration6;
			};
			isQiShieldModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Shield: Qi Shield modiifer", true, LocalizationResolver.Localize("config_modifiers_qi_shield_enabled_description"));
			isQiShieldModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration5 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration5.QiShieldModifierEnabled = isQiShieldModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration5;
			};
			isTimedShieldModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Shield: Cooldown Shield modiifer", true, LocalizationResolver.Localize("config_modifiers_cooldown_shield_enabled_description"));
			isTimedShieldModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration4 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration4.TimedShieldModifierEnabled = isTimedShieldModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration4;
			};
			isQiOverloadModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Qi Overload modiifer", true, LocalizationResolver.Localize("config_modifiers_qi_overload_enabled_description"));
			isQiOverloadModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration3 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration3.QiOverloadModifierEnabled = isQiOverloadModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration3;
			};
			isDistanceShieldModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Shield: Distance Shield modiifer", true, LocalizationResolver.Localize("config_modifiers_distance_shield_enabled_description"));
			isDistanceShieldModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration2 = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration2.DistanceShieldModifierEnabled = isDistanceShieldModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration2;
			};
			isYanlaoGunModifierEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Modifiers", "3.M Yanlago Gun modiifer", true, LocalizationResolver.Localize("config_modifiers_yanlao_gun_enabled_description"));
			isYanlaoGunModifierEnabled.SettingChanged += delegate
			{
				ChallengeConfiguration challengeConfiguration = ChallengeConfigurationManager.ChallengeConfiguration;
				challengeConfiguration.YanlaoGunModifierEnabled = isYanlaoGunModifierEnabled.Value;
				ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration;
			};
		}

		private void IsCyclingEnabled_SettingChanged(object sender, EventArgs e)
		{
			throw new NotImplementedException();
		}

		private void HandleConfigurationValues()
		{
			ChallengeConfiguration challengeConfiguration = ChallengeConfigurationManager.ChallengeConfiguration;
			challengeConfiguration.EnableRestoration = isCyclingEnabled.Value;
			challengeConfiguration.UseSingleRecordKey = useSingleRecordsKey.Value;
			challengeConfiguration.MaxCycles = maxCycles.Value;
			challengeConfiguration.EnableSpeedScaling = isSpeedScalingEnabled.Value;
			challengeConfiguration.MinSpeedScalingValue = minSpeedScalingValue.Value;
			challengeConfiguration.MaxSpeedScalingValue = maxSpeedScalingValue.Value;
			challengeConfiguration.MaxSpeedScalingCycle = maxSpeedScalingCycleValue.Value;
			challengeConfiguration.EnableModifiersScaling = isModifiersScalingEnabled.Value;
			challengeConfiguration.MaxModifiersNumber = maxModifiersNumber.Value;
			challengeConfiguration.MaxModifiersScalingCycle = maxModifiersNumberScalingValue.Value;
			challengeConfiguration.EnableRandomSpeedScaling = IsRandomSpeedScalingEnabled.Value;
			challengeConfiguration.RandomSpeedScalingStartDeath = StartRandomSpeedScalingDeath.Value;
			challengeConfiguration.MinRandomSpeedScalingValue = MinRandomSpeedScalingValue.Value;
			challengeConfiguration.MaxRandomSpeedScalingValue = MaxRandomSpeedScalingValue.Value;
			challengeConfiguration.EnableRandomModifiersScaling = IsRandomModifiersScalingEnabled.Value;
			challengeConfiguration.RandomModifiersScalingStartDeath = StartRandomModifiersScalingDeath.Value;
			challengeConfiguration.MinRandomModifiersNumber = MinRandomModifiersScalingValue.Value;
			challengeConfiguration.MaxRandomModifiersNumber = MaxRandomModifiersScalingValue.Value;
			challengeConfiguration.ModifiersEnabled = isModifiersEnabled.Value;
			challengeConfiguration.AllowRepeatModifiers = isModifiersRepeatingEnabled.Value;
			challengeConfiguration.SpeedModifierEnabled = isSpeedModifierEnabled.Value;
			challengeConfiguration.TimerModifierEnabled = isTimerModifierEnabled.Value;
			challengeConfiguration.ParryDirectDamageModifierEnabled = isParryDamageModifierEnabled.Value;
			challengeConfiguration.DamageBuildupModifierEnabled = isDamageBuildupModifierEnabled.Value;
			challengeConfiguration.RegenerationModifierEnabled = isRegenerationModifierEnabled.Value;
			challengeConfiguration.KnockbackModifierEnabled = isKnockbackModifierEnabled.Value;
			challengeConfiguration.RandomArrowModifierEnabled = isRandomArrowModifierEnabled.Value;
			challengeConfiguration.RandomTalismanModifierEnabled = isRandomTalismanModifierEnabled.Value;
			challengeConfiguration.EnduranceModifierEnabled = isEnduranceModifierEnabled.Value;
			challengeConfiguration.QiShieldModifierEnabled = isQiShieldModifierEnabled.Value;
			challengeConfiguration.TimedShieldModifierEnabled = isTimedShieldModifierEnabled.Value;
			challengeConfiguration.QiOverloadModifierEnabled = isQiOverloadModifierEnabled.Value;
			challengeConfiguration.DistanceShieldModifierEnabled = isDistanceShieldModifierEnabled.Value;
			challengeConfiguration.YanlaoGunModifierEnabled = isYanlaoGunModifierEnabled.Value;
			challengeConfiguration.ModifiersStartFromDeath = modifiersStartDeathValue.Value;
			ChallengeConfigurationManager.ChallengeConfiguration = challengeConfiguration;
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			UIController.FixUI();
			if (!isToastsDisplayed)
			{
				isToastsDisplayed = true;
				((MonoBehaviour)this).StartCoroutine(ShowToasts());
			}
		}

		private IEnumerator ShowToasts()
		{
			yield return (object)new WaitForSeconds(5f);
			for (int i = 1; i < 5; i++)
			{
				if (UnloadRequested)
				{
					break;
				}
				ToastManager.Toast((object)LocalizationResolver.Localize($"toast_message{i}"));
				yield return (object)new WaitForSeconds(4f);
			}
		}

		private void InitializeUIConfiguration()
		{
			UIConfiguration = new UIConfiguration();
			isCounterUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("4. UI", "4.1.1 Right panel(killer counter and modifiers list) UI enabled", true, LocalizationResolver.Localize("config_ui_counter_enabled_description"));
			isCounterUIEnabled.SettingChanged += delegate
			{
				UIConfiguration.CounterUIEnabled = isCounterUIEnabled.Value;
			};
			useCustomCounterPosition = ((BaseUnityPlugin)this).Config.Bind<bool>("4. UI", "4.1.2 Use custom right panel position", false, LocalizationResolver.Localize("config_ui_counter_custom_description"));
			useCustomCounterPosition.SettingChanged += delegate
			{
				UIConfiguration.UseCustomCounterPosition = useCustomCounterPosition.Value;
			};
			counterCustomXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.1.3 Custom right panel X position", 0f, LocalizationResolver.Localize("config_ui_counter_custom_x_description"));
			counterCustomXPosition.SettingChanged += delegate
			{
				UIConfiguration.CounterXPos = counterCustomXPosition.Value;
			};
			counterCustomYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.1.4 Custom right panel Y position", 0f, LocalizationResolver.Localize("config_ui_counter_custom_y_description"));
			counterCustomYPosition.SettingChanged += delegate
			{
				UIConfiguration.CounterYPos = counterCustomYPosition.Value;
			};
			counterScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.1.5 Right panel UI scale", 1f, LocalizationResolver.Localize("config_ui_counter_scale_description"));
			counterScale.SettingChanged += delegate
			{
				UIConfiguration.CounterUIScale = counterScale.Value;
			};
			isTimerUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("4. UI", "4.2.1 Timer UI enabled", true, LocalizationResolver.Localize("config_ui_timer_enabled_description"));
			isTimerUIEnabled.SettingChanged += delegate
			{
				UIConfiguration.TimerUIEnabled = isTimerUIEnabled.Value;
			};
			useCustomTimerPosition = ((BaseUnityPlugin)this).Config.Bind<bool>("4. UI", "4.2.2 Use custom timer position", false, LocalizationResolver.Localize("config_ui_timer_custom_description"));
			useCustomTimerPosition.SettingChanged += delegate
			{
				UIConfiguration.UseCustomTimerPosition = useCustomTimerPosition.Value;
			};
			timerCustomXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.2.3 Custom timer X position", 0f, LocalizationResolver.Localize("config_ui_timer_custom_x_description"));
			timerCustomXPosition.SettingChanged += delegate
			{
				UIConfiguration.TimerXPos = timerCustomXPosition.Value;
			};
			timerCustomYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.2.4 Custom timer Y position", 0f, LocalizationResolver.Localize("config_ui_timer_custom_y_description"));
			timerCustomYPosition.SettingChanged += delegate
			{
				UIConfiguration.TimerYPos = timerCustomYPosition.Value;
			};
			timerScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.2.5 Timer UI scale", 1f, LocalizationResolver.Localize("config_ui_timer_scale_description"));
			timerScale.SettingChanged += delegate
			{
				UIConfiguration.TimerUIScale = timerScale.Value;
			};
			isTalismanModeUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("4. UI", "4.3.1 Talisman Mode UI enabled", true, LocalizationResolver.Localize("config_ui_talisman_mode_enabled_description"));
			isTalismanModeUIEnabled.SettingChanged += delegate
			{
				UIConfiguration.TalismanModeUIEnabled = isTalismanModeUIEnabled.Value;
			};
			useCustomTalismanModePosition = ((BaseUnityPlugin)this).Config.Bind<bool>("4. UI", "4.3.2 Use custom talisman mode position", false, LocalizationResolver.Localize("config_ui_talisman_mode_custom_description"));
			useCustomTalismanModePosition.SettingChanged += delegate
			{
				UIConfiguration.UseCustomTalismanModePosition = useCustomTalismanModePosition.Value;
			};
			talismanModeCustomXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.3.3 Custom talisman mode X position", 0f, LocalizationResolver.Localize("config_ui_talisman_mode_custom_x_description"));
			talismanModeCustomXPosition.SettingChanged += delegate
			{
				UIConfiguration.TalismanModeXPos = talismanModeCustomXPosition.Value;
			};
			talismanModeCustomYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.3.4 Custom talisman mode Y position", 0f, LocalizationResolver.Localize("config_ui_talisman_mode_custom_y_description"));
			talismanModeCustomYPosition.SettingChanged += delegate
			{
				UIConfiguration.TalismanModeYPos = talismanModeCustomYPosition.Value;
			};
			talismanModeScale = ((BaseUnityPlugin)this).Config.Bind<float>("4. UI", "4.3.5 Talisman mode UI scale", 1f, LocalizationResolver.Localize("config_ui_talisman_mode_scale_description"));
			talismanModeScale.SettingChanged += delegate
			{
				UIConfiguration.TalismanUIScale = talismanModeScale.Value;
			};
		}

		private void HandleUIConfigurationValues()
		{
			UIConfiguration.CounterUIEnabled = isCounterUIEnabled.Value;
			UIConfiguration.UseCustomCounterPosition = useCustomCounterPosition.Value;
			UIConfiguration.CounterXPos = counterCustomXPosition.Value;
			UIConfiguration.CounterYPos = counterCustomYPosition.Value;
			UIConfiguration.CounterUIScale = counterScale.Value;
			UIConfiguration.TimerUIEnabled = isTimerUIEnabled.Value;
			UIConfiguration.UseCustomTimerPosition = useCustomTimerPosition.Value;
			UIConfiguration.TimerXPos = timerCustomXPosition.Value;
			UIConfiguration.TimerYPos = timerCustomYPosition.Value;
			UIConfiguration.TimerUIScale = timerScale.Value;
			UIConfiguration.TalismanModeUIEnabled = isTalismanModeUIEnabled.Value;
			UIConfiguration.UseCustomTalismanModePosition = useCustomTalismanModePosition.Value;
			UIConfiguration.TalismanModeXPos = talismanModeCustomXPosition.Value;
			UIConfiguration.TalismanModeYPos = talismanModeCustomYPosition.Value;
			UIConfiguration.TalismanUIScale = talismanModeScale.Value;
		}
	}
	internal static class Log
	{
		private static ManualLogSource? logSource;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogError(data);
			}
		}

		internal static void Fatal(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogFatal(data);
			}
		}

		internal static void Info(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogWarning(data);
			}
		}
	}
	[HarmonyPatch]
	public class Patches
	{
		private static int overloadCounter = 0;

		private static int overloadThreshold = 6;

		[HarmonyPatch(typeof(MonsterBase), "CheckInit")]
		[HarmonyPrefix]
		public static void CheckInit_Prefix(MonsterBase __instance, out IEnumerable<MonsterState> __state)
		{
			__state = new List<MonsterState>();
			if (((Component)__instance).tag == "Boss")
			{
				GeneralBossPatch value = null;
				if (!BossChallengeMod.Instance.BossPatches.TryGetValue(((Object)__instance).name, out value))
				{
					value = BossChallengeMod.Instance.BossPatches["Default"];
				}
				if (value != null)
				{
					value.PatchMonsterPostureSystem(__instance);
					__state = value.PatchMonsterStates(__instance);
					IEnumerable<RCGEventSender> senders = value.CreateSenders(__instance, __state);
					IEnumerable<RCGEventReceiver> receivers = value.CreateReceivers(__instance, __state);
					value.ProcessEventHandlers(receivers, senders);
				}
			}
		}

		[HarmonyPatch(typeof(MonsterBase), "CheckInit")]
		[HarmonyPostfix]
		public static void CheckInit_Postfix(MonsterBase __instance, IEnumerable<MonsterState> __state)
		{
			if (((Component)__instance).tag == "Boss")
			{
				GeneralBossPatch value = null;
				if (!BossChallengeMod.Instance.BossPatches.TryGetValue(((Object)__instance).name, out value))
				{
					value = BossChallengeMod.Instance.BossPatches["Default"];
				}
				value?.PatchMonsterFsmLookupStates(__instance, __state);
				value?.PostfixPatch(__instance);
			}
		}

		[HarmonyPatch(typeof(ButterflyBossFightLogic), "SetPhase")]
		[HarmonyPostfix]
		public static void SetPhase_Postfix(ButterflyBossFightLogic __instance, int targetPhase)
		{
			if (targetPhase == 2)
			{
				GeneralBossPatch generalBossPatch = BossChallengeMod.Instance.BossPatches["StealthGameMonster_Boss_ButterFly Variant"];
				MonsterBase obj = __instance.allMonsters[0];
				obj.postureSystem.DieHandleingStates.Clear();
				obj.postureSystem.DieHandleingStates.AddRange(generalBossPatch.DieStates);
				obj.postureSystem.GenerateCurrentDieHandleStacks();
			}
		}

		[HarmonyPatch(typeof(ButterflyBossFightLogic), "SetPhase")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> SetPhaseTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			if (list.Count >= 219)
			{
				list[213].opcode = OpCodes.Nop;
				list[214].opcode = OpCodes.Nop;
				list[215].opcode = OpCodes.Nop;
				list[216].opcode = OpCodes.Nop;
				list[217].opcode = OpCodes.Nop;
				list[218].opcode = OpCodes.Nop;
			}
			return instructions;
		}

		[HarmonyPatch(typeof(ButterflyBossFightLogic), "ChangingPhase")]
		[HarmonyTranspiler]
		public static IEnumerable<CodeInstruction> ChangingPhaseTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			if (list.Count >= 6)
			{
				list[0].opcode = OpCodes.Nop;
				list[1].opcode = OpCodes.Nop;
				list[2].opcode = OpCodes.Nop;
				list[3].opcode = OpCodes.Nop;
				list[4].opcode = OpCodes.Nop;
				list[5].opcode = OpCodes.Nop;
			}
			return instructions;
		}

		[HarmonyPatch(typeof(PlayerParryState), "NonAccurateParry")]
		[HarmonyPostfix]
		public static void ParryDamageModifier_Patch(PlayerParryState __instance, ref EffectHitData hitData, ref ParryParam param, ref DamageDealer bindDamage)
		{
			if ((Object)(object)bindDamage.Owner == (Object)null)
			{
				return;
			}
			ModifierBase[] componentsInChildren = ((Component)bindDamage.Owner).GetComponentsInChildren<ModifierBase>();
			if (componentsInChildren != null)
			{
				ModifierBase? modifierBase = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "parry_damage");
				if (modifierBase != null && ((Behaviour)modifierBase).enabled)
				{
					PlayerHealth health = Player.i.health;
					health.CurrentInternalInjury = 0f;
					health.ResetRecoverableTime();
				}
				ModifierBase? modifierBase2 = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "damage_buildup");
				if (modifierBase2 != null && ((Behaviour)modifierBase2).enabled)
				{
					PlayerHealth health2 = Player.i.health;
					float damageAmount = bindDamage.DamageAmount;
					health2.RecoverInternalInjury(damageAmount / 2f);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerParryState), "Parried")]
		[HarmonyPrefix]
		public static void ParryMethodPatch(ref ParryParam param, ref DamageDealer bindDamage)
		{
			if ((Object)(object)bindDamage.Owner == (Object)null)
			{
				return;
			}
			ModifierBase[] componentsInChildren = ((Component)bindDamage.Owner).GetComponentsInChildren<ModifierBase>();
			if (componentsInChildren != null)
			{
				ModifierBase? modifierBase = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "knockback");
				if (modifierBase != null && ((Behaviour)modifierBase).enabled)
				{
					param.knockBackValue *= 1.5f;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "NextItemCheck")]
		[HarmonyPrefix]
		public static bool NextItemPatch()
		{
			if (BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any())
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Player), "PreviousItemCheck")]
		[HarmonyPrefix]
		public static bool PrevItemPatch()
		{
			if (BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any())
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerWeaponState), "OnStateExit")]
		[HarmonyPostfix]
		public static void WeaponCheckPatch()
		{
			if (BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any())
			{
				Random random = new Random();
				int acquiredCount = ((AbstractGameFlagCollection)Player.i.weaponDataCollection).AcquiredCount;
				int num = random.Next(1, acquiredCount);
				for (int i = 0; i < num; i++)
				{
					((AbstractGameFlagCollection)Player.i.weaponDataCollection).Next();
				}
			}
		}

		[HarmonyPatch(typeof(FooManager), "ExplodeWithDealer")]
		[HarmonyPostfix]
		public static void FooExplodePatch()
		{
			Random random = new Random();
			if (!BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Any())
			{
				return;
			}
			CollectionRotateSelectorButton component = GameObject.Find("GameCore(Clone)/RCG LifeCycle/UIManager/GameplayUICamera/UI-Canvas/[Tab] MenuTab/CursorProvider/Menu Vertical Layout/Panels/PlayerStatus Panel/Description Provider/LeftPart/PlayerStatusSelectableButton_ControlStyle").GetComponent<CollectionRotateSelectorButton>();
			if ((Object)(object)component != (Object)null)
			{
				AbstractGameFlagCollection collection = ((SelectFromCollectionButton)component).collection;
				int acquiredCount = collection.AcquiredCount;
				int num = random.Next(1, acquiredCount);
				for (int i = 0; i < num; i++)
				{
					collection.Next();
				}
				((UIControlButton)component).UpdateView();
				BossChallengeMod.Instance.UIController.UpdateTalisman(((SelectFromCollectionButton)component).image.sprite);
			}
		}

		[HarmonyPatch(typeof(MonsterBase), "HurtInterruptCheck")]
		[HarmonyPrefix]
		public static bool HurtInterruptPatch(MonsterBase __instance)
		{
			if (((Object)__instance).name.Contains("Boss_ButterFly"))
			{
				return true;
			}
			ModifierBase[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<ModifierBase>();
			if (componentsInChildren != null)
			{
				ModifierBase? modifierBase = componentsInChildren.FirstOrDefault((ModifierBase m) => m.Key == "endurance");
				if (modifierBase != null && ((Behaviour)modifierBase).enabled)
				{
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerFooExplodeState), "AnimationEvent")]
		[HarmonyPostfix]
		public static void FooExplodeAnimationEventPatch()
		{
			if (((AbilityWrapper)(ref Player.i.mainAbilities.FooExplodeAutoStyle)).IsActivated)
			{
				Player.i.ChangeState((PlayerStateType)0, false);
			}
		}

		[HarmonyPatch(typeof(CollectionRotateSelectorButton), "SubmitImplementation")]
		[HarmonyPrefix]
		public static bool FooSelectionPatchPrefix(CollectionRotateSelectorButton __instance)
		{
			if (((Object)((Component)__instance).gameObject).name == "PlayerStatusSelectableButton_ControlStyle" && BossChallengeMod.Instance.GlobalModifiersFlags.BlockTalismanVotes.Any())
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(CollectionRotateSelectorButton), "SubmitImplementation")]
		[HarmonyPrefix]
		public static bool ArrowSelectionPatchPrefix(CollectionRotateSelectorButton __instance)
		{
			if (((Object)((Component)__instance).gameObject).name == "PlayerStatusSelectableButton_Arrow" && BossChallengeMod.Instance.GlobalModifiersFlags.BlockArrowVotes.Any())
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(CollectionRotateSelectorButton), "SubmitImplementation")]
		[HarmonyPostfix]
		public static void FooSelectionPatchPostfix(CollectionRotateSelectorButton __instance)
		{
			if (((Object)((Component)__instance).gameObject).name == "PlayerStatusSelectableButton_ControlStyle")
			{
				BossChallengeMod.Instance.UIController.UpdateTalisman(((SelectFromCollectionButton)__instance).image.sprite);
			}
		}

		[HarmonyPatch(typeof(ResolutionSetting), "OnChanged")]
		[HarmonyPostfix]
		public static void ResolutionChangedPatch(ref Resolution resolution)
		{
			BossChallengeMod.Instance.UIController?.RecalculatePositions(((Resolution)(ref resolution)).width, ((Resolution)(ref resolution)).height);
		}

		[HarmonyPatch(typeof(MonsterBase), "OnExplode")]
		[HarmonyPostfix]
		public static void OnExplodePostfix(MonsterBase __instance)
		{
			ModifierBase[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<ModifierBase>();
			if (componentsInChildren != null)
			{
				ModifierBase[] array = componentsInChildren;
				for (int i = 0; i < array.Length; i++)
				{
					array[i].MonsterNotify(MonsterNotifyType.OnExplode);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerEnergy), "Gain")]
		[HarmonyPrefix]
		public static bool OnQiGain(PlayerEnergy __instance, float amount)
		{
			if ((Object)(object)__instance == (Object)(object)Player.i.chiContainer && BossChallengeMod.Instance.GlobalModifiersFlags.EnableQiOverloadVotes.Any())
			{
				int num = Math.Max(0, (int)(__instance.Value + amount - __instance.MaxValue));
				if (num > 0)
				{
					Player.i.health.ReceiveRecoverableDamage(((Health)Player.i.health).maxHealth.Value / 10f);
					if (((Health)Player.i.health).currentValue <= ((Health)Player.i.health).maxHealth.Value / 10f)
					{
						overloadCounter += num;
						if (overloadCounter >= overloadThreshold)
						{
							__instance.Clear();
							overloadCounter = 0;
							return false;
						}
					}
				}
				else
				{
					overloadCounter = 0;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerEnergy), "Consume")]
		[HarmonyPostfix]
		public static void OnQiConsume(PlayerEnergy __instance)
		{
			overloadCounter = 0;
		}
	}
	public enum MonsterNotifyType
	{
		Generic,
		OnExplode,
		OnChargeAttack
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "BossChallengeMod";

		public const string PLUGIN_NAME = "BossChallengeMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BossChallengeMod.UI
{
	public class CurrentTalismanUIContoller : MonoBehaviour
	{
		private Image talismanImage;

		public void Awake()
		{
			talismanImage = CreateImage();
			ValidateImage();
		}

		public void UpdateCurrentTalisman(Sprite sprite)
		{
			_ = Player.i;
			talismanImage.sprite = sprite;
			ValidateImage();
		}

		private Image CreateImage()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			GameObject val = new GameObject("CurrentTalisman");
			val.transform.SetParent(((Component)this).transform, false);
			Image obj = val.AddComponent<Image>();
			((Transform)((Graphic)obj).rectTransform).localScale = new Vector3(1.5f, 1.5f, 1f);
			return obj;
		}

		private Sprite GetTalismanSprite(AbilityWrapper style, AbilityWrapper upgrade, Sprite baseSprite, Sprite upgradedSprite)
		{
			if (((AbilityWrapper)(ref style)).IsActivated)
			{
				if (!((AbilityWrapper)(ref upgrade)).IsActivated)
				{
					return baseSprite;
				}
				return upgradedSprite;
			}
			return null;
		}

		private void ValidateImage()
		{
			((Behaviour)talismanImage).enabled = (Object)(object)talismanImage.sprite != (Object)null;
		}
	}
	public class KillCounterController : MonoBehaviour
	{
		private TMP_FontAsset font;

		private LocalizationResolver localizer = BossChallengeMod.Instance.LocalizationResolver;

		private bool needToShow;

		private bool needToShowExpanded;

		public TMP_Text MainCounterText;

		public TMP_Text HightScoreText;

		public TMP_Text LastAttemptText;

		public float labelSpacing = 10f;

		public float animationChangeDuration = 1f;

		public float labelTextAnimationShowDuration = 1f;

		public float labelTextAnimationHideDuration = 1f;

		public float labelTextDefaultAlpha = 1f;

		public float expandedTextAnimationShowDuration = 1f;

		public float expandedTextAnimationHideDuration = 1f;

		public float expandedTextDefaultAlpha = 1f;

		public UIControllerAnimationState UIControllerAnimationState { get; set; }

		public void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			font = LoadFont();
			MainCounterText = UIController.InitializeText(Vector2.zero, ((Component)this).gameObject, string.Format("{0} {1}", localizer.Localize("kill_counter"), 0), active: false, 32, font, (TextAlignmentOptions)260);
			HightScoreText = UIController.InitializeText(new Vector2(0f, -36f), ((Component)this).gameObject, string.Format("{0} {1}", localizer.Localize("kill_counter_hs"), 0), active: false, 20, font, (TextAlignmentOptions)260);
			LastAttemptText = UIController.InitializeText(new Vector2(0f, -56f), ((Component)this).gameObject, string.Format("{0} {1}", localizer.Localize("kill_counter_last"), 0), active: false, 20, font, (TextAlignmentOptions)260);
			labelTextDefaultAlpha = MainCounterText.alpha;
			expandedTextDefaultAlpha = HightScoreText.alpha;
			MainCounterText.alpha = 0f;
		}

		public void ChangeNumber(int number)
		{
			MainCounterText.text = localizer.Localize("kill_counter") + " " + number;
		}

		public void Show()
		{
			needToShow = true;
			((MonoBehaviour)this).StartCoroutine(AnimateTextShow(MainCounterText, needToShow, labelTextDefaultAlpha, labelTextAnimationShowDuration, EasingFunctions.Linear));
		}

		public void Hide(Action? callback = null)
		{
			needToShow = false;
			((MonoBehaviour)this).StartCoroutine(AnimateTextHide(MainCounterText, needToShow, labelTextDefaultAlpha, labelTextAnimationHideDuration, EasingFunctions.Linear, callback));
		}

		public void UpdateHighScore(int number)
		{
			HightScoreText.text = localizer.Localize("kill_counter_hs") + " " + number;
		}

		public void UpdatePrevResult(int number)
		{
			LastAttemptText.text = localizer.Localize("kill_counter_last") + " " + number;
		}

		public void ShowExtraText(Action? callback = null)
		{
			if (UIControllerAnimationState == UIControllerAnimationState.ModifiersLowered)
			{
				needToShowExpanded = true;
				((MonoBehaviour)this).StartCoroutine(AnimateTextShow(HightScoreText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationShowDuration, EasingFunctions.Linear, callback));
				((MonoBehaviour)this).StartCoroutine(AnimateTextShow(LastAttemptText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationShowDuration, EasingFunctions.Linear));
			}
		}

		public void HideExtraText(Action? callback = null)
		{
			if (UIControllerAnimationState == UIControllerAnimationState.KillCounterExpanded)
			{
				needToShowExpanded = false;
				((MonoBehaviour)this).StartCoroutine(AnimateTextHide(HightScoreText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationHideDuration, EasingFunctions.Linear, callback));
				((MonoBehaviour)this).StartCoroutine(AnimateTextHide(LastAttemptText, needToShowExpanded, expandedTextDefaultAlpha, expandedTextAnimationHideDuration, EasingFunctions.Linear));
			}
		}

		private IEnumerator AnimateTextShow(TMP_Text text, bool flag, float defaultAlpha, float showDuration, Func<float, float> easingFunction, Action? callback = null)
		{
			if (flag)
			{
				((Component)text).gameObject.SetActive(true);
				float startingAlpha = text.alpha;
				float num = startingAlpha / defaultAlpha;
				float elapsedTime = showDuration * num;
				while (flag && elapsedTime < showDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float arg = elapsedTime / showDuration;
					text.alpha = Mathf.Lerp(startingAlpha, defaultAlpha, easingFunction(arg));
					yield return null;
				}
				if (flag)
				{
					callback?.Invoke();
				}
			}
		}

		private IEnumerator AnimateTextHide(TMP_Text text, bool flag, float defaultAlpha, float hideDuration, Func<float, float> easingFunction, Action? callback = null)
		{
			if (!flag)
			{
				float startingAlpha = text.alpha;
				float num = 1f - startingAlpha / defaultAlpha;
				float elapsedTime = hideDuration * num;
				while (!flag && elapsedTime < hideDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float arg = elapsedTime / hideDuration;
					text.alpha = Mathf.Lerp(startingAlpha, 0f, easingFunction(arg));
					yield return null;
				}
				if (!flag)
				{
					((Component)text).gameObject.SetActive(false);
					callback?.Invoke();
				}
			}
		}

		private TMP_FontAsset? LoadFont()
		{
			TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
			foreach (TMP_FontAsset val in array)
			{
				if (((Object)val).name == "LiberationSans SDF")
				{
					return val;
				}
			}
			return null;
		}
	}
	public class ModifiersUIController : MonoBehaviour
	{
		private enum ModifiersUIState
		{
			Hidden,
			UnfoldingLine,
			LineUnfolded,
			UnfoldingModifiers,
			ModifiersUnfolded,
			CollapsingModifiers,
			ModifiersCollapsed,
			CollapsingLine
		}

		private RectTransform line;

		private List<string> modifiers = new List<string>();

		private List<TMP_Text> items = new List<TMP_Text>();

		private LocalizationResolver localizer = BossChallengeMod.Instance.LocalizationResolver;

		public float lineDefaultLength = 200f;

		public float lineUnfoldAnimationDuration = 0.75f;

		public float lineFoldAnimationDuration = 0.75f;

		public float modifierTextAnimationShowDuration = 0.7f;

		public float modifierTextAnimationHideDuration = 0.7f;

		public float modifierTextDefaultAlpha = 0.79f;

		private float modifiersDefaultHeight = -21f;

		private float modifiersLoweredHeight = -66f;

		private float modifiersRaisingAnimationDuration = 1f;

		private float modifiersLoweringAnimationDuration = 1f;

		private bool forceHide;

		public UIControllerAnimationState UIControllerAnimationState;

		private ModifiersUIState currentState;

		private ModifiersUIState CurrentState
		{
			get
			{
				return currentState;
			}
			set
			{
				switch (value)
				{
				case ModifiersUIState.Hidden:
					currentState = value;
					break;
				case ModifiersUIState.UnfoldingLine:
					currentState = value;
					break;
				case ModifiersUIState.LineUnfolded:
					currentState = value;
					if (modifiers.Any())
					{
						((MonoBehaviour)this).StartCoroutine(UnfoldModifiers());
					}
					else
					{
						((MonoBehaviour)this).StartCoroutine(CollapseLineAnimation());
					}
					break;
				case ModifiersUIState.UnfoldingModifiers:
					currentState = value;
					break;
				case ModifiersUIState.ModifiersUnfolded:
					currentState = value;
					break;
				case ModifiersUIState.CollapsingModifiers:
					currentState = value;
					break;
				case ModifiersUIState.ModifiersCollapsed:
					currentState = value;
					if (modifiers.Any() && !forceHide)
					{
						((MonoBehaviour)this).StartCoroutine(UnfoldModifiers());
					}
					else
					{
						((MonoBehaviour)this).StartCoroutine(CollapseLineAnimation());
					}
					break;
				case ModifiersUIState.CollapsingLine:
					currentState = value;
					break;
				default:
					currentState = value;
					break;
				}
			}
		}

		public void Awake()
		{
			line = CreateLine();
			((Component)line).gameObject.SetActive(false);
		}

		public void Show(bool force = false)
		{
			if (modifiers.Any() || force)
			{
				forceHide = false;
				switch (CurrentState)
				{
				case ModifiersUIState.Hidden:
					((MonoBehaviour)this).StartCoroutine(UnfoldLineAnimation());
					break;
				case ModifiersUIState.CollapsingLine:
					((MonoBehaviour)this).StartCoroutine(UnfoldLineAnimation());
					break;
				case ModifiersUIState.UnfoldingLine:
				case ModifiersUIState.LineUnfolded:
				case ModifiersUIState.UnfoldingModifiers:
				case ModifiersUIState.ModifiersUnfolded:
				case ModifiersUIState.CollapsingModifiers:
				case ModifiersUIState.ModifiersCollapsed:
					break;
				}
			}
		}

		public void Hide(bool force = false)
		{
			forceHide = force;
			switch (CurrentState)
			{
			case ModifiersUIState.UnfoldingLine:
				CurrentState = ModifiersUIState.CollapsingLine;
				break;
			case ModifiersUIState.LineUnfolded:
				((MonoBehaviour)this).StartCoroutine(CollapseLineAnimation());
				break;
			case ModifiersUIState.UnfoldingModifiers:
				CurrentState = ModifiersUIState.CollapsingModifiers;
				break;
			case ModifiersUIState.ModifiersUnfolded:
				((MonoBehaviour)this).StartCoroutine(CollapseModifiers());
				break;
			case ModifiersUIState.Hidden:
			case ModifiersUIState.CollapsingModifiers:
			case ModifiersUIState.ModifiersCollapsed:
			case ModifiersUIState.CollapsingLine:
				break;
			}
		}

		public void SetModifiers(IEnumerable<string> modifiers)
		{
			this.modifiers.Clear();
			this.modifiers.AddRange(modifiers);
			Hide();
		}

		public void Reset()
		{
			SetModifiers(Array.Empty<string>());
		}

		public void RaiseModifiers(Action? callback = null)
		{
			((MonoBehaviour)this).StartCoroutine(AnimateModifiersRaising(callback));
		}

		public void LowerModifiers(Action? callback = null)
		{
			((MonoBehaviour)this).StartCoroutine(AnimateModifiersLowering(callback));
		}

		private IEnumerator UnfoldModifiers()
		{
			if (CurrentState == ModifiersUIState.LineUnfolded || CurrentState == ModifiersUIState.ModifiersCollapsed || CurrentState == ModifiersUIState.CollapsingModifiers)
			{
				CurrentState = ModifiersUIState.UnfoldingModifiers;
				Queue<string> modifiersQueue = new Queue<string>(modifiers);
				int counter = 1;
				while (items.Any())
				{
					yield return (object)new WaitForSecondsRealtime(0.1f);
				}
				while (modifiersQueue.Any() && CurrentState == ModifiersUIState.UnfoldingModifiers)
				{
					string key = modifiersQueue.Dequeue();
					TMP_Text val = UIController.InitializeText(new Vector2(0f, (float)(-31 * counter)), ((Component)this).gameObject, localizer.Localize(key), active: true, 21, null, (TextAlignmentOptions)260);
					counter++;
					val.alpha = 0f;
					items.Add(val);
					((MonoBehaviour)this).StartCoroutine(AnimateModifierShow(val, !modifiersQueue.Any()));
					yield return (object)new WaitForSecondsRealtime(0.25f);
				}
			}
		}

		private IEnumerator CollapseModifiers()
		{
			if (CurrentState == ModifiersUIState.ModifiersUnfolded || CurrentState == ModifiersUIState.UnfoldingModifiers)
			{
				CurrentState = ModifiersUIState.CollapsingModifiers;
				while (items.Any())
				{
					TMP_Text textItem = ListExtensions.Pop<TMP_Text>(items);
					((MonoBehaviour)this).StartCoroutine(AnimateModifierHide(textItem, !items.Any()));
					yield return (object)new WaitForSecondsRealtime(0.33f);
				}
			}
		}

		private IEnumerator UnfoldLineAnimation()
		{
			if (CurrentState == ModifiersUIState.Hidden || CurrentState == ModifiersUIState.CollapsingLine)
			{
				CurrentState = ModifiersUIState.UnfoldingLine;
				((Component)line).gameObject.SetActive(true);
				float startingLength = line.sizeDelta.x;
				float num = startingLength / lineDefaultLength;
				float elapsedTime = lineUnfoldAnimationDuration * num;
				while (CurrentState == ModifiersUIState.UnfoldingLine && elapsedTime < lineUnfoldAnimationDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float t = elapsedTime / lineUnfoldAnimationDuration;
					float num2 = Mathf.Lerp(startingLength, lineDefaultLength, EasingFunctions.EaseOut(t));
					line.sizeDelta = new Vector2(num2, line.sizeDelta.y);
					yield return null;
				}
				if (CurrentState == ModifiersUIState.UnfoldingLine)
				{
					CurrentState = ModifiersUIState.LineUnfolded;
				}
			}
		}

		private IEnumerator CollapseLineAnimation()
		{
			if (CurrentState == ModifiersUIState.LineUnfolded || CurrentState == ModifiersUIState.UnfoldingLine || CurrentState == ModifiersUIState.ModifiersCollapsed)
			{
				CurrentState = ModifiersUIState.CollapsingLine;
				float startingLength = line.sizeDelta.x;
				float num = 1f - startingLength / lineDefaultLength;
				float elapsedTime = lineFoldAnimationDuration * num;
				while (CurrentState == ModifiersUIState.CollapsingLine && elapsedTime < lineFoldAnimationDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float t = elapsedTime / lineFoldAnimationDuration;
					float num2 = Mathf.Lerp(startingLength, 0f, EasingFunctions.EaseOut(t));
					line.sizeDelta = new Vector2(num2, line.sizeDelta.y);
					yield return null;
				}
				if (CurrentState == ModifiersUIState.CollapsingLine)
				{
					CurrentState = ModifiersUIState.Hidden;
				}
			}
		}

		private IEnumerator AnimateModifierShow(TMP_Text textItem, bool last = false)
		{
			if (CurrentState == ModifiersUIState.UnfoldingModifiers)
			{
				((Component)textItem).gameObject.SetActive(true);
				float startingAlpha = textItem.alpha;
				float num = startingAlpha / modifierTextDefaultAlpha;
				float elapsedTime = modifierTextAnimationShowDuration * num;
				while (CurrentState == ModifiersUIState.UnfoldingModifiers && elapsedTime < modifierTextAnimationShowDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float num2 = elapsedTime / modifierTextAnimationShowDuration;
					textItem.alpha = Mathf.Lerp(startingAlpha, modifierTextDefaultAlpha, num2);
					yield return null;
				}
				if (CurrentState == ModifiersUIState.UnfoldingModifiers && last)
				{
					CurrentState = ModifiersUIState.ModifiersUnfolded;
				}
			}
		}

		private IEnumerator AnimateModifierHide(TMP_Text textItem, bool last = false)
		{
			float startingAlpha = textItem.alpha;
			float num = 1f - startingAlpha / modifierTextDefaultAlpha;
			float elapsedTime = modifierTextAnimationHideDuration * num;
			while (elapsedTime < modifierTextAnimationHideDuration)
			{
				elapsedTime += Time.unscaledDeltaTime;
				float num2 = elapsedTime / modifierTextAnimationHideDuration;
				textItem.alpha = Mathf.Lerp(startingAlpha, 0f, num2);
				yield return null;
			}
			if (CurrentState == ModifiersUIState.CollapsingModifiers && last)
			{
				CurrentState = ModifiersUIState.ModifiersCollapsed;
			}
			Object.Destroy((Object)(object)((Component)textItem).gameObject);
		}

		private IEnumerator AnimateModifiersLowering(Action? callback = null)
		{
			if (UIControllerAnimationState == UIControllerAnimationState.KillCounterCollapsed)
			{
				float elapsedTime = 0f;
				Vector3 localPosition = default(Vector3);
				while (elapsedTime < modifiersLoweringAnimationDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float t = elapsedTime / modifiersLoweringAnimationDuration;
					((Vector3)(ref localPosition))..ctor(((Component)this).transform.localPosition.x, Mathf.Lerp(modifiersDefaultHeight, modifiersLoweredHeight, EasingFunctions.EaseOut(t)));
					((Component)this).transform.localPosition = localPosition;
					yield return null;
				}
				if (UIControllerAnimationState == UIControllerAnimationState.KillCounterCollapsed)
				{
					callback?.Invoke();
				}
			}
		}

		private IEnumerator AnimateModifiersRaising(Action? callback = null)
		{
			if (UIControllerAnimationState == UIControllerAnimationState.KillCounterExpandedTextHidden)
			{
				float elapsedTime = 0f;
				Vector3 localPosition = default(Vector3);
				while (elapsedTime < modifiersRaisingAnimationDuration)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float t = elapsedTime / modifiersRaisingAnimationDuration;
					((Vector3)(ref localPosition))..ctor(((Component)this).transform.localPosition.x, Mathf.Lerp(modifiersLoweredHeight, modifiersDefaultHeight, EasingFunctions.EaseOut(t)));
					((Component)this).transform.localPosition = localPosition;
					yield return null;
				}
				if (UIControllerAnimationState == UIControllerAnimationState.KillCounterExpandedTextHidden)
				{
					callback?.Invoke();
				}
			}
		}

		private RectTransform CreateLine()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_004a: 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)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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)
			Color color = default(Color);
			((Color)(ref color))..ctor(0.941f, 0.862f, 0.588f, 0.79f);
			float num = 1f;
			float num2 = 0f;
			GameObject val = new GameObject("HorizontalLine");
			val.transform.SetParent(((Component)this).transform, false);
			((Graphic)val.AddComponent<Image>()).color = color;
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(num2, num);
			component.anchorMin = new Vector2(0.5f, 0.5f);
			component.anchorMax = new Vector2(0.5f, 0.5f);
			component.pivot = new Vector2(1f, 0.5f);
			component.anchoredPosition = Vector2.zero;
			val.transform.localPosition = Vector2.op_Implicit(new Vector2(100f, 0f));
			return component;
		}
	}
	public class MonsterUIController
	{
		private MonsterKillCounter? trackedKillCounter;

		private MonsterModifierController? trackedModifiersController;

		private UIController UIController = BossChallengeMod.Instance.UIController;

		private bool isHidingKillCounter;

		private bool isHidingRecordsText;

		public bool IsHidingKillCounter
		{
			get
			{
				return isHidingKillCounter;
			}
			set
			{
				isHidingKillCounter = value;
				if ((Object)(object)trackedKillCounter != (Object)null && !isHidingKillCounter)
				{
					UpdateKillCounterUI();
				}
			}
		}

		public bool IsHidingRecordsText
		{
			get
			{
				return isHidingRecordsText;
			}
			set
			{
				isHidingRecordsText = value;
				if ((Object)(object)trackedKillCounter != (Object)null && !isHidingRecordsText)
				{
					UpdateKillCounterUI();
				}
			}
		}

		public MonsterUIController()
		{
			UIController uIController = UIController;
			uIController.OnModifiersRaisedAnimationDone = (Action)Delegate.Combine(uIController.OnModifiersRaisedAnimationDone, (Action)delegate
			{
				IsHidingRecordsText = false;
			});
			SceneManager.sceneUnloaded += ValidateOnSceneUnload;
		}

		public void ChangeKillCounter(MonsterKillCounter? monsterKillCounter)
		{
			if ((Object)(object)trackedKillCounter != (Object)null)
			{
				MonsterKillCounter? monsterKillCounter2 = trackedKillCounter;
				monsterKillCounter2.OnUpdate = (Action)Delegate.Remove(monsterKillCounter2.OnUpdate, new Action(UpdateKillCounterUI));
				MonsterKillCounter? monsterKillCounter3 = trackedKillCounter;
				monsterKillCounter3.OnDestroyActions = (Action)Delegate.Remove(monsterKillCounter3.OnDestroyActions, new Action(ResetKillCounter));
			}
			trackedKillCounter = monsterKillCounter;
			if ((Object)(object)trackedKillCounter != (Object)null)
			{
				MonsterKillCounter? monsterKillCounter4 = trackedKillCounter;
				monsterKillCounter4.OnUpdate = (Action)Delegate.Combine(monsterKillCounter4.OnUpdate, new Action(UpdateKillCounterUI));
				MonsterKillCounter? monsterKillCounter5 = trackedKillCounter;
				monsterKillCounter5.OnDestroyActions = (Action)Delegate.Combine(monsterKillCounter5.OnDestroyActions, new Action(ResetKillCounter));
			}
			UpdateKillCounterUI();
		}

		public void ChangeModifiersController(MonsterModifierController? monsterModifierController)
		{
			if ((Object)(object)trackedModifiersController != (Object)null)
			{
				MonsterModifierController? monsterModifierController2 = trackedModifiersController;
				monsterModifierController2.OnModifiersRoll = (Action)Delegate.Remove(monsterModifierController2.OnModifiersRoll, new Action(UpdateModifierUI));
				MonsterModifierController? monsterModifierController3 = trackedModifiersController;
				monsterModifierController3.OnDestroyActions = (Action)Delegate.Remove(monsterModifierController3.OnDestroyActions, new Action(ResetModifierController));
			}
			trackedModifiersController = monsterModifierController;
			if ((Object)(object)trackedModifiersController != (Object)null)
			{
				MonsterModifierController? monsterModifierController4 = trackedModifiersController;
				monsterModifierController4.OnModifiersRoll = (Action)Delegate.Combine(monsterModifierController4.OnModifiersRoll, new Action(UpdateModifierUI));
				MonsterModifierController? monsterModifierController5 = trackedModifiersController;
				monsterModifierController5.OnDestroyActions = (Action)Delegate.Combine(monsterModifierController5.OnDestroyActions, new Action(ResetModifierController));
			}
			UpdateModifierUI();
		}

		private void UpdateKillCounterUI()
		{
			if ((Object)(object)trackedKillCounter == (Object)null)
			{
				IsHidingKillCounter = true;
				UIController.HideText(delegate
				{
					IsHidingKillCounter = false;
				});
				if (UIController.CurrentAnimationState != 0)
				{
					IsHidingRecordsText = true;
					UIController.HideExpandedKillNumbersText();
				}
				return;
			}
			if (!isHidingKillCounter)
			{
				UIController.UpdateBossCounterNumber(trackedKillCounter.KillCounter);
				UIController.ShowText();
			}
			if (!isHidingRecordsText && (trackedKillCounter.BestCount > 0 || trackedKillCounter.LastCount > 0))
			{
				UIController.UpdateBossRecordValues(trackedKillCounter.BestCount, trackedKillCounter.LastCount);
				UIController.ShowExpandedKillNumbersText();
			}
		}

		private void UpdateModifierUI()
		{
			if ((Object)(object)trackedModifiersController == (Object)null)
			{
				UIController.HideModifiers();
			}
			else if (trackedModifiersController.Selected.Any())
			{
				UIController.UpdateModifiers(trackedModifiersController.Selected.Select((ModifierConfig m) => m.Key));
			}
			else
			{
				UIController.HideModifiers();
			}
		}

		public void ResetKillCounter()
		{
			ChangeKillCounter(null);
		}

		public void ResetModifierController()
		{
			ChangeModifiersController(null);
		}

		public void ValidateOnSceneUnload(Scene scene)
		{
			UpdateKillCounterUI();
			UpdateModifierUI();
		}

		public void Unload()
		{
			SceneManager.sceneUnloaded -= ValidateOnSceneUnload;
		}
	}
	public class TimerController : MonoBehaviour
	{
		private enum UIAnimationStates
		{
			Show,
			Hide
		}

		private TMP_Text timerText;

		private TMP_FontAsset font;

		private float animationShowDuration = 0.75f;

		private float animationHideDuration = 0.75f;

		private float hiddenYPosition;

		private float visibleYPosition;

		private UIAnimationStates state = UIAnimationStates.Hide;

		public void Awake()
		{
			//IL_000d: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			font = LoadFont();
			timerText = UIController.InitializeText(Vector2.zero, ((Component)this).gameObject, "00:00:000", active: false, 32, font, (TextAlignmentOptions)514);
			visibleYPosition = GetVisiblePosition();
			hiddenYPosition = GetHiddenPosition();
			timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, hiddenYPosition);
		}

		public void Show()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			state = UIAnimationStates.Show;
			if (BossChallengeMod.Instance.UIConfiguration.UseCustomTimerPosition)
			{
				((Component)timerText).gameObject.SetActive(true);
				timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, visibleYPosition);
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(AnimateTimerShow());
			}
		}

		public void Hide()
		{
			state = UIAnimationStates.Hide;
			if (BossChallengeMod.Instance.UIConfiguration.UseCustomTimerPosition)
			{
				((Component)timerText).gameObject.SetActive(false);
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(AnimateTimerHide());
			}
		}

		public void UpdateTimer(int milliseconds)
		{
			timerText.text = FormatMilliseconds(milliseconds);
		}

		private string FormatMilliseconds(int milliseconds)
		{
			TimeSpan timeSpan = TimeSpan.FromMilliseconds(milliseconds);
			return $"{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}.{timeSpan.Milliseconds:D3}";
		}

		private IEnumerator AnimateTimerShow()
		{
			if (state == UIAnimationStates.Show)
			{
				((Component)timerText).gameObject.SetActive(true);
				float elapsedTime = 0f;
				while (elapsedTime < animationShowDuration && state == UIAnimationStates.Show)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float t = elapsedTime / animationShowDuration;
					float num = Mathf.Lerp(hiddenYPosition, visibleYPosition, EasingFunctions.EaseOut(t));
					timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, num);
					yield return null;
				}
			}
		}

		private IEnumerator AnimateTimerHide()
		{
			if (state == UIAnimationStates.Hide)
			{
				float elapsedTime = 0f;
				while (elapsedTime < animationHideDuration && state == UIAnimationStates.Hide)
				{
					elapsedTime += Time.unscaledDeltaTime;
					float t = elapsedTime / animationShowDuration;
					float num = Mathf.Lerp(visibleYPosition, hiddenYPosition, EasingFunctions.EaseOut(t));
					timerText.transform.localPosition = new Vector3(timerText.transform.localPosition.x, num);
					yield return null;
				}
				if (state == UIAnimationStates.Hide)
				{
					((Component)timerText).gameObject.SetActive(false);
				}
			}
		}

		private TMP_FontAsset? LoadFont()
		{
			TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
			foreach (TMP_FontAsset val in array)
			{
				if (((Object)val).name == "LiberationSans SDF")
				{
					return val;
				}
			}
			return null;
		}

		private float GetVisiblePosition()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = ((Component)((Component)NineSolsAPICore.FullscreenCanvas).transform).GetComponent<RectTransform>().rect;
			return ((Rect)(ref rect)).height * 0.03f;
		}

		private float GetHiddenPosition()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return 0f - ((Component)this).transform.position.y - timerText.preferredHeight;
		}
	}
	public class UIController
	{
		private KillCounterController bossCounterTextController;

		private ModifiersUIController modifiersController;

		private TimerController timerController;

		private CurrentTalismanUIContoller talismanUIController;

		public Action? OnModifiersRaisedAnimationDone;

		private UIConfiguration _configuration;

		private UIControllerAnimationState animationState;

		private RectTransform rightPanel;

		private RectTransform bottomPanel;

		private RectTransform bottomLeftPanel;

		public UIControllerAnimationState CurrentAnimationState
		{
			get
			{
				return animationState;
			}
			private set
			{
				animationState = value;
				modifiersController.UIControllerAnimationState = value;
				bossCounterTextController.UIControllerAnimationState = value;
				switch (value)
				{
				case UIControllerAnimationState.ModifiersLowered:
					bossCounterTextController.ShowExtraText(delegate
					{
						CurrentAnimationState = UIControllerAnimationState.KillCounterExpanded;
					});
					break;
				case UIControllerAnimationState.KillCounterExpandedTextHidden:
					modifiersController.RaiseModifiers(delegate
					{
						CurrentAnimationState = UIControllerAnimationState.KillCounterCollapsed;
						OnModifiersRaisedAnimationDone?.Invoke();
					});
					break;
				case UIControllerAnimationState.KillCounterCollapsed:
				case UIControllerAnimationState.KillCounterExpanded:
					break;
				}
			}
		}

		public UIController(UIConfiguration configuration)
		{
			rightPanel = CreateRightPanelObject();
			bottomPanel = CreateBottomPanelObject();
			bottomLeftPanel = CreateBottomLeftPanelObject();
			bossCounterTextController = MonoNodeExtension.AddChildrenComponent<KillCounterController>(((Component)rightPanel).gameObject, "KillCounter");
			modifiersController = CreateModifiersControllerGUI();
			timerController = MonoNodeExtension.AddChildrenComponent<TimerController>(((Component)bottomPanel).gameObject, "TimerUI");
			talismanUIController = MonoNodeExtension.AddChildrenComponent<CurrentTalismanUIContoller>(((Component)bottomLeftPanel).gameObject, "TalismanUI");
			_configuration = configuration;
			ResolveConfigurationEvents(_configuration);
		}

		private void RestoreUI()
		{
			rightPanel = CreateRightPanelObject();
			bottomPanel = CreateBottomPanelObject();
			bottomLeftPanel = CreateBottomLeftPanelObject();
			bossCounterTextController = MonoNodeExtension.AddChildrenComponent<KillCounterController>(((Component)rightPanel).gameObject, "KillCounter");
			modifiersController = CreateModifiersControllerGUI();
			timerController = MonoNodeExtension.AddChildrenComponent<TimerController>(((Component)bottomPanel).gameObject, "TimerUI");
			talismanUIController = MonoNodeExtension.AddChildrenComponent<CurrentTalismanUIContoller>(((Component)bottomLeftPanel).gameObject, "TalismanUI");
		}

		public RectTransform CreateRightPanelObject()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform;
			GameObject val = new GameObject("BossChallenge_RightPanelUI");
			val.transform.SetParent(transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			RectTransform component = ((Component)transform).GetComponent<RectTransform>();
			CalculateRightPanelPosition(component, out var coordsX, out var coordsY);
			obj.anchorMin = new Vector2(0f, 0f);
			obj.anchorMax = new Vector2(0f, 0f);
			obj.pivot = new Vector2(0f, 0f);
			obj.anchoredPosition = new Vector2(coordsX, coordsY);
			obj.sizeDelta = new Vector2(300f, 200f);
			return obj;
		}

		private void CalculateRightPanelPosition(RectTransform canvasRect, out float coordsX, out float coordsY)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = canvasRect.rect;
			float width = ((Rect)(ref rect)).width;
			rect = canvasRect.rect;
			float height = ((Rect)(ref rect)).height;
			CalculateRightPanelPosition(width, height, out coordsX, out coordsY);
		}

		private void CalculateRightPanelPosition(float width, float height, out float coordsX, out float coordsY)
		{
			coordsX = width - width / 10f;
			coordsY = height - height / 4.5f;
		}

		public RectTransform CreateBottomPanelObject()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform;
			GameObject val = new GameObject("BossChallenge_BottomPanelUI");
			val.transform.SetParent(transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			RectTransform component = ((Component)transform).GetComponent<RectTransform>();
			CalculateBottomPanelPosition(component, out var coordsX, out var coordsY);
			obj.anchorMin = new Vector2(0f, 0f);
			obj.anchorMax = new Vector2(0f, 0f);
			obj.pivot = new Vector2(0f, 0f);
			obj.anchoredPosition = new Vector2(coordsX, coordsY);
			obj.sizeDelta = new Vector2(100f, 100f);
			return obj;
		}

		private void CalculateBottomPanelPosition(RectTransform canvasRect, out float coordsX, out float coordsY)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = canvasRect.rect;
			float width = ((Rect)(ref rect)).width;
			rect = canvasRect.rect;
			float height = ((Rect)(ref rect)).height;
			CalculateBottomPanelPosition(width, height, out coordsX, out coordsY);
		}

		private void CalculateBottomPanelPosition(float width, float height, out float coordsX, out float coordsY)
		{
			coordsX = width - width / 2f;
			coordsY = height / 10f;
		}

		public RectTransform CreateBottomLeftPanelObject()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform;
			GameObject val = new GameObject("BossChallenge_BottomLeftPanelUI");
			val.transform.SetParent(transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			RectTransform component = ((Component)transform).GetComponent<RectTransform>();
			CalculateBottomLeftPanelPosition(component, out var coordsX, out var coordsY);
			obj.anchorMin = new Vector2(0f, 0f);
			obj.anchorMax = new Vector2(0f, 0f);
			obj.pivot = new Vector2(0f, 0f);
			obj.anchoredPosition = new Vector2(coordsX, coordsY);
			obj.sizeDelta = new Vector2(100f, 100f);
			return obj;
		}

		private void CalculateBottomLeftPanelPosition(RectTransform canvasRect, out float coordsX, out float coordsY)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = canvasRect.rect;
			float width = ((Rect)(ref rect)).width;
			rect = canvasRect.rect;
			float height = ((Rect)(ref rect)).height;
			CalculateBottomLeftPanelPosition(width, height, out coordsX, out coordsY);
		}

		private void CalculateBottomLeftPanelPosition(float width, float height, out float coordsX, out float coordsY)
		{
			coordsX = width / 13.71f;
			coordsY = height / 4.15f;
		}

		private ModifiersUIController CreateModifiersControllerGUI()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			ModifiersUIController modifiersUIController = MonoNodeExtension.AddChildrenComponent<ModifiersUIController>(((Component)rightPanel).gameObject, "ModifiersUI");
			((Component)modifiersUIController).transform.localPosition = new Vector3(0f, -21f);
			return modifiersUIController;
		}

		public static TMP_Text InitializeText(Vector2 localPosition, GameObject parent, string text = "Test", bool active = false, int fontSize = 32, TMP_FontAsset? font = null, TextAlignmentOptions alignment = 260)
		{
			//IL_004a: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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)
			TextMeshProUGUI val = MonoNodeExtension.AddChildrenComponent<TextMeshProUGUI>(((Component)((Component)NineSolsAPICore.FullscreenCanvas).transform).gameObject, "BossCounter_Text");
			((TMP_Text)val).fontSize = fontSize;
			if ((Object)(object)font != (Object)null)
			{
				((TMP_Text)val).font = font;
			}
			((Graphic)val).color = new Color(0.941f, 0.862f, 0.588f, 0.79f);
			((TMP_Text)val).alignment = alignment;
			((TMP_Text)val).text = text;
			((Component)val).GetComponent<RectTransform>().sizeDelta = new Vector2(200f, 50f);
			((TMP_Text)val).transform.localPosition = Vector2.op_Implicit(localPosition);
			((TMP_Text)val).transform.SetParent(parent.transform, false);
			MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)val, active);
			return (TMP_Text)(object)val;
		}

		public void UpdateTalisman(Sprite sprite)
		{
			talismanUIController.UpdateCurrentTalisman(sprite);
		}

		public void UpdateBossCounterNumber(int number)
		{
			if ((Object)(object)rightPanel == (Object)null || (Object)(object)bottomPanel == (Object)null || (Object)(object)timerController == (Object)null)
			{
				RestoreUI();
			}
			bossCounterTextController.ChangeNumber(number);
			ShowText();
		}

		public void UpdateModifiers(IEnumera