Decompiled source of HostReviveModFX v1.0.7

HostReviveModFX.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Peak.Afflictions;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace HostReviveModFX;

internal class GameUI : MonoBehaviour
{
	internal static GameUI Instance;

	private static readonly Color Cream = Hex("DFDAC2");

	private static readonly Color White = Hex("FDF8F2");

	private static readonly Color Faded = Hex("9E9A88");

	private static readonly Color Gold = Hex("F1C100");

	private static readonly Color OrangeP = Hex("A8470F");

	private static readonly Color OrangeB = Hex("E06F00");

	private static readonly Color GreenP = Hex("244B1E");

	private static readonly Color GreenB = Hex("0D6F1D");

	private static readonly Color BlueP = Hex("2F649F");

	private static readonly Color BlueB = Hex("008F98");

	private static readonly Color YellowP = Hex("C58E00");

	private static readonly Color YellowB = Hex("F1C100");

	private static readonly Color RedP = Hex("84212C");

	private static readonly Color RedB = Hex("BE3400");

	private static readonly Color GreyP = Hex("3A3832");

	private static readonly Color GreyB = Hex("6B675B");

	private RectTransform root;

	private TMP_FontAsset font;

	private GameObject buttonTemplate;

	private Sprite bannerSprite;

	private RectTransform panel;

	private RectTransform page;

	private readonly Button[] tabs = (Button[])(object)new Button[3];

	private bool leaderboardAllTime;

	private string pageSignature = "";

	private float nextRefresh;

	private readonly List<KeyValuePair<Character, TextMeshProUGUI>> deadInfo = new List<KeyValuePair<Character, TextMeshProUGUI>>();

	private TextMeshProUGUI boardText;

	private TextMeshProUGUI boardTop;

	private TextMeshProUGUI boardHead;

	private TextMeshProUGUI costLine;

	private RectTransform boardContent;

	private readonly List<Action> settingRefresh = new List<Action>();

	internal readonly Dictionary<ConfigEntryBase, Button> settingButtons = new Dictionary<ConfigEntryBase, Button>();

	private bool selfPicker;

	private readonly List<KeyValuePair<Character, TextMeshProUGUI>> pickDistance = new List<KeyValuePair<Character, TextMeshProUGUI>>();

	private TextMeshProUGUI nearestCaption;

	private Character nearestShown;

	private RectTransform corner;

	private TextMeshProUGUI cornerText;

	private float nextCorner;

	private readonly List<TextMeshProUGUI> markerPool = new List<TextMeshProUGUI>();

	private TextMeshProUGUI countdown;

	internal int Tab { get; private set; }

