Decompiled source of GladiatorArena v1.2.0

GladiatorArena.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using GladiatorArena.Data;
using GladiatorArena.Game;
using GladiatorArena.UI;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using REPOLib.Modules;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;
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("GladiatorArena")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: AssemblyProduct("GladiatorArena")]
[assembly: AssemblyTitle("GladiatorArena")]
[assembly: AssemblyVersion("1.2.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 GladiatorArena
{
	internal static class GladiatorConfig
	{
		public static ConfigEntry<bool> GladiatorModeEnabled;

		public static ConfigEntry<bool> PreventAllOtherSpawns;

		public static ConfigEntry<bool> DisableMonsterDespawn;

		public static ConfigEntry<bool> FullEnergyCrystals;

		public static ConfigEntry<bool> EndLevelOnVictory;

		public static ConfigEntry<bool> AggressiveMonsters;

		public static ConfigEntry<int> MinMonsterCount;

		public static ConfigEntry<int> MaxMonsterCount;

		public static ConfigEntry<int> LimitedWeaponCount;

		public static ConfigEntry<int> WeaponsPerExtraPlayer;

		public static ConfigEntry<bool> RewardEnabled;

		public static ConfigEntry<bool> CleanShop;

		public static ConfigEntry<bool> CleanupArenaWeapons;

		public static ConfigEntry<bool> DisableLoserArena;

		public static ConfigEntry<int> RewardLowMaxKills;

		public static ConfigEntry<int> RewardMediumMaxKills;

		public static ConfigEntry<int> RewardHighMaxKills;

		public static ConfigEntry<int> RewardLowPerPlayer;

		public static ConfigEntry<int> RewardMediumPerPlayer;

		public static ConfigEntry<int> RewardHighPerPlayer;

		public static ConfigEntry<int> RewardExtremePerPlayer;

		public static ConfigEntry<float> WeaponDurabilityMultiplier;

		public static ConfigEntry<float> TopTrackerUIScale;

		public static ConfigEntry<float> WheelSpinDurationSeconds;

		public static ConfigEntry<float> RoundStartDelaySeconds;

		public static ConfigEntry<float> SFXVolume;

		public static void Init(ConfigFile cfg)
		{
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Expected O, but got Unknown
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Expected O, but got Unknown
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Expected O, but got Unknown
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Expected O, but got Unknown
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Expected O, but got Unknown
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Expected O, but got Unknown
			GladiatorModeEnabled = cfg.Bind<bool>("1. Mode", "GladiatorModeEnabled", true, "Every level becomes a Gladiator Arena round.");
			PreventAllOtherSpawns = cfg.Bind<bool>("1. Mode", "PreventAllOtherSpawns", true, "Only the monsters rolled on the wheels exist in the level.");
			DisableMonsterDespawn = cfg.Bind<bool>("1. Mode", "DisableMonsterDespawn", true, "Arena monsters stay until they are killed (no despawn timer, no respawn after death).");
			AggressiveMonsters = cfg.Bind<bool>("1. Mode", "AggressiveMonsters", true, "Arena monsters are sent towards the players regularly, so nobody can wait them out.");
			EndLevelOnVictory = cfg.Bind<bool>("1. Mode", "EndLevelOnVictory", true, "When every pool is cleared, the round is won and the next level starts.");
			DisableLoserArena = cfg.Bind<bool>("1. Mode", "DisableLoserArena", true, "When the whole team dies, skip the vanilla 'King of the Losers' arena and end the run directly (lobby / new run). Only while Gladiator mode is on.");
			CleanShop = cfg.Bind<bool>("1. Mode", "CleanShop", true, "The shop only sells health packs, upgrades and energy crystals while Gladiator mode is on.");
			RoundStartDelaySeconds = cfg.Bind<float>("1. Mode", "RoundStartDelaySeconds", 6f, new ConfigDescription("Seconds after the level start before the wheels appear.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			MinMonsterCount = cfg.Bind<int>("2. Wheels", "MinMonsterCount", 1, new ConfigDescription("Lowest number on the count wheel.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 25), Array.Empty<object>()));
			MaxMonsterCount = cfg.Bind<int>("2. Wheels", "MaxMonsterCount", 25, new ConfigDescription("Highest number on the count wheel.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 25), Array.Empty<object>()));
			WheelSpinDurationSeconds = cfg.Bind<float>("2. Wheels", "WheelSpinDurationSeconds", 4.5f, new ConfigDescription("How long the monster wheel spins.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.5f, 15f), Array.Empty<object>()));
			LimitedWeaponCount = cfg.Bind<int>("3. Weapons", "LimitedWeaponCount", 4, new ConfigDescription("Weapons that spawn at the truck for one player. Choose wisely.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>()));
			WeaponsPerExtraPlayer = cfg.Bind<int>("3. Weapons", "WeaponsPerExtraPlayer", 2, new ConfigDescription("Extra weapons for every additional player (2 players with defaults = 6 weapons).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
			CleanupArenaWeapons = cfg.Bind<bool>("3. Weapons", "CleanupArenaWeapons", true, "Arena weapons stay in their level: they are never saved into the truck inventory, and leftovers are removed when a new round starts.");
			WeaponDurabilityMultiplier = cfg.Bind<float>("3. Weapons", "WeaponDurabilityMultiplier", 1f, new ConfigDescription("Battery durability of the arena weapons (2 = lasts twice as long).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			FullEnergyCrystals = cfg.Bind<bool>("3. Weapons", "FullEnergyCrystals", true, "The charging station in the truck starts fully charged.");
			RewardEnabled = cfg.Bind<bool>("4. Reward", "RewardEnabled", true, "When the level is completed, the team gets money for every monster killed in the arena (paid per player).");
			RewardLowMaxKills = cfg.Bind<int>("4. Reward", "LowUpToKills", 5, new ConfigDescription("1 up to this many kills = Low reward.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			RewardMediumMaxKills = cfg.Bind<int>("4. Reward", "MediumUpToKills", 15, new ConfigDescription("Up to this many kills = Medium reward.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 200), Array.Empty<object>()));
			RewardHighMaxKills = cfg.Bind<int>("4. Reward", "HighUpToKills", 39, new ConfigDescription("Up to this many kills = High reward. More = Extreme reward.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 300), Array.Empty<object>()));
			RewardLowPerPlayer = cfg.Bind<int>("4. Reward", "LowRewardK", 50, new ConfigDescription("Low reward per player, in $K (50 = $50K).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>()));
			RewardMediumPerPlayer = cfg.Bind<int>("4. Reward", "MediumRewardK", 100, new ConfigDescription("Medium reward per player, in $K.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>()));
			RewardHighPerPlayer = cfg.Bind<int>("4. Reward", "HighRewardK", 150, new ConfigDescription("High reward per player, in $K.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>()));
			RewardExtremePerPlayer = cfg.Bind<int>("4. Reward", "ExtremeRewardK", 200, new ConfigDescription("Extreme reward per player, in $K.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2000), Array.Empty<object>()));
			TopTrackerUIScale = cfg.Bind<float>("5. Personal", "TopTrackerUIScale", 1f, new ConfigDescription("Size of the monster tracker cards (only for you).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			SFXVolume = cfg.Bind<float>("5. Personal", "SFXVolume", 0.45f, new ConfigDescription("Volume of the arena sounds (only for you).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		}
	}
	[BepInPlugin("ThomasPlays.GladiatorArena", "GladiatorArena", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "ThomasPlays.GladiatorArena";

		public const string PluginName = "GladiatorArena";

		public const string PluginVersion = "1.2.0";

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_0020: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			GladiatorConfig.Init(((BaseUnityPlugin)this).Config);
			GladiatorNetworkSync.Register();
			new Harmony("ThomasPlays.GladiatorArena").PatchAll(typeof(Plugin).Assembly);
			GameObject val = new GameObject("GladiatorArena");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<GladiatorAnimationEngine>();
			val.AddComponent<GladiatorAudio>();
			val.AddComponent<GladiatorUIManager>();
			val.AddComponent<GladiatorGameManager>();
			Commands.RegisterCommand(new ChatCommand("gladiator", "Start a Gladiator Arena round now (host only)", (Action<bool, string[]>)delegate
			{
				GladiatorGameManager.Instance?.ForceStartRound();
			}, (Func<bool, string, string[], List<string>>)null, (Func<bool>)(() => true), false));
			Log.LogInfo((object)"GladiatorArena 1.2.0 loaded.");
		}
	}
}
namespace GladiatorArena.UI
{
	internal sealed class GladiatorAnimationEngine : MonoBehaviour
	{
		private readonly Dictionary<(int, string), Coroutine> _running = new Dictionary<(int, string), Coroutine>();

		public static GladiatorAnimationEngine Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
		}

		public static float Linear(float t)
		{
			return t;
		}

		public static float SmoothStep(float t)
		{
			t = Mathf.Clamp01(t);
			return t * t * (3f - 2f * t);
		}

		public static float EaseOutCubic(float t)
		{
			t = Mathf.Clamp01(t);
			float num = 1f - t;
			return 1f - num * num * num;
		}

		public static float EaseOutQuart(float t)
		{
			t = Mathf.Clamp01(t);
			float num = 1f - t;
			return 1f - num * num * num * num;
		}

		public static float EaseInCubic(float t)
		{
			t = Mathf.Clamp01(t);
			return t * t * t;
		}

		public static float EaseOutBack(float t)
		{
			t = Mathf.Clamp01(t);
			float num = t - 1f;
			return 1f + 2.70158f * num * num * num + 1.70158f * num * num;
		}

		public static float EaseOutElastic(float t)
		{
			t = Mathf.Clamp01(t);
			if (t <= 0f || t >= 1f)
			{
				return t;
			}
			return Mathf.Pow(2f, -10f * t) * Mathf.Sin((t * 10f - 0.75f) * (MathF.PI * 2f / 3f)) + 1f;
		}

		public Coroutine Tween(Object target, string channel, float duration, Func<float, float> ease, Action<float> apply, Action done = null, float delay = 0f)
		{
			(int, string) key = ((target != (Object)null) ? target.GetInstanceID() : 0, channel);
			if (_running.TryGetValue(key, out var value) && value != null)
			{
				((MonoBehaviour)this).StopCoroutine(value);
			}
			Coroutine val = ((MonoBehaviour)this).StartCoroutine(Run(key, target, duration, ease, apply, done, delay));
			_running[key] = val;
			return val;
		}

		private IEnumerator Run((int, string) key, Object target, float duration, Func<float, float> ease, Action<float> apply, Action done, float delay)
		{
			if (delay > 0f)
			{
				float d = 0f;
				while (d < delay)
				{
					d += Time.unscaledDeltaTime;
					yield return null;
				}
			}
			float t = 0f;
			while (t < duration)
			{
				if (target == (Object)null)
				{
					_running.Remove(key);
					yield break;
				}
				apply(ease(t / duration));
				t += Time.unscaledDeltaTime;
				yield return null;
			}
			if (target != (Object)null)
			{
				apply(ease(1f));
			}
			_running.Remove(key);
			done?.Invoke();
		}

		public void PunchScale(RectTransform rt, float peak = 1.18f, float duration = 0.25f)
		{
			Tween((Object)(object)rt, "punch", duration, Linear, delegate(float t)
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				float num = ((t < 0.35f) ? EaseOutCubic(t / 0.35f) : (1f - SmoothStep((t - 0.35f) / 0.65f)));
				float num2 = 1f + (peak - 1f) * num;
				((Transform)rt).localScale = new Vector3(num2, num2, 1f);
			});
		}

		public void ShakeRect(RectTransform rt, float strength = 14f, float duration = 0.3f)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Vector2 basePos = rt.anchoredPosition;
			Tween((Object)(object)rt, "shake", duration, Linear, delegate(float t)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				float num = strength * (1f - t) * (1f - t);
				rt.anchoredPosition = basePos + new Vector2(Random.Range(0f - num, num), Random.Range(0f - num, num));
			}, delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				rt.anchoredPosition = basePos;
			});
		}

		public void SmoothFill(Image img, float target, float duration = 0.45f)
		{
			float from = img.fillAmount;
			Tween((Object)(object)img, "fill", duration, SmoothStep, delegate(float t)
			{
				img.fillAmount = Mathf.Lerp(from, target, t);
			});
		}

		public void Fade(CanvasGroup g, float to, float duration, Func<float, float> ease = null, Action done = null, float delay = 0f, string channel = "fade")
		{
			float from = float.NaN;
			Tween((Object)(object)g, channel, duration, ease ?? new Func<float, float>(SmoothStep), delegate(float t)
			{
				if (float.IsNaN(from))
				{
					from = g.alpha;
				}
				g.alpha = Mathf.Lerp(from, to, t);
			}, done, delay);
		}

		public void FlashColor(Graphic g, Color flash, Color normal, float duration = 0.45f)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Tween((Object)(object)g, "flash", duration, EaseOutCubic, delegate(float t)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				g.color = Color.Lerp(flash, normal, t);
			});
		}
	}
	internal sealed class GladiatorAudio : MonoBehaviour
	{
		private const int Rate = 44100;

		private static readonly float[] Chord = new float[4] { 261.6f, 329.6f, 392f, 523.3f };

		private AudioSource _fx;

		private AudioSource _tick;

		private AudioClip _whoosh;

		private AudioClip _tickClip;

		private AudioClip _impact;

		private AudioClip _kill;

		private AudioClip _cleared;

		private AudioClip _victory;

		private AudioClip _slide;

		private AudioClip _tierUp;

		private AudioClip _cash;

		private AudioClip _countTick;

		public static GladiatorAudio Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			_fx = ((Component)this).gameObject.AddComponent<AudioSource>();
			_tick = ((Component)this).gameObject.AddComponent<AudioSource>();
			AudioSource[] array = (AudioSource[])(object)new AudioSource[2] { _fx, _tick };
			foreach (AudioSource obj in array)
			{
				obj.playOnAwake = false;
				obj.spatialBlend = 0f;
				obj.ignoreListenerPause = true;
			}
			_whoosh = Make("ga_whoosh", 0.55f, delegate(float t, float d)
			{
				float num = Mathf.Sin(MathF.PI * t / d);
				float num2 = Mathf.Lerp(180f, 900f, t / d);
				return ((Random.value * 2f - 1f) * 0.25f + Mathf.Sin(MathF.PI * 2f * num2 * t) * 0.06f) * num * 0.6f;
			});
			_tickClip = Make("ga_tick", 0.04f, (float t, float d) => (Mathf.Sin(MathF.PI * 2800f * t) * 0.35f + (Random.value * 2f - 1f) * 0.18f) * Mathf.Exp((0f - t) * 120f));
			_impact = Make("ga_impact", 0.6f, (float t, float d) => Mathf.Sin(MathF.PI * 2f * Mathf.Lerp(110f, 48f, t / d) * t) * 0.7f * Mathf.Exp((0f - t) * 9f) + (Mathf.Sin(MathF.PI * 1640f * t) + 0.6f * Mathf.Sin(MathF.PI * 2620f * t)) * 0.12f * Mathf.Exp((0f - t) * 14f) + (Random.value * 2f - 1f) * 0.3f * Mathf.Exp((0f - t) * 90f));
			_kill = Make("ga_kill", 0.28f, (float t, float d) => (Mathf.Sin(MathF.PI * 1040f * t) + 0.5f * Mathf.Sin(MathF.PI * 1560f * t)) * 0.22f * Mathf.Exp((0f - t) * 14f) * Mathf.Clamp01(t / 0.004f));
			_cleared = Make("ga_cleared", 0.9f, delegate(float t, float d)
			{
				float num = ((t < 0.12f) ? 523.3f : ((t < 0.24f) ? 659.3f : 784f));
				float num2 = ((t < 0.12f) ? t : ((t < 0.24f) ? (t - 0.12f) : (t - 0.24f)));
				return (Mathf.Sin(MathF.PI * 2f * num * t) + 0.3f * Mathf.Sin(MathF.PI * 4f * num * t)) * 0.2f * Mathf.Exp((0f - num2) * ((t < 0.24f) ? 10f : 3f));
			});
			_victory = Make("ga_victory", 2.2f, delegate(float t, float d)
			{
				float num = 0f;
				for (int j = 0; j < Chord.Length; j++)
				{
					float num2 = (float)j * 0.11f;
					if (!(t < num2))
					{
						float num3 = t - num2;
						num += (Mathf.Sin(MathF.PI * 2f * Chord[j] * num3) + 0.35f * Mathf.Sin(MathF.PI * 4f * Chord[j] * num3)) * Mathf.Exp((0f - num3) * 1.6f);
					}
				}
				return num * 0.12f * Mathf.Clamp01((d - t) / 0.4f);
			});
			_tierUp = Make("ga_tierup", 0.7f, delegate(float t, float d)
			{
				float num = ((t < 0.09f) ? 659.3f : 987.8f);
				float num2 = ((t < 0.09f) ? t : (t - 0.09f));
				float num3 = (Mathf.Sin(MathF.PI * 2f * num * t) + 0.4f * Mathf.Sin(MathF.PI * 4f * num * t)) * Mathf.Exp((0f - num2) * ((t < 0.09f) ? 18f : 5f));
				float num4 = Mathf.Sin(MathF.PI * 5274f * t) * Mathf.Sin(MathF.PI * 18f * t) * 0.25f * Mathf.Exp((0f - t) * 4f);
				return (num3 + num4) * 0.18f;
			});
			_cash = Make("ga_cash", 0.9f, delegate(float t, float d)
			{
				float num = (Random.value * 2f - 1f) * 0.35f * Mathf.Exp((0f - t) * 70f);
				float num2 = ((t < 0.07f) ? 0f : ((Mathf.Sin(MathF.PI * 4186f * t) + 0.6f * Mathf.Sin(MathF.PI * 6272f * t)) * Mathf.Exp((0f - (t - 0.07f)) * 7f)));
				float num3 = ((t < 0.15f) ? 0f : ((Mathf.Sin(MathF.PI * 5274f * t) + 0.5f * Mathf.Sin(MathF.PI * 7902f * t)) * Mathf.Exp((0f - (t - 0.15f)) * 5f)));
				return num + (num2 + num3) * 0.11f;
			});
			_countTick = Make("ga_counttick", 0.05f, (float t, float d) => Mathf.Sin(MathF.PI * 3520f * t) * 0.22f * Mathf.Exp((0f - t) * 90f));
			_slide = Make("ga_slide", 0.18f, (float t, float d) => (Random.value * 2f - 1f) * 0.14f * Mathf.Sin(MathF.PI * t / d));
		}

		public void Whoosh()
		{
			Play(_whoosh, 1f);
		}

		public void Impact()
		{
			Play(_impact, 1f);
		}

		public void Kill()
		{
			Play(_kill, 1f);
		}

		public void Cleared()
		{
			Play(_cleared, 1f);
		}

		public void Victory()
		{
			Play(_victory, 1f);
		}

		public void Slide()
		{
			Play(_slide, 0.8f);
		}

		public void TierUp()
		{
			Play(_tierUp, 1f);
		}

		public void Cash()
		{
			Play(_cash, 1f);
		}

		public void CountTick(float progress)
		{
			if (!((Object)(object)_tick == (Object)null))
			{
				_tick.pitch = Mathf.Lerp(0.9f, 1.6f, Mathf.Clamp01(progress));
				_tick.PlayOneShot(_countTick, 0.5f * GladiatorConfig.SFXVolume.Value);
			}
		}

		public void Tick(float progress, bool high)
		{
			if (!((Object)(object)_tick == (Object)null))
			{
				float pitch = Mathf.Lerp(1.55f, 0.82f, Mathf.Clamp01(progress)) * (high ? 1.18f : 1f);
				_tick.pitch = pitch;
				_tick.PlayOneShot(_tickClip, 0.55f * GladiatorConfig.SFXVolume.Value);
			}
		}

		private void Play(AudioClip clip, float volume)
		{
			if (!((Object)(object)clip == (Object)null) && !((Object)(object)_fx == (Object)null))
			{
				_fx.PlayOneShot(clip, volume * GladiatorConfig.SFXVolume.Value);
			}
		}

		private static AudioClip Make(string name, float seconds, Func<float, float, float> wave)
		{
			int num = Mathf.CeilToInt(seconds * 44100f);
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = Mathf.Clamp(wave((float)i / 44100f, seconds), -1f, 1f);
			}
			AudioClip obj = AudioClip.Create(name, num, 1, 44100, false);
			obj.SetData(array, 0);
			((Object)obj).hideFlags = (HideFlags)61;
			return obj;
		}
	}
	internal sealed class GladiatorUIManager : MonoBehaviour
	{
		private Canvas _canvas;

		private RectTransform _root;

		private RectTransform _panel;

		private RectTransform _trackers;

		private RectTransform _victory;

		private RectTransform _reward;

		private CanvasGroup _panelGroup;

		private CanvasGroup _victoryGroup;

		private CanvasGroup _rewardGroup;

		private TextMeshProUGUI _victorySub;

		private RewardMeter _meter;

		private RewardPayout? _pendingReward;

		private int _pendingFromLevel;

		private float _pendingSince;

		private RawImage _stripes;

		private RawImage _victoryStripes;

		private TextMeshProUGUI _title;

		private TextMeshProUGUI _owner;

		private TextMeshProUGUI _resultMonster;

		private TextMeshProUGUI _resultCount;

		private TextMeshProUGUI _times;

		private WheelWidget _monsterWheel;

		private WheelWidget _countWheel;

		private readonly List<TrackerCard> _cards = new List<TrackerCard>();

		private RoundSetup _round;

		private Pool _pool;

		private bool _introDone;

		private bool _exitDone;

		private int _levelId;

		private const float PanelW = 1060f;

		private const float PanelH = 540f;

		private const float WheelSize = 380f;

		private TextMeshProUGUI _rwTier;

		private TextMeshProUGUI _rwMath;

		private TextMeshProUGUI _rwKills;

		private TextMeshProUGUI _rwTotal;

		private Image _rwRing;

		private Image _rwGlow;

		private Image _rwEdge;

		private Image _rwBg;

		private RectTransform _rwBadge;

		private const float RewardW = 640f;

		private const float RewardH = 128f;

		public static GladiatorUIManager Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			BuildCanvas();
		}

		private void BuildCanvas()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("GladiatorArenaCanvas", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)this).transform, false);
			_canvas = val.AddComponent<Canvas>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.sortingOrder = 60;
			CanvasScaler obj = val.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			obj.matchWidthOrHeight = 0.5f;
			_root = (RectTransform)val.transform;
			_trackers = UiKit.MakeRect("Trackers", (Transform)(object)_root);
			UiKit.Place(_trackers, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-26f, -196f), new Vector2(318f, 600f));
			BuildVictory();
			BuildReward();
			val.SetActive(false);
		}

		private void BuildPanel(RoundSetup s, Pool pool)
		{
			//IL_0044: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_0614: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Unknown result type (might be due to invalid IL or missing references)
			//IL_0653: Unknown result type (might be due to invalid IL or missing references)
			//IL_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0704: Unknown result type (might be due to invalid IL or missing references)
			//IL_0713: Unknown result type (might be due to invalid IL or missing references)
			//IL_0722: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_panel).gameObject);
			}
			_panel = UiKit.MakeRect("WheelPanel", (Transform)(object)_root);
			UiKit.Place(_panel, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 60f), new Vector2(1060f, 540f));
			_panelGroup = ((Component)_panel).gameObject.AddComponent<CanvasGroup>();
			_panelGroup.alpha = 0f;
			UiKit.Place(((Graphic)UiKit.MakeImage((Transform)(object)_panel, "Glow", UiKit.Glow, GladiatorColors.A(GladiatorColors.Orange, 0.12f))).rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(1325f, 810f));
			UiKit.Stretch(((Graphic)UiKit.MakeImage((Transform)(object)_panel, "Bg", UiKit.Panel, GladiatorColors.Panel, sliced: true)).rectTransform);
			RawImage obj = UiKit.MakeRaw((Transform)(object)_panel, "Scan", (Texture)(object)UiKit.Scanlines, new Color(1f, 1f, 1f, 0.55f));
			UiKit.Stretch(((Graphic)obj).rectTransform, 3f);
			obj.uvRect = new Rect(0f, 0f, 530f, 180f);
			UiKit.Stretch(((Graphic)UiKit.MakeImage((Transform)(object)_panel, "Edge", UiKit.PanelOutline, GladiatorColors.PanelEdge, sliced: true)).rectTransform);
			RectTransform val = UiKit.MakeRect("Header", (Transform)(object)_panel);
			UiKit.Place(val, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -16f), new Vector2(1020f, 46f));
			_stripes = UiKit.MakeRaw((Transform)(object)val, "Stripes", (Texture)(object)UiKit.Stripes, GladiatorColors.A(GladiatorColors.Orange, 0.16f));
			UiKit.Stretch(((Graphic)_stripes).rectTransform);
			_stripes.uvRect = new Rect(0f, 0f, 22.173914f, 1f);
			_title = UiKit.MakeText((Transform)(object)val, "Title", "Gladiator Arena", 34f, GladiatorColors.Text, (TextAlignmentOptions)513, (FontStyles)1);
			UiKit.Place(((TMP_Text)_title).rectTransform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(18f, 0f), new Vector2(500f, 46f));
			((TMP_Text)_title).characterSpacing = 4f;
			_owner = UiKit.MakeText((Transform)(object)val, "Owner", "Roll for " + pool.OwnerName, 22f, GladiatorColors.Orange, (TextAlignmentOptions)516, (FontStyles)1);
			UiKit.Place(((TMP_Text)_owner).rectTransform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-18f, 0f), new Vector2(460f, 46f));
			UiKit.Place(((Graphic)UiKit.MakeImage((Transform)(object)_panel, "Neon", UiKit.White, GladiatorColors.Orange)).rectTransform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -66f), new Vector2(1020f, 2f));
			Color[] array = (Color[])(object)new Color[s.WheelIds.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = MonsterDatabase.ById(s.WheelIds[i]).Accent;
			}
			string discKey = "m:" + string.Join(",", s.WheelIds);
			_monsterWheel = WheelWidget.Build((Transform)(object)_panel, "MonsterWheel", 380f, s.WheelIds, monsters: true, array, discKey);
			UiKit.Place(_monsterWheel.Root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-250f, -6f), new Vector2(380f, 380f));
			int num = s.CountMax - s.CountMin + 1;
			string[] array2 = new string[num];
			Color[] array3 = (Color[])(object)new Color[num];
			for (int j = 0; j < num; j++)
			{
				array2[j] = (s.CountMin + j).ToString();
				float num2 = ((num > 1) ? ((float)j / (float)(num - 1)) : 0f);
				array3[j] = ((num2 < 0.5f) ? Color.Lerp(GladiatorColors.Cyan, GladiatorColors.Orange, num2 * 2f) : Color.Lerp(GladiatorColors.Orange, GladiatorColors.Blood, (num2 - 0.5f) * 2f));
			}
			_countWheel = WheelWidget.Build((Transform)(object)_panel, "CountWheel", 380f, array2, monsters: false, array3, $"c:{s.CountMin}-{s.CountMax}");
			UiKit.Place(_countWheel.Root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(250f, -6f), new Vector2(380f, 380f));
			_times = UiKit.MakeText((Transform)(object)_panel, "Times", "×", 64f, GladiatorColors.TextDim, (TextAlignmentOptions)514, (FontStyles)1);
			UiKit.Place(((TMP_Text)_times).rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -6f), new Vector2(80f, 80f));
			_resultMonster = UiKit.MakeText((Transform)(object)_panel, "ResultMonster", "", 30f, GladiatorColors.Text, (TextAlignmentOptions)514, (FontStyles)1);
			UiKit.Place(((TMP_Text)_resultMonster).rectTransform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-250f, 16f), new Vector2(420f, 40f));
			_resultCount = UiKit.MakeText((Transform)(object)_panel, "ResultCount", "", 30f, GladiatorColors.Text, (TextAlignmentOptions)514, (FontStyles)1);
			UiKit.Place(((TMP_Text)_resultCount).rectTransform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(250f, 16f), new Vector2(420f, 40f));
			_monsterWheel.Configure(pool.MonsterIndex, pool.JitterMonster, 3, 0.7f, s.Spin);
			_countWheel.Configure(pool.Total - s.CountMin, pool.JitterCount, 4, 0.85f, s.Spin + 0.9f - 0.15f);
		}

		private void BuildVictory()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			_victory = UiKit.MakeRect("Victory", (Transform)(object)_root);
			UiKit.Place(_victory, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 120f), new Vector2(900f, 150f));
			_victoryGroup = ((Component)_victory).gameObject.AddComponent<CanvasGroup>();
			_victoryGroup.alpha = 0f;
			UiKit.Stretch(((Graphic)UiKit.MakeImage((Transform)(object)_victory, "Bg", UiKit.Panel, GladiatorColors.Panel, sliced: true)).rectTransform);
			_victoryStripes = UiKit.MakeRaw((Transform)(object)_victory, "Stripes", (Texture)(object)UiKit.Stripes, GladiatorColors.A(GladiatorColors.Gold, 0.14f));
			UiKit.Stretch(((Graphic)_victoryStripes).rectTransform, 6f);
			_victoryStripes.uvRect = new Rect(0f, 0f, 15f, 2.4f);
			UiKit.Stretch(((Graphic)UiKit.MakeImage((Transform)(object)_victory, "Edge", UiKit.PanelOutline, GladiatorColors.Gold, sliced: true)).rectTransform);
			TextMeshProUGUI obj = UiKit.MakeText((Transform)(object)_victory, "Title", "Arena cleared", 76f, GladiatorColors.Gold, (TextAlignmentOptions)514, (FontStyles)1);
			((TMP_Text)obj).characterSpacing = 8f;
			UiKit.Place(((TMP_Text)obj).rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 14f), new Vector2(900f, 90f));
			_victorySub = UiKit.MakeText((Transform)(object)_victory, "Sub", "", 24f, GladiatorColors.Text, (TextAlignmentOptions)514, (FontStyles)0);
			UiKit.Place(((TMP_Text)_victorySub).rectTransform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 18f), new Vector2(900f, 30f));
			((Component)_victory).gameObject.SetActive(false);
		}

		private void BuildReward()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			_reward = UiKit.MakeRect("Reward", (Transform)(object)_root);
			UiKit.Place(_reward, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -40f), new Vector2(640f, 128f));
			_rewardGroup = ((Component)_reward).gameObject.AddComponent<CanvasGroup>();
			_rewardGroup.alpha = 0f;
			_rwGlow = UiKit.MakeImage((Transform)(object)_reward, "Glow", UiKit.Glow, new Color(1f, 1f, 1f, 0.12f));
			UiKit.Place(((Graphic)_rwGlow).rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(832f, 281.6f));
			_rwBg = UiKit.MakeImage((Transform)(object)_reward, "Bg", UiKit.Panel, GladiatorColors.Panel, sliced: true);
			UiKit.Stretch(((Graphic)_rwBg).rectTransform);
			RawImage obj = UiKit.MakeRaw((Transform)(object)_reward, "Scan", (Texture)(object)UiKit.Scanlines, new Color(1f, 1f, 1f, 0.5f));
			UiKit.Stretch(((Graphic)obj).rectTransform, 3f);
			obj.uvRect = new Rect(0f, 0f, 320f, 42.666668f);
			_rwEdge = UiKit.MakeImage((Transform)(object)_reward, "Edge", UiKit.PanelOutline, GladiatorColors.Gold, sliced: true);
			UiKit.Stretch(((Graphic)_rwEdge).rectTransform);
			_rwBadge = UiKit.MakeRect("Badge", (Transform)(object)_reward);
			UiKit.Place(_rwBadge, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(72f, 0f), new Vector2(96f, 96f));
			UiKit.Stretch(((Graphic)UiKit.MakeImage((Transform)(object)_rwBadge, "Disc", UiKit.Circle, new Color(0f, 0f, 0f, 0.45f))).rectTransform);
			_rwRing = UiKit.MakeImage((Transform)(object)_rwBadge, "Ring", UiKit.Ring, GladiatorColors.Gold);
			UiKit.Stretch(((Graphic)_rwRing).rectTransform);
			_rwTier = UiKit.MakeText((Transform)(object)_rwBadge, "Tier", "", 24f, GladiatorColors.Gold, (TextAlignmentOptions)514, (FontStyles)1);
			UiKit.Stretch(((TMP_Text)_rwTier).rectTransform, 10f);
			((TMP_Text)_rwTier).enableAutoSizing = true;
			((TMP_Text)_rwTier).fontSizeMin = 14f;
			((TMP_Text)_rwTier).fontSizeMax = 24f;
			UiKit.Place(((TMP_Text)UiKit.MakeText((Transform)(object)_reward, "Label", "Arena reward", 18f, GladiatorColors.TextDim, (TextAlignmentOptions)513, (FontStyles)0)).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(140f, -18f), new Vector2(240f, 22f));
			_rwMath = UiKit.MakeText((Transform)(object)_reward, "Math", "", 28f, GladiatorColors.Text, (TextAlignmentOptions)513, (FontStyles)1);
			UiKit.Place(((TMP_Text)_rwMath).rectTransform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(140f, 0f), new Vector2(260f, 36f));
			_rwKills = UiKit.MakeText((Transform)(object)_reward, "Kills", "", 17f, GladiatorColors.TextDim, (TextAlignmentOptions)513, (FontStyles)0);
			UiKit.Place(((TMP_Text)_rwKills).rectTransform, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(140f, 18f), new Vector2(260f, 22f));
			_rwTotal = UiKit.MakeText((Transform)(object)_reward, "Total", "", 58f, GladiatorColors.Gold, (TextAlignmentOptions)516, (FontStyles)1);
			UiKit.Place(((TMP_Text)_rwTotal).rectTransform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-28f, 0f), new Vector2(230f, 70f));
			((Component)_reward).gameObject.SetActive(false);
		}

		public void ShowReward(RewardPayout p)
		{
			if (p.TotalK > 0)
			{
				if (p.AtVictory)
				{
					PlayReward(p, atVictory: true);
					return;
				}
				_pendingReward = p;
				_pendingFromLevel = (((Object)(object)LevelGenerator.Instance != (Object)null) ? ((Object)LevelGenerator.Instance).GetInstanceID() : 0);
				_pendingSince = Time.unscaledTime;
			}
		}

		private void UpdatePendingReward()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Invalid comparison between Unknown and I4
			if (!_pendingReward.HasValue)
			{
				return;
			}
			if (Time.unscaledTime - _pendingSince > 90f)
			{
				_pendingReward = null;
				return;
			}
			LevelGenerator instance = LevelGenerator.Instance;
			GameDirector instance2 = GameDirector.instance;
			if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance2 == (Object)null) && instance.Generated && ((Object)instance).GetInstanceID() != _pendingFromLevel && (int)instance2.currentState == 2 && !(Time.unscaledTime - _pendingSince < 1.5f))
			{
				RewardPayout value = _pendingReward.Value;
				_pendingReward = null;
				PlayReward(value, atVictory: false);
			}
		}

		private void PlayReward(RewardPayout p, bool atVictory)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_005f: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			GladiatorAnimationEngine anim = GladiatorAnimationEngine.Instance;
			((Component)_canvas).gameObject.SetActive(true);
			Color val = RewardMeter.TierColor(p.Tier);
			((Graphic)_rwRing).color = val;
			((Graphic)_rwEdge).color = val;
			((Graphic)_rwGlow).color = GladiatorColors.A(val, 0.14f);
			((TMP_Text)_rwTier).text = RewardRules.Name(p.Tier);
			((Graphic)_rwTier).color = val;
			((TMP_Text)_rwMath).text = string.Format("{0} <color=#9A9690>×</color> {1} {2}", RewardRules.Money(p.PerPlayerK), p.Players, (p.Players == 1) ? "player" : "players");
			((TMP_Text)_rwKills).text = string.Format("{0} {1} this level", p.Kills, (p.Kills == 1) ? "kill" : "kills");
			((TMP_Text)_rwTotal).text = "+$0K";
			Vector2 home = new Vector2(0f, atVictory ? (-40f) : 250f);
			_reward.anchoredPosition = home;
			((Component)_reward).gameObject.SetActive(true);
			float num = (atVictory ? 0.55f : 0f);
			float num2 = (atVictory ? 3.6f : 5.5f);
			if ((Object)(object)anim == (Object)null)
			{
				_rewardGroup.alpha = 1f;
				((TMP_Text)_rwTotal).text = "+" + RewardRules.Money(p.TotalK);
				return;
			}
			_rewardGroup.alpha = 0f;
			((Transform)_reward).localScale = Vector3.one;
			anim.Fade(_rewardGroup, 1f, 0.3f, GladiatorAnimationEngine.SmoothStep, null, num);
			anim.Tween((Object)(object)_reward, "drop", 0.55f, GladiatorAnimationEngine.EaseOutBack, delegate(float t)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				_reward.anchoredPosition = home + new Vector2(0f, 46f * (1f - t));
			}, null, num);
			if (!atVictory)
			{
				GladiatorAudio.Instance?.Whoosh();
			}
			((Transform)_rwBadge).localScale = Vector3.zero;
			anim.Tween((Object)(object)_rwBadge, "badge", 0.45f, GladiatorAnimationEngine.EaseOutBack, delegate(float t)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				float num3 = Mathf.LerpUnclamped(2f, 1f, t);
				((Transform)_rwBadge).localScale = new Vector3(num3, num3, 1f);
			}, delegate
			{
				GladiatorAudio.Instance?.Impact();
				anim.ShakeRect(_reward, 7f, 0.22f);
			}, num + 0.25f);
			int last = -1;
			anim.Tween((Object)(object)_rwTotal, "count", 1.2f, GladiatorAnimationEngine.EaseOutCubic, delegate(float t)
			{
				int k = Mathf.RoundToInt((float)p.TotalK * t);
				((TMP_Text)_rwTotal).text = "+" + RewardRules.Money(k);
				int num3 = Mathf.FloorToInt(t * 14f);
				if (num3 != last && t < 1f)
				{
					last = num3;
					GladiatorAudio.Instance?.CountTick(t);
				}
			}, delegate
			{
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)_rwTotal).text = "+" + RewardRules.Money(p.TotalK);
				GladiatorAudio.Instance?.Cash();
				anim.PunchScale(((TMP_Text)_rwTotal).rectTransform, 1.22f, 0.3f);
				anim.FlashColor((Graphic)(object)_rwTotal, Color.white, GladiatorColors.Gold, 0.6f);
				anim.Tween((Object)(object)_rwBg, "cashflash", 0.7f, GladiatorAnimationEngine.EaseOutCubic, delegate(float k)
				{
					//IL_000b: 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_001a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					((Graphic)_rwBg).color = Color.Lerp(GladiatorColors.A(GladiatorColors.Gold, 0.35f), GladiatorColors.Panel, k);
				});
			}, num + 0.6f);
			anim.Fade(_rewardGroup, 0f, 0.6f, GladiatorAnimationEngine.EaseInCubic, delegate
			{
				((Component)_reward).gameObject.SetActive(false);
			}, num + 0.6f + 1.2f + num2, "fadeout");
		}

		public void PlayRound(RoundSetup s)
		{
			Clear();
			_round = s;
			_pool = s.LocalPool();
			if (_pool != null)
			{
				((Component)_canvas).gameObject.SetActive(true);
				PortraitCache.EnsureAll(s.WheelIds);
				BuildPanel(s, _pool);
				if (GladiatorConfig.RewardEnabled.Value)
				{
					_meter = RewardMeter.Build((Transform)(object)_trackers, s.Reward);
				}
				Pool[] pools = s.Pools;
				foreach (Pool pool in pools)
				{
					TrackerCard item = TrackerCard.Build((Transform)(object)_trackers, pool);
					_cards.Add(item);
				}
				LayoutCards();
				_introDone = (_exitDone = false);
			}
		}

		public void Clear()
		{
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_panel).gameObject);
			}
			_panel = null;
			foreach (TrackerCard card in _cards)
			{
				if ((Object)(object)card.Root != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)card.Root).gameObject);
				}
			}
			_cards.Clear();
			if (_meter != null && (Object)(object)_meter.Root != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_meter.Root).gameObject);
			}
			_meter = null;
			_round = null;
			_pool = null;
			if ((Object)(object)_victory != (Object)null)
			{
				((Component)_victory).gameObject.SetActive(false);
			}
		}

		public void UpdateCounts(int[] remaining, int[] totals)
		{
			if (_round != null)
			{
				for (int i = 0; i < _cards.Count && i < remaining.Length; i++)
				{
					_cards[i].SetCounts(remaining[i], totals[i], _exitDone);
				}
				_meter?.SetKills(_round.Kills, _exitDone);
			}
		}

		public void ShowVictory()
		{
			//IL_0079: 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)
			GladiatorAnimationEngine instance = GladiatorAnimationEngine.Instance;
			((Component)_victory).gameObject.SetActive(true);
			int num = ((_round != null) ? _round.Kills : 0);
			((TMP_Text)_victorySub).text = $"All {num} monsters are down.";
			GladiatorAudio.Instance?.Victory();
			if ((Object)(object)instance == (Object)null)
			{
				_victoryGroup.alpha = 1f;
				return;
			}
			((Transform)_victory).localScale = Vector3.one * 0.6f;
			instance.Tween((Object)(object)_victory, "victory", 0.9f, GladiatorAnimationEngine.EaseOutElastic, delegate(float t)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				float num2 = Mathf.LerpUnclamped(0.6f, 1f, t);
				((Transform)_victory).localScale = new Vector3(num2, num2, 1f);
			});
			instance.Fade(_victoryGroup, 1f, 0.25f);
			instance.Fade(_victoryGroup, 0f, 0.6f, GladiatorAnimationEngine.EaseInCubic, delegate
			{
				((Component)_victory).gameObject.SetActive(false);
			}, 4.2f, "fadeout");
		}

		private void Update()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.RunIsLevel() && (Object)(object)LevelGenerator.Instance != (Object)null)
			{
				int instanceID = ((Object)LevelGenerator.Instance).GetInstanceID();
				if (instanceID != _levelId)
				{
					_levelId = instanceID;
					PortraitCache.ResetQueue();
				}
				if (LevelGenerator.Instance.Generated)
				{
					PortraitCache.WarmUpStep();
				}
			}
			Rect uvRect;
			if ((Object)(object)_stripes != (Object)null)
			{
				RawImage stripes = _stripes;
				float num = Time.unscaledTime * 0.35f;
				uvRect = _stripes.uvRect;
				stripes.uvRect = new Rect(num, 0f, ((Rect)(ref uvRect)).width, 1f);
			}
			if ((Object)(object)_victoryStripes != (Object)null && ((Component)_victory).gameObject.activeSelf)
			{
				RawImage victoryStripes = _victoryStripes;
				float num2 = Time.unscaledTime * 0.25f;
				uvRect = _victoryStripes.uvRect;
				float width = ((Rect)(ref uvRect)).width;
				uvRect = _victoryStripes.uvRect;
				victoryStripes.uvRect = new Rect(num2, 0f, width, ((Rect)(ref uvRect)).height);
			}
			((Transform)_trackers).localScale = Vector3.one * GladiatorConfig.TopTrackerUIScale.Value;
			UpdatePendingReward();
			if (_round == null || (Object)(object)_panel == (Object)null)
			{
				return;
			}
			float num3 = (float)(NetTime.Now - _round.StartTime);
			if (num3 < 0f)
			{
				return;
			}
			GladiatorAnimationEngine instance = GladiatorAnimationEngine.Instance;
			if (!_introDone)
			{
				_introDone = true;
				GladiatorAudio.Instance?.Whoosh();
				instance?.Fade(_panelGroup, 1f, 0.45f);
				instance?.Tween((Object)(object)_panel, "intro", 0.6f, GladiatorAnimationEngine.EaseOutBack, delegate(float k)
				{
					//IL_001e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: Unknown result type (might be due to invalid IL or missing references)
					float num6 = Mathf.LerpUnclamped(0.8f, 1f, k);
					((Transform)_panel).localScale = new Vector3(num6, num6, 1f);
					_panel.anchoredPosition = new Vector2(0f, Mathf.LerpUnclamped(20f, 60f, k));
				});
			}
			if (_monsterWheel.Tick(num3, 1f))
			{
				MonsterInfo monsterInfo = MonsterDatabase.ById(_pool.MonsterId);
				_monsterWheel.LockFlash(monsterInfo.Accent);
				LockFeedback();
				PopResult(_resultMonster, monsterInfo.Name, monsterInfo.Accent);
			}
			if (_countWheel.Tick(num3, 1f))
			{
				_countWheel.LockFlash(GladiatorColors.Gold);
				LockFeedback();
				PopResult(_resultCount, $"{_pool.Total} monsters", GladiatorColors.Gold);
			}
			if (_exitDone || !(num3 >= _round.SpawnAt - 0.55f))
			{
				return;
			}
			_exitDone = true;
			GladiatorAudio.Instance?.Slide();
			Vector2 from = _panel.anchoredPosition;
			RectTransform panel = _panel;
			instance?.Tween((Object)(object)_panel, "exit", 0.55f, GladiatorAnimationEngine.EaseInCubic, delegate(float k)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				panel.anchoredPosition = from + new Vector2(0f, 90f * k);
			}, delegate
			{
				if ((Object)(object)panel != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)panel).gameObject);
				}
			});
			instance?.Fade(_panelGroup, 0f, 0.55f, GladiatorAnimationEngine.EaseInCubic);
			_meter?.SetKills(_round.Kills, animate: false);
			_meter?.Enter(0.2f);
			float num4 = ((_meter != null) ? 0.3f : 0.25f);
			for (int num5 = 0; num5 < _cards.Count; num5++)
			{
				_cards[num5].SetCounts(_round.Pools[num5].Remaining, _round.Pools[num5].Total, animate: false);
				_cards[num5].Enter(num4 + (float)num5 * 0.09f);
			}
		}

		private void LockFeedback()
		{
			GladiatorAudio.Instance?.Impact();
			GladiatorAnimationEngine.Instance?.ShakeRect(_panel, 12f, 0.32f);
		}

		private void PopResult(TextMeshProUGUI label, string text, Color color)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)label).text = text;
			((Graphic)label).color = color;
			GladiatorAnimationEngine.Instance?.Tween((Object)(object)label, "pop", 0.45f, GladiatorAnimationEngine.EaseOutBack, delegate(float k)
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.LerpUnclamped(0.55f, 1f, k);
				((Transform)((TMP_Text)label).rectTransform).localScale = new Vector3(num, num, 1f);
				((TMP_Text)label).alpha = Mathf.Clamp01(k * 2f);
			});
		}

		private void LayoutCards()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			if (_meter != null)
			{
				UiKit.Place(_meter.Root, new Vector2(1f, 1f), new Vector2(1f, 1f), Vector2.zero, new Vector2(318f, 96f));
				num = -110f;
			}
			for (int i = 0; i < _cards.Count; i++)
			{
				UiKit.Place(_cards[i].Root, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(0f, num - (float)i * 88f), new Vector2(318f, 78f));
			}
		}
	}
	internal static class PortraitCache
	{
		private const int Size = 256;

		private const int StudioLayer = 31;

		private static readonly Vector3 StudioPos = new Vector3(0f, -4000f, 0f);

		private static readonly Dictionary<string, Texture2D> Portraits = new Dictionary<string, Texture2D>(StringComparer.OrdinalIgnoreCase);

		private static readonly HashSet<string> Failed = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

		private static Queue<KeyValuePair<string, EnemySetup>> _todo;

		public static Texture2D Get(string id)
		{
			if (id != null && Portraits.TryGetValue(id, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			return null;
		}

		public static void WarmUpStep()
		{
			if (_todo == null)
			{
				if ((Object)(object)EnemyDirector.instance == (Object)null)
				{
					return;
				}
				_todo = new Queue<KeyValuePair<string, EnemySetup>>();
				foreach (MonsterInfo item in MonsterDatabase.Available())
				{
					if (!Portraits.ContainsKey(item.Id) && !Failed.Contains(item.Id))
					{
						_todo.Enqueue(new KeyValuePair<string, EnemySetup>(item.Id, item.Setup));
					}
				}
			}
			if (_todo.Count != 0)
			{
				KeyValuePair<string, EnemySetup> keyValuePair = _todo.Dequeue();
				RenderInto(keyValuePair.Key, keyValuePair.Value);
			}
		}

		public static void ResetQueue()
		{
			_todo = null;
		}

		public static void EnsureAll(IEnumerable<string> ids)
		{
			foreach (string id in ids)
			{
				if (!Portraits.ContainsKey(id) && !Failed.Contains(id))
				{
					MonsterInfo monsterInfo = MonsterDatabase.ById(id);
					if ((Object)(object)monsterInfo.Setup != (Object)null)
					{
						RenderInto(id, monsterInfo.Setup);
					}
					else
					{
						Failed.Add(id);
					}
				}
			}
		}

		private static void RenderInto(string id, EnemySetup setup)
		{
			if (!Portraits.ContainsKey(id) && !Failed.Contains(id) && !((Object)(object)setup == (Object)null))
			{
				Texture2D val = null;
				try
				{
					val = Render(setup);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogDebug((object)("Portrait for " + id + " failed: " + ex.Message));
				}
				if ((Object)(object)val != (Object)null)
				{
					Portraits[id] = val;
				}
				else
				{
					Failed.Add(id);
				}
			}
		}

		private static Texture2D Render(EnemySetup setup)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//IL_002b: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			EnemyParent val = EnemyCatalog.FindEnemyParent(setup);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			GameObject val2 = new GameObject("MR_PortraitStudio")
			{
				hideFlags = (HideFlags)61
			};
			val2.transform.position = StudioPos;
			try
			{
				List<Renderer> list = BuildPosedCopy(val, val2.transform, ((Object)setup).name);
				if (list == null || list.Count == 0)
				{
					list = BuildMeshCopy(val, val2.transform);
				}
				if (list.Count == 0)
				{
					return null;
				}
				Bounds bounds = MainBounds(list);
				return Photograph(val2, bounds, ViewFor(((Object)setup).name));
			}
			finally
			{
				Object.DestroyImmediate((Object)(object)val2);
			}
		}

		private static List<Renderer> BuildPosedCopy(EnemyParent parent, Transform studio, string setupName)
		{
			//IL_0088: 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)
			GameObject gameObject = ((Component)parent).gameObject;
			string text = (((Object)(object)parent.EnableObject != (Object)null) ? PathTo(gameObject.transform, parent.EnableObject.transform) : null);
			bool activeSelf = gameObject.activeSelf;
			GameObject val;
			try
			{
				gameObject.SetActive(false);
				val = Object.Instantiate<GameObject>(gameObject, studio);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("Portrait clone of " + setupName + " failed: " + ex.Message));
				return null;
			}
			finally
			{
				gameObject.SetActive(activeSelf);
			}
			((Object)val).hideFlags = (HideFlags)61;
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			for (int i = 0; i < 4; i++)
			{
				bool flag = false;
				Component[] componentsInChildren = val.GetComponentsInChildren<Component>(true);
				foreach (Component val2 in componentsInChildren)
				{
					if (!((Object)(object)val2 == (Object)null) && !(val2 is Transform) && !(val2 is MeshFilter) && !(val2 is MeshRenderer) && !(val2 is SkinnedMeshRenderer) && !(val2 is Animator))
					{
						try
						{
							Object.DestroyImmediate((Object)(object)val2);
							flag = true;
						}
						catch
						{
						}
					}
				}
				if (!flag)
				{
					break;
				}
			}
			if (text != null)
			{
				Transform val3 = ((text.Length == 0) ? val.transform : val.transform.Find(text));
				if ((Object)(object)val3 != (Object)null)
				{
					((Component)val3).gameObject.SetActive(true);
				}
			}
			Transform[] componentsInChildren2 = val.GetComponentsInChildren<Transform>(true);
			for (int j = 0; j < componentsInChildren2.Length; j++)
			{
				((Component)componentsInChildren2[j]).gameObject.layer = 31;
			}
			val.SetActive(true);
			Animator[] componentsInChildren3 = val.GetComponentsInChildren<Animator>();
			foreach (Animator val4 in componentsInChildren3)
			{
				try
				{
					val4.fireEvents = false;
					val4.cullingMode = (AnimatorCullingMode)0;
					val4.Update(0f);
					val4.Update(0.25f);
				}
				catch
				{
				}
			}
			List<Renderer> list = new List<Renderer>();
			Renderer[] componentsInChildren4 = val.GetComponentsInChildren<Renderer>();
			foreach (Renderer val5 in componentsInChildren4)
			{
				if (!val5.enabled || !((Component)val5).gameObject.activeInHierarchy || IsEffect(val5))
				{
					val5.enabled = false;
					continue;
				}
				SkinnedMeshRenderer val6 = (SkinnedMeshRenderer)(object)((val5 is SkinnedMeshRenderer) ? val5 : null);
				if (val6 != null)
				{
					val6.updateWhenOffscreen = true;
				}
				val5.shadowCastingMode = (ShadowCastingMode)0;
				val5.receiveShadows = false;
				list.Add(val5);
			}
			return list;
		}

		private static List<Renderer> BuildMeshCopy(EnemyParent parent, Transform studio)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			List<Renderer> list = new List<Renderer>();
			Transform transform = ((Component)parent).transform;
			Matrix4x4 worldToLocalMatrix = transform.worldToLocalMatrix;
			Renderer[] componentsInChildren = ((Component)transform).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				Mesh val2 = null;
				SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null);
				if (val3 != null)
				{
					val2 = val3.sharedMesh;
				}
				else if (val is MeshRenderer)
				{
					MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
					if ((Object)(object)component != (Object)null)
					{
						val2 = component.sharedMesh;
					}
				}
				if (!((Object)(object)val2 == (Object)null) && val.enabled && !IsEffect(val) && ActiveBelow(((Component)val).transform, ((Object)(object)parent.EnableObject != (Object)null) ? parent.EnableObject.transform : transform))
				{
					GameObject val4 = new GameObject("part")
					{
						hideFlags = (HideFlags)61,
						layer = 31
					};
					val4.transform.SetParent(studio, false);
					Matrix4x4 val5 = worldToLocalMatrix * ((Component)val).transform.localToWorldMatrix;
					val4.transform.localPosition = Vector4.op_Implicit(((Matrix4x4)(ref val5)).GetColumn(3));
					val4.transform.localRotation = ((Matrix4x4)(ref val5)).rotation;
					val4.transform.localScale = ((Matrix4x4)(ref val5)).lossyScale;
					val4.AddComponent<MeshFilter>().sharedMesh = val2;
					MeshRenderer val6 = val4.AddComponent<MeshRenderer>();
					((Renderer)val6).sharedMaterials = val.sharedMaterials;
					((Renderer)val6).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)val6).receiveShadows = false;
					list.Add((Renderer)(object)val6);
				}
			}
			return list;
		}

		private static bool ActiveBelow(Transform t, Transform top)
		{
			Transform val = t;
			while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)top)
			{
				if (!((Component)val).gameObject.activeSelf)
				{
					return false;
				}
				val = val.parent;
			}
			return true;
		}

		private static string PathTo(Transform root, Transform target)
		{
			if ((Object)(object)target == (Object)(object)root)
			{
				return "";
			}
			List<string> list = new List<string>();
			Transform val = target;
			while ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)root)
			{
				list.Insert(0, ((Object)val).name);
				val = val.parent;
			}
			return string.Join("/", list);
		}

		private static Vector3 ViewFor(string setupName)
		{
			//IL_0039: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			string text = (setupName ?? "").ToLowerInvariant();
			if (text.Contains("ceiling") || text.Contains("peeper"))
			{
				return Quaternion.Euler(50f, -20f, 0f) * Vector3.forward;
			}
			if (text.Contains("tick") || text.Contains("gnome") || text.Contains("head grab") || text.Contains("headgrab"))
			{
				return Quaternion.Euler(-30f, -25f, 0f) * Vector3.forward;
			}
			return Quaternion.Euler(-12f, -28f, 0f) * Vector3.forward;
		}

		private static bool IsEffect(Renderer r)
		{
			string text = ((Object)((Component)r).gameObject).name.ToLowerInvariant();
			if (text.Contains("debug") || text.Contains("collision") || text.Contains("effect") || text.Contains("particle") || text.Contains("death") || text.Contains("gib") || text.Contains("trigger"))
			{
				return true;
			}
			Material[] sharedMaterials = r.sharedMaterials;
			foreach (Material val in sharedMaterials)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val.shader == (Object)null))
				{
					string text2 = ((Object)val.shader).name.ToLowerInvariant();
					if (text2.Contains("particle") || text2.Contains("additive"))
					{
						return true;
					}
				}
			}
			return false;
		}

		private static Bounds MainBounds(List<Renderer> renderers)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			Bounds bounds;
			foreach (Renderer renderer in renderers)
			{
				bounds = renderer.bounds;
				list.Add(((Bounds)(ref bounds)).center);
			}
			List<float> list2 = list.ConvertAll((Vector3 c) => c.x);
			list2.Sort();
			List<float> list3 = list.ConvertAll((Vector3 c) => c.y);
			list3.Sort();
			List<float> list4 = list.ConvertAll((Vector3 c) => c.z);
			list4.Sort();
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(list2[list2.Count / 2], list3[list3.Count / 2], list4[list4.Count / 2]);
			Bounds? val2 = null;
			foreach (Renderer renderer2 in renderers)
			{
				bounds = renderer2.bounds;
				if (!(Vector3.Distance(((Bounds)(ref bounds)).center, val) > 4f))
				{
					bounds = renderer2.bounds;
					Vector3 size = ((Bounds)(ref bounds)).size;
					if (!(((Vector3)(ref size)).magnitude > 12f))
					{
						if (!val2.HasValue)
						{
							val2 = renderer2.bounds;
							continue;
						}
						Bounds value = val2.Value;
						((Bounds)(ref value)).Encapsulate(renderer2.bounds);
						val2 = value;
						continue;
					}
				}
				renderer2.enabled = false;
			}
			return (Bounds)(((??)val2) ?? renderers[0].bounds);
		}

		private static Texture2D Photograph(GameObject studio, Bounds bounds, Vector3 dir)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0066: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			Vector3 extents = ((Bounds)(ref bounds)).extents;
			float num = Mathf.Max(0.2f, ((Vector3)(ref extents)).magnitude);
			float num2 = num / Mathf.Sin(MathF.PI / 12f) * 1.02f;
			GameObject val = new GameObject("MR_PortraitCam")
			{
				hideFlags = (HideFlags)61
			};
			val.transform.SetParent(studio.transform, false);
			val.transform.position = ((Bounds)(ref bounds)).center + dir * num2;
			val.transform.LookAt(((Bounds)(ref bounds)).center);
			Camera val2 = val.AddComponent<Camera>();
			((Behaviour)val2).enabled = false;
			val2.cullingMask = int.MinValue;
			val2.clearFlags = (CameraClearFlags)2;
			val2.backgroundColor = new Color(0f, 0f, 0f, 0f);
			val2.fieldOfView = 30f;
			val2.nearClipPlane = 0.01f;
			val2.farClipPlane = num2 + num * 4f;
			val2.allowHDR = false;
			val2.allowMSAA = true;
			AddLight(studio, Quaternion.LookRotation(-dir + Vector3.down * 0.4f + Vector3.right * 0.5f), new Color(1f, 0.95f, 0.88f), 1.25f);
			AddLight(studio, Quaternion.LookRotation(-dir + Vector3.left * 0.8f), new Color(0.55f, 0.65f, 1f), 0.6f);
			AddLight(studio, Quaternion.LookRotation(dir + Vector3.down * 0.3f), new Color(1f, 0.35f, 0.3f), 0.9f);
			bool fog = RenderSettings.fog;
			AmbientMode ambientMode = RenderSettings.ambientMode;
			Color ambientLight = RenderSettings.ambientLight;
			RenderTexture temporary = RenderTexture.GetTemporary(256, 256, 24, (RenderTextureFormat)0);
			temporary.antiAliasing = 4;
			RenderTexture active = RenderTexture.active;
			try
			{
				RenderSettings.fog = false;
				RenderSettings.ambientMode = (AmbientMode)3;
				RenderSettings.ambientLight = new Color(0.45f, 0.45f, 0.5f);
				val2.targetTexture = temporary;
				val2.Render();
				RenderTexture.active = temporary;
				Texture2D val3 = new Texture2D(256, 256, (TextureFormat)4, false)
				{
					hideFlags = (HideFlags)61,
					filterMode = (FilterMode)1
				};
				val3.ReadPixels(new Rect(0f, 0f, 256f, 256f), 0, 0);
				val3.Apply();
				return HasContent(val3) ? val3 : null;
			}
			finally
			{
				RenderTexture.active = active;
				val2.targetTexture = null;
				RenderTexture.ReleaseTemporary(temporary);
				RenderSettings.fog = fog;
				RenderSettings.ambientMode = ambientMode;
				RenderSettings.ambientLight = ambientLight;
			}
		}

		private static void AddLight(GameObject studio, Quaternion rot, Color col, float intensity)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MR_PortraitLight")
			{
				hideFlags = (HideFlags)61
			};
			val.transform.SetParent(studio.transform, false);
			val.transform.rotation = rot;
			Light obj = val.AddComponent<Light>();
			obj.type = (LightType)1;
			obj.color = col;
			obj.intensity = intensity;
			obj.cullingMask = int.MinValue;
			obj.shadows = (LightShadows)0;
		}

		private static bool HasContent(Texture2D tex)
		{
			Color32[] pixels = tex.GetPixels32();
			int num = 0;
			for (int i = 0; i < pixels.Length; i += 7)
			{
				if (pixels[i].a > 40 && pixels[i].r + pixels[i].g + pixels[i].b > 30)
				{
					num++;
				}
			}
			return num > pixels.Length / 7 / 50;
		}
	}
	internal sealed class RewardMeter
	{
		public const float Width = 318f;

		public const float Height = 96f;

		private const float TrackW = 286f;

		public RectTransform Root;

		private CanvasGroup _group;

		private RectTransform _body;

		private RectTransform _shine;

		private Image _bg;

		private Image _top;

		private Image _shineImg;

		private TextMeshProUGUI _kills;

		private TextMeshProUGUI _payout;

		private TextMeshProUGUI _tierLine;

		private TextMeshProUGUI _hint;

		private readonly Image[] _zones = (Image[])(object)new Image[4];

		private readonly float[] _zoneFrom = new float[4];

		private readonly float[] _zoneTo = new float[4];

		private RewardRules _rules;

		private int _shownKills = -1;

		private int _killsTarget;

		private RewardTier _tier;

		public static Color TierColor(RewardTier t)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(t switch
			{
				RewardTier.Low => GladiatorColors.Orange, 
				RewardTier.Medium => GladiatorColors.Cyan, 
				RewardTier.High => GladiatorColors.Gold, 
				RewardTier.Extreme => GladiatorColors.Blood, 
				_ => GladiatorColors.TextDim, 
			});
		}

		public static RewardMeter Build(Transform parent, RewardRules rules)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			RewardMeter rewardMeter = new RewardMeter
			{
				_rules = rules
			};
			rewardMeter.Root = UiKit.MakeRect("RewardMeter", parent);
			rewardMeter.Root.sizeDelta = new Vector2(318f, 96f);
			rewardMeter._group = ((Component)rewardMeter.Root).gameObject.AddComponent<CanvasGroup>();
			rewardMeter._group.alpha = 0f;
			rewardMeter._body = UiKit.MakeRect("Body", (Transform)(object)rewardMeter.Root);
			UiKit.Stretch(rewardMeter._body);
			rewardMeter._bg = UiKit.MakeImage((Transform)(object)rewardMeter._body, "Bg", UiKit.Panel, GladiatorColors.Panel, sliced: true);
			UiKit.Stretch(((Graphic)rewardMeter._bg).rectTransform);
			UiKit.Stretch(((Graphic)UiKit.MakeImage((Transform)(object)rewardMeter._body, "Edge", UiKit.PanelOutline, GladiatorColors.A(GladiatorColors.PanelEdge, 0.9f), sliced: true)).rectTransform);
			RawImage obj = UiKit.MakeRaw((Transform)(object)rewardMeter._body, "Scan", (Texture)(object)UiKit.Scanlines, new Color(1f, 1f, 1f, 0.5f));
			UiKit.Stretch(((Graphic)obj).rectTransform, 2f);
			obj.uvRect = new Rect(0f, 0f, 159f, 32f);
			rewardMeter._top = UiKit.MakeImage((Transform)(object)rewardMeter._body, "Top", UiKit.White, GladiatorColors.TextDim);
			UiKit.Place(((Graphic)rewardMeter._top).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(16f, 0f), new Vector2(286f, 3f));
			rewardMeter._kills = UiKit.MakeText((Transform)(object)rewardMeter._body, "Kills", "", 44f, GladiatorColors.Text, (TextAlignmentOptions)1025, (FontStyles)1);
			UiKit.Place(((TMP_Text)rewardMeter._kills).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(16f, -6f), new Vector2(150f, 50f));
			rewardMeter._payout = UiKit.MakeText((Transform)(object)rewardMeter._body, "Payout", "", 34f, GladiatorColors.TextDim, (TextAlignmentOptions)1028, (FontStyles)1);
			UiKit.Place(((TMP_Text)rewardMeter._payout).rectTransform, new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(-16f, -32f), new Vector2(160f, 44f));
			rewardMeter._hint = UiKit.MakeText((Transform)(object)rewardMeter._body, "Hint", "", 14f, GladiatorColors.TextDim, (TextAlignmentOptions)513, (FontStyles)0);
			UiKit.Place(((TMP_Text)rewardMeter._hint).rectTransform, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(16f, 24f), new Vector2(170f, 20f));
			rewardMeter._tierLine = UiKit.MakeText((Transform)(object)rewardMeter._body, "Tier", "", 14f, GladiatorColors.TextDim, (TextAlignmentOptions)516, (FontStyles)0);
			UiKit.Place(((TMP_Text)rewardMeter._tierLine).rectTransform, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-16f, 24f), new Vector2(150f, 20f));
			float num = rules.LowMaxKills;
			float num2 = rules.MediumMaxKills;
			float num3 = rules.HighMaxKills;
			float num4 = num3 + Mathf.Max(6f, num3 * 0.2f);
			float[] array = new float[5] { 0f, num, num2, num3, num4 };
			Color[] array2 = (Color[])(object)new Color[4]
			{
				GladiatorColors.Orange,
				GladiatorColors.Cyan,
				GladiatorColors.Gold,
				GladiatorColors.Blood
			};
			for (int i = 0; i < 4; i++)
			{
				float num5 = array[i] / num4 * 286f;
				float num6 = array[i + 1] / num4 * 286f;
				float num7 = Mathf.Max(4f, num6 - num5 - ((i < 3) ? 3f : 0f));
				Image obj2 = UiKit.MakeImage((Transform)(object)rewardMeter._body, "Zone" + i, UiKit.White, GladiatorColors.A(array2[i], 0.14f));
				UiKit.Place(((Graphic)obj2).rectTransform, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(16f + num5, 12f), new Vector2(num7, 6f));
				Image val = UiKit.MakeImage(((Component)obj2).transform, "Fill", UiKit.White, array2[i]);
				UiKit.Stretch(((Graphic)val).rectTransform);
				val.type = (Type)3;
				val.fillMethod = (FillMethod)0;
				val.fillAmount = 0f;
				rewardMeter._zones[i] = val;
				rewardMeter._zoneFrom[i] = array[i];
				rewardMeter._zoneTo[i] = array[i + 1];
			}
			rewardMeter._shine = UiKit.MakeRect("Shine", (Transform)(object)rewardMeter._body);
			rewardMeter._shineImg = UiKit.MakeImage((Transform)(object)rewardMeter._shine, "Img", UiKit.Glow, new Color(1f, 1f, 1f, 0f));
			UiKit.Stretch(((Graphic)rewardMeter._shineImg).rectTransform);
			UiKit.Place(rewardMeter._shine, new Vector2(0f, 0f), new Vector2(0.5f, 0.5f), new Vector2(16f, 15f), new Vector2(70f, 26f));
			rewardMeter.SetKills(0, animate: false);
			return rewardMeter;
		}

		public void Enter(float delay)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			GladiatorAnimationEngine instance = GladiatorAnimationEngine.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				_group.alpha = 1f;
				return;
			}
			_body.anchoredPosition = new Vector2(358f, 0f);
			instance.Tween((Object)(object)_body, "enter", 0.6f, GladiatorAnimationEngine.EaseOutBack, delegate(float t)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				_body.anchoredPosition = new Vector2((1f - t) * 358f, 0f);
			}, null, delay);
			instance.Fade(_group, 1f, 0.35f, GladiatorAnimationEngine.SmoothStep, null, delay);
		}

		public void SetKills(int kills, bool animate)
		{
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			kills = Mathf.Max(0, kills);
			if (kills == _killsTarget && _shownKills >= 0)
			{
				return;
			}
			int from = Mathf.Max(_shownKills, 0);
			_killsTarget = kills;
			GladiatorAnimationEngine instance = GladiatorAnimationEngine.Instance;
			for (int i = 0; i < 4; i++)
			{
				float num = Mathf.Clamp01(((float)kills - _zoneFrom[i]) / Mathf.Max(1f, _zoneTo[i] - _zoneFrom[i]));
				if (animate && (Object)(object)instance != (Object)null)
				{
					instance.SmoothFill(_zones[i], num, 0.5f);
				}
				else
				{
					_zones[i].fillAmount = num;
				}
			}
			if (animate && (Object)(object)instance != (Object)null && kills > from)
			{
				instance.Tween((Object)(object)_kills, "count", 0.35f, GladiatorAnimationEngine.EaseOutCubic, delegate(float t)
				{
					ShowKills(Mathf.RoundToInt(Mathf.Lerp((float)from, (float)kills, t)));
				});
				instance.PunchScale(((TMP_Text)_kills).rectTransform, 1.12f, 0.22f);
			}
			else
			{
				ShowKills(kills);
			}
			RewardTier rewardTier = _rules.TierFor(kills);
			bool flag = rewardTier > _tier;
			_tier = rewardTier;
			Color val = TierColor(rewardTier);
			int k = _rules.PerPlayerK(rewardTier);
			((TMP_Text)_payout).text = RewardRules.Money(k);
			((Graphic)_top).color = val;
			((TMP_Text)_tierLine).text = ((rewardTier == RewardTier.None) ? "No reward yet" : ("<color=#" + ColorUtility.ToHtmlStringRGB(val) + ">" + RewardRules.Name(rewardTier) + "</color> per player"));
			int num2 = _rules.NextTierAt(kills);
			((TMP_Text)_hint).text = ((num2 == 0) ? "Top reward reached" : $"{num2 - kills} more for {RewardRules.Name(_rules.TierFor(num2))}");
			if (flag && animate && (Object)(object)instance != (Object)null)
			{
				TierUp(val);
			}
			else
			{
				((Graphic)_payout).color = val;
			}
		}

		private void ShowKills(int k)
		{
			_shownKills = k;
			((TMP_Text)_kills).text = $"{k}<size=38%><color=#9A9690> kills</color></size>";
		}

		private void TierUp(Color c)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			GladiatorAnimationEngine instance = GladiatorAnimationEngine.Instance;
			GladiatorAudio.Instance?.TierUp();
			RectTransform pay = ((TMP_Text)_payout).rectTransform;
			instance.Tween((Object)(object)pay, "slam", 0.5f, GladiatorAnimationEngine.EaseOutBack, delegate(float t)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.LerpUnclamped(1.75f, 1f, t);
				((Transform)pay).localScale = new Vector3(num, num, 1f);
			});
			instance.FlashColor((Graphic)(object)_payout, Color.white, c, 0.6f);
			instance.Tween((Object)(object)_bg, "tierflash", 0.8f, GladiatorAnimationEngine.EaseOutCubic, delegate(float t)
			{
				//IL_000c: Unknown result type (might be du