Decompiled source of Quads Highlight Reel v0.1.0

plugins/HighlightReel/HighlightReel.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Movement;
using TMPro;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI.")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")]
[assembly: AssemblyCompany("HighlightReel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2d8a83feadd983ac149b3d1ce53f5cc1a93d1d4f")]
[assembly: AssemblyProduct("HighlightReel")]
[assembly: AssemblyTitle("HighlightReel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HighlightReel
{
	[HarmonyPatch(typeof(PlayerData), "OnLocalPlayerKillTarget")]
	internal static class Kills
	{
		private const float BurstRest = 25f;

		private const float MeleeRest = 15f;

		private static readonly Queue<float> recent = new Queue<float>();

		private static Highlight burstShot;

		private static int burstKills;

		private static float lastKill = -999f;

		private static float nextBurst;

		private static float nextMelee;

		private static void Postfix(ref KillCallbackData data)
		{
			//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)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Invalid comparison between Unknown and I4
			if (LevelData.IsHub || (((IFollowable)data.target).Type & 1) == 0)
			{
				return;
			}
			ITarget target = data.target;
			EnemyCore val = (EnemyCore)(object)((target is EnemyCore) ? target : null);
			if (val != null && (Object)(object)((EnemyPart)val).Brain != (Object)null && Plugin.Bosses.Value)
			{
				EnemyBrain brain = ((EnemyPart)val).Brain;
				string sourceName = brain.SourceName;
				if ((int)brain.EnemyType == 3)
				{
					Reel.Capture(Kind.Boss, "BOSS DOWN" + (string.IsNullOrEmpty(sourceName) ? "" : (": " + sourceName.ToUpperInvariant())), 100, 0.35f);
				}
				else if ((int)brain.EnemyType == 2)
				{
					Reel.Capture(Kind.Boss, "ABOMINATION DOWN", 80, 0.35f);
				}
			}
			float time = Time.time;
			if (((DamageData)(ref data.damageData)).IsMelee && Plugin.MeleeKills.Value && time >= nextMelee)
			{
				nextMelee = time + 15f;
				Reel.Capture(Kind.Melee, "MELEE KILL", 60, 0.12f);
			}
			if (Plugin.MultiKills.Value)
			{
				float value = Plugin.MultiKillWindow.Value;
				if (burstShot != null && time - lastKill <= value)
				{
					burstKills++;
					burstShot.Caption = Caption(burstKills);
				}
				else if (burstShot != null)
				{
					burstShot = null;
					nextBurst = time + 25f;
				}
				lastKill = time;
				recent.Enqueue(time);
				while (recent.Count > 0 && time - recent.Peek() > value)
				{
					recent.Dequeue();
				}
				if (burstShot == null && recent.Count >= Plugin.MultiKillCount.Value && time >= nextBurst)
				{
					burstKills = recent.Count;
					burstShot = Reel.Capture(Kind.MultiKill, Caption(burstKills), 40 + Mathf.Min(burstKills, 10), 0.15f);
				}
			}
		}

		private static string Caption(int kills)
		{
			if (kills > 3)
			{
				if (kills != 4)
				{
					return "RAMPAGE ×" + kills;
				}
				return "QUAD KILL";
			}
			return "TRIPLE KILL";
		}

		public static void Reset()
		{
			recent.Clear();
			burstShot = null;
			burstKills = 0;
			lastKill = -999f;
			nextBurst = 0f;
			nextMelee = 0f;
		}
	}
	internal static class You
	{
		private static bool wasAlive = true;

		private static bool inCloseCall;

		private static float closeCallCooldownUntil;

		public static void Update()
		{
			if (LevelData.IsHub)
			{
				wasAlive = true;
				inCloseCall = false;
				return;
			}
			Player localPlayer = Player.LocalPlayer;
			if (localPlayer == null || !Object.op_Implicit((Object)(object)localPlayer))
			{
				return;
			}
			bool isAlive = localPlayer.IsAlive;
			if (isAlive && !wasAlive && Plugin.Revives.Value)
			{
				Reel.Capture(Kind.Revive, "BACK IN THE FIGHT", 30, 0.6f);
			}
			wasAlive = isAlive;
			if (!Plugin.CloseCalls.Value || !isAlive)
			{
				if (!isAlive)
				{
					inCloseCall = false;
				}
				return;
			}
			float normalizedHealth = localPlayer.NormalizedHealth;
			if (!inCloseCall && normalizedHealth > 0f && normalizedHealth <= Plugin.CloseCallHealth.Value && Time.time >= closeCallCooldownUntil)
			{
				inCloseCall = true;
				closeCallCooldownUntil = Time.time + 30f;
				Reel.Capture(Kind.CloseCall, "CLOSE CALL", 50, 0f, () => Player.LocalPlayer != null && Object.op_Implicit((Object)(object)Player.LocalPlayer) && Player.LocalPlayer.IsAlive, 3f);
			}
			else if (inCloseCall && normalizedHealth > Plugin.CloseCallHealth.Value * 2f)
			{
				inCloseCall = false;
			}
		}

		public static void Reset()
		{
			wasAlive = true;
			inCloseCall = false;
			closeCallCooldownUntil = 0f;
		}
	}
	[BepInPlugin("quadslab.mycopunk.highlightreel", "Quad's Highlight Reel", "0.1.0")]
	[BepInProcess("Mycopunk.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "quadslab.mycopunk.highlightreel";

		public const string Title = "Quad's Highlight Reel";

		public const string Version = "0.1.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> Bosses;

		internal static ConfigEntry<bool> MeleeKills;

		internal static ConfigEntry<bool> MultiKills;

		internal static ConfigEntry<bool> CloseCalls;

		internal static ConfigEntry<bool> Revives;

		internal static ConfigEntry<bool> AutoSave;

		internal static ConfigEntry<bool> TestKey;

		internal static ConfigEntry<int> MultiKillCount;

		internal static ConfigEntry<int> MaxShots;

		internal static ConfigEntry<float> MultiKillWindow;

		internal static ConfigEntry<float> CloseCallHealth;

		internal static ConfigEntry<string> Folder;

		private Harmony harmony;

		private GameObject runner;

		private LevelData level;

		private float nextFileCheck;

		internal static string SaveFolder
		{
			get
			{
				if (!string.IsNullOrWhiteSpace(Folder.Value))
				{
					return Folder.Value;
				}
				return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Mycopunk Highlights");
			}
		}

		private void Awake()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Expected O, but got Unknown
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Bosses = ((BaseUnityPlugin)this).Config.Bind<bool>("Moments", "Bosses", true, "A picture when you kill a boss or an Abomination.");
			MeleeKills = ((BaseUnityPlugin)this).Config.Bind<bool>("Moments", "MeleeKills", true, "A picture when you kill an enemy with your melee (one every 15 seconds at most).");
			MultiKills = ((BaseUnityPlugin)this).Config.Bind<bool>("Moments", "MultiKills", true, "A picture when you kill several enemies in a burst (one per burst, a rest between bursts).");
			MultiKillCount = ((BaseUnityPlugin)this).Config.Bind<int>("Moments", "MultiKillCount", 4, new ConfigDescription("How many kills within MultiKillWindow make a multi-kill.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 20), Array.Empty<object>()));
			MultiKillWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Moments", "MultiKillWindow", 1f, new ConfigDescription("Seconds those kills have to fall within (and between the kills that carry a burst on).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 5f), Array.Empty<object>()));
			CloseCalls = ((BaseUnityPlugin)this).Config.Bind<bool>("Moments", "CloseCalls", true, "A picture when your health dips very low and you live through it.");
			CloseCallHealth = ((BaseUnityPlugin)this).Config.Bind<float>("Moments", "CloseCallHealth", 0.15f, new ConfigDescription("How low is \"very low\" (0.15 = 15% of your health).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 0.5f), Array.Empty<object>()));
			Revives = ((BaseUnityPlugin)this).Config.Bind<bool>("Moments", "Revives", true, "A picture when you're brought back up.");
			MaxShots = ((BaseUnityPlugin)this).Config.Bind<int>("Reel", "MaxShots", 6, new ConfigDescription("How many pictures a mission keeps (the best ones, bosses first).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()));
			AutoSave = ((BaseUnityPlugin)this).Config.Bind<bool>("Reel", "AutoSave", false, "Save every picture of the reel when the mission's over. Off: nothing is saved unless you click a picture (pointing at it shows it big).");
			Folder = ((BaseUnityPlugin)this).Config.Bind<string>("Reel", "Folder", "", "Where saved pictures go; empty means your Pictures folder, in \"Mycopunk Highlights\".");
			TestKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "TestKey", false, "F8 in the hub takes three sample pictures and opens the reward screen with them (never saved). (A file BepInEx\\highlightreel-test.txt does the same, for automated tests.)");
			runner = new GameObject("HighlightReel");
			Object.DontDestroyOnLoad((Object)(object)runner);
			((Object)runner).hideFlags = (HideFlags)61;
			runner.AddComponent<Reel>();
			harmony = new Harmony("quadslab.mycopunk.highlightreel");
			harmony.PatchAll(typeof(Plugin).Assembly);
			Log.LogInfo((object)"Quad's Highlight Reel 0.1.0 loaded");
		}

		private void OnDestroy()
		{
			Harmony obj = harmony;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			Reel.Clear();
			if ((Object)(object)runner != (Object)null)
			{
				Object.Destroy((Object)(object)runner);
			}
		}

		private void Update()
		{
			if ((Object)(object)LevelData.Instance != (Object)(object)level)
			{
				level = LevelData.Instance;
				if ((Object)(object)level != (Object)null && !LevelData.IsHub)
				{
					Reel.Clear();
					Kills.Reset();
					You.Reset();
				}
			}
			You.Update();
			if (!TestKey.Value)
			{
				return;
			}
			bool flag = Keyboard.current != null && ((ButtonControl)Keyboard.current.f8Key).wasPressedThisFrame;
			if (Time.unscaledTime >= nextFileCheck)
			{
				nextFileCheck = Time.unscaledTime + 0.5f;
				string path = Path.Combine(Paths.BepInExRootPath, "highlightreel-test.txt");
				if (File.Exists(path))
				{
					try
					{
						File.Delete(path);
					}
					catch (Exception)
					{
					}
					flag = true;
				}
				string path2 = Path.Combine(Paths.BepInExRootPath, "highlightreel-hover.txt");
				if (File.Exists(path2))
				{
					try
					{
						Zoom.ForceIndex = (int.TryParse(File.ReadAllText(path2).Trim(), out var result) ? result : (-1));
						File.Delete(path2);
					}
					catch (Exception)
					{
					}
				}
				string path3 = Path.Combine(Paths.BepInExRootPath, "highlightreel-click.txt");
				if (File.Exists(path3))
				{
					try
					{
						File.Delete(path3);
					}
					catch (Exception)
					{
					}
					Zoom.ForceClick = true;
				}
			}
			if (flag)
			{
				((MonoBehaviour)this).StartCoroutine(Test());
			}
		}

		private IEnumerator Test()
		{
			if ((Object)(object)PlayerLook.Instance == (Object)null || (Object)(object)GameManager.Instance == (Object)null || !LevelData.IsHub)
			{
				Log.LogInfo((object)"Highlight Reel: the test only runs in the hub");
				yield break;
			}
			Reel.Testing = true;
			Reel.Clear();
			string path = Path.Combine(Paths.BepInExRootPath, "highlightreel-sample.txt");
			if (File.Exists(path))
			{
				Reel.LoadSample(File.ReadAllLines(path));
			}
			else
			{
				(Kind, string, int)[] array = new(Kind, string, int)[4]
				{
					(Kind.Boss, "BOSS DOWN: TEST", 100),
					(Kind.MultiKill, "QUAD KILL", 44),
					(Kind.CloseCall, "CLOSE CALL", 50),
					(Kind.Melee, "MELEE KILL", 60)
				};
				for (int i = 0; i < array.Length; i++)
				{
					var (kind, caption, priority) = array[i];
					Reel.Capture(kind, caption, priority, 0f).Sample = true;
					yield return (object)new WaitForSecondsRealtime(0.4f);
				}
			}
			yield return (object)new WaitForSecondsRealtime(0.6f);
			Reel.Testing = false;
			try
			{
				List<RewardInfo> list = new List<RewardInfo>
				{
					new RewardInfo((object)Player.LocalPlayer.Character, 321)
				};
				if (Player.LocalPlayer.Gear.Length != 0)
				{
					IUpgradable prefab = ((IUpgradable)Player.LocalPlayer.Gear[0]).Prefab;
					if (prefab != null)
					{
						list.Add(new RewardInfo((object)prefab, 123));
					}
				}
				list.Add(new RewardInfo((object)Global.Instance.PlayerResources[0], 42));
				list.Sort();
				((MissionRewardsWindow)GameManager.Instance.OpenPopupWindowFromPrefab((Window)(object)Global.Instance.MissionRewardsWindow, false, true)).SetRewards(Global.Instance.Missions[0], Global.Instance.DefaultMissionContainer, list, (MissionState)0, 0);
				Log.LogInfo((object)$"Highlight Reel: test reward screen open ({Reel.Shots.Count} pictures)");
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Highlight Reel: the test screen didn't open: " + ex));
			}
		}
	}
	internal enum Kind
	{
		Boss,
		Melee,
		MultiKill,
		CloseCall,
		Revive
	}
	internal sealed class Highlight
	{
		public RenderTexture Picture;

		public string Caption;

		public Kind Kind;

		public int Priority;

		public int Order;

		public bool Saved;

		public bool Sample;
	}
	internal sealed class Reel : MonoBehaviour
	{
		public const int Width = 960;

		public const int Height = 540;

		public static Reel Instance;

		public static bool Testing;

		public static readonly List<Highlight> Shots = new List<Highlight>();

		private static int order;

		private static int Cap(Kind kind)
		{
			switch (kind)
			{
			default:
				return 1;
			case Kind.Melee:
			case Kind.MultiKill:
				return 2;
			case Kind.Boss:
				return 99;
			}
		}

		public static void Clear()
		{
			foreach (Highlight shot in Shots)
			{
				Free(shot);
			}
			Shots.Clear();
			order = 0;
		}

		private static void Free(Highlight h)
		{
			if ((Object)(object)h.Picture != (Object)null)
			{
				h.Picture.Release();
				Object.Destroy((Object)(object)h.Picture);
				h.Picture = null;
			}
		}

		public static Highlight Capture(Kind kind, string caption, int priority, float delay, Func<bool> keepIf = null, float decideAfter = 0f)
		{
			if ((Object)(object)Instance == (Object)null)
			{
				return null;
			}
			Highlight highlight = new Highlight
			{
				Kind = kind,
				Caption = caption,
				Priority = priority,
				Order = order++
			};
			((MonoBehaviour)Instance).StartCoroutine(Instance.Take(highlight, delay, keepIf, decideAfter));
			return highlight;
		}

		private IEnumerator Take(Highlight h, float delay, Func<bool> keepIf, float decideAfter)
		{
			if (delay > 0f)
			{
				yield return (object)new WaitForSecondsRealtime(delay);
			}
			yield return (object)new WaitForEndOfFrame();
			RenderTexture temporary = RenderTexture.GetTemporary(Screen.width, Screen.height, 0, (RenderTextureFormat)0);
			try
			{
				ScreenCapture.CaptureScreenshotIntoRenderTexture(temporary);
				h.Picture = new RenderTexture(960, 540, 0, (RenderTextureFormat)0)
				{
					name = "HighlightReel " + h.Caption
				};
				h.Picture.Create();
				if (SystemInfo.graphicsUVStartsAtTop)
				{
					Graphics.Blit((Texture)(object)temporary, h.Picture, new Vector2(1f, -1f), new Vector2(0f, 1f));
				}
				else
				{
					Graphics.Blit((Texture)(object)temporary, h.Picture);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Highlight Reel: couldn't take the picture: " + ex.Message));
				yield break;
			}
			finally
			{
				RenderTexture.ReleaseTemporary(temporary);
			}
			if (keepIf != null)
			{
				yield return (object)new WaitForSecondsRealtime(decideAfter);
				if (!keepIf())
				{
					Free(h);
					yield break;
				}
			}
			Shots.Add(h);
			List<Highlight> list = Shots.Where((Highlight s) => s.Kind == h.Kind).ToList();
			while (list.Count > Cap(h.Kind))
			{
				Highlight highlight = (from s in list
					orderby s.Priority, s.Order
					select s).First();
				list.Remove(highlight);
				Shots.Remove(highlight);
				Free(highlight);
			}
			while (Shots.Count > Plugin.MaxShots.Value)
			{
				Highlight highlight2 = (from s in Shots
					orderby s.Priority, s.Order
					select s).First();
				Shots.Remove(highlight2);
				Free(highlight2);
			}
			Plugin.Log.LogInfo((object)("Highlight Reel: " + h.Caption));
		}

		public static void LoadSample(IEnumerable<string> lines)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			foreach (string line in lines)
			{
				string[] array = line.Split('|');
				if (array.Length >= 3 && File.Exists(array[0].Trim()) && Enum.TryParse<Kind>(array[1].Trim(), out var result))
				{
					Texture2D val = new Texture2D(2, 2);
					if (!ImageConversion.LoadImage(val, File.ReadAllBytes(array[0].Trim())))
					{
						Object.Destroy((Object)(object)val);
						continue;
					}
					Highlight highlight = new Highlight
					{
						Kind = result,
						Caption = array[2].Trim(),
						Priority = 50,
						Order = order++,
						Sample = true
					};
					highlight.Picture = new RenderTexture(960, 540, 0, (RenderTextureFormat)0)
					{
						name = "HighlightReel sample"
					};
					highlight.Picture.Create();
					Graphics.Blit((Texture)(object)val, highlight.Picture);
					Object.Destroy((Object)(object)val);
					Shots.Add(highlight);
				}
			}
			Plugin.Log.LogInfo((object)$"Highlight Reel: sample reel of {Shots.Count} saved pictures");
		}

		public static void SaveAll()
		{
			if (Testing || !Plugin.AutoSave.Value)
			{
				return;
			}
			foreach (Highlight item in Shots.Where((Highlight s) => !s.Saved && !s.Sample && (Object)(object)s.Picture != (Object)null))
			{
				SaveOne(item);
			}
		}

		public static void SaveOne(Highlight h)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			if (h.Saved || (Object)(object)h.Picture == (Object)null)
			{
				return;
			}
			h.Saved = true;
			string caption = h.Caption;
			string folder = (h.Sample ? Path.Combine(Paths.CachePath, "HighlightReel samples") : Plugin.SaveFolder);
			AsyncGPUReadback.Request((Texture)(object)h.Picture, 0, (TextureFormat)4, (Action<AsyncGPUReadbackRequest>)delegate(AsyncGPUReadbackRequest request)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				if (((AsyncGPUReadbackRequest)(ref request)).hasError)
				{
					return;
				}
				try
				{
					byte[] png = ImageConversion.EncodeNativeArrayToPNG<byte>(((AsyncGPUReadbackRequest)(ref request)).GetData<byte>(0), (GraphicsFormat)4, 960u, 540u, 0u).ToArray();
					string name = $"{DateTime.Now:yyyy-MM-dd HH.mm.ss} {Safe(caption)}.png";
					Task.Run(delegate
					{
						try
						{
							Directory.CreateDirectory(folder);
							File.WriteAllBytes(Path.Combine(folder, name), png);
						}
						catch (Exception ex2)
						{
							Plugin.Log.LogWarning((object)("Highlight Reel: couldn't save " + name + ": " + ex2.Message));
						}
					});
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)("Highlight Reel: couldn't save the picture: " + ex.Message));
				}
			});
		}

		private static string Safe(string s)
		{
			return new string(s.Select((char c) => (!Path.GetInvalidFileNameChars().Contains(c)) ? c : '_').ToArray());
		}

		private void Awake()
		{
			Instance = this;
		}

		private void OnDestroy()
		{
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}
	}
	[HarmonyPatch(typeof(MissionRewardsWindow), "SetRewards")]
	internal static class OnRewards
	{
		private static void Postfix(MissionRewardsWindow __instance, MissionState completed)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Strip.Remove(((Component)__instance).transform);
			Reel.SaveAll();
			if ((int)completed != 0 && (Object)(object)Reel.Instance != (Object)null)
			{
				((MonoBehaviour)__instance).StartCoroutine(Strip.Later((MonoBehaviour)(object)__instance, delegate
				{
					Strip.InTheGap(__instance);
				}));
			}
		}
	}
	[HarmonyPatch(typeof(MissionStatsWindow), "OnOpen")]
	internal static class OnAwards
	{
		private static void Postfix(MissionStatsWindow __instance)
		{
			Strip.Remove(((Component)__instance).transform);
			if ((Object)(object)Reel.Instance != (Object)null)
			{
				((MonoBehaviour)__instance).StartCoroutine(Strip.Later((MonoBehaviour)(object)__instance, delegate
				{
					Strip.AboveTheCards(__instance);
				}));
			}
		}
	}
	internal static class Strip
	{
		private const string Name = "HighlightReelStrip";

		public static void Remove(Transform window)
		{
			Transform[] componentsInChildren = ((Component)window).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null && (((Object)val).name == "HighlightReelStrip" || ((Object)val).name == "HighlightReelZoom"))
				{
					Object.Destroy((Object)(object)((Component)val).gameObject);
				}
			}
		}

		public static IEnumerator Later(MonoBehaviour window, Action build)
		{
			yield return (object)new WaitForSecondsRealtime(1.2f);
			if ((Object)(object)window == (Object)null || !((Behaviour)window).isActiveAndEnabled || Reel.Shots.Count == 0)
			{
				yield break;
			}
			try
			{
				build();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Highlight Reel: the reel didn't build: " + ex));
			}
		}

		public static void AboveTheCards(MissionStatsWindow window)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_0178: 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_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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)
			RectTransform val = (RectTransform)((Component)window).transform;
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			Rect rect = val.rect;
			float num = ((Rect)(ref rect)).center.y;
			List<RectTransform> list = new List<RectTransform>();
			MissionStat[] statDisplays = window.statDisplays;
			foreach (MissionStat val2 in statDisplays)
			{
				if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy)
				{
					list.AddRange(((Component)val2).GetComponentsInChildren<RectTransform>(false));
				}
			}
			TextMeshProUGUI[] array2 = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3] { window.eventText1, window.eventText2, window.eventPointsText };
			for (int i = 0; i < array2.Length; i++)
			{
				TMP_Text val3 = (TMP_Text)(object)array2[i];
				if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.activeInHierarchy)
				{
					list.Add(val3.rectTransform);
				}
			}
			foreach (RectTransform item in list)
			{
				item.GetWorldCorners(array);
				num = Mathf.Max(num, ((Transform)val).InverseTransformPoint(array[1]).y);
			}
			TMP_Text val4 = ((IEnumerable<TMP_Text>)((Component)window).GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => t.text.Trim().ToUpperInvariant() == "DEADLIEST")) ?? ((Component)window).GetComponentsInChildren<TMP_Text>(true).First();
			float headerSize = val4.fontSize * 1.6f;
			rect = val.rect;
			float x = ((Rect)(ref rect)).center.x;
			rect = val.rect;
			float yMax = ((Rect)(ref rect)).yMax;
			rect = val.rect;
			float top = yMax - ((Rect)(ref rect)).height * 0.05f;
			rect = val.rect;
			Grid(val, val4, headerSize, x, top, ((Rect)(ref rect)).width * 0.9f, 6, 360f, num + 40f);
		}

		public static void InTheGap(MissionRewardsWindow window)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0110: 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)
			RectTransform val = (RectTransform)((Component)window).transform;
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			window.xpParent.GetWorldCorners(array);
			float num = ((Transform)val).InverseTransformPoint(array[3]).x;
			float y = ((Transform)val).InverseTransformPoint(array[1]).y;
			window.upgradeParent.GetWorldCorners(array);
			float x = ((Transform)val).InverseTransformPoint(array[0]).x;
			window.resourceParent.GetWorldCorners(array);
			x = Mathf.Min(x, ((Transform)val).InverseTransformPoint(array[0]).x);
			if (x - num < 200f)
			{
				num = -150f;
				x = 150f;
			}
			TMP_Text val2 = (TMP_Text)(((object)((IEnumerable<TMP_Text>)((Component)window).GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => t.text.Trim().ToUpperInvariant() == "XP"))) ?? ((object)window.missionText));
			float fontSize = val2.fontSize;
			float x2 = (num + x) * 0.5f;
			float width = x - num - 20f;
			Rect rect = val.rect;
			float yMin = ((Rect)(ref rect)).yMin;
			rect = val.rect;
			Grid(val, val2, fontSize, x2, y, width, 2, 240f, yMin + ((Rect)(ref rect)).height * 0.17f);
		}

		private static void Grid(RectTransform screen, TMP_Text style, float headerSize, float x, float top, float width, int perRow, float maxPicture, float bottomLimit)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: 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_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: 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_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: 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_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = new GameObject("HighlightReelStrip", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component).SetParent((Transform)(object)screen, false);
			((Transform)component).localRotation = Quaternion.identity;
			((Transform)component).localScale = Vector3.one;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.5f);
			component.anchorMax = val;
			component.anchorMin = val;
			((Transform)component).localPosition = new Vector3(x, top, 0f);
			float y = 0f;
			Text(component, style, "HIGHLIGHTS", headerSize, Color.white, 0f, ref y);
			y -= 8f;
			List<Highlight> list = (from s in Reel.Shots
				where (Object)(object)s.Picture != (Object)null
				orderby s.Order
				select s).ToList();
			float num = 16f;
			float num2 = Mathf.Max(style.fontSize * 0.5f, 14f);
			int num3 = Mathf.Max(1, Mathf.Min(list.Count, Mathf.Min(perRow, Mathf.FloorToInt((width + num) / (140f + num)))));
			int num4 = Mathf.CeilToInt((float)list.Count / (float)num3);
			float num5 = Mathf.Min(maxPicture, (width - num * (float)(num3 - 1)) / (float)num3);
			float num6 = num2 * 1.6f + 10f;
			float num7 = top + y - bottomLimit;
			if ((float)num4 * (num5 * 540f / 960f + num6) > num7)
			{
				num5 = Mathf.Max(80f, (num7 / (float)num4 - num6) * 960f / 540f);
			}
			float num8 = num5 * 540f / 960f;
			Zoom zoom = ((Component)component).gameObject.AddComponent<Zoom>();
			zoom.Setup(screen, style);
			Vector2 val2 = default(Vector2);
			for (int num9 = 0; num9 < list.Count; num9++)
			{
				int num10 = num9 % num3;
				int num11 = num9 / num3;
				int num12 = Mathf.Min(num3, list.Count - num11 * num3);
				float num13 = ((float)num10 - (float)(num12 - 1) * 0.5f) * (num5 + num);
				float num14 = y - (float)num11 * (num8 + num6);
				RectTransform component2 = new GameObject("Shot", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
				((Transform)component2).SetParent((Transform)(object)component, false);
				((Vector2)(ref val))..ctor(0.5f, 1f);
				component2.anchorMax = val;
				component2.anchorMin = val;
				component2.sizeDelta = new Vector2(num5 + 6f, num8 + 6f);
				((Transform)component2).localPosition = new Vector3(num13, num14 - num8 * 0.5f - 3f, 0f);
				Image obj = ((Component)component2).gameObject.AddComponent<Image>();
				((Graphic)obj).color = CaptionColor(list[num9]);
				((Graphic)obj).raycastTarget = false;
				float num15 = Mathf.Max(style.fontSize * 0.4f, 12f);
				RectTransform component3 = new GameObject("SavedTag", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
				((Transform)component3).SetParent((Transform)(object)component2, false);
				((Vector2)(ref val2))..ctor(1f, 1f);
				component3.pivot = val2;
				val = (component3.anchorMin = (component3.anchorMax = val2));
				component3.sizeDelta = new Vector2(num15 * 5.6f, num15 * 1.6f);
				component3.anchoredPosition = new Vector2(-6f, -6f);
				Image obj2 = ((Component)component3).gameObject.AddComponent<Image>();
				((Graphic)obj2).color = new Color(0f, 0f, 0f, 0.75f);
				((Graphic)obj2).raycastTarget = false;
				float y2 = 0f;
				TMP_Text val5 = Text(component3, style, "✓ SAVED", num15, new Color(0.45f, 1f, 0.55f), 0f, ref y2);
				RectTransform rectTransform = val5.rectTransform;
				RectTransform rectTransform2 = val5.rectTransform;
				RectTransform rectTransform3 = val5.rectTransform;
				((Vector2)(ref val2))..ctor(0.5f, 0.5f);
				rectTransform3.pivot = val2;
				val = (rectTransform.anchorMin = (rectTransform2.anchorMax = val2));
				val5.rectTransform.sizeDelta = component3.sizeDelta;
				val5.rectTransform.anchoredPosition = Vector2.zero;
				val5.alignment = (TextAlignmentOptions)514;
				val5.fontStyle = (FontStyles)1;
				zoom.Add(component2, list[num9], val5);
				RectTransform component4 = new GameObject("Picture", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
				((Transform)component4).SetParent((Transform)(object)component2, false);
				component4.sizeDelta = new Vector2(num5, num8);
				RawImage obj3 = ((Component)component4).gameObject.AddComponent<RawImage>();
				obj3.texture = (Texture)(object)list[num9].Picture;
				((Graphic)obj3).raycastTarget = false;
				float y3 = num14 - num8 - 10f;
				TMP_Text val8 = Text(component, style, list[num9].Caption, num2, CaptionColor(list[num9]), num13, ref y3);
				val8.rectTransform.sizeDelta = new Vector2(num5 + num, val8.rectTransform.sizeDelta.y);
			}
		}

		internal static Color CaptionColor(Highlight h)
		{
			//IL_0068: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (h.Kind != Kind.Boss)
			{
				if (h.Kind != Kind.Melee)
				{
					if (h.Kind != Kind.Revive)
					{
						return new Color(0.35f, 0.95f, 1f);
					}
					return new Color(0.85f, 0.85f, 0.85f);
				}
				return new Color(1f, 0.55f, 0.2f);
			}
			return new Color(1f, 0.82f, 0.25f);
		}

		internal static TMP_Text Text(RectTransform parent, TMP_Text style, string text, float size, Color color, float x, ref float y)
		{
			//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)
			//IL_002a: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Line", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent((Transform)(object)parent, false);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).font = style.font;
			((TMP_Text)val2).fontSharedMaterial = style.fontSharedMaterial;
			((TMP_Text)val2).fontSize = size;
			((Graphic)val2).color = color;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)258;
			((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).SetText(text);
			RectTransform val3 = (RectTransform)val.transform;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(0.5f, 1f);
			val3.anchorMax = val4;
			val3.anchorMin = val4;
			val3.pivot = new Vector2(0.5f, 1f);
			val3.sizeDelta = new Vector2(1000f, size * 1.4f);
			((Transform)val3).localPosition = new Vector3(x, y, 0f);
			y -= size * 1.5f;
			return (TMP_Text)(object)val2;
		}
	}
	internal sealed class Zoom : MonoBehaviour
	{
		public const string Name = "HighlightReelZoom";

		public static int ForceIndex = -1;

		public static bool ForceClick;

		private readonly List<(RectTransform frame, Highlight shot, TMP_Text tag)> frames = new List<(RectTransform, Highlight, TMP_Text)>();

		private RectTransform screen;

		private TMP_Text style;

		private RectTransform big;

		private RawImage bigPicture;

		private Image bigBorder;

		private TMP_Text bigCaption;

		private TMP_Text bigHint;

		private int showing = -1;

		public void Setup(RectTransform screen, TMP_Text style)
		{
			this.screen = screen;
			this.style = style;
		}

		public void Add(RectTransform frame, Highlight shot, TMP_Text tag)
		{
			frames.Add((frame, shot, tag));
			Tag(frames.Count - 1);
		}

		private void Update()
		{
			int num = ((ForceIndex >= 0 && ForceIndex < frames.Count) ? ForceIndex : Pointed());
			if (num != showing)
			{
				showing = num;
				if (num < 0)
				{
					if ((Object)(object)big != (Object)null)
					{
						((Component)big).gameObject.SetActive(false);
					}
				}
				else
				{
					Show(frames[num].shot);
				}
			}
			bool num2 = ForceClick || (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame);
			ForceClick = false;
			if (num2 && num >= 0 && !frames[num].shot.Saved)
			{
				Reel.SaveOne(frames[num].shot);
				Show(frames[num].shot);
				Tag(num);
			}
		}

		private int Pointed()
		{
			//IL_0020: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (Mouse.current == null || frames.Count == 0)
			{
				return -1;
			}
			Vector2 val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue();
			Canvas componentInParent = ((Component)this).GetComponentInParent<Canvas>();
			Camera val2 = (((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) ? (componentInParent.rootCanvas.worldCamera ?? Camera.main) : null);
			for (int i = 0; i < frames.Count; i++)
			{
				if ((Object)(object)frames[i].frame != (Object)null && RectTransformUtility.RectangleContainsScreenPoint(frames[i].frame, val, val2))
				{
					return i;
				}
			}
			return -1;
		}

		private void Tag(int i)
		{
			TMP_Text item = frames[i].tag;
			if (!((Object)(object)item == (Object)null))
			{
				Transform parent = item.transform.parent;
				parent.SetAsLastSibling();
				((Component)parent).gameObject.SetActive(frames[i].shot.Saved);
			}
		}

		private void Show(Highlight shot)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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)
			if ((Object)(object)big == (Object)null)
			{
				Build();
			}
			((Component)big).gameObject.SetActive(true);
			((Transform)big).SetAsLastSibling();
			bigPicture.texture = (Texture)(object)shot.Picture;
			((Graphic)bigBorder).color = Strip.CaptionColor(shot);
			((Graphic)bigCaption).color = Strip.CaptionColor(shot);
			bigCaption.SetText(shot.Caption);
			bigHint.SetText(shot.Saved ? "✓ SAVED" : "CLICK TO SAVE");
			((Graphic)bigHint).color = (shot.Saved ? new Color(0.45f, 1f, 0.55f) : new Color(1f, 1f, 1f, 0.8f));
		}

		private void Build()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00e2: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_011b: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: 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_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = screen.rect;
			float num = Mathf.Min(((Rect)(ref rect)).width * 0.62f, 1400f);
			float num2 = num * 540f / 960f;
			big = new GameObject("HighlightReelZoom", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)big).SetParent((Transform)(object)screen, false);
			((Transform)big).localRotation = Quaternion.identity;
			((Transform)big).localScale = Vector3.one;
			RectTransform obj = big;
			RectTransform obj2 = big;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.5f);
			obj2.anchorMax = val;
			obj.anchorMin = val;
			big.sizeDelta = new Vector2(num + 10f, num2 + 10f);
			RectTransform obj3 = big;
			rect = screen.rect;
			float x = ((Rect)(ref rect)).center.x;
			rect = screen.rect;
			((Transform)obj3).localPosition = new Vector3(x, ((Rect)(ref rect)).center.y - num2 * 0.06f, 0f);
			bigBorder = ((Component)big).gameObject.AddComponent<Image>();
			((Graphic)bigBorder).raycastTarget = false;
			RectTransform component = new GameObject("Picture", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component).SetParent((Transform)(object)big, false);
			component.sizeDelta = new Vector2(num, num2);
			bigPicture = ((Component)component).gameObject.AddComponent<RawImage>();
			((Graphic)bigPicture).raycastTarget = false;
			RectTransform component2 = new GameObject("Band", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>();
			((Transform)component2).SetParent((Transform)(object)component, false);
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 0f);
			component2.pivot = new Vector2(0.5f, 0f);
			component2.sizeDelta = new Vector2(0f, style.fontSize * 1.6f);
			component2.anchoredPosition = Vector2.zero;
			Image obj4 = ((Component)component2).gameObject.AddComponent<Image>();
			((Graphic)obj4).color = new Color(0f, 0f, 0f, 0.65f);
			((Graphic)obj4).raycastTarget = false;
			float y = 0f;
			bigCaption = Strip.Text(component2, style, "", style.fontSize, Color.white, 0f, ref y);
			RectTransform rectTransform = bigCaption.rectTransform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			rectTransform.pivot = val2;
			val = (rectTransform.anchorMin = (rectTransform.anchorMax = val2));
			rectTransform.anchoredPosition = Vector2.zero;
			bigCaption.alignment = (TextAlignmentOptions)514;
			y = 0f;
			bigHint = Strip.Text(component2, style, "", style.fontSize * 0.7f, Color.white, 0f, ref y);
			RectTransform rectTransform2 = bigHint.rectTransform;
			((Vector2)(ref val2))..ctor(1f, 0.5f);
			rectTransform2.pivot = val2;
			val = (rectTransform2.anchorMin = (rectTransform2.anchorMax = val2));
			rectTransform2.sizeDelta = new Vector2(num * 0.4f, rectTransform2.sizeDelta.y);
			rectTransform2.anchoredPosition = new Vector2((0f - style.fontSize) * 0.8f, 0f);
			bigHint.alignment = (TextAlignmentOptions)516;
		}

		private void OnDestroy()
		{
			if ((Object)(object)big != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)big).gameObject);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}