	private static Color Hex(string h)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		Color result = default(Color);
		ColorUtility.TryParseHtmlString("#" + h, ref result);
		return result;
	}

	private static string Html(Color c)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return "#" + ColorUtility.ToHtmlStringRGB(c);
	}

	internal static string ShortName(string name, int maxWidth)
	{
		if (string.IsNullOrEmpty(name))
		{
			return "";
		}
		StringBuilder stringBuilder = new StringBuilder();
		bool flag = false;
		foreach (char c in name)
		{
			if (c == '<')
			{
				flag = true;
			}
			else if (flag)
			{
				if (c == '>')
				{
					flag = false;
				}
			}
			else
			{
				stringBuilder.Append(c);
			}
		}
		int num = 0;
		for (int j = 0; j < stringBuilder.Length; j++)
		{
			num += ((stringBuilder[j] <= '\u2e7f') ? 1 : 2);
			if (num > maxWidth)
			{
				return stringBuilder.ToString(0, j).TrimEnd() + "…";
			}
		}
		return name;
	}

	internal static void Ensure()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected O, but got Unknown
		if (!((Object)(object)Instance != (Object)null))
		{
			GameObject val = new GameObject("HostReviveModFX_UI", new Type[1] { typeof(RectTransform) });
			Object.DontDestroyOnLoad((Object)(object)val);
			Instance = val.AddComponent<GameUI>();
		}
	}

	private void Awake()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		Canvas val = ((Component)this).gameObject.AddComponent<Canvas>();
		val.renderMode = (RenderMode)0;
		val.sortingOrder = 190;
		CanvasScaler val2 = ((Component)this).gameObject.AddComponent<CanvasScaler>();
		val2.uiScaleMode = (ScaleMode)1;
		val2.referenceResolution = new Vector2(1920f, 1080f);
		val2.screenMatchMode = (ScreenMatchMode)0;
		val2.matchWidthOrHeight = 1f;
		((Component)this).gameObject.AddComponent<GraphicRaycaster>();
		root = (RectTransform)((Component)this).transform;
	}

	private bool Resolve()
	{
		if ((Object)(object)font == (Object)null)
		{
			TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
			foreach (TMP_FontAsset val in array)
			{
				if (((Object)val).name == "DarumaDropOne-Regular SDF")
				{
					font = val;
					break;
				}
			}
		}
		if ((Object)(object)buttonTemplate == (Object)null && (Object)(object)GUIManager.instance != (Object)null && Plugin.PauseMenuField != null)
		{
			object? value = Plugin.PauseMenuField.GetValue(GUIManager.instance);
			GameObject val2 = (GameObject)((value is GameObject) ? value : null);
			Transform val3 = (((Object)(object)val2 != (Object)null) ? FindDeep(val2.transform, "UI_MainMenuButton_Resume") : null);
			if ((Object)(object)val3 != (Object)null)
			{
				buttonTemplate = ((Component)val3).gameObject;
			}
		}
		if ((Object)(object)buttonTemplate == (Object)null && (Object)(object)bannerSprite == (Object)null)
		{
			Sprite[] array2 = Resources.FindObjectsOfTypeAll<Sprite>();
			foreach (Sprite val4 in array2)
			{
				if (((Object)val4).name == "UI_Banner")
				{
					bannerSprite = val4;
					break;
				}
			}
		}
		return (Object)(object)font != (Object)null;
	}

	private static Transform FindDeep(Transform t, string name)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		if (((Object)t).name == name)
		{
			return t;
		}
		foreach (Transform item in t)
		{
			Transform t2 = item;
			Transform val = FindDeep(t2, name);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private static RectTransform Node(Transform parent, string name)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
		val.transform.SetParent(parent, false);
		return (RectTransform)val.transform;
	}

	private static void Place(RectTransform rt, Vector2 anchor, Vector2 pos, Vector2 size)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: 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_001b: 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_002d: Unknown result type (might be due to invalid IL or missing references)
		Vector2 anchorMin = (rt.anchorMax = anchor);
		rt.anchorMin = anchorMin;
		rt.pivot = new Vector2(0.5f, 0.5f);
		rt.anchoredPosition = pos;
		rt.sizeDelta = size;
	}

	private static void Stretch(RectTransform rt)
	{
		//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_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		rt.anchorMin = Vector2.zero;
		rt.anchorMax = Vector2.one;
		Vector2 offsetMin = (rt.offsetMax = Vector2.zero);
		rt.offsetMin = offsetMin;
	}

	private TextMeshProUGUI Text(Transform parent, string text, float size, Color color, TextAlignmentOptions align, Vector2 anchor, Vector2 pos, Vector2 box)
	{
		//IL_002c: 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_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		RectTransform val = Node(parent, "Text");
		TextMeshProUGUI val2 = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>();
		((TMP_Text)val2).font = font;
		((TMP_Text)val2).fontSize = size;
		((Graphic)val2).color = color;
		((TMP_Text)val2).alignment = align;
		((TMP_Text)val2).richText = true;
		((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
		((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
		((Graphic)val2).raycastTarget = false;
		((TMP_Text)val2).text = text;
		Place(val, anchor, pos, box);
		return val2;
	}

	private static void Outline(TextMeshProUGUI t, float strength)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		Material fontMaterial = ((TMP_Text)t).fontMaterial;
		fontMaterial.EnableKeyword(ShaderUtilities.Keyword_Underlay);
		fontMaterial.SetColor(ShaderUtilities.ID_UnderlayColor, new Color(0f, 0f, 0f, 0.8f));
		fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetX, 0.5f);
		fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayOffsetY, -0.5f);
		fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayDilate, 0.3f + strength);
		fontMaterial.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 0.35f);
		((TMP_Text)t).fontMaterial = fontMaterial;
	}

	private RectTransform ScrollArea(Transform parent, float top, float height, float contentHeight, float width)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: 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_00e4: 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_0155: Unknown result type (might be due to invalid IL or missing references)
		RectTransform val = Node(parent, "View");
		Vector2 anchorMin = (val.anchorMax = new Vector2(0.5f, 1f));
		val.anchorMin = anchorMin;
		val.pivot = new Vector2(0.5f, 1f);
		val.anchoredPosition = new Vector2(0f, 0f - top);
		val.sizeDelta = new Vector2(width, height);
		Image val3 = ((Component)val).gameObject.AddComponent<Image>();
		((Graphic)val3).color = new Color(0f, 0f, 0f, 0f);
		((Component)val).gameObject.AddComponent<RectMask2D>();
		RectTransform val4 = Node((Transform)(object)val, "Content");
		val4.anchorMin = new Vector2(0f, 1f);
		val4.anchorMax = new Vector2(1f, 1f);
		val4.pivot = new Vector2(0.5f, 1f);
		val4.anchoredPosition = Vector2.zero;
		val4.sizeDelta = new Vector2(0f, contentHeight);
		ScrollRect val5 = ((Component)val).gameObject.AddComponent<ScrollRect>();
		val5.horizontal = false;
		val5.vertical = true;
		val5.movementType = (MovementType)2;
		val5.scrollSensitivity = 45f;
		val5.viewport = val;
		val5.content = val4;
		AddScrollbar(parent, val5, new Vector2(width / 2f + 22f, 0f - top - height / 2f), height);
		return val4;
	}

	private void AddScrollbar(Transform parent, ScrollRect sr, Vector2 centre, float height)
	{
		//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_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		RectTransform val = Node(parent, "Scrollbar");
		Place(val, new Vector2(0.5f, 1f), centre, new Vector2(10f, height));
		Image val2 = ((Component)val).gameObject.AddComponent<Image>();
		((Graphic)val2).color = new Color(0.87f, 0.85f, 0.76f, 0.1f);
		RectTransform val3 = Node((Transform)(object)val, "Sliding Area");
		Stretch(val3);
		RectTransform val4 = Node((Transform)(object)val3, "Handle");
		Stretch(val4);
		Image val5 = ((Component)val4).gameObject.AddComponent<Image>();
		((Graphic)val5).color = new Color(0.87f, 0.85f, 0.76f, 0.75f);
		Scrollbar val6 = ((Component)val).gameObject.AddComponent<Scrollbar>();
		val6.handleRect = val4;
		((Selectable)val6).targetGraphic = (Graphic)(object)val5;
		val6.direction = (Direction)2;
		sr.verticalScrollbar = val6;
		sr.verticalScrollbarVisibility = (ScrollbarVisibility)1;
	}

	private Image Box(Transform parent, Color color, Vector2 anchor, Vector2 pos, Vector2 size)
	{
		//IL_0019: 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_0021: 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)
		RectTransform val = Node(parent, "Box");
		Image val2 = ((Component)val).gameObject.AddComponent<Image>();
		((Graphic)val2).color = color;
		Place(val, anchor, pos, size);
		return val2;
	}

	private Button Banner(Transform parent, string text, Color fill, Color border, Vector2 anchor, Vector2 pos, Vector2 size, float fontSize, UnityAction onClick)
	{
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: 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_01a8: Expected O, but got Unknown
		//IL_01ae: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Expected O, but got Unknown
		//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_01ff: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Expected O, but got Unknown
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
		GameObject val;
		TextMeshProUGUI val4;
		if ((Object)(object)buttonTemplate != (Object)null)
		{
			val = Object.Instantiate<GameObject>(buttonTemplate, parent, false);
			((Object)val).name = "Banner";
			val.SetActive(true);
			Component[] componentsInChildren = val.GetComponentsInChildren<Component>(true);
			foreach (Component val2 in componentsInChildren)
			{
				if ((Object)(object)val2 != (Object)null && ((object)val2).GetType().Name == "LocalizedText")
				{
					Object.DestroyImmediate((Object)(object)val2);
				}
			}
			StretchChildren((RectTransform)val.transform);
			Image[] componentsInChildren2 = val.GetComponentsInChildren<Image>(true);
			foreach (Image val3 in componentsInChildren2)
			{
				if (((Object)val3).name == "Panel")
				{
					((Graphic)val3).color = fill;
				}
				else if (((Object)val3).name == "Border")
				{
					((Graphic)val3).color = border;
				}
				else if (((Object)val3).name == "Glow")
				{
					Color color = ((Graphic)val3).color;
					color.a = 0f;
					((Graphic)val3).color = color;
				}
			}
			val4 = val.GetComponentInChildren<TextMeshProUGUI>(true);
		}
		else
		{
			RectTransform val5 = Node(parent, "Banner");
			val = ((Component)val5).gameObject;
			Image val6 = val.AddComponent<Image>();
			val6.sprite = bannerSprite;
			val6.type = (Type)1;
			((Graphic)val6).color = fill;
			((Selectable)val.AddComponent<Button>()).targetGraphic = (Graphic)(object)val6;
			val4 = Text(val.transform, "", fontSize, White, (TextAlignmentOptions)4098, new Vector2(0.5f, 0.5f), Vector2.zero, size);
			Stretch((RectTransform)((TMP_Text)val4).transform);
		}
		Place((RectTransform)val.transform, anchor, pos, size);
		((TMP_Text)val4).text = text;
		((TMP_Text)val4).font = font;
		((TMP_Text)val4).fontSize = fontSize;
		((TMP_Text)val4).enableAutoSizing = false;
		((Graphic)val4).color = White;
		Button component = val.GetComponent<Button>();
		component.onClick = new ButtonClickedEvent();
		((UnityEvent)component.onClick).AddListener(onClick);
		return component;
	}

	private static void StretchChildren(RectTransform parent)
	{
		//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_003e: Expected O, but got Unknown
		//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_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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: 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_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		Rect rect = parent.rect;
		if (((Rect)(ref rect)).width <= 0f || ((Rect)(ref rect)).height <= 0f)
		{
			return;
		}
		Vector2 anchorMin = default(Vector2);
		Vector2 anchorMax = default(Vector2);
		foreach (Transform item in (Transform)parent)
		{
			Transform val = item;
			RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null);
			if (!((Object)(object)val2 == (Object)null))
			{
				Vector3[] array = (Vector3[])(object)new Vector3[4];
				val2.GetLocalCorners(array);
				Vector2 val3 = Vector2.op_Implicit(((Transform)val2).localPosition) + Vector2.op_Implicit(array[0]);
				Vector2 val4 = Vector2.op_Implicit(((Transform)val2).localPosition) + Vector2.op_Implicit(array[2]);
				((Vector2)(ref anchorMin))..ctor((val3.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width, (val3.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height);
				((Vector2)(ref anchorMax))..ctor((val4.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width, (val4.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height);
				if (((Object)val2).name == "Border")
				{
					float num = val4.y - val3.y;
					float num2 = (anchorMin.y + anchorMax.y) / 2f;
					val2.anchorMin = new Vector2(anchorMin.x, num2);
					val2.anchorMax = new Vector2(anchorMax.x, num2);
					val2.offsetMin = new Vector2(0f, (0f - num) / 2f);
					val2.offsetMax = new Vector2(0f, num / 2f);
				}
				else
				{
					val2.anchorMin = anchorMin;
					val2.anchorMax = anchorMax;
					Vector2 offsetMin = (val2.offsetMax = Vector2.zero);
					val2.offsetMin = offsetMin;
				}
			}
		}
	}

	private static void SetBannerText(Button b, string text)
	{
		TextMeshProUGUI componentInChildren = ((Component)b).GetComponentInChildren<TextMeshProUGUI>(true);
		if ((Object)(object)componentInChildren != (Object)null)
		{
			((TMP_Text)componentInChildren).text = text;
		}
	}

	private static void SetBannerColor(Button b, Color fill, Color border)
	{
		//IL_0029: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		Image component = ((Component)b).GetComponent<Image>();
		if ((Object)(object)component != (Object)null && (Object)(object)((Component)b).transform.Find("Panel") == (Object)null)
		{
			((Graphic)component).color = fill;
			return;
		}
		Image[] componentsInChildren = ((Component)b).GetComponentsInChildren<Image>(true);
		foreach (Image val in componentsInChildren)
		{
			if (((Object)val).name == "Panel")
			{
				((Graphic)val).color = fill;
			}
			else if (((Object)val).name == "Border")
			{
				((Graphic)val).color = border;
			}
		}
	}

	private static void Clear(Transform t)
	{
		for (int num = t.childCount - 1; num >= 0; num--)
		{
			Object.Destroy((Object)(object)((Component)t.GetChild(num)).gameObject);
		}
	}

	private static string T(string zh, string en)
	{
		return Plugin.T(zh, en);
	}

	private static string Distance(Vector3 from, Character c)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		if (!(from != Vector3.zero) || !((Object)(object)c != (Object)null))
		{
			return "";
		}
		return Mathf.RoundToInt(Vector3.Distance(from, c.Center) * CharacterStats.unitsToMeters) + "m";
	}

	internal void ShowSelfPicker()
	{
		selfPicker = true;
		SetTab(0);
	}

	internal bool ShowPanel(bool open)
	{
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Expected O, but got Unknown
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		selfPicker = false;
		if (!open)
		{
			if ((Object)(object)panel != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)panel).gameObject);
			}
			panel = null;
			return true;
		}
		if (!Resolve())
		{
			return false;
		}
		if ((Object)(object)panel != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)panel).gameObject);
		}
		panel = Node((Transform)(object)root, "Panel");
		Stretch(panel);
		Canvas val = ((Component)panel).gameObject.AddComponent<Canvas>();
		val.overrideSorting = true;
		val.sortingOrder = 1100;
		((Component)panel).gameObject.AddComponent<GraphicRaycaster>();
		Image val2 = ((Component)panel).gameObject.AddComponent<Image>();
		((Graphic)val2).color = new Color(0f, 0f, 0f, 0.9f);
		Vector2 val3 = default(Vector2);
		((Vector2)(ref val3))..ctor(0.5f, 1f);
		Text((Transform)(object)panel, T("复活面板", "Revive panel"), 60f, Cream, (TextAlignmentOptions)4098, val3, new Vector2(0f, -105f), new Vector2(800f, 80f));
		string[] array = new string[3]
		{
			T("复活", "Revive"),
			T("排行榜", "Leaderboard"),
			T("设置", "Settings")
		};
		for (int i = 0; i < 3; i++)
		{
			int tab = i;
			tabs[i] = Banner((Transform)(object)panel, array[i], GreyP, GreyB, val3, new Vector2((float)(i - 1) * 250f, -200f), new Vector2(230f, 62f), 26f, (UnityAction)delegate
			{
				SetTab(tab);
			});
		}
		Text((Transform)(object)panel, T(string.Concat("按 ", Plugin.PanelKey.Value, " 关闭"), string.Concat("Press ", Plugin.PanelKey.Value, " to close")), 22f, Faded, (TextAlignmentOptions)4098, new Vector2(0.5f, 0f), new Vector2(0f, 60f), new Vector2(600f, 40f));
		page = Node((Transform)(object)panel, "Page");
		RectTransform obj = page;
		Vector2 anchorMin = (page.anchorMax = val3);
		obj.anchorMin = anchorMin;
		page.pivot = new Vector2(0.5f, 1f);
		page.anchoredPosition = new Vector2(0f, -265f);
		page.sizeDelta = new Vector2(1100f, 660f);
		SetTab(Tab);
		return true;
	}

	internal void SetTab(int tab)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		if (tab != 0)
		{
			selfPicker = false;
		}
		Tab = tab;
		Color[] array = (Color[])(object)new Color[3] { OrangeP, YellowP, BlueP };
		Color[] array2 = (Color[])(object)new Color[3] { OrangeB, YellowB, BlueB };
		for (int i = 0; i < 3; i++)
		{
			if ((Object)(object)tabs[i] != (Object)null)
			{
				SetBannerColor(tabs[i], (i == tab) ? array[i] : GreyP, (i == tab) ? array2[i] : GreyB);
			}
		}
		BuildPage();
	}

	private void BuildPage()
	{
		if (!((Object)(object)page == (Object)null))
		{
			Clear((Transform)(object)page);
			deadInfo.Clear();
			pickDistance.Clear();
			nearestCaption = null;
			settingRefresh.Clear();
			settingButtons.Clear();
			boardText = (boardTop = (boardHead = (costLine = null)));
			boardContent = null;
			if (Tab == 0)
			{
				BuildRevivePage();
			}
			else if (Tab == 1)
			{
				BuildBoardPage();
			}
			else
			{
				BuildSettingsPage();
			}
			pageSignature = Signature();
		}
	}

	private string Signature()
	{
		if (Tab != 0)
		{
			return "";
		}
		List<string> list = new List<string>();
		foreach (Character item in Plugin.DeadTeammates())
		{
			list.Add(((MonoBehaviourPun)item).photonView.ViewID.ToString());
		}
		if (selfPicker)
		{
			List<int> list2 = new List<int>();
			foreach (Character item2 in Plugin.AliveTeammates())
			{
				list2.Add(((MonoBehaviourPun)item2).photonView.ViewID);
			}
			list2.Sort();
			list.Add("|pick");
			foreach (int item3 in list2)
			{
				list.Add(item3.ToString());
			}
		}
		return string.Join(",", list.ToArray());
	}

	private void Update()
	{
		//IL_00ce: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)panel == (Object)null || Time.unscaledTime < nextRefresh)
		{
			return;
		}
		nextRefresh = Time.unscaledTime + 0.4f;
		if (Signature() != pageSignature)
		{
			BuildPage();
			return;
		}
		Character localCharacter = Character.localCharacter;
		foreach (KeyValuePair<Character, TextMeshProUGUI> item in deadInfo)
		{
			if ((Object)(object)item.Key != (Object)null && (Object)(object)item.Value != (Object)null)
			{
				((TMP_Text)item.Value).text = Plugin.Instance.DeadInfo(item.Key, localCharacter);
			}
		}
		Vector3 val = ((pickDistance.Count > 0) ? Plugin.SelfSpot() : Vector3.zero);
		foreach (KeyValuePair<Character, TextMeshProUGUI> item2 in pickDistance)
		{
			if ((Object)(object)item2.Key != (Object)null && (Object)(object)item2.Value != (Object)null)
			{
				((TMP_Text)item2.Value).text = Distance(val, item2.Key);
			}
		}
		if ((Object)(object)nearestCaption != (Object)null && (Object)(object)nearestShown != (Object)null)
		{
			((TMP_Text)nearestCaption).text = ShortName(nearestShown.characterName, 20) + "  ·  " + Distance(val, nearestShown);
		}
		if ((Object)(object)costLine != (Object)null)
		{
			((TMP_Text)costLine).text = CostText();
		}
		if ((Object)(object)boardText != (Object)null)
		{
			FillBoard();
		}
	}

	private string CostText()
	{
		if (Plugin.ReviveCost.Value == ReviveCostItem.None)
		{
			return "";
		}
		return T("每救一人消耗:", "Each revive uses: ") + Plugin.CostName() + ((Plugin.CostSlot(Character.localCharacter) >= 0) ? "" : Plugin.Warn(T("(你身上没有)", " (you have none)")));
	}

	private void BuildRevivePage()
	{
		//IL_005e: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: 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_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: 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_03fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: 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_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Expected O, but got Unknown
		//IL_0451: Unknown result type (might be due to invalid IL or missing references)
		//IL_0456: Unknown result type (might be due to invalid IL or missing references)
		//IL_045b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_0415: Unknown result type (might be due to invalid IL or missing references)
		//IL_041f: Expected O, but got Unknown
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: Expected O, but got Unknown
		Character localCharacter = Character.localCharacter;
		if (selfPicker && ((Object)(object)localCharacter == (Object)null || !localCharacter.data.dead))
		{
			selfPicker = false;
		}
		if (selfPicker)
		{
			BuildSelfPicker();
			return;
		}
		Vector2 anchor = default(Vector2);
		((Vector2)(ref anchor))..ctor(0.5f, 1f);
		costLine = Text((Transform)(object)page, CostText(), 24f, Faded, (TextAlignmentOptions)4098, anchor, new Vector2(0f, -18f), new Vector2(1000f, 36f));
		List<Character> list = Plugin.DeadTeammates();
		Character localCharacter2 = Character.localCharacter;
		if (list.Count == 0)
		{
			Text((Transform)(object)page, T("没有死亡的队友", "Nobody is dead"), 34f, Cream, (TextAlignmentOptions)4098, anchor, new Vector2(0f, -83f), new Vector2(1000f, 60f));
		}
		float num = (float)Mathf.Min(Mathf.Max(list.Count, 1), 6) * 74f;
		RectTransform parent = ScrollArea((Transform)(object)page, 46f, num, (float)list.Count * 74f, 1010f);
		for (int i = 0; i < list.Count; i++)
		{
			Character val = list[i];
			float num2 = -37f - (float)i * 74f;
			Box((Transform)(object)parent, new Color(0.87f, 0.85f, 0.76f, 0.07f), anchor, new Vector2(0f, num2), new Vector2(1000f, 64f));
			Text((Transform)(object)parent, ShortName(val.characterName, 18) + (val.IsLocal ? ("<color=" + Html(Faded) + ">" + T("(你)", " (you)") + "</color>") : ""), 32f, White, (TextAlignmentOptions)4097, anchor, new Vector2(-270f, num2), new Vector2(420f, 60f));
			TextMeshProUGUI value = Text((Transform)(object)parent, Plugin.Instance.DeadInfo(val, localCharacter2), 24f, Cream, (TextAlignmentOptions)4097, anchor, new Vector2(150f, num2), new Vector2(380f, 60f));
			deadInfo.Add(new KeyValuePair<Character, TextMeshProUGUI>(val, value));
			Character target = val;
			Banner((Transform)(object)parent, T("复活", "Revive"), OrangeP, OrangeB, anchor, new Vector2(410f, num2), new Vector2(170f, 54f), 24f, (UnityAction)delegate
			{
				Plugin.Instance.PanelRevive(target);
			});
		}
		if (list.Count > 6)
		{
			Text((Transform)(object)page, T("共 " + list.Count + " 人,滚动查看", list.Count + " in all, scroll for more"), 20f, Faded, (TextAlignmentOptions)4098, anchor, new Vector2(0f, -46f - num - 14f), new Vector2(600f, 26f));
		}
		float num3 = -46f - num - 60f;
		Button val2 = Banner((Transform)(object)page, string.Concat(T("全部复活", "Revive everyone"), "  (", Plugin.ReviveAllKey.Value, ")"), GreenP, GreenB, anchor, new Vector2(-170f, num3), new Vector2(320f, 64f), 26f, (UnityAction)delegate
		{
			Plugin.Instance.ReviveAll();
		});
		((Selectable)val2).interactable = list.Count > 0;
		Banner((Transform)(object)page, T("关闭", "Close"), RedP, RedB, anchor, new Vector2(170f, num3), new Vector2(220f, 64f), 26f, (UnityAction)delegate
		{
			Plugin.Instance.SetPanel(open: false);
		});
	}

	private void BuildSelfPicker()
	{
		//IL_0026: 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_0047: 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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Expected O, but got Unknown
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Expected O, but got Unknown
		//IL_04de: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_051a: Expected O, but got Unknown
		//IL_0480: Unknown result type (might be due to invalid IL or missing references)
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		Vector2 anchor = default(Vector2);
		((Vector2)(ref anchor))..ctor(0.5f, 1f);
		List<Character> list = Plugin.AliveTeammates();
		Vector3 val = Plugin.SelfSpot();
		Text((Transform)(object)page, T("复活到哪里?", "Where do you want to come back?"), 38f, White, (TextAlignmentOptions)4098, anchor, new Vector2(0f, -30f), new Vector2(1000f, 56f));
		Action<Character> go = delegate(Character beside)
		{
			if (Plugin.Instance.ReviveSelf(beside))
			{
				Plugin.Instance.SetPanel(open: false);
			}
		};
		Banner((Transform)(object)page, T("原地复活", "Right here"), OrangeP, OrangeB, anchor, new Vector2(-230f, -112f), new Vector2(400f, 64f), 27f, (UnityAction)delegate
		{
			go(null);
		});
		Character nearest = ((list.Count > 0) ? list[0] : null);
		Button val2 = Banner((Transform)(object)page, ((Object)(object)nearest != (Object)null) ? T("最近的队友旁", "Next to the nearest") : T("没有活着的队友", "Nobody is alive"), GreenP, GreenB, anchor, new Vector2(230f, -112f), new Vector2(400f, 64f), 25f, (UnityAction)delegate
		{
			go(nearest);
		});
		((Selectable)val2).interactable = (Object)(object)nearest != (Object)null;
		if ((Object)(object)nearest != (Object)null)
		{
			nearestCaption = Text((Transform)(object)page, "", 21f, Cream, (TextAlignmentOptions)4098, anchor, new Vector2(230f, -158f), new Vector2(400f, 28f));
			nearestShown = nearest;
			((TMP_Text)nearestCaption).text = ShortName(nearest.characterName, 20) + "  ·  " + Distance(val, nearest);
		}
		if (list.Count > 0)
		{
			Text((Transform)(object)page, T("或者选一个队友:", "Or pick a teammate:"), 26f, Faded, (TextAlignmentOptions)4097, anchor, new Vector2(-30f, -192f), new Vector2(1000f, 40f));
		}
		float num = (float)Mathf.Min(list.Count, 5) * 70f;
		RectTransform parent = ScrollArea((Transform)(object)page, 218f, Mathf.Max(num, 1f), (float)list.Count * 70f, 1010f);
		for (int num2 = 0; num2 < list.Count; num2++)
		{
			Character val3 = list[num2];
			float num3 = -35f - (float)num2 * 70f;
			Box((Transform)(object)parent, new Color(0.87f, 0.85f, 0.76f, 0.07f), anchor, new Vector2(0f, num3), new Vector2(1000f, 60f));
			Text((Transform)(object)parent, ShortName(val3.characterName, 22), 30f, White, (TextAlignmentOptions)4097, anchor, new Vector2(-270f, num3), new Vector2(420f, 58f));
			TextMeshProUGUI value = Text((Transform)(object)parent, Distance(val, val3), 24f, Cream, (TextAlignmentOptions)4097, anchor, new Vector2(150f, num3), new Vector2(300f, 58f));
			pickDistance.Add(new KeyValuePair<Character, TextMeshProUGUI>(val3, value));
			Character target = val3;
			Banner((Transform)(object)parent, T("复活到他旁边", "Go there"), BlueP, BlueB, anchor, new Vector2(390f, num3), new Vector2(210f, 52f), 23f, (UnityAction)delegate
			{
				go(target);
			});
		}
		if (list.Count > 5)
		{
			Text((Transform)(object)page, T("共 " + list.Count + " 人,滚动查看", list.Count + " in all, scroll for more"), 20f, Faded, (TextAlignmentOptions)4098, anchor, new Vector2(0f, -218f - num - 14f), new Vector2(600f, 26f));
		}
		float num4 = -218f - num - 60f;
		Banner((Transform)(object)page, T("返回", "Back"), GreyP, GreyB, anchor, new Vector2(0f, num4), new Vector2(220f, 60f), 25f, (UnityAction)delegate
		{
			selfPicker = false;
			BuildPage();
		});
	}

	private void BuildBoardPage()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Expected O, but got Unknown
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: 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_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: 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_01bb: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		Vector2 anchor = default(Vector2);
		((Vector2)(ref anchor))..ctor(0.5f, 1f);
		Banner((Transform)(object)page, T("本局", "This run"), leaderboardAllTime ? GreyP : BlueP, leaderboardAllTime ? GreyB : BlueB, anchor, new Vector2(-110f, -30f), new Vector2(200f, 54f), 24f, (UnityAction)delegate
		{
			leaderboardAllTime = false;
			BuildPage();
		});
		Banner((Transform)(object)page, T("总计", "All time"), leaderboardAllTime ? BlueP : GreyP, leaderboardAllTime ? BlueB : GreyB, anchor, new Vector2(110f, -30f), new Vector2(200f, 54f), 24f, (UnityAction)delegate
		{
			leaderboardAllTime = true;
			BuildPage();
		});
		boardTop = Text((Transform)(object)page, "", 30f, Cream, (TextAlignmentOptions)4098, anchor, new Vector2(0f, -105f), new Vector2(1050f, 50f));
		boardHead = Text((Transform)(object)page, "", 26f, Gold, (TextAlignmentOptions)4097, anchor, new Vector2(0f, -160f), new Vector2(900f, 40f));
		boardContent = ScrollArea((Transform)(object)page, 186f, 392f, 56f, 920f);
		boardText = Text((Transform)(object)boardContent, "", 30f, White, (TextAlignmentOptions)257, anchor, new Vector2(0f, -1000f), new Vector2(900f, 2000f));
		FillBoard();
	}

	private void FillBoard()
	{
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: 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)
		Dictionary<int, Plugin.Stat> dictionary = (leaderboardAllTime ? Plugin.Instance.allStats : Plugin.Instance.runStats);
		Plugin.Stat stat = Plugin.Top(dictionary, (Plugin.Stat st) => st.deaths);
		Plugin.Stat stat2 = Plugin.Top(dictionary, (Plugin.Stat st) => st.given);
		((TMP_Text)boardTop).text = T("死得最多:", "Died most: ") + ((stat != null) ? (ShortName(stat.name, 14) + "<color=" + Html(Faded) + ">" + T("(" + stat.deaths + " 次)", " (" + stat.deaths + ")") + "</color>") : "—") + "        " + T("救人最多:", "Saved most: ") + ((stat2 != null) ? (ShortName(stat2.name, 14) + "<color=" + Html(Faded) + ">" + T("(" + stat2.given + " 次)", " (" + stat2.given + ")") + "</color>") : "—");
		StringBuilder stringBuilder = new StringBuilder();
		((TMP_Text)boardHead).text = T("玩家", "Player") + "<pos=44%>" + T("死亡", "Deaths") + "<pos=58%>" + T("昏迷", "Pass-outs") + "<pos=72%>" + T("救人", "Revived others") + "<pos=88%>" + T("被救", "Got revived");
		stringBuilder.Append("<line-height=56>");
		List<Plugin.Stat> list = new List<Plugin.Stat>(dictionary.Values);
		list.Sort((Plugin.Stat a, Plugin.Stat b) => (b.deaths == a.deaths) ? b.given.CompareTo(a.given) : b.deaths.CompareTo(a.deaths));
		if (list.Count == 0)
		{
			stringBuilder.Append("<color=" + Html(Faded) + ">" + T("还没有记录", "Nothing yet") + "</color>");
		}
		foreach (Plugin.Stat item in list)
		{
			stringBuilder.Append(ShortName(item.name, 22) + "<pos=46%>" + item.deaths + "<pos=60%>" + item.passOuts + "<pos=75%>" + item.given + "<pos=90%>" + item.revived + "\n");
		}
		((TMP_Text)boardText).text = stringBuilder.ToString();
		if ((Object)(object)boardContent != (Object)null)
		{
			boardContent.sizeDelta = new Vector2(0f, (float)Mathf.Max(1, list.Count) * 56f);
		}
	}

	private static string KeyZh(ConfigEntryBase e)
	{
		string key = e.Definition.Key;
		int num = key.IndexOf(" / ");
		if (num >= 0)
		{
			return key.Substring(0, num);
		}
		return key;
	}

	private static string KeyEn(ConfigEntryBase e)
	{
		string key = e.Definition.Key;
		int num = key.IndexOf(" / ");
		if (num >= 0)
		{
			return key.Substring(num + 3);
		}
		return key;
	}

	private static string EnumName(object v)
	{
		return v.ToString() switch
		{
			"Body" => T("倒下处", "Where they fell"), 
			"Reviver" => T("救人者身边", "Next to the reviver"), 
			"Campfire" => T("最近的营火", "Nearest campfire"), 
			"Ask" => T("每次选择", "Ask each time"), 
			"NearestTeammate" => T("最近的队友旁", "Next to the nearest teammate"), 
			"None" => T("不消耗", "Nothing"), 
			"Bandage" => T("绷带", "Bandage"), 
			"FirstAidKit" => T("急救包", "First-aid kit"), 
			"AnyMedical" => T("任一医疗品", "Any medical item"), 
			"Auto" => T("跟随游戏", "Follow the game"), 
			"Chinese" => "中文", 
			"English" => "English", 
			_ => v.ToString(), 
		};
	}

	private void BuildSettingsPage()
	{
		//IL_0031: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_0138: 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_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_050d: Unknown result type (might be due to invalid IL or missing references)
		//IL_051c: Unknown result type (might be due to invalid IL or missing references)
		//IL_052b: Unknown result type (might be due to invalid IL or missing references)
		RectTransform val = Node((Transform)(object)page, "View");
		Stretch(val);
		val.offsetMin = new Vector2(0f, 50f);
		Image val2 = ((Component)val).gameObject.AddComponent<Image>();
		((Graphic)val2).color = new Color(0f, 0f, 0f, 0f);
		((Component)val).gameObject.AddComponent<RectMask2D>();
		RectTransform content = Node((Transform)(object)val, "Content");
		content.anchorMin = new Vector2(0f, 1f);
		content.anchorMax = new Vector2(1f, 1f);
		content.pivot = new Vector2(0.5f, 1f);
		content.anchoredPosition = Vector2.zero;
		ScrollRect val3 = ((Component)val).gameObject.AddComponent<ScrollRect>();
		val3.horizontal = false;
		val3.vertical = true;
		val3.movementType = (MovementType)2;
		val3.scrollSensitivity = 45f;
		val3.viewport = val;
		val3.content = content;
		AddScrollbar((Transform)(object)page, val3, new Vector2(560f, -305f), 600f);
		float y = -10f;
		Action<string, string> action = delegate(string zh, string en)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			y -= 40f;
			Text((Transform)(object)content, T(zh, en), 30f, Gold, (TextAlignmentOptions)4097, new Vector2(0.5f, 1f), new Vector2(-30f, y), new Vector2(1000f, 46f));
			y -= 52f;
		};
		Action<ConfigEntryBase, string, string, float, string> action2 = delegate(ConfigEntryBase e, string zh, string en, float step, string zero)
		{
			AddSetting(content, e, zh, en, step, zero, y);
			y -= 60f;
		};
		action("复活方式", "Ways to revive");
		action2((ConfigEntryBase)(object)Plugin.HoldEnabled, "长按骸骨复活", "Hold to revive", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.HoldSeconds, "\u3000按住秒数", "  Hold seconds", 0.5f, null);
		action2((ConfigEntryBase)(object)Plugin.HoldPlace, "\u3000长按复活的位置", "  Hold revive place", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.ReviveAllEnabled, string.Concat("一键全体复活(", Plugin.ReviveAllKey.Value, ")"), string.Concat("Revive all (", Plugin.ReviveAllKey.Value, ")"), 0f, null);
		action2((ConfigEntryBase)(object)Plugin.ReviveAllIncludesDowned, "\u3000包括昏迷的人", "  Include passed-out", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.ReviveAllPlace, "\u3000全体复活和面板复活的位置", "  Revive all / panel place", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.SelfPlace, "\u3000复活自己时的位置", "  Reviving yourself", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.AutoEnabled, "自动复活", "Auto revive", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.AutoDelay, "\u3000等待秒数", "  Delay seconds", 5f, null);
		action2((ConfigEntryBase)(object)Plugin.AutoPlace, "\u3000自动复活的位置", "  Auto revive place", 0f, null);
		action("通用", "General");
		action2((ConfigEntryBase)(object)Plugin.ApplyPenalty, "原版复活惩罚", "Vanilla penalty", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.ProtectionSeconds, "复活保护秒数", "Revive protection (s)", 1f, T("关", "Off"));
		action2((ConfigEntryBase)(object)Plugin.KeepItems, "死亡保留物品", "Keep items on death", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.KeepItemsOnPassOut, "昏迷不掉落", "Keep items on pass out", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.BackpackReturns, "复活时背包回到背上", "Backpack returns on revive", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.ReviveLog, "复活记录(谁救了谁)", "Revive log", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.Notify, "消息栏提示", "Messages", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.Language, "提示语言", "Language", 0f, null);
		action("限制与代价", "Limits & costs");
		action2((ConfigEntryBase)(object)Plugin.MaxRevives, "每人每局复活次数", "Max revives per player", 1f, T("不限", "Unlimited"));
		action2((ConfigEntryBase)(object)Plugin.ReviverHungerCost, "救人饥饿代价", "Reviver hunger cost", 0.05f, T("关", "Off"));
		action2((ConfigEntryBase)(object)Plugin.ReviveCost, "救人消耗物品", "Revive item cost", 0f, null);
		action("显示", "Display");
		action2((ConfigEntryBase)(object)Plugin.MarkersEnabled, "骸骨指引", "Skeleton markers", 0f, null);
		action2((ConfigEntryBase)(object)Plugin.MarkersMaxDistance, "\u3000最大显示距离(米)", "  Max distance (m)", 50f, T("不限", "Unlimited"));
		action2((ConfigEntryBase)(object)Plugin.LeaderboardEnabled, "左上角排行榜", "Corner leaderboard", 0f, null);
		content.sizeDelta = new Vector2(0f, 0f - y + 20f);
		Text((Transform)(object)page, T("按键在游戏的 Mod 设置里改", "Change hotkeys in the game's Mod Settings"), 20f, Faded, (TextAlignmentOptions)4098, new Vector2(0.5f, 0f), new Vector2(0f, 20f), new Vector2(1000f, 30f));
	}

	private void AddSetting(RectTransform content, ConfigEntryBase e, string zh, string en, float step, string zeroText, float y)
	{
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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_0099: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Expected O, but got Unknown
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Expected O, but got Unknown
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Expected O, but got Unknown
		//IL_0312: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Expected O, but got Unknown
		UnityAction val = null;
		UnityAction val2 = null;
		UnityAction val3 = null;
		Vector2 val4 = default(Vector2);
		((Vector2)(ref val4))..ctor(0.5f, 1f);
		Box((Transform)(object)content, new Color(0.87f, 0.85f, 0.76f, 0.045f), val4, new Vector2(0f, y), new Vector2(1060f, 54f));
		Text((Transform)(object)content, T(zh, en), 27f, Cream, (TextAlignmentOptions)4097, val4, new Vector2(-230f, y), new Vector2(560f, 54f));
		Type type = e.SettingType;
		if (type == typeof(bool))
		{
			ConfigEntry<bool> entry = (ConfigEntry<bool>)(object)e;
			Button b = null;
			b = Banner((Transform)(object)content, "", GreenP, GreenB, val4, new Vector2(400f, y), new Vector2(170f, 48f), 24f, (UnityAction)delegate
			{
				entry.Value = !entry.Value;
				RefreshSettings();
			});
			settingButtons[e] = b;
			settingRefresh.Add(delegate
			{
				//IL_0052: 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_006b: 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)
				SetBannerText(b, entry.Value ? T("开", "On") : T("关", "Off"));
				SetBannerColor(b, entry.Value ? GreenP : GreyP, entry.Value ? GreenB : GreyB);
			});
		}
		else if (type.IsEnum)
		{
			Button b2 = null;
			Color blueP = BlueP;
			Color blueB = BlueB;
			Vector2 anchor = val4;
			Vector2 pos = new Vector2(345f, y);
			Vector2 size = new Vector2(280f, 48f);
			if (val == null)
			{
				val = (UnityAction)delegate
				{
					Array values = Enum.GetValues(type);
					int num = Array.IndexOf(values, e.BoxedValue);
					e.BoxedValue = values.GetValue((num + 1) % values.Length);
					RefreshSettings();
				};
			}
			b2 = Banner((Transform)(object)content, "", blueP, blueB, anchor, pos, size, 23f, val);
			settingButtons[e] = b2;
			settingRefresh.Add(delegate
			{
				SetBannerText(b2, EnumName(e.BoxedValue));
			});
		}
		else
		{
			TextMeshProUGUI value = Text((Transform)(object)content, "", 27f, White, (TextAlignmentOptions)4098, val4, new Vector2(345f, y), new Vector2(140f, 54f));
			Color blueP2 = BlueP;
			Color blueB2 = BlueB;
			Vector2 anchor2 = val4;
			Vector2 pos2 = new Vector2(240f, y);
			Vector2 size2 = new Vector2(64f, 46f);
			if (val2 == null)
			{
				val2 = (UnityAction)delegate
				{
					Step(e, 0f - step);
					RefreshSettings();
				};
			}
			Banner((Transform)(object)content, "−", blueP2, blueB2, anchor2, pos2, size2, 28f, val2);
			Color blueP3 = BlueP;
			Color blueB3 = BlueB;
			Vector2 anchor3 = val4;
			Vector2 pos3 = new Vector2(450f, y);
			Vector2 size3 = new Vector2(64f, 46f);
			if (val3 == null)
			{
				val3 = (UnityAction)delegate
				{
					Step(e, step);
					RefreshSettings();
				};
			}
			Button value2 = Banner((Transform)(object)content, "+", blueP3, blueB3, anchor3, pos3, size3, 28f, val3);
			settingButtons[e] = value2;
			settingRefresh.Add(delegate
			{
				double num = Convert.ToDouble(e.BoxedValue);
				((TMP_Text)value).text = ((num <= 0.0001 && zeroText != null) ? zeroText : ((step < 1f) ? num.ToString("0.##") : num.ToString("0")));
			});
		}
		settingRefresh[settingRefresh.Count - 1]();
	}

	private static void Step(ConfigEntryBase e, float step)
	{
		double num = Convert.ToDouble(e.BoxedValue) + (double)step;
		object obj = ((e.SettingType == typeof(int)) ? ((object)(int)Math.Round(num)) : ((object)(float)Math.Round(num, 2)));
		if (e.Description.AcceptableValues != null)
		{
			obj = e.Description.AcceptableValues.Clamp(obj);
		}
		e.BoxedValue = obj;
	}

	private void RefreshSettings()
	{
		foreach (Action item in settingRefresh)
		{
			item();
		}
	}

	private void UpdateCorner()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: 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_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Expected O, but got Unknown
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		if (!Plugin.LeaderboardEnabled.Value || !PhotonCheck() || !((Object)(object)Plugin.Instance != (Object)null) || !((Object)(object)font != (Object)null))
		{
			if ((Object)(object)corner != (Object)null)
			{
				((Component)corner).gameObject.SetActive(false);
			}
			return;
		}
		if ((Object)(object)corner == (Object)null)
		{
			corner = Node((Transform)(object)root, "CornerLeaderboard");
			RectTransform obj = corner;
			Vector2 anchorMin = (corner.anchorMax = new Vector2(0f, 1f));
			obj.anchorMin = anchorMin;
			corner.pivot = new Vector2(0f, 1f);
			corner.anchoredPosition = new Vector2(18f, -230f);
			Image val2 = ((Component)corner).gameObject.AddComponent<Image>();
			((Graphic)val2).color = new Color(0f, 0f, 0f, 0.32f);
			((Graphic)val2).raycastTarget = false;
			cornerText = Text((Transform)(object)corner, "", 21f, Cream, (TextAlignmentOptions)257, new Vector2(0f, 1f), Vector2.zero, new Vector2(300f, 200f));
			RectTransform val3 = (RectTransform)((TMP_Text)cornerText).transform;
			val3.pivot = new Vector2(0f, 1f);
			val3.anchoredPosition = new Vector2(10f, -6f);
			Outline(cornerText, 0.08f);
			((Transform)corner).SetAsFirstSibling();
		}
		((Component)corner).gameObject.SetActive(true);
		if (!(Time.unscaledTime < nextCorner))
		{
			nextCorner = Time.unscaledTime + 1f;
			((TMP_Text)cornerText).text = CornerText();
			Vector2 preferredValues = ((TMP_Text)cornerText).GetPreferredValues(((TMP_Text)cornerText).text);
			corner.sizeDelta = new Vector2(Mathf.Max(220f, preferredValues.x + 20f), preferredValues.y + 12f);
		}
	}

	private static bool PhotonCheck()
	{
		if (PhotonNetwork.InRoom)
		{
			return (Object)(object)Character.localCharacter != (Object)null;
		}
		return false;
	}

	internal static string CornerText()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<int, Plugin.Stat> runStats = Plugin.Instance.runStats;
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.Append("<color=" + Html(Gold) + ">" + T("排行榜·本局", "This run") + "<pos=165>" + T("死亡", "Died") + "<pos=230>" + T("救人", "Saved") + "</color>");
		List<Plugin.Stat> list = new List<Plugin.Stat>(runStats.Values);
		list.Sort((Plugin.Stat a, Plugin.Stat b) => (b.deaths == a.deaths) ? b.given.CompareTo(a.given) : b.deaths.CompareTo(a.deaths));
		if (list.Count == 0)
		{
			stringBuilder.Append("\n<color=" + Html(Faded) + ">" + T("还没有记录", "Nothing yet") + "</color>");
		}
		for (int num = 0; num < list.Count && num < 4; num++)
		{
			stringBuilder.Append("\n" + ShortName(list[num].name, 14) + "<pos=175>" + list[num].deaths + "<pos=240>" + list[num].given);
		}
		return stringBuilder.ToString();
	}

	private void LateUpdate()
	{
		if (!((Object)(object)Plugin.Instance == (Object)null) && (!((Object)(object)font == (Object)null) || Resolve()))
		{
			UpdateCorner();
			UpdateCountdown();
			UpdateMarkers();
		}
	}

	private void UpdateCountdown()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		float num = (PhotonCheck() ? Plugin.Instance.AutoReviveRemaining() : (-1f));
		if (num < 0f)
		{
			if ((Object)(object)countdown != (Object)null)
			{
				((Component)countdown).gameObject.SetActive(false);
			}
			return;
		}
		if ((Object)(object)countdown == (Object)null)
		{
			countdown = Text((Transform)(object)root, "", 40f, Hex("FFE073"), (TextAlignmentOptions)4098, new Vector2(0.5f, 1f), new Vector2(0f, -190f), new Vector2(900f, 60f));
			Outline(countdown, 0.1f);
			((TMP_Text)countdown).transform.SetAsFirstSibling();
		}
		((Component)countdown).gameObject.SetActive(true);
		((TMP_Text)countdown).text = ((num > 0.05f) ? T(Mathf.CeilToInt(num) + " 秒后自动复活", "Auto revive in " + Mathf.CeilToInt(num) + "s") : T("正在复活…", "Reviving..."));
	}

	private void UpdateMarkers()
	{
		//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_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: 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_00de: 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_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: 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)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		Camera val = Plugin.GameCamera();
		Character localCharacter = Character.localCharacter;
		if (Plugin.MarkersEnabled.Value && (Object)(object)panel == (Object)null && PhotonCheck() && (Object)(object)val != (Object)null && (Object)(object)localCharacter != (Object)null)
		{
			float num2 = 48f;
			Rect rect = root.rect;
			Vector2 val2 = ((Rect)(ref rect)).size / 2f;
			Vector2 val4 = default(Vector2);
			foreach (Plugin.Mark item in Plugin.Instance.CollectMarks())
			{
				float num3 = Vector3.Distance(localCharacter.Center, item.world) * CharacterStats.unitsToMeters;
				if (Plugin.MarkersMaxDistance.Value > 0f && num3 > Plugin.MarkersMaxDistance.Value)
				{
					continue;
				}
				Vector3 val3 = val.WorldToScreenPoint(item.world);
				bool flag = val3.z < 0f;
				if (flag)
				{
					val3.x = (float)Screen.width - val3.x;
					val3.y = (float)Screen.height - val3.y;
				}
				RectTransformUtility.ScreenPointToLocalPointInRectangle(root, new Vector2(val3.x, val3.y), (Camera)null, ref val4);
				bool flag2 = flag || Mathf.Abs(val4.x) > val2.x - num2 || Mathf.Abs(val4.y) > val2.y - num2;
				string text = "";
				if (flag2)
				{
					Vector2 val5 = val4;
					if (flag && ((Vector2)(ref val5)).sqrMagnitude < 1f)
					{
						((Vector2)(ref val5))..ctor(0f, -1f);
					}
					float num4 = Mathf.Min((val2.x - num2) / Mathf.Max(Mathf.Abs(val5.x), 0.001f), (val2.y - num2) / Mathf.Max(Mathf.Abs(val5.y), 0.001f));
					val4 = val5 * num4;
					text = ((!(Mathf.Abs(val5.x) > Mathf.Abs(val5.y))) ? ((val5.y > 0f) ? " ^" : " v") : ((val5.x > 0f) ? " >" : "< "));
				}
				string text2 = item.prefix + (((Object)(object)item.who != (Object)null) ? ShortName(item.who.characterName, 18) : "") + "  <color=" + Html(Cream) + ">" + Mathf.RoundToInt(num3) + "m</color>";
				if (num >= markerPool.Count)
				{
					TextMeshProUGUI val6 = Text((Transform)(object)root, "", 24f, Hex("A6FFE6"), (TextAlignmentOptions)4098, new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(600f, 40f));
					Outline(val6, 0.1f);
					((TMP_Text)val6).transform.SetAsFirstSibling();
					markerPool.Add(val6);
				}
				TextMeshProUGUI val7 = markerPool[num++];
				((Component)val7).gameObject.SetActive(true);
				((Graphic)val7).color = (((Object)(object)item.who == (Object)null) ? Hex("F2CC8C") : Hex("A6FFE6"));
				((TMP_Text)val7).text = (text.StartsWith("<") ? (text + text2) : (text2 + text));
				((RectTransform)((TMP_Text)val7).transform).anchoredPosition = val4;
			}
		}
		for (int i = num; i < markerPool.Count; i++)
		{
			((Component)markerPool[i]).gameObject.SetActive(false);
		}
	}
}
public enum TextLanguage
{
	Auto,
	Chinese,
	English
}
public enum RevivePlace
{
	Body,
	Reviver,
	Campfire
}
public enum ReviveCostItem
{
	None,
	Bandage,
	FirstAidKit,
	AnyMedical
}
public enum SelfRevivePlace
{
	Ask,
	Body,
	NearestTeammate
}
[BepInPlugin("com.hostrevivemodfx", "HostReviveModFX", "1.0.7")]
public class Plugin : BaseUnityPlugin
{
	internal class Stat
	{
		public string name;

