Decompiled source of JujutsuValheim v1.1.1

plugins/JujutsuValheim.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using JujutsuValheim.Audio;
using JujutsuValheim.Combat;
using JujutsuValheim.Configuration;
using JujutsuValheim.Core;
using JujutsuValheim.CursedEnergy;
using JujutsuValheim.Fingers;
using JujutsuValheim.Gojo;
using JujutsuValheim.Input;
using JujutsuValheim.Items;
using JujutsuValheim.Networking;
using JujutsuValheim.Npc;
using JujutsuValheim.Sukuna;
using JujutsuValheim.Techniques;
using JujutsuValheim.UI;
using JujutsuValheim.VFX;
using Microsoft.CodeAnalysis;
using Splatform;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[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 JujutsuValheim.UI
{
	public class CursedEnergyBar : MonoBehaviour
	{
		private RectTransform _root;

		private RectTransform _fill;

		private Text _text;

		private Image _fillImg;

		private float _shown;

		private readonly Vector3[] _corners = (Vector3[])(object)new Vector3[4];

		public static void Init()
		{
			GUIManager.OnCustomGUIAvailable += delegate
			{
				//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)
				if (!GUIManager.IsHeadless())
				{
					GameObject val = new GameObject("JJK_CursedEnergyBar", new Type[1] { typeof(RectTransform) });
					val.transform.SetParent(GUIManager.CustomGUIFront.transform, false);
					val.AddComponent<CursedEnergyBar>().Build();
					Log.Info("Cursed energy bar created");
				}
			};
		}

		private void Build()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_001d: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00e1: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0113: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_0179: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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_01c5: 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)
			_root = (RectTransform)((Component)this).transform;
			RectTransform root = _root;
			Vector2 anchorMin = (_root.anchorMax = Vector2.zero);
			root.anchorMin = anchorMin;
			_root.pivot = new Vector2(0f, 0.5f);
			Stretch(MakeImage("Border", (Transform)(object)_root, new Color(0.42f, 0.33f, 0.18f, 0.95f)), 0f);
			RectTransform val = MakeImage("Bg", (Transform)(object)_root, new Color(0.06f, 0.06f, 0.08f, 0.85f));
			Stretch(val, 2f);
			_fill = MakeImage("Fill", (Transform)(object)val, new Color(0.28f, 0.52f, 0.95f, 1f));
			_fill.anchorMin = Vector2.zero;
			_fill.anchorMax = Vector2.one;
			RectTransform fill = _fill;
			anchorMin = (_fill.offsetMax = Vector2.zero);
			fill.offsetMin = anchorMin;
			_fillImg = ((Component)_fill).GetComponent<Image>();
			RectTransform obj = MakeImage("Shine", (Transform)(object)_fill, new Color(1f, 1f, 1f, 0.22f));
			obj.anchorMin = new Vector2(0f, 0.55f);
			obj.anchorMax = Vector2.one;
			anchorMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = anchorMin;
			GameObject val2 = GUIManager.Instance.CreateText("100", (Transform)(object)_root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, GUIManager.Instance.AveriaSerifBold, 12, Color.white, true, Color.black, 200f, 20f, false);
			_text = val2.GetComponent<Text>();
			_text.alignment = (TextAnchor)4;
		}

		private static RectTransform MakeImage(string n, Transform parent, Color c)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0039: 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_004a: Expected O, but got Unknown
			GameObject val = new GameObject(n, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			((Graphic)val.GetComponent<Image>()).color = c;
			return (RectTransform)val.transform;
		}

		private static void Stretch(RectTransform r, float inset)
		{
			//IL_0001: 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_0019: 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)
			r.anchorMin = Vector2.zero;
			r.anchorMax = Vector2.one;
			r.offsetMin = new Vector2(inset, inset);
			r.offsetMax = new Vector2(0f - inset, 0f - inset);
		}

		private void LateUpdate()
		{
			//IL_0067: 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_00cf: 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_0117: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: 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)
			Player localPlayer = Player.m_localPlayer;
			Hud instance = Hud.instance;
			bool flag = JJKConfig.ShowCEBar.Value && Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.m_rootObject) && instance.m_rootObject.activeInHierarchy && Object.op_Implicit((Object)(object)instance.m_healthPanel);
			foreach (Transform item in ((Component)this).transform)
			{
				((Component)item).gameObject.SetActive(flag);
			}
			if (flag)
			{
				JujutsuValheim.CursedEnergy.CursedEnergy cursedEnergy = JujutsuValheim.CursedEnergy.CursedEnergy.For((Character)(object)localPlayer);
				if (Object.op_Implicit((Object)(object)cursedEnergy))
				{
					float num = ((((Transform)_root).lossyScale.x > 0f) ? ((Transform)_root).lossyScale.x : 1f);
					_root.sizeDelta = new Vector2(JJKConfig.CEBarWidth.Value, JJKConfig.CEBarHeight.Value);
					instance.m_healthPanel.GetWorldCorners(_corners);
					Vector3 val = (_corners[2] + _corners[3]) * 0.5f;
					((Transform)_root).position = new Vector3(val.x + JJKConfig.CEBarOffsetX.Value * num, val.y + JJKConfig.CEBarOffsetY.Value * num, 0f);
					float num2 = ((cursedEnergy.Max > 0f) ? Mathf.Clamp01(cursedEnergy.Current / cursedEnergy.Max) : 0f);
					_shown = Mathf.Lerp(_shown, num2, Time.unscaledDeltaTime * 10f);
					_fill.anchorMax = new Vector2(_shown, 1f);
					((Graphic)_fillImg).color = Color.Lerp(new Color(0.62f, 0.22f, 0.72f), new Color(0.28f, 0.52f, 0.95f), Mathf.Clamp01((num2 - 0.1f) / 0.3f));
					_text.text = $"{Mathf.FloorToInt(cursedEnergy.Current)} / {cursedEnergy.Max:0}";
				}
			}
		}
	}
	public enum ToastKind
	{
		Info,
		Warn,
		Good
	}
	public class JJKHud : MonoBehaviour
	{
		private static JJKHud _i;

		private static Font _font;

		private static readonly Color Gold = new Color(0.55f, 0.43f, 0.22f, 1f);

		private static readonly Color Panel = new Color(0.05f, 0.05f, 0.08f, 0.86f);

		private CanvasGroup _subGroup;

		private CanvasGroup _callGroup;

		private Text _subText;

		private Text _callText;

		private RectTransform _callRt;

		private float _subT0 = -99f;

		private float _subLen;

		private float _callT0 = -99f;

		private float _callLen;

		private CanvasGroup _bossGroup;

		private Text _bossName;

		private Text _bossStatus;

		private RectTransform _bossHp;

		private RectTransform _bossShield;

		private Image _bossHpImg;

		private float _bossUntil;

		private float _bossHpShown = 1f;

		private CanvasGroup _banGroup;

		private Text _banTitle;

		private Text _banSub;

		private RectTransform _banRt;

		private float _banT0 = -99f;

		private float _banLen = 1.5f;

		private Image _flashImg;

		private float _flashT0 = -99f;

		private float _flashLen = 0.2f;

		private Color _flashCol;

		private CanvasGroup _toastGroup;

		private Text _toastText;

		private Image _toastAccent;

		private RectTransform _toastRt;

		private float _toastT0 = -99f;

		private float _toastLen;

		private CanvasGroup _chargeGroup;

		private Text _chargeTitle;

		private Text _chargeValue;

		private Image _chargeFill;

		private Image _chargeBorder;

		private Image _chargeGlow;

		private RectTransform _chargeFillRt;

		private float _chargeUntil;

		private float _pct;

		private bool _red;

		private bool _full;

		public static Font CjkFont
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)_font))
				{
					return _font = Font.CreateDynamicFontFromOSFont(new string[3] { "Microsoft JhengHei", "Microsoft YaHei", "Arial" }, 32);
				}
				return _font;
			}
		}

		private static JJKHud Get()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0033: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_i))
			{
				return _i;
			}
			try
			{
				if (GUIManager.IsHeadless())
				{
					return null;
				}
			}
			catch
			{
			}
			GameObject val = new GameObject("JJK_Hud");
			Object.DontDestroyOnLoad((Object)val);
			Canvas obj2 = val.AddComponent<Canvas>();
			obj2.renderMode = (RenderMode)0;
			obj2.sortingOrder = 90;
			CanvasScaler obj3 = val.AddComponent<CanvasScaler>();
			obj3.uiScaleMode = (ScaleMode)1;
			obj3.referenceResolution = new Vector2(1920f, 1080f);
			obj3.matchWidthOrHeight = 0.5f;
			_i = val.AddComponent<JJKHud>();
			_i.Build();
			return _i;
		}

		public static void Toast(string text, ToastKind kind = ToastKind.Info)
		{
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.ShowToast(L.T(text), kind);
			}
		}

		public static void ShowCharge(string title, float seconds, float limit, float mult, bool red)
		{
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.SetCharge(title, seconds, limit, mult, red);
			}
		}

		public static void Subtitle(string speaker, string text, float seconds = 4f)
		{
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.DoSub(L.T(speaker), L.T(text), seconds);
			}
		}

		public static void Callout(string text, Color c, float seconds = 1.6f)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.DoCall(L.T(text), c, seconds);
			}
		}

		private void DoSub(string who, string text, float len)
		{
			if (!string.IsNullOrEmpty(text))
			{
				_subText.text = (string.IsNullOrEmpty(who) ? text : ("<color=#ffd890>" + who + "</color>:" + text));
				_subT0 = Time.unscaledTime;
				_subLen = len;
			}
		}

		private void DoCall(string text, Color c, float len)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			_callText.text = text;
			((Graphic)_callText).color = c;
			_callT0 = Time.unscaledTime;
			_callLen = len;
		}

		public static void ShowBoss(string name, float hp01, float shield01, string status)
		{
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.SetBoss(name, hp01, shield01, status);
			}
		}

		private void SetBoss(string name, float hp, float sh, string status)
		{
			//IL_005d: 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_0097: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			_bossUntil = Time.unscaledTime + 0.3f;
			_bossName.text = name;
			_bossStatus.text = status;
			_bossHpShown = Mathf.Lerp(_bossHpShown, Mathf.Clamp01(hp), Time.unscaledDeltaTime * 8f);
			_bossHp.anchorMax = new Vector2(_bossHpShown, 1f);
			_bossShield.anchorMax = new Vector2(Mathf.Clamp01(sh), 1f);
			((Graphic)_bossHpImg).color = Color.Lerp(new Color(0.85f, 0.1f, 0.1f), new Color(0.95f, 0.55f, 0.15f), Mathf.Clamp01(1f - hp));
		}

		public static void Banner(string title, string sub, Color c, float seconds = 1.5f)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.DoBanner(L.T(title), L.T(sub), c, seconds);
			}
		}

		private void DoBanner(string t, string s, Color c, float len)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			_banTitle.text = t;
			((Graphic)_banTitle).color = c;
			_banSub.text = s;
			_banT0 = Time.unscaledTime;
			_banLen = len;
		}

		public static void Flash(Color c, float seconds)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			JJKHud jJKHud = Get();
			if (Object.op_Implicit((Object)(object)jJKHud))
			{
				jJKHud.DoFlash(c, seconds);
			}
		}

		private void DoFlash(Color c, float s)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			_flashCol = c;
			_flashLen = Mathf.Max(0.05f, s);
			_flashT0 = Time.unscaledTime;
		}

		private void Build()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_00b6: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0118: 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)
			//IL_0148: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: 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_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: 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_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0512: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_0696: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: 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_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0802: Unknown result type (might be due to invalid IL or missing references)
			//IL_081a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			//IL_0893: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_090e: Unknown result type (might be due to invalid IL or missing references)
			//IL_092d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0946: Unknown result type (might be due to invalid IL or missing references)
			//IL_095b: Unknown result type (might be due to invalid IL or missing references)
			//IL_096f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09db: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
			_flashImg = Img("Flash", ((Component)this).transform, new Color(0f, 0f, 0f, 0f), stretch: true);
			RectTransform val = (_banRt = Rect("Banner", ((Component)this).transform, new Vector2(0.5f, 0.58f), new Vector2(900f, 160f)));
			_banGroup = ((Component)val).gameObject.AddComponent<CanvasGroup>();
			_banGroup.alpha = 0f;
			_banTitle = Label("Title", (Transform)(object)val, 96, (TextAnchor)4, Color.white);
			RectTransform rectTransform = ((Graphic)_banTitle).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0.35f);
			rectTransform.anchorMax = Vector2.one;
			Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero);
			rectTransform.offsetMin = offsetMin;
			((Shadow)((Component)_banTitle).GetComponent<Outline>()).effectDistance = new Vector2(3f, -3f);
			_banSub = Label("Sub", (Transform)(object)val, 36, (TextAnchor)4, new Color(1f, 0.85f, 0.85f));
			RectTransform rectTransform2 = ((Graphic)_banSub).rectTransform;
			rectTransform2.anchorMin = Vector2.zero;
			rectTransform2.anchorMax = new Vector2(1f, 0.35f);
			offsetMin = (rectTransform2.offsetMax = Vector2.zero);
			rectTransform2.offsetMin = offsetMin;
			RectTransform val2 = Rect("Subtitle", ((Component)this).transform, new Vector2(0.5f, 0.14f), new Vector2(1300f, 80f));
			_subGroup = ((Component)val2).gameObject.AddComponent<CanvasGroup>();
			_subGroup.alpha = 0f;
			Img("Back", val2, new Color(0f, 0f, 0f, 0.55f), stretch: true);
			_subText = Label("Text", (Transform)(object)val2, 34, (TextAnchor)4, Color.white);
			_subText.fontStyle = (FontStyle)0;
			Stretch(((Graphic)_subText).rectTransform, 12f);
			_subText.supportRichText = true;
			RectTransform val3 = (_callRt = Rect("Callout", ((Component)this).transform, new Vector2(0.5f, 0.74f), new Vector2(1200f, 110f)));
			_callGroup = ((Component)val3).gameObject.AddComponent<CanvasGroup>();
			_callGroup.alpha = 0f;
			_callText = Label("Text", (Transform)(object)val3, 64, (TextAnchor)4, Color.white);
			Stretch(((Graphic)_callText).rectTransform, 0f);
			((Shadow)((Component)_callText).GetComponent<Outline>()).effectDistance = new Vector2(3f, -3f);
			RectTransform val4 = Rect("Boss", ((Component)this).transform, new Vector2(0.5f, 0.93f), new Vector2(900f, 70f));
			_bossGroup = ((Component)val4).gameObject.AddComponent<CanvasGroup>();
			_bossGroup.alpha = 0f;
			_bossName = Label("Name", (Transform)(object)val4, 30, (TextAnchor)1, new Color(1f, 0.9f, 0.75f));
			RectTransform rectTransform3 = ((Graphic)_bossName).rectTransform;
			rectTransform3.anchorMin = new Vector2(0f, 1f);
			rectTransform3.anchorMax = new Vector2(1f, 1f);
			rectTransform3.pivot = new Vector2(0.5f, 1f);
			rectTransform3.sizeDelta = new Vector2(0f, 36f);
			RectTransform val5 = Rect("BossBar", (Transform)(object)val4, new Vector2(0.5f, 0f), new Vector2(760f, 20f));
			val5.anchoredPosition = new Vector2(0f, 8f);
			Img("Border", val5, Gold, stretch: true);
			Image val6 = Img("Bg", val5, new Color(0.03f, 0.03f, 0.05f, 0.92f), stretch: true);
			Inset(val6, 2f);
			Image val7 = Img("Hp", ((Graphic)val6).rectTransform, new Color(0.85f, 0.1f, 0.1f), stretch: true);
			_bossHp = ((Graphic)val7).rectTransform;
			_bossHpImg = val7;
			_bossHp.anchorMin = Vector2.zero;
			_bossHp.anchorMax = Vector2.one;
			RectTransform bossHp = _bossHp;
			offsetMin = (_bossHp.offsetMax = Vector2.zero);
			bossHp.offsetMin = offsetMin;
			Image val8 = Img("Shield", ((Graphic)val6).rectTransform, new Color(0.5f, 0.9f, 1f, 0.85f), stretch: true);
			_bossShield = ((Graphic)val8).rectTransform;
			_bossShield.anchorMin = new Vector2(0f, 0.72f);
			_bossShield.anchorMax = Vector2.one;
			RectTransform bossShield = _bossShield;
			offsetMin = (_bossShield.offsetMax = Vector2.zero);
			bossShield.offsetMin = offsetMin;
			_bossStatus = Label("Status", (Transform)(object)val4, 20, (TextAnchor)7, new Color(0.85f, 0.9f, 1f));
			RectTransform rectTransform4 = ((Graphic)_bossStatus).rectTransform;
			rectTransform4.anchorMin = new Vector2(0f, 0f);
			rectTransform4.anchorMax = new Vector2(1f, 0f);
			rectTransform4.pivot = new Vector2(0.5f, 1f);
			rectTransform4.anchoredPosition = new Vector2(0f, -2f);
			rectTransform4.sizeDelta = new Vector2(0f, 26f);
			RectTransform val9 = (_toastRt = Rect("Toast", ((Component)this).transform, new Vector2(0.5f, 0.66f), new Vector2(520f, 46f)));
			_toastGroup = ((Component)val9).gameObject.AddComponent<CanvasGroup>();
			_toastGroup.alpha = 0f;
			Img("Border", val9, Gold, stretch: true);
			Inset(Img("Bg", val9, Panel, stretch: true), 2f);
			_toastAccent = Img("Accent", val9, Gold, stretch: false);
			((Graphic)_toastAccent).rectTransform.anchorMin = new Vector2(0f, 0f);
			((Graphic)_toastAccent).rectTransform.anchorMax = new Vector2(0f, 1f);
			((Graphic)_toastAccent).rectTransform.pivot = new Vector2(0f, 0.5f);
			((Graphic)_toastAccent).rectTransform.sizeDelta = new Vector2(6f, 0f);
			_toastText = Label("Text", (Transform)(object)val9, 24, (TextAnchor)4, Color.white);
			Stretch(((Graphic)_toastText).rectTransform, 12f);
			RectTransform val10 = Rect("Charge", ((Component)this).transform, new Vector2(0.5f, 0.3f), new Vector2(520f, 96f));
			_chargeGroup = ((Component)val10).gameObject.AddComponent<CanvasGroup>();
			_chargeGroup.alpha = 0f;
			_chargeTitle = Label("Title", (Transform)(object)val10, 30, (TextAnchor)1, Color.white);
			RectTransform rectTransform5 = ((Graphic)_chargeTitle).rectTransform;
			rectTransform5.anchorMin = new Vector2(0f, 1f);
			rectTransform5.anchorMax = new Vector2(1f, 1f);
			rectTransform5.pivot = new Vector2(0.5f, 1f);
			rectTransform5.sizeDelta = new Vector2(0f, 40f);
			rectTransform5.anchoredPosition = Vector2.zero;
			RectTransform val11 = Rect("Bar", (Transform)(object)val10, new Vector2(0.5f, 0.5f), new Vector2(460f, 22f));
			val11.anchoredPosition = new Vector2(0f, -8f);
			_chargeGlow = Img("Glow", val11, new Color(1f, 1f, 1f, 0f), stretch: false);
			Inset(_chargeGlow, -5f);
			_chargeBorder = Img("Border", val11, Gold, stretch: true);
			Image val12 = Img("Bg", val11, new Color(0.03f, 0.03f, 0.06f, 0.92f), stretch: true);
			Inset(val12, 2f);
			_chargeFillRt = ((Graphic)(_chargeFill = Img("Fill", ((Graphic)val12).rectTransform, Color.white, stretch: true))).rectTransform;
			for (int i = 1; i < 4; i++)
			{
				RectTransform rectTransform6 = ((Graphic)Img("Tick" + i, ((Graphic)val12).rectTransform, new Color(0f, 0f, 0f, 0.55f), stretch: false)).rectTransform;
				rectTransform6.anchorMin = new Vector2((float)i / 4f, 0f);
				rectTransform6.anchorMax = new Vector2((float)i / 4f, 1f);
				rectTransform6.pivot = new Vector2(0.5f, 0.5f);
				rectTransform6.sizeDelta = new Vector2(2f, 0f);
			}
			_chargeValue = Label("Value", (Transform)(object)val10, 22, (TextAnchor)7, new Color(0.9f, 0.92f, 1f));
			RectTransform rectTransform7 = ((Graphic)_chargeValue).rectTransform;
			rectTransform7.anchorMin = new Vector2(0f, 0f);
			rectTransform7.anchorMax = new Vector2(1f, 0f);
			rectTransform7.pivot = new Vector2(0.5f, 0f);
			rectTransform7.sizeDelta = new Vector2(0f, 30f);
			rectTransform7.anchoredPosition = Vector2.zero;
		}

		private void ShowToast(string text, ToastKind kind)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			_toastText.text = text;
			((Graphic)_toastAccent).color = (Color)(kind switch
			{
				ToastKind.Good => new Color(0.35f, 0.65f, 1f), 
				ToastKind.Warn => new Color(0.9f, 0.25f, 0.22f), 
				_ => Gold, 
			});
			_toastT0 = Time.unscaledTime;
			_toastLen = 1.7f;
		}

		private void SetCharge(string title, float seconds, float limit, float mult, bool red)
		{
			_chargeUntil = Time.unscaledTime + 0.15f;
			_red = red;
			_pct = ((limit > 0f) ? Mathf.Clamp01(seconds / limit) : 0f);
			_full = _pct >= 0.995f;
			_chargeTitle.text = title + (_full ? L.T("  ·  最大出力") : "");
			_chargeValue.text = L.F("{0:0.0} / {1:0.0} 秒     威力 ×{2:0.00}", seconds, limit, mult);
		}

		private void Update()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: 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_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: 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_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			Hud instance = Hud.instance;
			bool flag = Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.m_rootObject) && instance.m_rootObject.activeInHierarchy;
			float unscaledTime = Time.unscaledTime;
			float num = (unscaledTime - _flashT0) / _flashLen;
			((Graphic)_flashImg).color = ((num >= 0f && num < 1f) ? new Color(_flashCol.r, _flashCol.g, _flashCol.b, 0.38f * (1f - num) * (1f - num)) : new Color(0f, 0f, 0f, 0f));
			float num2 = unscaledTime - _subT0;
			_subGroup.alpha = ((num2 >= 0f && num2 < _subLen) ? (Mathf.Clamp01(num2 / 0.15f) * Mathf.Clamp01((_subLen - num2) / 0.4f)) : 0f);
			float num3 = unscaledTime - _callT0;
			if (num3 >= 0f && num3 < _callLen)
			{
				_callGroup.alpha = Mathf.Clamp01(num3 / 0.05f) * Mathf.Clamp01((_callLen - num3) / 0.35f);
				((Transform)_callRt).localScale = Vector3.one * Mathf.Lerp(1.5f, 1f, Mathf.Clamp01(num3 / 0.15f));
			}
			else
			{
				_callGroup.alpha = 0f;
			}
			_bossGroup.alpha = Mathf.MoveTowards(_bossGroup.alpha, (unscaledTime < _bossUntil && flag) ? 1f : 0f, Time.unscaledDeltaTime / 0.25f);
			float num4 = unscaledTime - _banT0;
			if (num4 >= 0f && num4 < _banLen)
			{
				_banGroup.alpha = Mathf.Clamp01(num4 / 0.06f) * Mathf.Clamp01((_banLen - num4) / 0.45f);
				((Transform)_banRt).localScale = Vector3.one * Mathf.Lerp(1.7f, 1f, Mathf.Clamp01(num4 / 0.18f));
			}
			else
			{
				_banGroup.alpha = 0f;
			}
			float num5 = unscaledTime - _toastT0;
			float num6 = 0f;
			if (num5 >= 0f && num5 < _toastLen)
			{
				num6 = Mathf.Clamp01(num5 / 0.12f) * Mathf.Clamp01((_toastLen - num5) / 0.35f);
			}
			_toastGroup.alpha = ((flag || num5 < _toastLen) ? num6 : 0f);
			_toastRt.anchoredPosition = new Vector2(0f, Mathf.Lerp(-10f, 0f, Mathf.Clamp01(num5 / 0.15f)));
			bool flag2 = unscaledTime < _chargeUntil && flag;
			_chargeGroup.alpha = Mathf.MoveTowards(_chargeGroup.alpha, flag2 ? 1f : 0f, Time.unscaledDeltaTime / (flag2 ? 0.08f : 0.2f));
			if (!(_chargeGroup.alpha <= 0f))
			{
				_chargeFillRt.anchorMin = Vector2.zero;
				_chargeFillRt.anchorMax = new Vector2(Mathf.Lerp(_chargeFillRt.anchorMax.x, _pct, Time.unscaledDeltaTime * 18f), 1f);
				RectTransform chargeFillRt = _chargeFillRt;
				Vector2 offsetMin = (_chargeFillRt.offsetMax = Vector2.zero);
				chargeFillRt.offsetMin = offsetMin;
				Color val = (_red ? new Color(0.75f, 0.12f, 0.12f) : new Color(0.15f, 0.35f, 0.85f));
				Color val2 = (_red ? new Color(1f, 0.55f, 0.25f) : new Color(0.55f, 0.9f, 1f));
				float num7 = (_full ? (0.5f + 0.5f * Mathf.Sin(unscaledTime * 14f)) : 0f);
				((Graphic)_chargeFill).color = Color.Lerp(Color.Lerp(val, val2, _pct), Color.white, num7 * 0.55f);
				((Graphic)_chargeBorder).color = Color.Lerp(Gold, _red ? new Color(1f, 0.5f, 0.3f) : new Color(0.6f, 0.95f, 1f), _full ? (0.6f + num7 * 0.4f) : (_pct * 0.35f));
				Color color = (_red ? new Color(1f, 0.35f, 0.2f) : new Color(0.4f, 0.85f, 1f));
				color.a = (_full ? (0.25f + num7 * 0.35f) : 0f);
				((Graphic)_chargeGlow).color = color;
			}
		}

		internal static RectTransform Rect(string n, Transform parent, Vector2 anchor, Vector2 size)
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			GameObject val = new GameObject(n, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 anchorMin = (val2.anchorMax = anchor);
			val2.anchorMin = anchorMin;
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.sizeDelta = size;
			val2.anchoredPosition = Vector2.zero;
			return val2;
		}

		internal static Image Img(string n, Transform parent, Color c, bool stretch)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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)
			GameObject val = new GameObject(n, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			Image component = val.GetComponent<Image>();
			((Graphic)component).color = c;
			((Graphic)component).raycastTarget = false;
			if (stretch)
			{
				Stretch(((Graphic)component).rectTransform, 0f);
			}
			return component;
		}

		internal static Image Img(string n, RectTransform parent, Color c, bool stretch)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return Img(n, (Transform)(object)parent, c, stretch);
		}

		internal static Text Label(string n, Transform parent, int size, TextAnchor al, Color c)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_004d: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(n, new Type[2]
			{
				typeof(RectTransform),
				typeof(Text)
			});
			val.transform.SetParent(parent, false);
			Text component = val.GetComponent<Text>();
			component.font = CjkFont;
			component.fontSize = size;
			component.alignment = al;
			((Graphic)component).color = c;
			((Graphic)component).raycastTarget = false;
			component.horizontalOverflow = (HorizontalWrapMode)1;
			component.verticalOverflow = (VerticalWrapMode)1;
			component.fontStyle = (FontStyle)1;
			Outline obj = val.AddComponent<Outline>();
			((Shadow)obj).effectColor = new Color(0f, 0f, 0f, 0.95f);
			((Shadow)obj).effectDistance = new Vector2(1.6f, -1.6f);
			return component;
		}

		internal static void Stretch(RectTransform r, float inset)
		{
			//IL_0001: 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_0019: 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)
			r.anchorMin = Vector2.zero;
			r.anchorMax = Vector2.one;
			r.offsetMin = new Vector2(inset, inset);
			r.offsetMax = new Vector2(0f - inset, 0f - inset);
		}

		internal static void Inset(Image i, float v)
		{
			Stretch(((Graphic)i).rectTransform, v);
		}
	}
	public static class JjkStyle
	{
		public static readonly Color Crimson = new Color(0.62f, 0.05f, 0.07f, 1f);

		public static readonly Color Ink = new Color(0.03f, 0.02f, 0.025f, 0.96f);

		public static readonly Color Paper = new Color(0.93f, 0.88f, 0.8f);

		private static Texture2D _bg;

		private static Texture2D _brush;

		private static Texture2D BgTex()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_bg))
			{
				return _bg;
			}
			_bg = new Texture2D(256, 256, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num = (float)j / 255f;
					float num2 = (float)i / 255f;
					float num3 = Mathf.Clamp01(Mathf.Max(Mathf.Abs(num - 0.5f), Mathf.Abs(num2 - 0.5f)) * 2f);
					num3 *= num3;
					float num4 = Mathf.PerlinNoise(num * 5f + 3f, num2 * 5f + 7f) * 0.6f + Mathf.PerlinNoise(num * 13f, num2 * 13f) * 0.4f;
					Color val = Color.Lerp(new Color(0.035f, 0.025f, 0.03f), new Color(0.22f, 0.02f, 0.04f), num3 * 0.8f + Mathf.Clamp01((num4 - 0.6f) * 2.2f) * 0.35f * (1f - num2 * 0.5f));
					_bg.SetPixel(j, i, new Color(val.r, val.g, val.b, 0.97f));
				}
			}
			_bg.Apply();
			return _bg;
		}

		private static Texture2D BrushTex()
		{
			//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)
			//IL_002c: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_brush))
			{
				return _brush;
			}
			_brush = new Texture2D(256, 16, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num = (float)j / 255f;
					float num2 = Mathf.Abs((float)i / 15f - 0.5f) * 2f;
					float num3 = Mathf.Clamp01((Mathf.Lerp(0.25f, 1f, Mathf.Sin(num * (float)Math.PI)) * (0.8f + 0.2f * Mathf.PerlinNoise(num * 20f, 1f)) - num2) * 6f) * Mathf.Clamp01(1f - Mathf.PerlinNoise(num * 40f, (float)i * 0.3f) * 0.5f);
					_brush.SetPixel(j, i, new Color(1f, 1f, 1f, num3));
				}
			}
			_brush.Apply();
			return _brush;
		}

		public static Graphic Panel(RectTransform panel, float titleY = -84f)
		{
			//IL_0006: 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_003c: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: 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_01fe: 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_0223: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			JJKHud.Img("Border", panel, Crimson, stretch: true);
			GameObject val = new GameObject("Bg", new Type[2]
			{
				typeof(RectTransform),
				typeof(RawImage)
			});
			val.transform.SetParent((Transform)(object)panel, false);
			RawImage component = val.GetComponent<RawImage>();
			component.texture = (Texture)(object)BgTex();
			((Graphic)component).raycastTarget = true;
			JJKHud.Stretch(((Graphic)component).rectTransform, 2f);
			bool[] array = new bool[2] { true, false };
			foreach (bool flag in array)
			{
				RectTransform val2 = JJKHud.Rect(flag ? "TalismanL" : "TalismanR", (Transform)(object)panel, new Vector2(flag ? 0f : 1f, 1f), new Vector2(34f, 190f));
				val2.pivot = new Vector2(0.5f, 1f);
				val2.anchoredPosition = new Vector2(flag ? 30f : (-30f), -14f);
				JJKHud.Img("Paper", val2, new Color(0.72f, 0.07f, 0.08f, 0.95f), stretch: true);
				Text obj = JJKHud.Label("Kanji", (Transform)(object)val2, 26, (TextAnchor)1, new Color(0.08f, 0.02f, 0.02f));
				JJKHud.Stretch(((Graphic)obj).rectTransform, 2f);
				obj.text = "呪\n\n封\n\n印";
				obj.fontStyle = (FontStyle)1;
			}
			GameObject val3 = new GameObject("TitleBrush", new Type[2]
			{
				typeof(RectTransform),
				typeof(RawImage)
			});
			val3.transform.SetParent((Transform)(object)panel, false);
			RawImage component2 = val3.GetComponent<RawImage>();
			component2.texture = (Texture)(object)BrushTex();
			((Graphic)component2).color = Crimson;
			((Graphic)component2).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)component2).rectTransform;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(0.5f, 1f);
			rectTransform.anchorMax = val4;
			rectTransform.anchorMin = val4;
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.sizeDelta = new Vector2(520f, 14f);
			rectTransform.anchoredPosition = new Vector2(0f, titleY);
			return (Graphic)(object)component;
		}

		public static Image Button(RectTransform bt)
		{
			//IL_001a: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			JJKHud.Img("Border", bt, new Color(0.42f, 0.05f, 0.06f, 1f), stretch: true);
			Image obj = JJKHud.Img("Fill", bt, new Color(0.06f, 0.03f, 0.035f, 1f), stretch: true);
			JJKHud.Inset(obj, 1.5f);
			((Graphic)obj).raycastTarget = true;
			RectTransform val = JJKHud.Rect("Accent", (Transform)(object)bt, new Vector2(0f, 0.5f), new Vector2(6f, 38f));
			val.anchoredPosition = new Vector2(10f, 0f);
			JJKHud.Img("A", val, Crimson, stretch: true);
			return obj;
		}

		public static void TitleColor(Text t)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)t).color = Paper;
		}
	}
	public class OverheadBar : MonoBehaviour
	{
		private static Canvas _cv;

		public string Title = "";

		public Color FillColor = Color.red;

		public float Height = 3f;

		public Func<float> Hp01;

		public Func<string> Extra;

		public Func<bool> Alive;

		private RectTransform _rt;

		private Image _fill;

		private Text _label;

		private bool _built;

		public static OverheadBar Attach(GameObject go, string title, Color fill, float height, Func<float> hp01, Func<string> extra = null, Func<bool> alive = null)
		{
			//IL_0018: 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)
			OverheadBar obj = go.GetComponent<OverheadBar>() ?? go.AddComponent<OverheadBar>();
			obj.Title = title;
			obj.FillColor = fill;
			obj.Height = height;
			obj.Hp01 = hp01;
			obj.Extra = extra;
			obj.Alive = alive;
			return obj;
		}

		private static Canvas Cv()
		{
			//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_0022: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)_cv))
			{
				return _cv;
			}
			GameObject val = new GameObject("JJK_OverheadBars");
			Object.DontDestroyOnLoad((Object)val);
			_cv = val.AddComponent<Canvas>();
			_cv.renderMode = (RenderMode)0;
			_cv.sortingOrder = 60;
			return _cv;
		}

		private void Build()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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)
			_built = true;
			_rt = JJKHud.Rect("Bar_" + Title, ((Component)Cv()).transform, Vector2.zero, new Vector2(190f, 30f));
			((Graphic)JJKHud.Img("Back", _rt, new Color(0f, 0f, 0f, 0.65f), stretch: false)).rectTransform.sizeDelta = new Vector2(190f, 12f);
			Transform child = ((Transform)_rt).GetChild(0);
			RectTransform val = (RectTransform)(object)((child is RectTransform) ? child : null);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0f);
			val.anchorMax = val2;
			val.anchorMin = val2;
			val.pivot = new Vector2(0.5f, 0f);
			val.anchoredPosition = Vector2.zero;
			_fill = JJKHud.Img("Fill", val, FillColor, stretch: true);
			JJKHud.Stretch(((Graphic)_fill).rectTransform, 2f);
			((Graphic)_fill).rectTransform.pivot = new Vector2(0f, 0.5f);
			_label = JJKHud.Label("Name", (Transform)(object)_rt, 18, (TextAnchor)7, Color.white);
			RectTransform rectTransform = ((Graphic)_label).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.offsetMin = new Vector2(0f, 14f);
			rectTransform.offsetMax = Vector2.zero;
		}

		private void LateUpdate()
		{
			//IL_0086: 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)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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)
			Camera main = Camera.main;
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)main) || !Object.op_Implicit((Object)(object)localPlayer) || Hp01 == null || (Alive != null && !Alive()) || !(Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position) < 140f))
			{
				if (Object.op_Implicit((Object)(object)_rt))
				{
					((Component)_rt).gameObject.SetActive(false);
				}
				return;
			}
			Vector3 val = main.WorldToScreenPoint(((Component)this).transform.position + Vector3.up * Height);
			if (val.z <= 0f)
			{
				if (Object.op_Implicit((Object)(object)_rt))
				{
					((Component)_rt).gameObject.SetActive(false);
				}
				return;
			}
			if (!_built)
			{
				Build();
			}
			((Component)_rt).gameObject.SetActive(true);
			_rt.anchoredPosition = new Vector2(val.x, val.y);
			float num = Mathf.Clamp01(Hp01());
			((Graphic)_fill).rectTransform.anchorMax = new Vector2(num, 1f);
			((Graphic)_fill).rectTransform.anchorMin = new Vector2(0f, 0f);
			_label.text = Title + ((Extra != null) ? (" " + Extra()) : "") + $" {Mathf.RoundToInt(num * 100f)}%";
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)_rt))
			{
				Object.Destroy((Object)(object)((Component)_rt).gameObject);
			}
		}
	}
}
namespace JujutsuValheim.Techniques
{
	public abstract class Technique
	{
		public abstract string Id { get; }