		public int deaths;

		public int passOuts;

		public int revived;

		public int given;

		public int helped;
	}

	internal class Mark
	{
		public Vector3 world;

		public string prefix;

		public Character who;
	}

	public const string Guid = "com.hostrevivemodfx";

	public const string Version = "1.0.7";

	private const string PropKey = "HostReviveModFX";

	private const string AutoKey = "HRFX_Auto";

	private const float RequestCooldown = 3f;

	private const string CountKey = "HRFX_Revives";

	private const byte ReviveEventCode = 177;

	internal static Plugin Instance;

	internal static ConfigEntry<bool> HoldEnabled;

	internal static ConfigEntry<float> HoldSeconds;

	internal static ConfigEntry<RevivePlace> HoldPlace;

	internal static ConfigEntry<bool> ReviveAllEnabled;

	internal static ConfigEntry<KeyCode> ReviveAllKey;

	internal static ConfigEntry<bool> KeepItems;

	internal static ConfigEntry<bool> KeepItemsOnPassOut;

	internal static ConfigEntry<bool> ReviveAllIncludesDowned;

	internal static ConfigEntry<RevivePlace> ReviveAllPlace;

	internal static ConfigEntry<bool> AutoEnabled;

	internal static ConfigEntry<float> AutoDelay;

	internal static ConfigEntry<RevivePlace> AutoPlace;

	internal static ConfigEntry<bool> ApplyPenalty;

	internal static ConfigEntry<bool> Notify;

	internal static ConfigEntry<TextLanguage> Language;

	internal static ConfigEntry<bool> SoloTestMode;

	internal static ConfigEntry<float> ProtectionSeconds;

	internal static ConfigEntry<KeyCode> SelfTestKey;

	internal static ConfigEntry<bool> AutoSelfTest;

	internal static ConfigEntry<int> MaxRevives;

	internal static ConfigEntry<float> ReviverHungerCost;

	internal static ConfigEntry<bool> MarkersEnabled;

	internal static ConfigEntry<float> MarkersMaxDistance;

	internal static ConfigEntry<bool> PanelEnabled;

	internal static ConfigEntry<KeyCode> PanelKey;

	internal static ConfigEntry<SelfRevivePlace> SelfPlace;

	internal static ConfigEntry<bool> LeaderboardEnabled;

	internal static ConfigEntry<bool> BackpackReturns;

	internal static ConfigEntry<bool> ReviveLog;

	internal static ConfigEntry<ReviveCostItem> ReviveCost;

	private static readonly FieldInfo SpawnedFromField = AccessTools.Field(typeof(Skelleton), "spawnedFromCharacter");

	private static readonly MethodInfo HasBookMethod = AccessTools.Method(typeof(Skelleton), "CharacterHasBook", (Type[])null, (Type[])null);