		public abstract string DisplayName { get; }

		public abstract float Cost { get; }

		public abstract float Cooldown { get; }

		public abstract bool Execute(Character caster);
	}
	public enum CastResult
	{
		Ok,
		NotOwner,
		Dead,
		OnCooldown,
		NotEnoughEnergy,
		Failed
	}
	public class TechniqueCaster : MonoBehaviour
	{
		private Character _character;

		private JujutsuValheim.CursedEnergy.CursedEnergy _ce;

		private readonly Dictionary<string, float> _readyAt = new Dictionary<string, float>();

		private void Awake()
		{
			_character = ((Component)this).GetComponent<Character>();
			_ce = ((Component)this).GetComponent<JujutsuValheim.CursedEnergy.CursedEnergy>();
		}

		public float CooldownRemaining(Technique t)
		{
			if (!JJKCheat.Infinite)
			{
				if (!_readyAt.TryGetValue(t.Id.Replace("_max", ""), out var value))
				{
					return 0f;
				}
				return Mathf.Max(0f, value - Time.time);
			}
			return 0f;
		}

		public CastResult TryCast(Technique t)
		{
			if ((Object)(object)_ce == (Object)null)
			{
				_ce = ((Component)this).GetComponent<JujutsuValheim.CursedEnergy.CursedEnergy>();
			}
			if ((Object)(object)_ce == (Object)null || !_ce.IsOwner)
			{
				return CastResult.NotOwner;
			}
			if (_character.IsDead())
			{
				return CastResult.Dead;
			}
			if (CooldownRemaining(t) > 0f)
			{
				return CastResult.OnCooldown;
			}
			if (!_ce.CanSpend(t.Cost))
			{
				return CastResult.NotEnoughEnergy;
			}
			if (!t.Execute(_character))
			{
				return CastResult.Failed;
			}
			_ce.TrySpend(t.Cost);
			_readyAt[t.Id.Replace("_max", "")] = Time.time + t.Cooldown;
			if ((Object)(object)_character == (Object)(object)Player.m_localPlayer)
			{
				CombatMusic.NotifyAttack();
			}
			TechniqueNetwork.BroadcastCast(_character, t);
			object[] obj = new object[4] { t.Id, null, null, null };
			Character character = _character;
			Player val = (Player)(object)((character is Player) ? character : null);
			obj[1] = ((val != null) ? val.GetPlayerName() : ((Object)_character).name);
			obj[2] = _ce.Current;
			obj[3] = _ce.Max;
			Log.Info(string.Format("Cast {0} by {1} (CE {2:0}/{3:0})", obj));
			return CastResult.Ok;
		}
	}
	public class TestTechnique : Technique
	{
		public static readonly TestTechnique Instance = new TestTechnique();