	private static readonly MethodInfo AddMessageMethod = AccessTools.Method(typeof(PlayerConnectionLog), "AddMessage", (Type[])null, (Type[])null);

	private readonly Dictionary<int, float> deadSince = new Dictionary<int, float>();

	private readonly Dictionary<int, float> lastRequest = new Dictionary<int, float>();

	private PlayerConnectionLog messageLog;

	private float lastAdvertise = -999f;

	private string lastScene;

	internal static string lastPlacement = "";

	internal static Vector3 lastPlacementPos;

	internal static bool testIgnoreBody;

	internal static bool testIgnoreCampfire;

	private static int groundMask;

	internal static readonly Dictionary<int, Skelleton> latestSkeleton = new Dictionary<int, Skelleton>();

	private static readonly Dictionary<int, Vector3> lastAlive = new Dictionary<int, Vector3>();

	private string lastAliveScene;

	private readonly HashSet<string> versionWarned = new HashSet<string>();

	private int runRevives;

	private readonly Dictionary<int, float> loggedRevive = new Dictionary<int, float>();

	private readonly Dictionary<int, float> revivedAt = new Dictionary<int, float>();

	internal static string lastLog = "";

	internal readonly Dictionary<int, Stat> runStats = new Dictionary<int, Stat>();

	internal readonly Dictionary<int, Stat> allStats = new Dictionary<int, Stat>();