		public override string Id => "test";

		public override string DisplayName => L.T("測試術式");

		public override float Cost => JJKConfig.TestTechniqueCost.Value;

		public override float Cooldown => JJKConfig.TestTechniqueCooldown.Value;

		public override bool Execute(Character caster)
		{
			JJKHud.Toast(L.F("{0}  -{1:0} 咒力", DisplayName, Cost));
			return true;
		}
	}
}
namespace JujutsuValheim.VFX
{
	public static class SukunaFx
	{
		private class Fader : MonoBehaviour
		{
			private LineRenderer _lr;

			private float _w;

			private float _d;

			private float _t;

			private Color _c;

			public void Init(LineRenderer lr, float w, float d, Color c)
			{
				//IL_0016: 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)
				_lr = lr;
				_w = w;
				_d = d;
				_c = c;
				Tick();
			}

			private void Update()
			{
				_t += Time.deltaTime;
				Tick();
			}

			private void Tick()
			{
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: 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_007b: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)_lr))
				{
					float num = Mathf.Clamp01(_t / _d);
					Color val = default(Color);
					if (_t < _d)
					{
						float num2 = Mathf.Lerp(0.15f, 0.9f, num);
						LineRenderer lr = _lr;
						LineRenderer lr2 = _lr;
						((Color)(ref val))..ctor(_c.r, _c.g, _c.b, num2);
						lr2.endColor = val;
						lr.startColor = val;
						_lr.widthMultiplier = _w * Mathf.Lerp(0.05f, 0.25f, num);
					}
					else
					{
						float num3 = Mathf.Clamp01(1f - (_t - _d) / 0.3f);
						LineRenderer lr3 = _lr;
						LineRenderer lr4 = _lr;
						((Color)(ref val))..ctor(1f, 1f, 1f, num3);
						lr4.endColor = val;
						lr3.startColor = val;
						_lr.widthMultiplier = _w * num3;
					}
				}
			}
		}

		private class CircleGrow : MonoBehaviour
		{
			private LineRenderer _lr;

			private float _r;

			private float _d;

			private float _t;

			public void Init(LineRenderer lr, float r, float d)
			{
				_lr = lr;
				_r = r;
				_d = d;
				Tick();
			}

			private void Update()
			{
				_t += Time.deltaTime;
				Tick();
			}

			private void Tick()
			{
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)_lr))
				{
					float num = Mathf.Clamp01(_t / _d);
					float num2 = _r * Mathf.Lerp(0.15f, 1f, num);
					for (int i = 0; i < _lr.positionCount; i++)
					{
						float num3 = (float)i / (float)_lr.positionCount * (float)Math.PI * 2f;
						_lr.SetPosition(i, new Vector3(Mathf.Cos(num3) * num2, 0.15f, Mathf.Sin(num3) * num2));
					}
					float num4 = ((_t < _d) ? Mathf.Lerp(0.25f, 0.95f, num) : Mathf.Clamp01(1f - (_t - _d) / 0.3f));
					LineRenderer lr = _lr;
					LineRenderer lr2 = _lr;
					Color val = default(Color);
					((Color)(ref val))..ctor(0.7f, 0.02f, 0.06f, num4);
					lr2.endColor = val;
					lr.startColor = val;
				}
			}
		}

		private static Material _mat;

		private static Material Mat
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Expected O, but got Unknown
				//IL_0022: Expected O, but got Unknown
				if (!Object.op_Implicit((Object)(object)_mat))
				{
					Material val = new Material(Shader.Find("Sprites/Default"));
					_mat = val;
					return val;
				}
				return _mat;
			}
		}

		public static void Line(Vector3 a, Vector3 b, float width, float duration, bool world)
		{
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_SukunaLine");
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.useWorldSpace = true;
			val2.positionCount = 2;
			val2.SetPosition(0, a);
			val2.SetPosition(1, b);
			((Renderer)val2).material = Mat;
			val2.numCapVertices = 2;
			val.AddComponent<Fader>().Init(val2, width, duration, world ? new Color(1f, 0.9f, 0.9f) : new Color(1f, 0.1f, 0.12f));
			Object.Destroy((Object)val, duration + 0.5f);
		}

		public static void Circle(Vector3 pos, float radius, float duration)
		{
			//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_0010: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_SukunaCircle");
			val.transform.position = pos;
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.useWorldSpace = false;
			val2.loop = true;
			val2.positionCount = 40;
			((Renderer)val2).material = Mat;
			val2.widthMultiplier = 0.18f;
			val.AddComponent<CircleGrow>().Init(val2, radius, duration);
			Object.Destroy((Object)val, duration + 0.4f);
		}
	}
	public static class AudioBank
	{
		private sealed class Pcm
		{
			public string Name;

			public float[] F;

			public int Ch;

			public int Rate;
		}

		private static readonly Dictionary<string, AudioClip> _clips = new Dictionary<string, AudioClip>();

		private static string _dir;

		private static readonly Queue<Pcm> _ready = new Queue<Pcm>();

		private static readonly HashSet<string> _pending = new HashSet<string>();

		public const float SfxScale = 0.35f;

		public const float LineScale = 0.3f;

		public static string Dir
		{
			get
			{
				if (_dir == null)
				{
					_dir = Path.Combine(Path.GetDirectoryName(typeof(AudioBank).Assembly.Location), "sounds");
				}
				return _dir;
			}
		}

		public static AudioClip Get(string name)
		{
			if (_clips.TryGetValue(name, out var value))
			{
				return value;
			}
			if (_dir == null)
			{
				_dir = Path.Combine(Path.GetDirectoryName(typeof(AudioBank).Assembly.Location), "sounds");
			}
			AudioClip val = null;
			try
			{
				string text = Path.Combine(_dir, name + ".wav");
				if (File.Exists(text))
				{
					val = LoadWav(text, name);
				}
				else
				{
					Log.Warn("Sound file missing: " + text);
				}
			}
			catch (Exception ex)
			{
				Log.Warn("Sound '" + name + "' load failed: " + ex.Message);
			}
			_clips[name] = val;
			return val;
		}

		public static void PreloadBig()
		{
			List<string> list = new List<string>();
			try
			{
				string[] files = Directory.GetFiles(Dir, "*.wav", SearchOption.AllDirectories);
				foreach (string text in files)
				{
					if (new FileInfo(text).Length > 1000000)
					{
						list.Add(text);
					}
				}
			}
			catch (Exception ex)
			{
				Log.Warn("Sound preload scan failed: " + ex.Message);
				return;
			}
			List<string> names = new List<string>();
			foreach (string item2 in list)
			{
				string text2 = item2.Substring(Dir.Length + 1).Replace('\\', '/');
				text2 = text2.Substring(0, text2.Length - 4);
				names.Add(text2);
				lock (_pending)
				{
					_pending.Add(text2);
				}
			}
			Thread thread = new Thread((ThreadStart)delegate
			{
				for (int j = 0; j < list.Count; j++)
				{
					try
					{
						Pcm item = Decode(list[j], names[j]);
						lock (_ready)
						{
							_ready.Enqueue(item);
						}
					}
					catch (Exception ex2)
					{
						lock (_pending)
						{
							_pending.Remove(names[j]);
						}
						Log.Warn("Sound '" + names[j] + "' preload failed: " + ex2.Message);
					}
				}
			});
			thread.IsBackground = true;
			thread.Start();
			Log.Info($"Sound preload: {list.Count} large file(s) decoding in background");
		}

		public static void Tick()
		{
			Pcm pcm = null;
			lock (_ready)
			{
				if (_ready.Count > 0)
				{
					pcm = _ready.Dequeue();
				}
			}
			if (pcm == null)
			{
				return;
			}
			lock (_pending)
			{
				_pending.Remove(pcm.Name);
			}
			if (_clips.ContainsKey(pcm.Name))
			{
				return;
			}
			try
			{
				_clips[pcm.Name] = Create(pcm);
			}
			catch (Exception ex)
			{
				Log.Warn("Sound '" + pcm.Name + "' create failed: " + ex.Message);
			}
		}

		private static AudioClip LoadWav(string path, string name)
		{
			return Create(Decode(path, name));
		}

		private static AudioClip Create(Pcm p)
		{
			AudioClip val = AudioClip.Create(p.Name, p.F.Length / p.Ch, p.Ch, p.Rate, false);
			typeof(AudioClip).GetMethod("SetData", new Type[2]
			{
				typeof(float[]),
				typeof(int)
			}).Invoke(val, new object[2] { p.F, 0 });
			Log.Info($"Sound loaded: {p.Name} ({val.length:0.0}s)");
			return val;
		}

		private static Pcm Decode(string path, string name)
		{
			byte[] array = File.ReadAllBytes(path);
			int num = BitConverter.ToInt16(array, 22);
			int num2 = BitConverter.ToInt32(array, 24);
			if (BitConverter.ToInt16(array, 34) != 16)
			{
				throw new Exception("only 16-bit PCM supported");
			}
			int i = 12;
			int num3 = -1;
			int num4 = 0;
			int num5;
			for (; i + 8 <= array.Length; i += 8 + num5)
			{
				string text = Encoding.ASCII.GetString(array, i, 4);
				num5 = BitConverter.ToInt32(array, i + 4);
				if (text == "data")
				{
					num3 = i + 8;
					num4 = Math.Min(num5, array.Length - num3);
					break;
				}
			}
			if (num3 < 0)
			{
				throw new Exception("no data chunk");
			}
			int num6 = num4 / 2;
			float[] array2 = new float[num6];
			bool flag = name == "domain_voice" || name == "domain_end_voice" || name.StartsWith("boss/");
			float num7;
			if (!name.StartsWith("boss/"))
			{
				if (!flag)
				{
					switch (name)
					{
					default:
						num7 = (name.StartsWith("domain_") ? JJKConfig.DomainGain.Value : ((name == "combat_theme" || name.StartsWith("music/")) ? 1f : JJKConfig.VoiceGain.Value));
						break;
					case "domain_open":
					case "black_flash":
					case "heal":
						num7 = 1f;
						break;
					}
				}
				else
				{
					num7 = JJKConfig.DomainVoiceGain.Value;
				}
			}
			else
			{
				num7 = BossConfig.VoiceGain.Value;
			}
			float num8 = num7;
			for (int j = 0; j < num6; j++)
			{
				float num9 = (float)BitConverter.ToInt16(array, num3 + j * 2) / 32768f;
				array2[j] = (flag ? num9 : ((num8 > 1f) ? ((float)Math.Tanh(num9 * num8)) : (num9 * num8)));
			}
			if (flag)
			{
				Limit(array2, num8, num2 * num);
			}
			return new Pcm
			{
				Name = name,
				F = array2,
				Ch = num,
				Rate = num2
			};
		}

		private static void Limit(float[] f, float gain, int samplesPerSec)
		{
			int num = f.Length;
			float[] array = new float[num];
			float num2 = 1f / (0.005f * (float)samplesPerSec);
			float num3 = 1f / (0.12f * (float)samplesPerSec);
			for (int i = 0; i < num; i++)
			{
				float num4 = Math.Abs(f[i]) * gain;
				array[i] = ((num4 > 0.95f) ? (0.95f / num4) : 1f);
			}
			for (int num5 = num - 2; num5 >= 0; num5--)
			{
				array[num5] = Math.Min(array[num5], array[num5 + 1] + num2);
			}
			for (int j = 1; j < num; j++)
			{
				array[j] = Math.Min(array[j], array[j - 1] + num3);
			}
			for (int k = 0; k < num; k++)
			{
				f[k] = Mathf.Clamp(f[k] * gain * array[k], -0.95f, 0.95f);
			}
		}

		private static float Volume()
		{
			float num = 1f;
			try
			{
				num = AudioMan.GetSFXVolume();
			}
			catch
			{
			}
			return JJKConfig.SoundVolume.Value * num * 0.35f;
		}

		public static AudioSource Attach(GameObject go, string clipName, bool loop = false, float vol = 1f)
		{
			if (!JJKConfig.SoundEnabled.Value)
			{
				return null;
			}
			AudioClip val = Get(clipName);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			AudioSource obj = go.AddComponent<AudioSource>();
			obj.clip = val;
			obj.loop = loop;
			obj.spatialBlend = 1f;
			obj.rolloffMode = (AudioRolloffMode)1;
			obj.minDistance = 6f;
			obj.maxDistance = 70f;
			obj.volume = Mathf.Clamp01(Volume() * vol);
			obj.playOnAwake = false;
			obj.Play();
			return obj;
		}

		public static void PlayGlobal(string clipName, float vol = 1f)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_00a3: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_GlobalSfx_" + clipName);
			AudioSource val2 = Attach(val, clipName, loop: false, vol);
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.spatialBlend = 0f;
				val2.volume = (clipName.StartsWith("boss/") ? Mathf.Clamp01(JJKConfig.SoundVolume.Value * 1.2f * vol * 0.3f) : Mathf.Clamp01(Volume() * 1.2f * vol));
			}
			Object.Destroy((Object)val, (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.clip)) ? (val2.clip.length + 0.2f) : 0.1f);
		}

		public static void PlayAt(string clipName, Vector3 pos, float vol = 1f)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0058: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_Sfx_" + clipName);
			val.transform.position = pos;
			AudioSource val2 = Attach(val, clipName, loop: false, vol);
			Object.Destroy((Object)val, (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.clip)) ? (val2.clip.length + 0.2f) : 0.1f);
		}
	}
	public class SoundAtEnd : MonoBehaviour
	{
		public string Clip;

		public float At;

		private float _t0;

		private bool _done;

		private void Start()
		{
			_t0 = Time.time;
		}

		private void Update()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (!_done && !(Time.time - _t0 < At))
			{
				_done = true;
				AudioBank.PlayAt(Clip, ((Component)this).transform.position);
			}
		}
	}
	public class FadeOutDestroy : MonoBehaviour
	{
		public float Duration = 0.25f;

		private float _t0;

		private AudioSource _s;

		private float _v0;

		private void Start()
		{
			_t0 = Time.time;
			_s = ((Component)this).GetComponent<AudioSource>();
			if (Object.op_Implicit((Object)(object)_s))
			{
				_v0 = _s.volume;
			}
		}

		private void Update()
		{
			float num = (Time.time - _t0) / Duration;
			if (Object.op_Implicit((Object)(object)_s))
			{
				_s.volume = _v0 * Mathf.Clamp01(1f - num);
			}
			if (num >= 1f)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public static class DomainCamera
	{
		public static float Offset;
	}
	[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
	internal static class DomainCameraPatch
	{
		private static readonly FieldRef<GameCamera, Camera> Cam = AccessTools.FieldRefAccess<GameCamera, Camera>("m_camera");

		private static readonly FieldRef<GameCamera, Camera> Sky = AccessTools.FieldRefAccess<GameCamera, Camera>("m_skyCamera");

		private static void Postfix(GameCamera __instance)
		{
			if (!(Mathf.Abs(DomainCamera.Offset) < 0.01f))
			{
				Camera val = Cam.Invoke(__instance);
				if (Object.op_Implicit((Object)(object)val))
				{
					val.fieldOfView = Mathf.Clamp(val.fieldOfView + DomainCamera.Offset, 20f, 120f);
				}
				Camera val2 = Sky.Invoke(__instance);
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.fieldOfView = Mathf.Clamp(val2.fieldOfView + DomainCamera.Offset, 20f, 120f);
				}
			}
		}
	}
	public static class DomainVfx
	{
		public static void Start(Vector3 pos, float radius, float duration, ZDOID owner)
		{
			//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_0010: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			GameObject val = new GameObject("JJK_DomainVfx");
			val.transform.position = pos;
			val.AddComponent<DomainRoot>().Init(radius, duration, owner);
			Object.Destroy((Object)val, duration + 3f);
		}
	}
	internal class DomainRoot : MonoBehaviour
	{
		public static bool Active;

		private float _radius;

		private float _dur;

		private float _t0;

		private bool _local;

		private bool _inside;

		private bool _restored;

		private GameObject _sky;

		private GameObject _shell;

		private GameObject _canvas;

		private Image _flash;

		private Image _tint;

		private Image _barTop;

		private Image _barBot;

		private Image _cdFill;

		private Text _title;

		private Text _count;

		private Material _shellMat;

		private Camera _cam;

		private static readonly Color Void = new Color(0.02f, 0.01f, 0.08f);

		public void Init(float radius, float dur, ZDOID owner)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			_radius = radius;
			_dur = dur;
			_t0 = Time.time;
			GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.FindInstance(owner) : null);
			_local = Object.op_Implicit((Object)(object)val) && (Object)(object)val.GetComponent<Player>() == (Object)(object)Player.m_localPlayer;
			try
			{
				if (Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)val.GetComponent<GojoAura>()))
				{
					val.gameObject.AddComponent<GojoAura>().Lifetime = dur;
				}
			}
			catch
			{
			}
			_inside = Object.op_Implicit((Object)(object)Player.m_localPlayer) && Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)this).transform.position) <= radius * 1.5f;
			if (_inside || _local)
			{
				Active = true;
				if (Object.op_Implicit((Object)(object)EnvMan.instance))
				{
					EnvMan.instance.m_debugTimeOfDay = true;
					EnvMan.instance.m_debugTime = 0f;
				}
				CombatMusic.DuckForDomain(dur);
				AudioBank.PlayGlobal("domain_open");
				BuildSky();
				BuildShell();
				BuildRain();
				BuildUi();
			}
		}

		private void BuildSky()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00d1: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: 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_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			_sky = new GameObject("StarRiver");
			_sky.transform.SetParent(((Component)this).transform, false);
			ParticleSystem val = JJKVfx.MakePS(_sky.transform, "Stars", worldSpace: false, _dur + 2f, 2.2f, Color.white, 1500, 0f);
			ShapeModule shape = val.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 240f;
			((ShapeModule)(ref shape)).radiusThickness = 0f;
			MainModule main = val.main;
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.8f, 2.8f);
			((MainModule)(ref main)).startColor = new MinMaxGradient(Color.white, new Color(0.6f, 0.85f, 1f));
			EmissionModule emission = val.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
			{
				new Burst(0f, (short)1300)
			});
			ParticleSystem val2 = JJKVfx.MakePS(_sky.transform, "Galaxy", worldSpace: false, _dur + 2f, 3f, new Color(0.55f, 0.45f, 1f), 2500, 0f);
			((Component)val2).transform.localRotation = Quaternion.Euler(35f, 20f, 25f);
			ShapeModule shape2 = val2.shape;
			((ShapeModule)(ref shape2)).enabled = true;
			((ShapeModule)(ref shape2)).shapeType = (ParticleSystemShapeType)17;
			((ShapeModule)(ref shape2)).radius = 235f;
			((ShapeModule)(ref shape2)).donutRadius = 38f;
			((ShapeModule)(ref shape2)).radiusThickness = 1f;
			MainModule main2 = val2.main;
			((MainModule)(ref main2)).startSize = new MinMaxCurve(1.2f, 4f);
			((MainModule)(ref main2)).startColor = new MinMaxGradient(new Color(0.35f, 0.8f, 1f), new Color(0.8f, 0.35f, 1f));
			EmissionModule emission2 = val2.emission;
			((EmissionModule)(ref emission2)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission2)).SetBursts((Burst[])(object)new Burst[1]
			{
				new Burst(0f, (short)2200)
			});
			val.Play();
			val2.Play();
		}

		private void BuildShell()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = (_shell = GameObject.CreatePrimitive((PrimitiveType)0));
			val.transform.SetParent(((Component)this).transform, false);
			Object.Destroy((Object)(object)val.GetComponent<Collider>());
			Shader val2 = Shader.Find("Sprites/Default");
			_shellMat = new Material(val2)
			{
				color = new Color(0f, 0f, 0.01f, 0.97f)
			};
			val.GetComponent<Renderer>().material = _shellMat;
			val.transform.localScale = Vector3.zero;
			ParticleSystem val3 = JJKVfx.MakePS(val.transform, "ShellStars", worldSpace: false, _dur + 1f, 0.22f, Color.white, 900, 0f);
			ShapeModule shape = val3.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 0.5f;
			((ShapeModule)(ref shape)).radiusThickness = 0f;
			EmissionModule emission = val3.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1]
			{
				new Burst(0f, (short)800)
			});
			val3.Play();
		}

		private void BuildRain()
		{
			//IL_0025: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00c7: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem obj = JJKVfx.MakePS(((Component)this).transform, "DataRain", worldSpace: false, 1.2f, 0.035f, new Color(0.55f, 0.95f, 1f), 600, 160f);
			((Component)obj).transform.localPosition = Vector3.up * (_radius * 0.75f);
			ShapeModule shape = obj.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10;
			((ShapeModule)(ref shape)).radius = _radius * 0.85f;
			((ShapeModule)(ref shape)).radiusThickness = 1f;
			MainModule main = obj.main;
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(1.5f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.025f, 0.06f);
			JJKVfx.Stretch(obj, 0.04f, 9f);
			JJKVfx.FadeCurve(obj, Color.white, new Color(0.35f, 0.75f, 1f), 0.1f);
			obj.Play();
		}

		private void BuildUi()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: 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_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			_canvas = new GameObject("JJK_DomainUI");
			Object.DontDestroyOnLoad((Object)(object)_canvas);
			Canvas obj = _canvas.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 5000;
			_tint = Img("Tint", new Color(0.02f, 0f, 0.12f, 0f));
			_flash = Img("Flash", new Color(1f, 1f, 1f, 1f));
			Font f = Font.CreateDynamicFontFromOSFont(new string[3] { "Microsoft JhengHei", "Microsoft YaHei", "Arial" }, 64);
			_barTop = Bar("BarTop", top: true);
			_barBot = Bar("BarBot", top: false);
			_title = Txt("Title", f, 70, new Vector2(0f, 0.12f));
			_title.fontStyle = (FontStyle)1;
			_title.text = L.T("<size=54><color=#9fe8ff>領域展開</color></size>\n<size=120>無量空処</size>");
			Outline obj2 = ((Component)_title).gameObject.AddComponent<Outline>();
			((Shadow)obj2).effectColor = new Color(0.1f, 0.35f, 0.8f, 0.9f);
			((Shadow)obj2).effectDistance = new Vector2(3f, -3f);
			Shadow obj3 = ((Component)_title).gameObject.AddComponent<Shadow>();
			obj3.effectColor = new Color(0f, 0f, 0f, 0.85f);
			obj3.effectDistance = new Vector2(0f, -6f);
			_count = Txt("Count", f, 40, new Vector2(0f, -0.34f));
			_count.fontStyle = (FontStyle)1;
			Outline obj4 = ((Component)_count).gameObject.AddComponent<Outline>();
			((Shadow)obj4).effectColor = new Color(0f, 0f, 0f, 0.9f);
			((Shadow)obj4).effectDistance = new Vector2(2f, -2f);
			RectTransform rectTransform = ((Graphic)Img("CdBg", new Color(0f, 0f, 0f, 0.55f))).rectTransform;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.120000005f);
			rectTransform.anchorMax = val;
			rectTransform.anchorMin = val;
			rectTransform.offsetMin = new Vector2(-310f, -5f);
			rectTransform.offsetMax = new Vector2(310f, 5f);
			_cdFill = Img("CdFill", new Color(0.45f, 0.85f, 1f, 1f));
			RectTransform rectTransform2 = ((Graphic)_cdFill).rectTransform;
			((Transform)rectTransform2).SetParent((Transform)(object)rectTransform, false);
			rectTransform2.anchorMin = Vector2.zero;
			rectTransform2.anchorMax = Vector2.one;
			rectTransform2.offsetMin = new Vector2(1f, 1f);
			rectTransform2.offsetMax = new Vector2(-1f, -1f);
		}

		private Image Bar(string n, bool top)
		{
			//IL_0002: 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_0046: 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_0071: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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)
			Image obj = Img(n, Color.black);
			RectTransform rectTransform = ((Graphic)obj).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, top ? 1f : 0f);
			rectTransform.anchorMax = new Vector2(1f, top ? 1f : 0f);
			rectTransform.pivot = new Vector2(0.5f, top ? 1f : 0f);
			Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero);
			rectTransform.offsetMin = offsetMin;
			rectTransform.sizeDelta = Vector2.zero;
			return obj;
		}

		private Image Img(string n, Color c)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0053: 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)
			GameObject val = new GameObject(n);
			val.transform.SetParent(_canvas.transform, false);
			Image obj = val.AddComponent<Image>();
			((Graphic)obj).color = c;
			((Graphic)obj).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)obj).rectTransform;
			rectTransform.anchorMin = Vector2.zero;
			rectTransform.anchorMax = Vector2.one;
			Vector2 offsetMin = (rectTransform.offsetMax = Vector2.zero);
			rectTransform.offsetMin = offsetMin;
			return obj;
		}

		private Text Txt(string n, Font f, int size, Vector2 anchorOffset)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(n);
			val.transform.SetParent(_canvas.transform, false);
			Text obj = val.AddComponent<Text>();
			obj.font = f;
			obj.fontSize = size;
			obj.alignment = (TextAnchor)4;
			((Graphic)obj).color = Color.white;
			((Graphic)obj).raycastTarget = false;
			obj.horizontalOverflow = (HorizontalWrapMode)1;
			RectTransform rectTransform = ((Graphic)obj).rectTransform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f + anchorOffset.y);
			rectTransform.anchorMax = val2;
			rectTransform.anchorMin = val2;
			rectTransform.sizeDelta = new Vector2(1400f, 330f);
			rectTransform.anchoredPosition = Vector2.zero;
			return obj;
		}

		private void Update()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: 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_020d: 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_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			if (_restored || (!_inside && !_local))
			{
				return;
			}
			float num = Time.time - _t0;
			float num2 = Mathf.Max(0f, _dur - num);
			if (Object.op_Implicit((Object)(object)_shell))
			{
				float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(num / 1.1f));
				if (num2 < 0.8f)
				{
					num3 *= num2 / 0.8f;
				}
				_shell.transform.localScale = Vector3.one * (_radius * 2.8f * num3);
			}
			if (Object.op_Implicit((Object)(object)_sky))
			{
				_cam = Camera.main;
				if (Object.op_Implicit((Object)(object)_cam))
				{
					_sky.transform.position = ((Component)_cam).transform.position;
				}
				_sky.transform.Rotate(Vector3.up, 1.5f * Time.deltaTime, (Space)0);
			}
			if (Object.op_Implicit((Object)(object)_flash))
			{
				float num4 = ((num < 0.12f) ? 1f : Mathf.Clamp01(1f - (num - 0.12f) / 0.75f));
				((Graphic)_flash).color = new Color(1f, 1f, 1f, num4);
			}
			if (Object.op_Implicit((Object)(object)_tint))
			{
				((Graphic)_tint).color = new Color(0.02f, 0f, 0.12f, (num < 0.8f) ? 0f : (0.22f * ((num2 < 0.8f) ? (num2 / 0.8f) : 1f)));
			}
			if (Object.op_Implicit((Object)(object)_title))
			{
				float num5 = ((num < 0.5f) ? 0f : ((num < 2.8f) ? 1f : Mathf.Clamp01(1f - (num - 2.8f) / 0.5f)));
				((Graphic)_title).color = new Color(1f, 1f, 1f, num5);
				((Transform)((Graphic)_title).rectTransform).localScale = Vector3.one * Mathf.Lerp(1.25f, 1f, Mathf.Clamp01((num - 0.5f) / 0.25f)) * ((num > 2.8f) ? (1f + (num - 2.8f) * 0.8f) : 1f);
			}
			if (Object.op_Implicit((Object)(object)_count))
			{
				_count.text = L.F("領域持續  {0:0.0}", num2);
				((Graphic)_count).color = new Color(0.65f, 0.95f, 1f, (num < 0.9f) ? 0f : Mathf.Clamp01(num2 / 0.5f));
			}
			float num6 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(num / 0.6f)) * Mathf.Clamp01(num2 / 0.5f);
			float num7 = (float)Screen.height * 0.085f * num6;
			if (Object.op_Implicit((Object)(object)_barTop))
			{
				((Graphic)_barTop).rectTransform.sizeDelta = new Vector2(0f, num7);
			}
			if (Object.op_Implicit((Object)(object)_barBot))
			{
				((Graphic)_barBot).rectTransform.sizeDelta = new Vector2(0f, num7);
			}
			if (Object.op_Implicit((Object)(object)_cdFill))
			{
				((Graphic)_cdFill).rectTransform.anchorMax = new Vector2(Mathf.Clamp01(num2 / Mathf.Max(0.01f, _dur)), 1f);
				((Graphic)_cdFill).color = new Color(0.45f, 0.85f, 1f, (num < 0.9f) ? 0f : Mathf.Clamp01(num2 / 0.5f));
			}
			if (_local)
			{
				float num8 = ((num < 0.8f) ? (Mathf.Sin(num / 0.8f * (float)Math.PI) * 28f) : 0f);
				float num9 = ((num2 < 0.6f) ? (Mathf.Sin((1f - num2 / 0.6f) * (float)Math.PI) * -10f) : 0f);
				DomainCamera.Offset = num8 + num9;
			}
			if (num2 <= 0f)
			{
				AudioBank.PlayGlobal("domain_end_voice");
				Restore();
			}
		}

		private void Restore()
		{
			if (!_restored)
			{
				_restored = true;
				DomainCamera.Offset = 0f;
				Active = false;
				if (Object.op_Implicit((Object)(object)EnvMan.instance))
				{
					EnvMan.instance.m_debugTimeOfDay = false;
				}
				if (Object.op_Implicit((Object)(object)_canvas))
				{
					Object.Destroy((Object)(object)_canvas);
				}
			}
		}

		private void OnDestroy()
		{
			Restore();
		}
	}
	public static class DuelFx
	{
		private class Runner : MonoBehaviour
		{
			private readonly List<KeyValuePair<float, Action>> _q = new List<KeyValuePair<float, Action>>();

			public void Add(float t, Action a)
			{
				_q.Add(new KeyValuePair<float, Action>(Time.time + t, a));
			}

			private void Update()
			{
				for (int num = _q.Count - 1; num >= 0; num--)
				{
					if (!(Time.time < _q[num].Key))
					{
						Action value = _q[num].Value;
						_q.RemoveAt(num);
						try
						{
							value();
						}
						catch (Exception ex)
						{
							Log.Warn("DuelFx action failed: " + ex.Message);
						}
					}
				}
			}
		}

		private class PillarAnim : MonoBehaviour
		{
			private LineRenderer _core;

			private L