	private readonly HashSet<int> passedOutSeen = new HashSet<int>();

	private static readonly string[][] CostKeys = new string[4][]
	{
		new string[0],
		new string[1] { "bandage" },
		new string[1] { "firstaid" },
		new string[7] { "bandage", "firstaid", "cureall", "antidote", "medicinal", "remedy", "heal" }
	};

	private bool panelOpen;

	private static readonly MethodInfo WheelActiveGetter = AccessTools.PropertyGetter(typeof(GUIManager), "wheelActive");

	internal static readonly FieldInfo PauseMenuField = AccessTools.Field(typeof(GUIManager), "pauseMenu");

	private float autoMenuSeen = -1f;

	private float autoAliveSince = -1f;

	private bool autoStarted;

	private bool autoTested;

	private bool autoBoarded;

	private static bool recordFootage;

	private bool selfTestRunning;

	private int testFails;

	private static readonly FieldInfo InvincibleField = AccessTools.Field(typeof(CharacterData), "isInvincible");

	private static readonly FieldInfo ItemsViewField = AccessTools.Field(typeof(CharacterItems), "photonView");

	private readonly List<Skelleton> markers = new List<Skelleton>();

	private readonly List<Character> zombieMarkers = new List<Character>();

	private readonly Dictionary<int, MushroomZombie> liveZombies = new Dictionary<int, MushroomZombie>();

	internal static readonly Dictionary<int, Vector3> zombifiedAt = new Dictionary<int, Vector3>();

	private static readonly FieldInfo ZombieSourceField = AccessTools.Field(typeof(MushroomZombie), "spawnedFromCharacter");

	private float lastMarkerScan = -999f;

	internal bool PanelOpen => panelOpen;

	private void Awake()
	{
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Expected O, but got Unknown
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Expected O, but got Unknown
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Expected O, but got Unknown
		//IL_0386: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Expected O, but got Unknown
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Expected O, but got Unknown
		//IL_0462: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Expected O, but got Unknown
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_047c: Expected O, but got Unknown
		Instance = this;
		HoldEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1. 长按复活 / Hold Revive", "启用 / Enabled", true, "对着队友的骸骨按住交互键即可复活他,不需要亡灵之书。\nHold the interact key on a dead teammate's skeleton to revive them, no Book of Bones needed.");
		HoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("1. 长按复活 / Hold Revive", "按住秒数 / Hold Seconds", 3f, new ConfigDescription("需要按住多久。\nHow long to hold.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f), new object[0]));
		HoldPlace = ((BaseUnityPlugin)this).Config.Bind<RevivePlace>("1. 长按复活 / Hold Revive", "复活位置 / Revive Place", RevivePlace.Body, "Body = 骸骨所在处;Reviver = 救人者身边;Campfire = 最近的已点燃营火。\nBody = at the skeleton; Reviver = next to you; Campfire = nearest lit campfire.");
		ReviveAllEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. 一键全体复活 / Revive All", "启用 / Enabled", true, "按快捷键复活所有死亡的队友。\nPress the hotkey to revive every dead teammate.");
		ReviveAllKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("2. 一键全体复活 / Revive All", "快捷键 / Hotkey", (KeyCode)121, "全体复活快捷键,可在 Mod 设置里直接改。长按复活用的是游戏的交互键,在游戏自己的按键设置里改。\nRevive-all hotkey, editable in the Mod Settings menu. Hold revive uses the game's Interact key; rebind it in the game's own controls.");
		ReviveAllIncludesDowned = ((BaseUnityPlugin)this).Config.Bind<bool>("2. 一键全体复活 / Revive All", "包括昏迷的人 / Include Downed", true, "同时救起还没死、但已彻底昏迷倒地的队友(和原版复活雕像一致)。\nAlso revive teammates who are fully passed out but not yet dead (same as the vanilla statue).");
		ReviveAllPlace = ((BaseUnityPlugin)this).Config.Bind<RevivePlace>("2. 一键全体复活 / Revive All", "复活位置 / Revive Place", RevivePlace.Body, "Body = 各自倒下的地方;Reviver = 按键人身边;Campfire = 最近的已点燃营火。\nBody = where each one fell; Reviver = next to you; Campfire = nearest lit campfire.");
		PanelEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("2. 一键全体复活 / Revive All", "复活面板 / Revive Panel", true, "按面板快捷键打开复活面板:列出所有死亡的队友,点谁复活谁,不用走过去;也能一键全体复活。开着面板时鼠标可以点,人物不会动。复活位置和全体复活相同。\nPress the panel key to open the revive panel: it lists every dead teammate, click one to revive just them from anywhere, or revive everyone. The mouse is free and your character stays put while it is open. Uses the Revive All place.");
		PanelKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("2. 一键全体复活 / Revive All", "面板快捷键 / Panel Hotkey", (KeyCode)117, "打开/关闭复活面板的按键,可在 Mod 设置里直接改。\nKey that opens and closes the revive panel, editable in the Mod Settings menu.");
		SelfPlace = ((BaseUnityPlugin)this).Config.Bind<SelfRevivePlace>("2. 一键全体复活 / Revive All", "自救复活位置 / Self Revive Place", SelfRevivePlace.Ask, "自己死了、用全体复活键或复活面板复活自己时出现在哪:Ask = 每次在面板里选(原地 / 最近的队友旁 / 列出所有活着的队友任选一个);Body = 原地;NearestTeammate = 最近的活着的队友旁边(没人活着就原地)。\nWhere you come back when you revive yourself with the revive-all key or the panel: Ask = choose in the panel each time (in place / next to the nearest teammate / next to any living teammate); Body = where you died; NearestTeammate = next to the closest living teammate (in place if nobody is alive).");
		AutoEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("3. 自动复活 / Auto Revive", "启用 / Enabled", false, "队友死亡后等待一段时间自动复活,死者屏幕上显示倒计时。房间里只要有一个装了本 mod 的人打开它就生效(多人打开时由房主负责,按房主的秒数)。\nAutomatically revive dead teammates after a delay, with a countdown on the dead player's screen. Works as long as one player with this mod turns it on (if several do, the host's setting wins).");
		AutoDelay = ((BaseUnityPlugin)this).Config.Bind<float>("3. 自动复活 / Auto Revive", "等待秒数 / Delay Seconds", 20f, new ConfigDescription("死亡后多少秒自动复活。\nSeconds after death before reviving.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 600f), new object[0]));
		AutoPlace = ((BaseUnityPlugin)this).Config.Bind<RevivePlace>("3. 自动复活 / Auto Revive", "复活位置 / Revive Place", RevivePlace.Body, "Body = 骸骨所在处;Campfire = 最近的已点燃营火(Reviver 在这里等同于 Body)。\nBody = at the skeleton; Campfire = nearest lit campfire (Reviver behaves like Body here).");
		ApplyPenalty = ((BaseUnityPlugin)this).Config.Bind<bool>("4. 通用 / General", "原版复活惩罚 / Vanilla Penalty", true, "开启后复活带原版惩罚(按难度的诅咒 + 30% 饥饿,和复活雕像一样),关闭则满状态复活。\nOn: revive with the vanilla penalty (ascent curse + 30% hunger, same as the statue). Off: revive at full health.");
		ProtectionSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("4. 通用 / General", "复活保护秒数 / Revive Protection", 3f, new ConfigDescription("复活后几秒内无敌(游戏自带的无敌效果,带金光),避免刚复活就被毒雾、摔落再次秒杀。0 = 关闭。需要被复活的人也装了本 mod。\nSeconds of the game's own invincibility (gold glow) after a revive, so you aren't killed again instantly. 0 = off. Needs the mod on the revived player's side.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 15f), new object[0]));
		KeepItems = ((BaseUnityPlugin)this).Config.Bind<bool>("4. 通用 / General", "死亡保留物品 / Keep Items On Death", true, "死亡时物品栏 3 格和手上拿着的东西留在身上,复活后还在;背包照原版掉在死亡的地方。需要死者本人也装了本 mod。\nOn death, keep the 3 inventory slots and the held item so they come back on revive; the backpack still drops where you died. Needs the mod on the dying player's side.");
		KeepItemsOnPassOut = ((BaseUnityPlugin)this).Config.Bind<bool>("4. 通用 / General", "昏迷不掉落 / Keep Items On Pass Out", true, "昏迷倒地时物品栏 3 格和手上的东西不掉出来(原版会全部掉在地上),醒来或被救起后还在,手上那件会放回手里。关闭则照原版掉落。需要昏迷的人本人也装了本 mod。\nWhen you pass out, your 3 inventory slots and the item in your hands stay with you instead of spilling on the ground as in vanilla; the held item goes back into your hands when you get up. Off = vanilla drop. Needs the mod on the passed-out player's side.");
		BackpackReturns = ((BaseUnityPlugin)this).Config.Bind<bool>("4. 通用 / General", "复活时背包回到背上 / Backpack Returns On Revive", true, "死亡时掉在原地的背包,复活后自动回到背上(已被队友拿走或背上就不会)。关闭则只在屏幕上标出你的背包在哪。需要被复活的人装了本 mod。\nThe backpack you dropped when you died goes back on your back when you are revived (unless a teammate took it). Off: your backpack is only marked on screen. Needs the mod on the revived player's side.");
		ReviveLog = ((BaseUnityPlugin)this).Config.Bind<bool>("4. 通用 / General", "复活记录 / Revive Log", true, "消息栏写明谁救了谁,回到机场时汇总本局一共复活了几次。\nShow who revived whom in the message log, and a summary of the run's revives back at the airport.");
		Notify = ((BaseUnityPlugin)this).Config.Bind<bool>("4. 通用 / General", "复活提示 / Notifications", true, "在左下角消息栏显示复活信息。\nShow revive messages in the bottom-left message log.");
		Language = ((BaseUnityPlugin)this).Config.Bind<TextLanguage>("4. 通用 / General", "提示语言 / Language", TextLanguage.Auto, "Auto = 跟随游戏语言(简体/繁体中文显示中文,其余显示英文);Chinese = 中文;English = 英文。\nAuto = follow the game language; Chinese; English.");
		SoloTestMode = ((BaseUnityPlugin)this).Config.Bind<bool>("5. 调试 / Debug", "单人测试模式 / Solo Test Mode", false, "开启后,所有人都死了也不会结束本局,方便一个人测试:自己死掉后按全体复活键,或等自动复活。只在房主身上生效,测试完请关闭。\nWhen on, the run does not end when everyone is dead, so you can test alone: die, then press the revive-all key or wait for auto revive. Host only; turn it off after testing.");
		SelfTestKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("5. 调试 / Debug", "自检快捷键 / Self Test Key", (KeyCode)0, "开启单人测试模式后按这个键,自动跑一遍:拿 3 件物品 → 死亡 → 复活 → 骸骨不在时再复活,结果写进 Player.log(搜 [HRFX-TEST])。None = 关闭。\nWith Solo Test Mode on, press to run: take 3 items, die, revive, revive again without a skeleton. Results go to Player.log ([HRFX-TEST]). None = off.");
		AutoSelfTest = ((BaseUnityPlugin)this).Config.Bind<bool>("5. 调试 / Debug", "启动后自动自检 / Auto Self Test", false, "给开发者用:游戏进主菜单后自动开一局单人游戏,登机进入第一张地图跑一遍自检,跑完自动退出游戏。平时请保持关闭。\nFor development: start a solo game from the main menu, board to the first map, run the self test there, then quit the game. Keep it off normally.");
		MaxRevives = ((BaseUnityPlugin)this).Config.Bind<int>("6. 限制与代价 / Limits & Costs", "每人每局复活次数 / Max Revives Per Player", 0, new ConfigDescription("每个玩家每局最多被复活几次,0 = 不限。次数全房间共用,回到机场重新计数。\nHow many times each player can be revived per run; 0 = unlimited. Shared by the whole room, reset at the airport.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 99), new object[0]));
		ReviverHungerCost = ((BaseUnityPlugin)this).Config.Bind<float>("6. 限制与代价 / Limits & Costs", "救人饥饿代价 / Reviver Hunger Cost", 0f, new ConfigDescription("每救起一个人,救人者增加多少饥饿(0.1 = 一成饥饿条),0 = 无代价。只对长按复活和全体复活生效。\nHunger added to the reviver per revive (0.1 = a tenth of the bar); 0 = free. Applies to hold revive and revive all.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[0]));
		ReviveCost = ((BaseUnityPlugin)this).Config.Bind<ReviveCostItem>("6. 限制与代价 / Limits & Costs", "救人消耗物品 / Revive Item Cost", ReviveCostItem.None, "长按复活、全体复活、单人远程复活每救起一个死亡的队友,从救人者的物品栏(3 格或手上)消耗一件:Bandage = 绷带;FirstAidKit = 急救包;AnyMedical = 任一医疗品(绷带、急救包、万灵药等);None = 不消耗。自动复活和扶起昏迷的人不消耗。\nEach dead teammate revived by hold revive, revive all or revive one uses up one item from the reviver's slots or hands: Bandage, FirstAidKit, AnyMedical (bandage, first-aid kit, cure-all...) or None. Auto revive and picking up passed-out teammates are free.");
		LeaderboardEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("8. 排行榜 / Leaderboard", "左上角排行榜 / Corner Leaderboard", false, "在屏幕左上角常驻一个半透明的小排行榜(本局谁死得最多、谁救人最多),像游戏的实时信息一样。完整的排行榜随时可以在复活面板(U)里看。\nKeep a small translucent leaderboard (this run: who died most, who saved most) in the top-left corner, like the game's live info. The full leaderboard is always in the revive panel (U).");
		MarkersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("7. 骸骨指引 / Skeleton Markers", "启用 / Enabled", true, "在屏幕上标出队友骸骨的名字和距离,不在视野里时贴着屏幕边缘指方向。被蘑菇感染死的队友没有骸骨,标的是他变成的僵尸(僵尸消失后标他倒下的地方)。\nShow each dead teammate's skeleton with name and distance; off-screen ones point from the screen edge. Mushroom deaths leave no skeleton: their zombie is marked instead (or where they turned, once it is gone).");
		MarkersMaxDistance = ((BaseUnityPlugin)this).Config.Bind<float>("7. 骸骨指引 / Skeleton Markers", "最大显示距离 / Max Distance", 0f, new ConfigDescription("超过这个距离(米)就不显示,0 = 不限。\nHide markers farther than this (metres); 0 = no limit.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5000f), new object[0]));
		Harmony harmony = new Harmony("com.hostrevivemodfx");
		if (SpawnedFromField == null || HasBookMethod == null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Skelleton members not found; hold revive disabled (game update?)");
		}
		else
		{
			Patch(harmony, typeof(SkeletonPatches), "hold revive");
		}
		Patch(harmony, typeof(EndGamePatch), "solo test mode");
		Patch(harmony, typeof(KeepItemsPatches), "keep items on death");
		Patch(harmony, typeof(PassOutDropPatch), "keep items on pass out");
		Patch(harmony, typeof(BackpackPatches), "backpack returns on revive");
		Patch(harmony, typeof(PanelInputPatch), "revive panel");
		Patch(harmony, typeof(ProtectionPatch), "revive protection");
		Patch(harmony, typeof(SkeletonTrackPatch), "skeleton tracking");
		PhotonNetwork.NetworkingClient.EventReceived += OnPhotonEvent;
		GameUI.Ensure();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"HostReviveModFX 1.0.7 loaded");
	}

	private void Patch(Harmony harmony, Type patches, string feature)
	{
		try
		{
			harmony.PatchAll(patches);
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Could not enable " + feature + ": " + ex.Message));
		}
	}

	private void Update()
	{
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		if (AutoSelfTest.Value)
		{
			DriveAutoSelfTest();
		}
		if (!PhotonNetwork.InRoom || (Object)(object)Character.localCharacter == (Object)null)
		{
			deadSince.Clear();
			passedOutSeen.Clear();
			markers.Clear();
			zombieMarkers.Clear();
			if (panelOpen)
			{
				SetPanel(open: false);
			}
			return;
		}
		AdvertiseMod();
		ResetCountsAtAirport();
		TrackDeaths();
		RememberAlivePositions();
		if ((SoloTestMode.Value || AutoSelfTest.Value) && (int)SelfTestKey.Value != 0 && Input.GetKeyDown(SelfTestKey.Value) && !selfTestRunning)
		{
			((MonoBehaviour)this).StartCoroutine(SelfTest());
		}
		RefreshMarkers();
		if (ReviveAllEnabled.Value && Input.GetKeyDown(ReviveAllKey.Value) && !IsTyping())
		{
			ReviveAll();
		}
		if (PanelEnabled.Value && Input.GetKeyDown(PanelKey.Value) && !IsTyping())
		{
			SetPanel(!panelOpen);
		}
		if (panelOpen && (!PanelEnabled.Value || PanelBlockedByGame()))
		{
			SetPanel(open: false);
		}
		if (panelOpen)
		{
			PanelInputPatch.Apply();
		}
		FlushRevivedMessages();
		if (AutoEnabled.Value && IsAutoReviveSender())
		{
			AutoRevive();
		}
	}

	internal bool RequestRevive(Character target, RevivePlace place, Skelleton skeleton, Character reviver)
	{
		return RequestRevive(target, place, skeleton, reviver, null);
	}

	internal bool RequestRevive(Character target, RevivePlace place, Skelleton skeleton, Character reviver, Character beside)
	{
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Expected O, but got Unknown
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: 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_0183: Unknown result t