Decompiled source of WZC UI v1.0.1

plugins\wzcui.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("wzcui")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+89082013f688ed3463a5813ac31d2ddd0f3d340d")]
[assembly: AssemblyProduct("wzcui")]
[assembly: AssemblyTitle("wzcui")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public enum TeammateDisplayMode
{
	常显,
	按键显示
}
public enum DisplayMode
{
	文字显示,
	原生UI显示
}
[BepInPlugin("local.repo.enemycountoverlay", "A.王子晨的定制UI显示", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
	private const string TeammateConfigSection = "A1.好友头顶显示";

	private const string EnemyWorldConfigSection = "A2.敌人头顶显示";

	private const string TabMapConfigSection = "B.Tab地图缩放";

	private const string ExperimentalConfigSection = "Z.实验功能";

	private static readonly FieldInfo PlayerDeadSetField = typeof(PlayerAvatar).GetField("deadSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerIsDisabledField = typeof(PlayerAvatar).GetField("isDisabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerNameField = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerIsLocalField = typeof(PlayerAvatar).GetField("isLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerTransformField = typeof(PlayerAvatar).GetField("playerTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerDeathSpotField = typeof(PlayerAvatar).GetField("deathSpot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerDeathHeadField = typeof(PlayerAvatar).GetField("playerDeathHead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo PlayerLastNavmeshPositionField = typeof(PlayerAvatar).GetField("LastNavmeshPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo DeathHeadPhysGrabObjectField = typeof(PlayerDeathHead).GetField("physGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo DeathHeadTriggeredPositionField = typeof(PlayerDeathHead).GetField("triggeredPosition", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo DeathHeadOverridePositionTransformField = typeof(PlayerDeathHead).GetField("overridePositionTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo SpectateCameraInstanceField = typeof(SpectateCamera).GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo SpectateCameraPlayerField = typeof(SpectateCamera).GetField("player", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo SpectateCameraPlayerOverrideField = typeof(SpectateCamera).GetField("playerOverride", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo SpectateCameraMainCameraField = typeof(SpectateCamera).GetField("MainCamera", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyParentField = typeof(Enemy).GetField("EnemyParent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyTypeField = typeof(Enemy).GetField("Type", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyCenterTransformField = typeof(Enemy).GetField("CenterTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyParentNameField = typeof(EnemyParent).GetField("enemyName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyParentSpawnedField = typeof(EnemyParent).GetField("Spawned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyHealthField = typeof(Enemy).GetField("Health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo EnemyHealthDeadField = typeof(EnemyHealth).GetField("dead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo GoalUiTextField = typeof(GoalUI).GetField("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? typeof(GoalUI).GetField("uiText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static Type cachedMapValueTrackerType;

	private static FieldInfo cachedMapValueTrackerTotalValueField;

	private static FieldInfo cachedMapValueTrackerInitialValueField;

	private static readonly FieldInfo ValuableOriginalValueField = typeof(ValuableObject).GetField("dollarValueOriginal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo ValuableCurrentValueField = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo ValuableValueSetField = typeof(ValuableObject).GetField("dollarValueSet", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo ValuablePhotonViewField = typeof(ValuableObject).GetField("photonView", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo ValuablePhysGrabObjectField = typeof(ValuableObject).GetField("physGrabObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo RoundDirectorInstanceField = typeof(RoundDirector).GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo RoundDirectorDollarHaulListField = typeof(RoundDirector).GetField("dollarHaulList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static ConfigEntry<string> keyCaptureEntry;

	private static ConfigEntry<bool> itemRotationExperimentalEnabled;

	private static ConfigEntry<bool> invertItemRotationHorizontal;

	private static ConfigEntry<bool> invertItemRotationVertical;

	private static ConfigEntry<float> itemRotationSensitivity;

	private static int itemRotationInputDepth;

	private ConfigEntry<bool> overlayEnabled;

	private ConfigEntry<bool> sectionSpacing;

	private ConfigEntry<DisplayMode> displayMode;

	private ConfigEntry<int> fontSize;

	private ConfigEntry<float> updateInterval;

	private ConfigEntry<bool> showBreakdown;

	private ConfigEntry<bool> showTotalEnemyCount;

	private ConfigEntry<bool> showMapLostValue;

	private ConfigEntry<bool> showMapTotalValue;

	private ConfigEntry<bool> showSubmittedValue;

	private ConfigEntry<bool> showLevelInfo;

	private ConfigEntry<bool> showPlayerCounts;

	private ConfigEntry<bool> teammateOverlayEnabled;

	private ConfigEntry<int> teammateFontSize;

	private ConfigEntry<float> teammateUpdateInterval;

	private ConfigEntry<TeammateDisplayMode> teammateDisplayMode;

	private ConfigEntry<string> teammateToggleKey;

	private ConfigEntry<float> teammateHoldSeconds;

	private ConfigEntry<bool> enemyOverlayEnabled;

	private ConfigEntry<int> enemyFontSize;

	private ConfigEntry<float> enemyUpdateInterval;

	private ConfigEntry<TeammateDisplayMode> enemyDisplayMode;

	private ConfigEntry<string> enemyToggleKey;

	private ConfigEntry<float> enemyHoldSeconds;

	private ConfigEntry<bool> tabMapZoomEnabled;

	private ConfigEntry<bool> tabMapRestoreOfficialOnOpen;

	private ConfigEntry<float> tabMapDefaultZoom;

	private ConfigEntry<float> tabMapMinZoom;

	private ConfigEntry<float> tabMapMaxZoom;

	private ConfigEntry<float> tabMapScrollSpeed;

	private GameObject overlayObject;

	private GameObject overlayCanvasObject;

	private Canvas overlayCanvas;

	private RectTransform overlayRect;

	private TextMeshProUGUI overlayLabel;

	private Harmony itemRotationHarmony;

	private string overlayText = string.Empty;

	private readonly List<EnemyLabelInfo> enemyLabels = new List<EnemyLabelInfo>();

	private float refreshTimer;

	private float teammateVisibleTimer;

	private float enemyRefreshTimer;

	private float enemyVisibleTimer;

	private float tabMapZoomMultiplier = 1f;

	private bool tabMapWasActive;

	private Transform tabMapZoomTarget;

	private Vector3 tabMapOriginalScale = Vector3.one;

	private Vector3 tabMapOriginalLocalPosition = Vector3.zero;

	private Vector3 tabMapOriginalCenterLocal = Vector3.zero;

	private float tabMapOriginalMapScale = 1f;

	private bool tabMapHasOriginalCenter;

	private readonly Dictionary<int, TabMapTransformSnapshot> tabMapLayerSnapshots = new Dictionary<int, TabMapTransformSnapshot>();

	private int trackedLevelNumber = -1;

	private float previousExtractedValue = -1f;

	private float accumulatedLostValue;

	private readonly Dictionary<int, ValuableSnapshot> valuableSnapshots = new Dictionary<int, ValuableSnapshot>();

	private static readonly Vector3 tabMapFallbackZero = Vector3.zero;

	private void Awake()
	{
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Expected O, but got Unknown
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Expected O, but got Unknown
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Expected O, but got Unknown
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Expected O, but got Unknown
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: Expected O, but got Unknown
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Expected O, but got Unknown
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Expected O, but got Unknown
		//IL_052b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0535: Expected O, but got Unknown
		teammateOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("A1.好友头顶显示", "启用好友头顶显示", true, ConfigDescriptionWithOrder("在好友头顶显示名字、距离和死亡状态。", 600));
		teammateFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("A1.好友头顶显示", "好友头顶文字大小", 18, ConfigDescriptionWithOrder("好友头顶文字的字体大小。", 590));
		teammateUpdateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("A1.好友头顶显示", "好友头顶刷新间隔秒数", 0.5f, ConfigDescriptionWithOrder("每隔多少秒刷新一次好友头顶信息。", 580));
		teammateDisplayMode = ((BaseUnityPlugin)this).Config.Bind<TeammateDisplayMode>("A1.好友头顶显示", "好友头顶显示方式", TeammateDisplayMode.常显, ConfigDescriptionWithOrder("常显,或按键后显示一段时间。", 570));
		teammateToggleKey = ((BaseUnityPlugin)this).Config.Bind<string>("A1.好友头顶显示", "好友头顶显示按键", "F", new ConfigDescription("按键显示模式下,按下后显示好友头顶信息。可以填写 F、T、G、F1、Mouse3 这类 KeyCode 名称。", (AcceptableValueBase)null, new object[1]
		{
			new ConfigurationManagerAttributes
			{
				Order = 560,
				CustomDrawer = DrawKeyBinding
			}
		}));
		teammateHoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("A1.好友头顶显示", "按键显示持续秒数", 5f, ConfigDescriptionWithOrder("按下好友显示按键后,好友距离显示持续多少秒。", 550));
		enemyOverlayEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("A2.敌人头顶显示", "启用敌人头顶显示", true, ConfigDescriptionWithOrder("在敌人头顶显示名字和距离,统一使用红色。", 540));
		enemyFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("A2.敌人头顶显示", "敌人头顶文字大小", 16, ConfigDescriptionWithOrder("敌人头顶文字的字体大小。", 530));
		enemyUpdateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("A2.敌人头顶显示", "敌人头顶刷新间隔秒数", 0.5f, ConfigDescriptionWithOrder("每隔多少秒刷新一次敌人头顶信息。", 520));
		enemyDisplayMode = ((BaseUnityPlugin)this).Config.Bind<TeammateDisplayMode>("A2.敌人头顶显示", "敌人头顶显示方式", TeammateDisplayMode.按键显示, ConfigDescriptionWithOrder("常显,或按键后显示一段时间。", 510));
		enemyToggleKey = ((BaseUnityPlugin)this).Config.Bind<string>("A2.敌人头顶显示", "敌人头顶显示按键", "F", new ConfigDescription("按键显示模式下,按下后显示敌人头顶信息。可以填写 F、T、Y、G、F1、Mouse3 这类 KeyCode 名称。", (AcceptableValueBase)null, new object[1]
		{
			new ConfigurationManagerAttributes
			{
				Order = 500,
				CustomDrawer = DrawKeyBinding
			}
		}));
		enemyHoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("A2.敌人头顶显示", "敌人按键显示持续秒数", 5f, ConfigDescriptionWithOrder("按下敌人显示按键后,敌人头顶信息显示持续多少秒。", 490));
		tabMapZoomEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("B.Tab地图缩放", "启用Tab地图缩放", true, "开启后,按Tab打开原版地图时可以用鼠标滚轮缩放地图内容。");
		tabMapRestoreOfficialOnOpen = ((BaseUnityPlugin)this).Config.Bind<bool>("B.Tab地图缩放", "每次打开地图强制恢复官方状态", true, "开启后,每次关闭/重新打开Tab地图都会恢复官方默认地图状态,再应用默认缩放。关闭后,地图会保留上一次滚轮缩放后的状态。");
		tabMapDefaultZoom = ((BaseUnityPlugin)this).Config.Bind<float>("B.Tab地图缩放", "打开地图默认缩放", 0.75f, new ConfigDescription("每次打开Tab地图时的默认缩放倍率。小于1可以看到更大范围,大于1会放大细节。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 3f), Array.Empty<object>()));
		tabMapMinZoom = ((BaseUnityPlugin)this).Config.Bind<float>("B.Tab地图缩放", "最小缩放倍率", 0.25f, new ConfigDescription("地图最多缩小到多少。数值越小,一次看到的范围越大;如果还有房间看不到,就继续调低这个值。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 2f), Array.Empty<object>()));
		tabMapMaxZoom = ((BaseUnityPlugin)this).Config.Bind<float>("B.Tab地图缩放", "最大缩放倍率", 2f, new ConfigDescription("地图最多放大到多少。这个控制的是放大看细节,不控制看到更多房间;要看到更多房间请调低最小缩放倍率。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 8f), Array.Empty<object>()));
		tabMapScrollSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("B.Tab地图缩放", "滚轮缩放速度", 0.18f, new ConfigDescription("鼠标滚轮每格调整的缩放速度。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.02f, 1f), Array.Empty<object>()));
		itemRotationExperimentalEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Z.实验功能", "启用物品旋转实验功能", false, ConfigDescriptionWithOrder("默认关闭。开启后才会修改按住右键旋转物品时的鼠标输入。", 300));
		invertItemRotationHorizontal = ((BaseUnityPlugin)this).Config.Bind<bool>("Z.实验功能", "反转物品左右旋转", true, ConfigDescriptionWithOrder("实验功能开启后生效。开启后按住右键旋转物品时,鼠标左右方向会反过来。", 290));
		invertItemRotationVertical = ((BaseUnityPlugin)this).Config.Bind<bool>("Z.实验功能", "反转物品上下旋转", true, ConfigDescriptionWithOrder("实验功能开启后生效。开启后按住右键旋转物品时,鼠标上下方向会反过来。", 280));
		itemRotationSensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("Z.实验功能", "物品旋转灵敏度", 1f, new ConfigDescription("实验功能开启后生效。按住右键旋转物品时的鼠标灵敏度倍率。1.0 为原版速度。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), new object[1]
		{
			new ConfigurationManagerAttributes
			{
				Order = 270
			}
		}));
		overlayEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("C1.右下角基础设置", "启用显示", true, "是否在右下角显示额外信息。");
		sectionSpacing = ((BaseUnityPlugin)this).Config.Bind<bool>("C1.右下角基础设置", "不同分区空行", true, "默认开启。开启后不同信息分区之间会插入一行空白。");
		displayMode = ((BaseUnityPlugin)this).Config.Bind<DisplayMode>("C1.右下角基础设置", "显示模式", DisplayMode.文字显示, new ConfigDescription("可切换为文字显示或更贴近游戏的原生UI显示。", (AcceptableValueBase)null, new object[1]
		{
			new ConfigurationManagerAttributes
			{
				CustomDrawer = DrawDisplayMode
			}
		}));
		fontSize = ((BaseUnityPlugin)this).Config.Bind<int>("C1.右下角基础设置", "字体大小", 18, "显示文字的字体大小。");
		updateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("C1.右下角基础设置", "刷新间隔秒数", 1.5f, "每隔多少秒刷新一次显示。");
		showMapLostValue = ((BaseUnityPlugin)this).Config.Bind<bool>("C2.右下角价值统计", "显示地图损失价值", true, "显示本局地图中已摔坏或丢失的价值。");
		showMapTotalValue = ((BaseUnityPlugin)this).Config.Bind<bool>("C2.右下角价值统计", "显示地图价值", true, "显示当前地图剩余总价值。");
		showSubmittedValue = ((BaseUnityPlugin)this).Config.Bind<bool>("C2.右下角价值统计", "显示已提交价值", true, "显示本局已经成功提交的总价值。");
		showBreakdown = ((BaseUnityPlugin)this).Config.Bind<bool>("C3.右下角怪物统计", "显示怪物明细", true, "显示每种怪物当前数量。");
		showTotalEnemyCount = ((BaseUnityPlugin)this).Config.Bind<bool>("C3.右下角怪物统计", "显示怪物总数", true, "显示当前存活怪物总数。");
		showLevelInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("C4.右下角其他信息", "显示关卡信息", true, "显示当前关卡编号和名称。");
		showPlayerCounts = ((BaseUnityPlugin)this).Config.Bind<bool>("C4.右下角其他信息", "显示玩家数量", true, "显示死亡、存活和总玩家数量。");
		ApplyItemRotationPatch();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"wzcui loaded.");
	}

	private void Update()
	{
		if (!overlayEnabled.Value || !SemiFunc.RunIsLevel())
		{
			ResetLossTracking();
			overlayText = string.Empty;
			enemyLabels.Clear();
			teammateVisibleTimer = 0f;
			enemyVisibleTimer = 0f;
			SetNativeOverlayVisible(visible: false);
			return;
		}
		refreshTimer += Time.deltaTime;
		UpdateTeammateOverlayState();
		UpdateEnemyOverlayState();
		if (refreshTimer >= Mathf.Max(0.15f, updateInterval.Value))
		{
			refreshTimer = 0f;
			overlayText = BuildOverlayText();
			UpdateNativeOverlay();
		}
		if (displayMode.Value == DisplayMode.原生UI显示)
		{
			SetNativeOverlayVisible(visible: true);
			UpdateNativeOverlay();
		}
		else
		{
			SetNativeOverlayVisible(visible: false);
		}
	}

	private void LateUpdate()
	{
		UpdateTabMapZoom();
	}

	private void ApplyItemRotationPatch()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_008e: 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_00b0: Expected O, but got Unknown
		//IL_00b0: Expected O, but got Unknown
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Expected O, but got Unknown
		try
		{
			itemRotationHarmony = new Harmony("local.repo.enemycountoverlay.itemrotation");
			MethodInfo methodInfo = AccessTools.Method(typeof(PhysGrabber), "ObjectTurning", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Input), "GetAxis", new Type[1] { typeof(string) }, (Type[])null);
			if (methodInfo == null || methodInfo2 == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Failed to find item rotation input methods.");
				return;
			}
			itemRotationHarmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin), "BeginItemRotationInputPatch", (Type[])null), new HarmonyMethod(typeof(Plugin), "EndItemRotationInputPatch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			itemRotationHarmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "InputGetAxisPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Item rotation controls patched.");
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Failed to patch item rotation controls: {arg}");
		}
	}

	private static void BeginItemRotationInputPatch()
	{
		itemRotationInputDepth++;
	}

	private static void EndItemRotationInputPatch()
	{
		itemRotationInputDepth = Math.Max(0, itemRotationInputDepth - 1);
	}

	private static void InputGetAxisPostfix(string axisName, ref float __result)
	{
		if (itemRotationInputDepth > 0 && itemRotationExperimentalEnabled != null && itemRotationExperimentalEnabled.Value && (string.Equals(axisName, "Mouse X", StringComparison.OrdinalIgnoreCase) || string.Equals(axisName, "Mouse Y", StringComparison.OrdinalIgnoreCase)))
		{
			__result = AdjustItemRotationAxis(__result, axisName);
		}
	}

	internal static float AdjustItemRotationAxis(float value, string axisName)
	{
		float num = ((itemRotationSensitivity == null) ? 1f : Mathf.Clamp(itemRotationSensitivity.Value, 0f, 5f));
		float num2 = value * num;
		if (string.Equals(axisName, "Mouse X", StringComparison.OrdinalIgnoreCase) && invertItemRotationHorizontal != null && invertItemRotationHorizontal.Value)
		{
			num2 = 0f - num2;
		}
		if (string.Equals(axisName, "Mouse Y", StringComparison.OrdinalIgnoreCase) && invertItemRotationVertical != null && invertItemRotationVertical.Value)
		{
			num2 = 0f - num2;
		}
		return num2;
	}

	private void UpdateTabMapZoom()
	{
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		if (!tabMapZoomEnabled.Value || !SemiFunc.RunIsLevel())
		{
			ResetTabMapZoom();
			return;
		}
		Map instance = Map.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			ResetTabMapZoom();
			return;
		}
		if (!instance.Active)
		{
			if (tabMapRestoreOfficialOnOpen.Value)
			{
				ResetTabMapZoom();
			}
			return;
		}
		Transform transform = ((Component)instance).transform;
		if ((Object)(object)transform == (Object)null)
		{
			ResetTabMapZoom();
			return;
		}
		if ((Object)(object)tabMapZoomTarget != (Object)(object)transform || !tabMapWasActive)
		{
			if ((Object)(object)tabMapZoomTarget != (Object)(object)transform)
			{
				RestoreTabMapZoomTarget();
			}
			tabMapZoomTarget = transform;
			tabMapOriginalScale = transform.localScale;
			tabMapOriginalLocalPosition = transform.localPosition;
			tabMapOriginalMapScale = instance.Scale;
			RestoreTabMapModulePositions(instance);
			tabMapZoomMultiplier = ClampTabMapZoom(tabMapDefaultZoom.Value);
			tabMapLayerSnapshots.Clear();
			CaptureTabMapLayerSnapshots(instance);
			tabMapHasOriginalCenter = TryGetMapContentBounds(instance, transform, out var bounds);
			tabMapOriginalCenterLocal = (tabMapHasOriginalCenter ? transform.InverseTransformPoint(((Bounds)(ref bounds)).center) : Vector3.zero);
			tabMapWasActive = true;
		}
		float axis = Input.GetAxis("Mouse ScrollWheel");
		if (Mathf.Abs(axis) > 0.001f)
		{
			tabMapZoomMultiplier = ClampTabMapZoom(tabMapZoomMultiplier + axis * tabMapScrollSpeed.Value * 10f);
		}
		ApplyTabMapZoom(instance, transform);
	}

	private void ResetTabMapZoom()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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)
		RestoreTabMapZoomTarget();
		tabMapWasActive = false;
		tabMapZoomMultiplier = ClampTabMapZoom(tabMapDefaultZoom.Value);
		tabMapZoomTarget = null;
		tabMapOriginalScale = Vector3.one;
		tabMapOriginalLocalPosition = Vector3.zero;
		tabMapOriginalCenterLocal = Vector3.zero;
		tabMapOriginalMapScale = 1f;
		tabMapHasOriginalCenter = false;
		tabMapLayerSnapshots.Clear();
	}

	private void RestoreTabMapZoomTarget()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)tabMapZoomTarget == (Object)null))
		{
			tabMapZoomTarget.localScale = tabMapOriginalScale;
			tabMapZoomTarget.localPosition = tabMapOriginalLocalPosition;
			Map instance = Map.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				instance.Scale = tabMapOriginalMapScale;
				RestoreTabMapLayerSnapshots();
				RestoreTabMapModulePositions(instance);
			}
		}
	}

	private void ApplyTabMapZoom(Map map, Transform target)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_0049: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		target.localPosition = tabMapOriginalLocalPosition;
		target.localScale = tabMapOriginalScale;
		map.Scale = tabMapOriginalMapScale * tabMapZoomMultiplier;
		ApplyTabMapLayerZoom(map);
		if (tabMapHasOriginalCenter)
		{
			Bounds bounds;
			Vector3 val = (TryGetMapContentBounds(map, target, out bounds) ? ToParentSpace(target, ((Bounds)(ref bounds)).center) : ToParentSpace(target, target.TransformPoint(tabMapOriginalCenterLocal)));
			Vector3 val2 = GetTabMapAnchorInParentSpace(map, target) - val;
			val2.y = 0f;
			target.localPosition += val2;
		}
	}

	private void CaptureTabMapLayerSnapshots(Map map)
	{
		if ((Object)(object)map == (Object)null || map.Layers == null)
		{
			return;
		}
		foreach (MapLayer layer in map.Layers)
		{
			if (!((Object)(object)layer == (Object)null))
			{
				Transform transform = ((Component)layer).transform;
				if (ShouldZoomTabMapLayer(map, transform))
				{
					CaptureTabMapLayerSnapshot(transform);
				}
			}
		}
	}

	private void CaptureTabMapLayerSnapshot(Transform transform)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)transform == (Object)null))
		{
			int instanceID = ((Object)transform).GetInstanceID();
			if (!tabMapLayerSnapshots.ContainsKey(instanceID))
			{
				tabMapLayerSnapshots[instanceID] = new TabMapTransformSnapshot
				{
					Transform = transform,
					LocalPosition = transform.localPosition,
					LocalScale = transform.localScale
				};
			}
		}
	}

	private void ApplyTabMapLayerZoom(Map map)
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)map == (Object)null || map.Layers == null)
		{
			return;
		}
		foreach (MapLayer layer in map.Layers)
		{
			if ((Object)(object)layer == (Object)null)
			{
				continue;
			}
			Transform transform = ((Component)layer).transform;
			if (ShouldZoomTabMapLayer(map, transform))
			{
				CaptureTabMapLayerSnapshot(transform);
				int instanceID = ((Object)transform).GetInstanceID();
				if (tabMapLayerSnapshots.TryGetValue(instanceID, out var value))
				{
					transform.localPosition = value.LocalPosition;
					Vector3 localScale = value.LocalScale;
					localScale.x *= tabMapZoomMultiplier;
					localScale.z *= tabMapZoomMultiplier;
					transform.localScale = localScale;
				}
			}
		}
	}

	private void RestoreTabMapLayerSnapshots()
	{
		//IL_0030: 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)
		foreach (TabMapTransformSnapshot value in tabMapLayerSnapshots.Values)
		{
			if (!((Object)(object)value.Transform == (Object)null))
			{
				value.Transform.localPosition = value.LocalPosition;
				value.Transform.localScale = value.LocalScale;
			}
		}
	}

	private static void RestoreTabMapModulePositions(Map map)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)map == (Object)null || map.MapModules == null)
		{
			return;
		}
		foreach (MapModule mapModule in map.MapModules)
		{
			if (!((Object)(object)mapModule == (Object)null) && !((Object)(object)mapModule.module == (Object)null))
			{
				MapLayer layerParent = map.GetLayerParent(((Component)mapModule.module).transform.position.y);
				if (!((Object)(object)layerParent == (Object)null))
				{
					((Component)mapModule).transform.position = ((Component)mapModule.module).transform.position * map.Scale + ((Component)layerParent).transform.position + map.GetLayerPosition(layerParent.layer);
				}
			}
		}
	}

	private static bool ShouldZoomTabMapLayer(Map map, Transform transform)
	{
		if ((Object)(object)transform == (Object)null)
		{
			return false;
		}
		if (!((Object)(object)map == (Object)null) && !((Object)(object)map.OverLayerParent == (Object)null))
		{
			return (Object)(object)transform != (Object)(object)map.OverLayerParent;
		}
		return true;
	}

	private static Vector3 GetTabMapAnchorInParentSpace(Map map, Transform target)
	{
		//IL_003c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
		Transform val = (((Object)(object)map != (Object)null && (Object)(object)map.ActiveParent != (Object)null) ? map.ActiveParent.transform : target.parent);
		if (!((Object)(object)val != (Object)null))
		{
			return tabMapFallbackZero;
		}
		return ToParentSpace(target, val.position);
	}

	private static bool TryGetMapContentBounds(Map map, Transform target, out Bounds bounds)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		bounds = default(Bounds);
		bool hasBounds = false;
		if ((Object)(object)map != (Object)null && map.Layers != null)
		{
			foreach (MapLayer layer in map.Layers)
			{
				if (!((Object)(object)layer == (Object)null) && ShouldZoomTabMapLayer(map, ((Component)layer).transform))
				{
					EncapsulateRenderers(((Component)layer).transform, ref bounds, ref hasBounds);
				}
			}
		}
		if (hasBounds)
		{
			return true;
		}
		if ((Object)(object)target == (Object)null)
		{
			return false;
		}
		EncapsulateRenderers(target, ref bounds, ref hasBounds);
		return hasBounds;
	}

	private static void EncapsulateRenderers(Transform root, ref Bounds bounds, ref bool hasBounds)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)root == (Object)null)
		{
			return;
		}
		Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(false);
		foreach (Renderer val in componentsInChildren)
		{
			if (!((Object)(object)val == (Object)null) && val.enabled)
			{
				if (!hasBounds)
				{
					bounds = val.bounds;
					hasBounds = true;
				}
				else
				{
					((Bounds)(ref bounds)).Encapsulate(val.bounds);
				}
			}
		}
	}

	private static Vector3 ToParentSpace(Transform target, Vector3 worldPoint)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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)
		if (!((Object)(object)target != (Object)null) || !((Object)(object)target.parent != (Object)null))
		{
			return worldPoint;
		}
		return target.parent.InverseTransformPoint(worldPoint);
	}

	private float ClampTabMapZoom(float value)
	{
		float num = Mathf.Min(tabMapMinZoom.Value, tabMapMaxZoom.Value);
		float num2 = Mathf.Max(tabMapMinZoom.Value, tabMapMaxZoom.Value);
		return Mathf.Clamp(value, num, num2);
	}

	private string BuildOverlayText()
	{
		Enemy[] array = Resources.FindObjectsOfTypeAll<Enemy>();
		Enemy[] array2 = ((array == null) ? Array.Empty<Enemy>() : array.Where(IsEnemyCountable).ToArray());
		string text = string.Empty;
		if (showBreakdown.Value && array2.Length != 0)
		{
			text = string.Join("\n", from @group in array2.GroupBy(GetEnemyDisplayName)
				select new
				{
					Name = @group.Key,
					Count = @group.Count()
				} into @group
				where @group.Count > 0 && !string.IsNullOrWhiteSpace(@group.Name)
				orderby @group.Count descending, @group.Name
				select $"{@group.Name}: {@group.Count}");
		}
		string text2 = (showTotalEnemyCount.Value ? string.Format("{0}: {1}", "怪物总数", array2.Length) : string.Empty);
		float mapValueFromTracker = GetMapValueFromTracker();
		float value = UpdateAndGetLostMapValue(mapValueFromTracker);
		string text3 = (showMapLostValue.Value ? ("损失价值: " + FormatMoney(value)) : string.Empty);
		string text4 = (showMapTotalValue.Value ? ("地图价值: " + FormatMoney(mapValueFromTracker)) : string.Empty);
		string text5 = (showSubmittedValue.Value ? ("已提交: " + FormatMoney(GetCurrentExtractedValue())) : string.Empty);
		string text6 = (showLevelInfo.Value ? BuildLevelLine() : string.Empty);
		string text7 = (showPlayerCounts.Value ? BuildPlayerCountLine() : string.Empty);
		List<string> list = new List<string>();
		List<string> list2 = new List<string>();
		List<string> list3 = new List<string>();
		if (!string.IsNullOrWhiteSpace(text))
		{
			list.Add(text);
		}
		if (!string.IsNullOrWhiteSpace(text2))
		{
			list.Add(text2);
		}
		if (!string.IsNullOrWhiteSpace(text3))
		{
			list2.Add(text3);
		}
		if (!string.IsNullOrWhiteSpace(text4))
		{
			list2.Add(text4);
		}
		if (!string.IsNullOrWhiteSpace(text5))
		{
			list2.Add(text5);
		}
		if (!string.IsNullOrWhiteSpace(text6))
		{
			list3.Add(text6);
		}
		if (!string.IsNullOrWhiteSpace(text7))
		{
			list3.Add(text7);
		}
		List<string> list4 = new List<string>();
		AppendSection(list4, list);
		AppendSection(list4, list2);
		AppendSection(list4, list3);
		return string.Join("\n", list4);
	}

	private void UpdateTeammateOverlayState()
	{
		if (!teammateOverlayEnabled.Value)
		{
			teammateVisibleTimer = 0f;
			return;
		}
		if (teammateDisplayMode.Value == TeammateDisplayMode.按键显示 && IsConfiguredKeyDown(teammateToggleKey.Value))
		{
			teammateVisibleTimer = Mathf.Max(0.1f, teammateHoldSeconds.Value);
		}
		if (teammateDisplayMode.Value == TeammateDisplayMode.按键显示 && teammateVisibleTimer > 0f)
		{
			teammateVisibleTimer -= Time.deltaTime;
		}
	}

	private void UpdateEnemyOverlayState()
	{
		if (!enemyOverlayEnabled.Value)
		{
			enemyLabels.Clear();
			enemyVisibleTimer = 0f;
			return;
		}
		if (enemyDisplayMode.Value == TeammateDisplayMode.按键显示 && IsConfiguredKeyDown(enemyToggleKey.Value))
		{
			enemyVisibleTimer = Mathf.Max(0.1f, enemyHoldSeconds.Value);
		}
		if (enemyDisplayMode.Value == TeammateDisplayMode.按键显示 && enemyVisibleTimer > 0f)
		{
			enemyVisibleTimer -= Time.deltaTime;
		}
		if (enemyDisplayMode.Value != 0 && !(enemyVisibleTimer > 0f))
		{
			enemyLabels.Clear();
			return;
		}
		enemyRefreshTimer += Time.deltaTime;
		if (enemyRefreshTimer >= Mathf.Max(0.1f, enemyUpdateInterval.Value) || enemyLabels.Count == 0)
		{
			enemyRefreshTimer = 0f;
			RefreshEnemyLabels();
		}
	}

	private void AppendSection(List<string> parts, List<string> sectionItems)
	{
		if (sectionItems != null && sectionItems.Count != 0)
		{
			if (parts.Count > 0 && sectionSpacing.Value)
			{
				parts.Add(string.Empty);
			}
			parts.AddRange(sectionItems);
		}
	}

	private void UpdateNativeOverlay()
	{
		//IL_0076: 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_0108: 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_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		if (displayMode.Value == DisplayMode.原生UI显示 && !string.IsNullOrWhiteSpace(overlayText))
		{
			EnsureNativeOverlay();
			if (!((Object)(object)overlayLabel == (Object)null) && !((Object)(object)overlayRect == (Object)null))
			{
				((TMP_Text)overlayLabel).text = overlayText;
				((TMP_Text)overlayLabel).fontSize = Mathf.Clamp(fontSize.Value, 10, 28);
				((Graphic)overlayLabel).color = Color.white;
				((TMP_Text)overlayLabel).enableWordWrapping = false;
				((TMP_Text)overlayLabel).alignment = (TextAlignmentOptions)1028;
				((TMP_Text)overlayLabel).overflowMode = (TextOverflowModes)0;
				((TMP_Text)overlayLabel).horizontalAlignment = (HorizontalAlignmentOptions)4;
				((TMP_Text)overlayLabel).verticalAlignment = (VerticalAlignmentOptions)1024;
				float num = (showBreakdown.Value ? 460f : 320f);
				overlayRect.anchorMin = new Vector2(1f, 0f);
				overlayRect.anchorMax = new Vector2(1f, 0f);
				overlayRect.pivot = new Vector2(1f, 0f);
				overlayRect.anchoredPosition = new Vector2(-18f, 18f);
				overlayRect.sizeDelta = new Vector2(num, 720f);
			}
		}
	}

	private void EnsureNativeOverlay()
	{
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Expected O, but got Unknown
		if (!((Object)(object)overlayObject != (Object)null) || !((Object)(object)overlayLabel != (Object)null) || !((Object)(object)overlayRect != (Object)null))
		{
			if ((Object)(object)overlayCanvasObject == (Object)null || (Object)(object)overlayCanvas == (Object)null)
			{
				overlayCanvasObject = new GameObject("wzcui.Canvas", new Type[3]
				{
					typeof(Canvas),
					typeof(CanvasScaler),
					typeof(GraphicRaycaster)
				});
				overlayCanvas = overlayCanvasObject.GetComponent<Canvas>();
				overlayCanvas.renderMode = (RenderMode)0;
				overlayCanvas.sortingOrder = 32767;
				overlayCanvas.pixelPerfect = false;
				CanvasScaler component = overlayCanvasObject.GetComponent<CanvasScaler>();
				component.uiScaleMode = (ScaleMode)1;
				component.referenceResolution = new Vector2(1920f, 1080f);
				component.screenMatchMode = (ScreenMatchMode)0;
				component.matchWidthOrHeight = 0.5f;
				Object.DontDestroyOnLoad((Object)(object)overlayCanvasObject);
			}
			overlayObject = new GameObject("wzcui.NativeOverlay", new Type[1] { typeof(RectTransform) });
			overlayObject.transform.SetParent(((Component)overlayCanvas).transform, false);
			overlayObject.transform.SetAsLastSibling();
			overlayRect = overlayObject.GetComponent<RectTransform>();
			overlayLabel = overlayObject.AddComponent<TextMeshProUGUI>();
			((Graphic)overlayLabel).raycastTarget = false;
			((TMP_Text)overlayLabel).richText = true;
			((TMP_Text)overlayLabel).enableWordWrapping = false;
			((TMP_Text)overlayLabel).alignment = (TextAlignmentOptions)1028;
			TryCopyGoalUiStyle(overlayLabel);
		}
	}

	private static void TryCopyGoalUiStyle(TextMeshProUGUI target)
	{
		//IL_0027: 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_007d: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)target == (Object)null)
		{
			return;
		}
		GoalUI val = Object.FindObjectOfType<GoalUI>();
		if ((Object)(object)val == (Object)null || GoalUiTextField == null)
		{
			((Graphic)target).color = Color.white;
			return;
		}
		object? value = GoalUiTextField.GetValue(val);
		TextMeshProUGUI val2 = (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null);
		if ((Object)(object)val2 == (Object)null)
		{
			((Graphic)target).color = Color.white;
			return;
		}
		((TMP_Text)target).font = ((TMP_Text)val2).font;
		((TMP_Text)target).fontSharedMaterial = ((TMP_Text)val2).fontSharedMaterial;
		((Graphic)target).color = Color.white;
		((TMP_Text)target).outlineColor = ((TMP_Text)val2).outlineColor;
		((TMP_Text)target).outlineWidth = ((TMP_Text)val2).outlineWidth;
		((TMP_Text)target).enableVertexGradient = ((TMP_Text)val2).enableVertexGradient;
		((TMP_Text)target).fontStyle = ((TMP_Text)val2).fontStyle;
		((TMP_Text)target).characterSpacing = ((TMP_Text)val2).characterSpacing;
		((TMP_Text)target).lineSpacing = ((TMP_Text)val2).lineSpacing;
		((TMP_Text)target).margin = ((TMP_Text)val2).margin;
	}

	private float UpdateAndGetLostMapValue(float currentMapValue)
	{
		int num = SemiFunc.RunGetLevelsCompleted() + 1;
		float currentExtractedValue = GetCurrentExtractedValue();
		if (trackedLevelNumber != num || previousExtractedValue < 0f)
		{
			trackedLevelNumber = num;
			previousExtractedValue = currentExtractedValue;
			accumulatedLostValue = 0f;
			valuableSnapshots.Clear();
			return accumulatedLostValue;
		}
		if (currentExtractedValue < previousExtractedValue)
		{
			previousExtractedValue = currentExtractedValue;
			accumulatedLostValue = 0f;
			valuableSnapshots.Clear();
			return accumulatedLostValue;
		}
		float num2 = Mathf.Max(0f, currentExtractedValue - previousExtractedValue);
		float num3 = UpdateValuableLossSnapshots(num2 > 0f);
		previousExtractedValue = currentExtractedValue;
		return accumulatedLostValue + num3;
	}

	private void ResetLossTracking()
	{
		trackedLevelNumber = -1;
		previousExtractedValue = -1f;
		accumulatedLostValue = 0f;
		valuableSnapshots.Clear();
	}

	private float UpdateValuableLossSnapshots(bool extractionJustChanged)
	{
		ValuableObject[] array = Object.FindObjectsOfType<ValuableObject>(true);
		List<object> currentDollarHaulObjects = GetCurrentDollarHaulObjects();
		HashSet<int> hashSet = new HashSet<int>();
		float num = 0f;
		ValuableObject[] array2 = array;
		foreach (ValuableObject val in array2)
		{
			if (!((Object)(object)val == (Object)null) && IsValuableReady(val))
			{
				int valuableKey = GetValuableKey(val);
				float floatField = GetFloatField(ValuableOriginalValueField, val);
				float floatField2 = GetFloatField(ValuableCurrentValueField, val);
				float num2 = Mathf.Max(0f, floatField - floatField2);
				object target = ValuablePhysGrabObjectField?.GetValue(val);
				bool flag = IsReferenceInList(currentDollarHaulObjects, target);
				hashSet.Add(valuableKey);
				if (!valuableSnapshots.TryGetValue(valuableKey, out var value))
				{
					ValuableSnapshot valuableSnapshot = default(ValuableSnapshot);
					valuableSnapshot.BaselineDamage = num2;
					value = valuableSnapshot;
				}
				value.OriginalValue = floatField;
				value.CurrentValue = floatField2;
				value.CurrentDamage = num2;
				value.WasInHaul |= flag;
				valuableSnapshots[valuableKey] = value;
				if (!flag)
				{
					num += Mathf.Max(0f, num2 - value.BaselineDamage);
				}
			}
		}
		foreach (int item in valuableSnapshots.Keys.ToList())
		{
			if (!hashSet.Contains(item))
			{
				ValuableSnapshot valuableSnapshot2 = valuableSnapshots[item];
				if (!valuableSnapshot2.WasInHaul && !extractionJustChanged)
				{
					accumulatedLostValue += Mathf.Max(0f, valuableSnapshot2.CurrentDamage - valuableSnapshot2.BaselineDamage);
				}
				valuableSnapshots.Remove(item);
			}
		}
		return num;
	}

	private static float GetCurrentExtractedValue()
	{
		try
		{
			return (float)SemiFunc.StatGetRunCurrency() * 1000f;
		}
		catch
		{
			try
			{
				return (float)SemiFunc.StatGetRunTotalHaul() * 1000f;
			}
			catch
			{
				return 0f;
			}
		}
	}

	private static float GetCurrentTotalHaulValue()
	{
		try
		{
			return (float)SemiFunc.StatGetRunTotalHaul() * 1000f;
		}
		catch
		{
			return 0f;
		}
	}

	private static bool IsValuableReady(ValuableObject valuable)
	{
		if (ValuableValueSetField == null)
		{
			return true;
		}
		object value = ValuableValueSetField.GetValue(valuable);
		bool flag = default(bool);
		int num;
		if (value is bool)
		{
			flag = (bool)value;
			num = ((1 == 0) ? 1 : 0);
		}
		else
		{
			num = 1;
		}
		return (byte)((uint)num | (flag ? 1u : 0u)) != 0;
	}

	private static int GetValuableKey(ValuableObject valuable)
	{
		object obj = ValuablePhotonViewField?.GetValue(valuable);
		if (obj != null)
		{
			if (obj.GetType().GetProperty("ViewID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj, null) is int num && num != 0)
			{
				return num;
			}
			if ((obj.GetType().GetField("viewID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? obj.GetType().GetField("ViewID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))?.GetValue(obj) is int num2 && num2 != 0)
			{
				return num2;
			}
		}
		return ((Object)valuable).GetInstanceID();
	}

	private static float GetFloatField(FieldInfo field, object instance)
	{
		if (field == null || instance == null)
		{
			return 0f;
		}
		object value = field.GetValue(instance);
		if (value != null)
		{
			return Convert.ToSingle(value, CultureInfo.InvariantCulture);
		}
		return 0f;
	}

	private static List<object> GetCurrentDollarHaulObjects()
	{
		object obj = RoundDirectorInstanceField?.GetValue(null);
		if (!(((obj == null) ? null : RoundDirectorDollarHaulListField?.GetValue(obj)) is IEnumerable enumerable))
		{
			return new List<object>();
		}
		List<object> list = new List<object>();
		foreach (object item in enumerable)
		{
			if (item != null)
			{
				list.Add(item);
			}
		}
		return list;
	}

	private static bool IsReferenceInList(List<object> list, object target)
	{
		if (target != null)
		{
			return list.Any((object item) => item == target);
		}
		return false;
	}

	private float GetMapValueFromTracker()
	{
		FieldInfo mapValueTrackerTotalValueField = GetMapValueTrackerTotalValueField();
		if (mapValueTrackerTotalValueField == null)
		{
			return 0f;
		}
		object value = mapValueTrackerTotalValueField.GetValue(null);
		if (value == null)
		{
			return 0f;
		}
		return Convert.ToSingle(value, CultureInfo.InvariantCulture);
	}

	private float GetMapInitialValueFromTracker()
	{
		FieldInfo mapValueTrackerInitialValueField = GetMapValueTrackerInitialValueField();
		if (mapValueTrackerInitialValueField == null)
		{
			return 0f;
		}
		object value = mapValueTrackerInitialValueField.GetValue(null);
		if (value == null)
		{
			return 0f;
		}
		return Convert.ToSingle(value, CultureInfo.InvariantCulture);
	}

	private static Type GetMapValueTrackerType()
	{
		if (cachedMapValueTrackerType != null)
		{
			return cachedMapValueTrackerType;
		}
		Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
		for (int i = 0; i < assemblies.Length; i++)
		{
			Type type = SafeGetTypes(assemblies[i]).FirstOrDefault((Type candidate) => candidate != null && candidate.FullName == "MapValueTracker.MapValueTracker");
			if (type != null)
			{
				cachedMapValueTrackerType = type;
				return cachedMapValueTrackerType;
			}
		}
		return null;
	}

	private static FieldInfo GetMapValueTrackerTotalValueField()
	{
		if (cachedMapValueTrackerTotalValueField != null)
		{
			return cachedMapValueTrackerTotalValueField;
		}
		Type mapValueTrackerType = GetMapValueTrackerType();
		if (mapValueTrackerType == null)
		{
			return null;
		}
		cachedMapValueTrackerTotalValueField = mapValueTrackerType.GetField("totalValue", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		return cachedMapValueTrackerTotalValueField;
	}

	private static FieldInfo GetMapValueTrackerInitialValueField()
	{
		if (cachedMapValueTrackerInitialValueField != null)
		{
			return cachedMapValueTrackerInitialValueField;
		}
		Type mapValueTrackerType = GetMapValueTrackerType();
		if (mapValueTrackerType == null)
		{
			return null;
		}
		cachedMapValueTrackerInitialValueField = mapValueTrackerType.GetField("totalValueInit", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
		return cachedMapValueTrackerInitialValueField;
	}

	private string BuildLevelLine()
	{
		int num = SemiFunc.RunGetLevelsCompleted() + 1;
		string arg = "未知";
		if ((Object)(object)RunManager.instance != (Object)null && (Object)(object)RunManager.instance.levelCurrent != (Object)null)
		{
			string narrativeName = RunManager.instance.levelCurrent.NarrativeName;
			if (!string.IsNullOrWhiteSpace(narrativeName))
			{
				arg = LevelNameLocalizer.Translate(narrativeName.Trim());
			}
		}
		return string.Format("{0}: {1} - {2}", "当前关卡", num, arg);
	}

	private string BuildPlayerCountLine()
	{
		List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
		int num = list?.Count ?? 0;
		int num2 = list?.Count(IsPlayerAlive) ?? 0;
		int num3 = Math.Max(0, num - num2);
		return string.Format("{0}: {1} {2} | {3} {4} | {5} {6}", "玩家数量", "死亡", num3, "存活", num2, "总数", num);
	}

	private void RefreshEnemyLabels()
	{
		enemyLabels.Clear();
		Enemy[] array = Resources.FindObjectsOfTypeAll<Enemy>();
		if (array == null || array.Length == 0)
		{
			return;
		}
		foreach (Enemy item in array.Where(IsEnemyCountable))
		{
			enemyLabels.Add(new EnemyLabelInfo
			{
				Enemy = item,
				Name = GetEnemyDisplayName(item)
			});
		}
	}

	private static bool IsPlayerAlive(PlayerAvatar player)
	{
		if ((Object)(object)player == (Object)null)
		{
			return false;
		}
		bool flag = default(bool);
		int num;
		if (PlayerDeadSetField != null)
		{
			object value = PlayerDeadSetField.GetValue(player);
			if (value is bool)
			{
				flag = (bool)value;
				num = 1;
			}
			else
			{
				num = 0;
			}
		}
		else
		{
			num = 0;
		}
		int num2 = num & (flag ? 1 : 0);
		bool flag2 = default(bool);
		int num3;
		if (PlayerIsDisabledField != null)
		{
			object value = PlayerIsDisabledField.GetValue(player);
			if (value is bool)
			{
				flag2 = (bool)value;
				num3 = 1;
			}
			else
			{
				num3 = 0;
			}
		}
		else
		{
			num3 = 0;
		}
		bool flag3 = (byte)((uint)num3 & (flag2 ? 1u : 0u)) != 0;
		if (num2 == 0 && !flag3)
		{
			return true;
		}
		if (HasPlayerDeathMarker(player))
		{
			return false;
		}
		Transform playerTransform;
		return TryGetPlayerLiveTransform(player, requireActive: true, out playerTransform);
	}

	private static PlayerAvatar GetLocalPlayer(List<PlayerAvatar> players)
	{
		try
		{
			PlayerAvatar val = SemiFunc.PlayerAvatarLocal();
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		catch
		{
		}
		if (players == null || players.Count == 0)
		{
			return null;
		}
		return ((IEnumerable<PlayerAvatar>)players).FirstOrDefault((Func<PlayerAvatar, bool>)delegate(PlayerAvatar player)
		{
			bool flag = default(bool);
			int num;
			if ((Object)(object)player != (Object)null)
			{
				object obj2 = PlayerIsLocalField?.GetValue(player);
				if (obj2 is bool)
				{
					flag = (bool)obj2;
					num = 1;
				}
				else
				{
					num = 0;
				}
			}
			else
			{
				num = 0;
			}
			return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
		}) ?? ((IEnumerable<PlayerAvatar>)players).FirstOrDefault((Func<PlayerAvatar, bool>)((PlayerAvatar player) => (Object)(object)player != (Object)null));
	}

	private static string GetPlayerName(PlayerAvatar player)
	{
		if ((Object)(object)player == (Object)null)
		{
			return "未知玩家";
		}
		try
		{
			string text = SemiFunc.PlayerGetName(player);
			if (!string.IsNullOrWhiteSpace(text))
			{
				return text.Trim();
			}
		}
		catch
		{
		}
		string text2 = PlayerNameField?.GetValue(player) as string;
		if (!string.IsNullOrWhiteSpace(text2))
		{
			return text2.Trim();
		}
		if (!string.IsNullOrWhiteSpace(((Object)player).name))
		{
			return ((Object)player).name.Replace("(Clone)", string.Empty).Trim();
		}
		return "未知玩家";
	}

	private static string GetPlayerColorHex(PlayerAvatar player)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string text = SemiFunc.PlayerGetSteamID(player);
			if (!string.IsNullOrWhiteSpace(text))
			{
				return ColorUtility.ToHtmlStringRGB(EnsureReadableColor(SemiFunc.PlayerGetColorFromSteamID(text))).ToLowerInvariant();
			}
		}
		catch
		{
		}
		return "ffffff";
	}

	private static Vector3 GetPlayerDistanceOrigin(PlayerAvatar localPlayer, bool localAlive)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: 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)
		if ((Object)(object)localPlayer == (Object)null)
		{
			return Vector3.zero;
		}
		if (localAlive)
		{
			return GetPlayerReferencePosition(localPlayer, preferDeathPosition: false);
		}
		if (TryGetSpectateOrigin(localPlayer, out var position))
		{
			return position;
		}
		return GetPlayerReferencePosition(localPlayer, preferDeathPosition: true);
	}

	private static bool TryGetSpectateOrigin(PlayerAvatar localPlayer, out Vector3 position)
	{
		//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_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_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		position = Vector3.zero;
		object? obj = SpectateCameraInstanceField?.GetValue(null);
		SpectateCamera val = (SpectateCamera)((obj is SpectateCamera) ? obj : null);
		if ((Object)(object)val == (Object)null)
		{
			return TryGetMainCameraPosition(out position);
		}
		object? obj2 = SpectateCameraPlayerOverrideField?.GetValue(val);
		PlayerAvatar val2 = (PlayerAvatar)(((obj2 is PlayerAvatar) ? obj2 : null) ?? ((object)/*isinst with value type is only supported in some contexts*/));
		if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)localPlayer && IsPlayerAlive(val2))
		{
			position = GetPlayerReferencePosition(val2, preferDeathPosition: false);
			return true;
		}
		object? obj3 = SpectateCameraMainCameraField?.GetValue(val);
		Camera val3 = (Camera)((obj3 is Camera) ? obj3 : null);
		if (val3 != null && (Object)(object)val3 != (Object)null)
		{
			position = ((Component)val3).transform.position;
			return true;
		}
		return TryGetMainCameraPosition(out position);
	}

	private static bool TryGetMainCameraPosition(out Vector3 position)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		position = Vector3.zero;
		Camera main = Camera.main;
		if ((Object)(object)main == (Object)null)
		{
			return false;
		}
		position = ((Component)main).transform.position;
		return true;
	}

	private static Color EnsureReadableColor(Color color)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: 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_0040: 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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		if (color.a <= 0f)
		{
			return Color.white;
		}
		if (color.r * 0.299f + color.g * 0.587f + color.b * 0.114f < 0.35f)
		{
			color = Color.Lerp(color, Color.white, 0.35f);
		}
		color.a = 1f;
		return color;
	}

	private static Vector3 GetPlayerReferencePosition(PlayerAvatar player, bool preferDeathPosition)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)player == (Object)null)
		{
			return Vector3.zero;
		}
		if (preferDeathPosition)
		{
			object? obj = PlayerDeathHeadField?.GetValue(player);
			PlayerDeathHead val = (PlayerDeathHead)((obj is PlayerDeathHead) ? obj : null);
			if (val != null && (Object)(object)val != (Object)null)
			{
				object? obj2 = DeathHeadPhysGrabObjectField?.GetValue(val);
				Component val2 = (Component)((obj2 is Component) ? obj2 : null);
				if (val2 != null && (Object)(object)val2 != (Object)null)
				{
					return val2.transform.position;
				}
				object? obj3 = DeathHeadOverridePositionTransformField?.GetValue(val);
				Transform val3 = (Transform)((obj3 is Transform) ? obj3 : null);
				if (val3 != null && (Object)(object)val3 != (Object)null)
				{
					return val3.position;
				}
				if (TryGetVector3Field(DeathHeadTriggeredPositionField, val, out var position))
				{
					return position;
				}
				return ((Component)val).transform.position;
			}
			object? obj4 = PlayerDeathSpotField?.GetValue(player);
			GameObject val4 = (GameObject)((obj4 is GameObject) ? obj4 : null);
			if (val4 != null && (Object)(object)val4 != (Object)null)
			{
				return val4.transform.position;
			}
			if (TryGetVector3Field(PlayerLastNavmeshPositionField, player, out var position2))
			{
				return position2;
			}
		}
		if (TryGetPlayerLiveTransform(player, !preferDeathPosition, out var playerTransform) || TryGetPlayerLiveTransform(player, requireActive: false, out playerTransform))
		{
			return playerTransform.position;
		}
		return ((Component)player).transform.position;
	}

	private static Vector3 GetPlayerLabelPosition(PlayerAvatar player, Vector3 fallbackPosition, bool preferDeathPosition)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_0050: 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_0076: 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_0085: 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_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)player == (Object)null)
		{
			return fallbackPosition;
		}
		if (preferDeathPosition)
		{
			return fallbackPosition + Vector3.up * 0.05f;
		}
		Component val = null;
		val = (Component)((!TryGetPlayerLiveTransform(player, requireActive: true, out var playerTransform) && !TryGetPlayerLiveTransform(player, requireActive: false, out playerTransform)) ? ((object)player) : ((object)playerTransform));
		if (TryGetObjectTopNear((IEnumerable<Component>)(object)new Component[2]
		{
			val,
			(Component)player
		}, fallbackPosition, 3f, out var topPosition))
		{
			return topPosition + Vector3.up * 0.05f;
		}
		return fallbackPosition + Vector3.up * 1.7f;
	}

	private static bool HasPlayerDeathMarker(PlayerAvatar player)
	{
		if ((Object)(object)player == (Object)null)
		{
			return false;
		}
		object? obj = PlayerDeathHeadField?.GetValue(player);
		PlayerDeathHead val = (PlayerDeathHead)((obj is PlayerDeathHead) ? obj : null);
		if (val != null && (Object)(object)val != (Object)null && IsUsableTransform(((Component)val).transform, requireActive: true))
		{
			return true;
		}
		object? obj2 = PlayerDeathSpotField?.GetValue(player);
		GameObject val2 = (GameObject)((obj2 is GameObject) ? obj2 : null);
		if (val2 != null && (Object)(object)val2 != (Object)null && IsUsableTransform(val2.transform, requireActive: true))
		{
			return true;
		}
		return false;
	}

	private static bool TryGetPlayerLiveTransform(PlayerAvatar player, bool requireActive, out Transform playerTransform)
	{
		playerTransform = null;
		if ((Object)(object)player == (Object)null)
		{
			return false;
		}
		object? obj = PlayerTransformField?.GetValue(player);
		Transform val = (Transform)((obj is Transform) ? obj : null);
		if (val != null && IsUsableTransform(val, requireActive))
		{
			playerTransform = val;
			return true;
		}
		if (IsUsableTransform(((Component)player).transform, requireActive))
		{
			playerTransform = ((Component)player).transform;
			return true;
		}
		return false;
	}

	private static bool IsUsableTransform(Transform transform, bool requireActive)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)transform == (Object)null) && !((Object)(object)((Component)transform).gameObject == (Object)null))
		{
			Scene scene = ((Component)transform).gameObject.scene;
			if (((Scene)(ref scene)).IsValid())
			{
				if (requireActive)
				{
					return ((Component)transform).gameObject.activeInHierarchy;
				}
				return true;
			}
		}
		return false;
	}

	private static bool TryGetVector3Field(FieldInfo field, object instance, out Vector3 position)
	{
		//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_002a: 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_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		position = Vector3.zero;
		if (field == null || instance == null)
		{
			return false;
		}
		if (!(field.GetValue(instance) is Vector3 val))
		{
			return false;
		}
		position = val;
		return ((Vector3)(ref val)).sqrMagnitude > 0.001f;
	}

	private static Vector3 GetEnemyReferencePosition(Enemy enemy)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: 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)
		Transform enemyCenterTransform = GetEnemyCenterTransform(enemy);
		if ((Object)(object)enemyCenterTransform != (Object)null)
		{
			return enemyCenterTransform.position;
		}
		Component enemyRootComponent = GetEnemyRootComponent(enemy);
		if ((Object)(object)enemyRootComponent != (Object)null)
		{
			return enemyRootComponent.transform.position;
		}
		Component enemyParentComponent = GetEnemyParentComponent(enemy);
		if (!((Object)(object)enemyParentComponent == (Object)null))
		{
			return enemyParentComponent.transform.position;
		}
		return Vector3.zero;
	}

	private static Vector3 GetEnemyLabelPosition(Enemy enemy, Vector3 fallbackPosition)
	{
		//IL_001f: 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_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: 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_0042: 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_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		Component enemyRootComponent = GetEnemyRootComponent(enemy);
		Transform enemyCenterTransform = GetEnemyCenterTransform(enemy);
		Vector3 val = (((Object)(object)enemyCenterTransform == (Object)null) ? fallbackPosition : enemyCenterTransform.position);
		if (TryGetObjectTopNear((IEnumerable<Component>)(object)new Component[3]
		{
			(Component)enemyCenterTransform,
			enemyRootComponent,
			(Component)enemy
		}, val, 6f, out var topPosition))
		{
			return topPosition + Vector3.up * 0.1f;
		}
		return val + Vector3.up * 1.1f;
	}

	private static bool TryGetObjectTop(IEnumerable<Component> roots, out Vector3 topPosition)
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: 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_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		topPosition = Vector3.zero;
		if (roots == null)
		{
			return false;
		}
		Bounds bounds = default(Bounds);
		bool hasBounds = false;
		HashSet<int> hashSet = new HashSet<int>();
		foreach (Component root in roots)
		{
			if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null)
			{
				continue;
			}
			Scene scene = root.gameObject.scene;
			if (!((Scene)(ref scene)).IsValid())
			{
				continue;
			}
			int instanceID = ((Object)root.gameObject).GetInstanceID();
			if (!hashSet.Add(instanceID))
			{
				continue;
			}
			Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (!((Object)(object)val == (Object)null) && val.enabled)
				{
					EncapsulateBounds(ref bounds, ref hasBounds, val.bounds);
				}
			}
			Collider[] componentsInChildren2 = root.GetComponentsInChildren<Collider>();
			foreach (Collider val2 in componentsInChildren2)
			{
				if (!((Object)(object)val2 == (Object)null) && val2.enabled)
				{
					EncapsulateBounds(ref bounds, ref hasBounds, val2.bounds);
				}
			}
		}
		if (hasBounds)
		{
			topPosition = new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z);
			return true;
		}
		return false;
	}

	private static bool TryGetObjectTopNear(IEnumerable<Component> roots, Vector3 anchorPosition, float maxHorizontalDistance, out Vector3 topPosition)
	{
		//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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: 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_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: 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)
		topPosition = Vector3.zero;
		if (roots == null)
		{
			return false;
		}
		Bounds bounds = default(Bounds);
		bool hasBounds = false;
		HashSet<int> hashSet = new HashSet<int>();
		float maxDistanceSquared = maxHorizontalDistance * maxHorizontalDistance;
		foreach (Component root in roots)
		{
			if ((Object)(object)root == (Object)null || (Object)(object)root.gameObject == (Object)null)
			{
				continue;
			}
			Scene scene = root.gameObject.scene;
			if (!((Scene)(ref scene)).IsValid())
			{
				continue;
			}
			int instanceID = ((Object)root.gameObject).GetInstanceID();
			if (!hashSet.Add(instanceID))
			{
				continue;
			}
			Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (!((Object)(object)val == (Object)null) && val.enabled && IsBoundsNear(val.bounds, anchorPosition, maxDistanceSquared))
				{
					EncapsulateBounds(ref bounds, ref hasBounds, val.bounds);
				}
			}
			Collider[] componentsInChildren2 = root.GetComponentsInChildren<Collider>();
			foreach (Collider val2 in componentsInChildren2)
			{
				if (!((Object)(object)val2 == (Object)null) && val2.enabled && IsBoundsNear(val2.bounds, anchorPosition, maxDistanceSquared))
				{
					EncapsulateBounds(ref bounds, ref hasBounds, val2.bounds);
				}
			}
		}
		if (hasBounds)
		{
			topPosition = new Vector3(anchorPosition.x, ((Bounds)(ref bounds)).max.y, anchorPosition.z);
			return true;
		}
		return false;
	}

	private static bool IsBoundsNear(Bounds bounds, Vector3 anchorPosition, float maxDistanceSquared)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_001f: 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_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = new Vector2(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).center.z);
		Vector2 val2 = default(Vector2);
		((Vector2)(ref val2))..ctor(anchorPosition.x, anchorPosition.z);
		Vector2 val3 = val - val2;
		return ((Vector2)(ref val3)).sqrMagnitude <= maxDistanceSquared;
	}

	private static void EncapsulateBounds(ref Bounds bounds, ref bool hasBounds, Bounds nextBounds)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: 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)
		if (!hasBounds)
		{
			bounds = nextBounds;
			hasBounds = true;
		}
		else
		{
			((Bounds)(ref bounds)).Encapsulate(nextBounds);
		}
	}

	private static Component GetEnemyRootComponent(Enemy enemy)
	{
		if ((Object)(object)enemy == (Object)null)
		{
			return null;
		}
		return (Component)(object)enemy;
	}

	private static Transform GetEnemyCenterTransform(Enemy enemy)
	{
		if ((Object)(object)enemy == (Object)null)
		{
			return null;
		}
		object? obj = EnemyCenterTransformField?.GetValue(enemy);
		return (Transform)((obj is Transform) ? obj : null);
	}

	private static Component GetEnemyParentComponent(Enemy enemy)
	{
		if ((Object)(object)enemy == (Object)null)
		{
			return null;
		}
		object? obj = EnemyParentField?.GetValue(enemy);
		return (Component)((obj is Component) ? obj : null);
	}

	private static bool IsEnemyCountable(Enemy enemy)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)enemy == (Object)null) && !((Object)(object)((Component)enemy).gameObject == (Object)null))
		{
			Scene scene = ((Component)enemy).gameObject.scene;
			if (((Scene)(ref scene)).IsValid())
			{
				if (EnemyHealthField != null && EnemyHealthDeadField != null)
				{
					object value = EnemyHealthField.GetValue(enemy);
					bool flag = default(bool);
					int num;
					if (value != null)
					{
						object value2 = EnemyHealthDeadField.GetValue(value);
						if (value2 is bool)
						{
							flag = (bool)value2;
							num = 1;
						}
						else
						{
							num = 0;
						}
					}
					else
					{
						num = 0;
					}
					if (((uint)num & (flag ? 1u : 0u)) != 0)
					{
						return false;
					}
				}
				if (EnemyParentField != null && EnemyParentSpawnedField != null)
				{
					object value3 = EnemyParentField.GetValue(enemy);
					if (value3 != null)
					{
						object value2 = EnemyParentSpawnedField.GetValue(value3);
						if (value2 is bool && !(bool)value2)
						{
							return false;
						}
					}
				}
				return true;
			}
		}
		return false;
	}

	private string GetEnemyDisplayName(Enemy enemy)
	{
		if ((Object)(object)enemy == (Object)null)
		{
			return string.Empty;
		}
		if (EnemyParentField != null)
		{
			object value = EnemyParentField.GetValue(enemy);
			if (value != null && EnemyParentNameField != null)
			{
				string text = EnemyParentNameField.GetValue(value) as string;
				if (!string.IsNullOrWhiteSpace(text))
				{
					return EnemyNameLocalizer.Translate(text.Trim());
				}
			}
		}
		if (EnemyTypeField != null)
		{
			object value2 = EnemyTypeField.GetValue(enemy);
			if (value2 != null)
			{
				string text2 = value2.ToString();
				if (!string.IsNullOrWhiteSpace(text2))
				{
					return EnemyNameLocalizer.Translate(text2.Trim());
				}
			}
		}
		if (!string.IsNullOrWhiteSpace(((Object)enemy).name))
		{
			return EnemyNameLocalizer.Translate(((Object)enemy).name.Replace("(Clone)", string.Empty).Trim());
		}
		return "未知怪物";
	}

	private static IEnumerable<Type> SafeGetTypes(Assembly assembly)
	{
		try
		{
			return assembly.GetTypes();
		}
		catch (ReflectionTypeLoadException ex)
		{
			return ex.Types.Where((Type type) => type != null);
		}
		catch
		{
			return Array.Empty<Type>();
		}
	}

	private static string FormatMoney(float value)
	{
		return "$" + Mathf.RoundToInt(value).ToString("N0", CultureInfo.GetCultureInfo("en-US"));
	}

	private void SetNativeOverlayVisible(bool visible)
	{
		if ((Object)(object)overlayObject != (Object)null)
		{
			overlayObject.SetActive(visible);
		}
	}

	private void OnGUI()
	{
		if (overlayEnabled.Value)
		{
			if (displayMode.Value == DisplayMode.文字显示 && !string.IsNullOrEmpty(overlayText))
			{
				DrawMainTextOverlay();
			}
			if (enemyLabels.Count > 0)
			{
				DrawEnemyWorldLabels();
			}
			if (ShouldDrawTeammateWorldLabels())
			{
				DrawTeammateWorldLabels();
			}
		}
	}

	private bool ShouldDrawTeammateWorldLabels()
	{
		if (!teammateOverlayEnabled.Value || !SemiFunc.RunIsLevel())
		{
			return false;
		}
		if (teammateDisplayMode.Value != 0)
		{
			return teammateVisibleTimer > 0f;
		}
		return true;
	}

	private void DrawMainTextOverlay()
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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_0037: 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_0046: Expected O, but got Unknown
		//IL_004c: 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_005d: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Expected O, but got Unknown
		//IL_010a: 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)
		GUIStyle val = new GUIStyle(GUI.skin.label)
		{
			fontSize = Mathf.Clamp(fontSize.Value, 10, 28),
			fontStyle = (FontStyle)1,
			alignment = (TextAnchor)8,
			wordWrap = false,
			richText = true
		};
		val.normal.textColor = Color.white;
		GUIStyle val2 = new GUIStyle(val);
		val2.richText = false;
		val2.normal.textColor = new Color(0f, 0f, 0f, 0.85f);
		float num = (showBreakdown.Value ? 430f : 320f);
		float num2 = val.CalcHeight(new GUIContent(overlayText), num);
		float num3 = (float)Screen.width - num - 12f;
		float num4 = (float)Screen.height - num2 - 26f;
		Rect val3 = default(Rect);
		((Rect)(ref val3))..ctor(num3, num4, num, num2);
		GUI.Label(new Rect(((Rect)(ref val3)).x + 1f, ((Rect)(ref val3)).y + 1f, ((Rect)(ref val3)).width, ((Rect)(ref val3)).height), StripRichText(overlayText), val2);
		GUI.Label(val3, overlayText, val);
	}

	private void DrawTeammateWorldLabels()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Expected O, but got Unknown
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Expected O, but got Unknown
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Expected O, but got Unknown
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: 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_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_01c1: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: 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_02b7: Expected O, but got Unknown
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		Camera worldLabelCamera = GetWorldLabelCamera();
		if ((Object)(object)worldLabelCamera == (Object)null)
		{
			return;
		}
		List<PlayerAvatar> list = SemiFunc.PlayerGetAll();
		PlayerAvatar localPlayer = GetLocalPlayer(list);
		bool flag = IsPlayerAlive(localPlayer);
		Vector3 playerDistanceOrigin = GetPlayerDistanceOrigin(localPlayer, flag);
		int num = Mathf.Clamp(teammateFontSize.Value, 10, 36);
		GUIStyle val = new GUIStyle(GUI.skin.label)
		{
			fontSize = num,
			fontStyle = (FontStyle)1,
			alignment = (TextAnchor)4,
			wordWrap = false,
			richText = true
		};
		val.normal.textColor = Color.white;
		GUIStyle val2 = new GUIStyle(val);
		val2.richText = false;
		val2.normal.textColor = new Color(0f, 0f, 0f, 0.85f);
		GUIStyle val3 = new GUIStyle(val)
		{
			fontSize = Mathf.Clamp(num + 3, 10, 42)
		};
		GUIStyle val4 = new GUIStyle(val3);
		val4.richText = false;
		val4.normal.textColor = new Color(0f, 0f, 0f, 0.85f);
		if (list == null || list.Count == 0)
		{
			return;
		}
		bool includeLocalPlayer = !flag;
		Rect val9 = default(Rect);
		foreach (PlayerAvatar item in list.Where((PlayerAvatar player) => (Object)(object)player != (Object)null && (includeLocalPlayer || (Object)(object)player != (Object)(object)localPlayer)))
		{
			if ((Object)(object)item == (Object)null)
			{
				continue;
			}
			bool flag2 = IsPlayerAlive(item);
			if (!((Object)(object)item == (Object)(object)localPlayer && flag))
			{
				Vector3 playerReferencePosition = GetPlayerReferencePosition(item, !flag2);
				Vector3 playerLabelPosition = GetPlayerLabelPosition(item, playerReferencePosition, !flag2);
				Vector3 val5 = worldLabelCamera.WorldToScreenPoint(playerLabelPosition);
				if (!(val5.z <= 0.05f) && !(val5.x < -80f) && !(val5.x > (float)Screen.width + 80f) && !(val5.y < -80f) && !(val5.y > (float)Screen.height + 80f))
				{
					int num2 = Mathf.RoundToInt(Vector3.Distance(playerDistanceOrigin, playerReferencePosition));
					string playerColorHex = GetPlayerColorHex(item);
					string text = (flag2 ? string.Empty : "☠ ");
					string text2 = $"<color=#{playerColorHex}>{text}{GetPlayerName(item)} {num2}m</color>";
					string text3 = StripRichText(text2);
					GUIStyle val6 = (flag2 ? val : val3);
					GUIStyle val7 = (flag2 ? val2 : val4);
					Vector2 val8 = val6.CalcSize(new GUIContent(text3));
					float num3 = Mathf.Clamp(val8.x + 18f, 80f, 320f);
					float num4 = val8.y + 6f;
					float num5 = val5.x - num3 / 2f;
					float num6 = (float)Screen.height - val5.y - num4 - 6f;
					((Rect)(ref val9))..ctor(num5, num6, num3, num4);
					GUI.Label(new Rect(((Rect)(ref val9)).x + 1f, ((Rect)(ref val9)).y + 1f, ((Rect)(ref val9)).width, ((Rect)(ref val9)).height), text3, val7);
					GUI.Label(val9, text2, val6);
				}
			}
		}
	}

	private void DrawEnemyWorldLabels()
	{
		//IL_0038: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_008a: 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_009c: Expected O, but got Unknown
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: 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_0113: 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_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: 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_0180: 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_01da: Expected O, but got Unknown
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: 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_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		Camera worldLabelCamera = GetWorldLabelCamera();
		if ((Object)(object)worldLabelCamera == (Object)null)
		{
			return;
		}
		PlayerAvatar localPlayer = GetLocalPlayer(SemiFunc.PlayerGetAll());
		Vector3 val = (((Object)(object)localPlayer == (Object)null) ? ((Component)worldLabelCamera).transform.position : GetPlayerDistanceOrigin(localPlayer, IsPlayerAlive(localPlayer)));
		GUIStyle val2 = new GUIStyle(GUI.skin.label)
		{
			fontSize = Mathf.Clamp(enemyFontSize.Value, 10, 36),
			fontStyle = (FontStyle)1,
			alignment = (TextAnchor)4,
			wordWrap = false,
			richText = true
		};
		val2.normal.textColor = Color.red;
		GUIStyle val3 = new GUIStyle(val2);
		val3.richText = false;
		val3.normal.textColor = new Color(0f, 0f, 0f, 0.85f);
		Rect val6 = default(Rect);
		foreach (EnemyLabelInfo item in enemyLabels.ToList())
		{
			Enemy enemy = item.Enemy;
			if (IsEnemyCountable(enemy))
			{
				Vector3 enemyReferencePosition = GetEnemyReferencePosition(enemy);
				Vector3 enemyLabelPosition = GetEnemyLabelPosition(enemy, enemyReferencePosition);
				Vector3 val4 = worldLabelCamera.WorldToScreenPoint(enemyLabelPosition);
				if (!(val4.z <= 0.05f) && !(val4.x < -80f) && !(val4.x > (float)Screen.width + 80f) && !(val4.y < -80f) && !(val4.y > (float)Screen.height + 80f))
				{
					int num = Mathf.RoundToInt(Vector3.Distance(val, enemyReferencePosition));
					string arg = (string.IsNullOrWhiteSpace(item.Name) ? GetEnemyDisplayName(enemy) : item.Name);
					string text = $"<color=#ff3333>\ud83d\udc79 {arg} {num}m</color>";
					string text2 = StripRichText(text);
					Vector2 val5 = val2.CalcSize(new GUIContent(text2));
					float num2 = Mathf.Clamp(val5.x + 18f, 80f, 390f);
					float num3 = val5.y + 6f;
					float num4 = val4.x - num2 / 2f;
					float num5 = (float)Screen.height - val4.y - num3 - 6f;
					((Rect)(ref val6))..ctor(num4, num5, num2, num3);
					GUI.Label(new Rect(((Rect)(ref val6)).x + 1f, ((Rect)(ref val6)).y + 1f, ((Rect)(ref val6)).width, ((Rect)(ref val6)).height), text2, val3);
					GUI.Label(val6, text, val2);
				}
			}
		}
	}

	private static Camera GetWorldLabelCamera()
	{
		Camera main = Camera.main;
		if ((Object)(object)main != (Object)null)
		{
			return main;
		}
		object? obj = SpectateCameraInstanceField?.GetValue(null);
		SpectateCamera val = (SpectateCamera)((obj is SpectateCamera) ? obj : null);
		if ((Object)(object)val != (Object)null)
		{
			object? obj2 = SpectateCameraMainCameraField?.GetValue(val);
			Camera val2 = (Camera)((obj2 is Camera) ? obj2 : null);
			if (val2 != null && (Object)(object)val2 != (Object)null)
			{
				return val2;
			}
		}
		return null;
	}

	private static string StripRichText(string text)
	{
		if (!string.IsNullOrEmpty(text))
		{
			return Regex.Replace(text, "<.*?>", string.Empty);
		}
		return string.Empty;
	}

	private static ConfigDescription ConfigDescriptionWithOrder(string description, int order)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		return new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
		{
			new ConfigurationManagerAttributes
			{
				Order = order
			}
		});
	}

	private static bool IsConfiguredKeyDown(string keyName)
	{
		//IL_000d: 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)
		if (!TryParseConfiguredKey(keyName, out var keyCode))
		{
			keyCode = (KeyCode)116;
		}
		return Input.GetKeyDown(keyCode);
	}

	private static bool TryParseConfiguredKey(string keyName, out KeyCode keyCode)
	{
		keyCode = (KeyCode)0;
		if (string.IsNullOrWhiteSpace(keyName))
		{
			return false;
		}
		string text = keyName.Trim().Replace(" ", string.Empty);
		switch (text.ToLowerInvariant())
		{
		case "左键":
		case "鼠标左键":
		case "leftmouse":
			keyCode = (KeyCode)323;
			return true;
		case "右键":
		case "鼠标右键":
		case "rightmouse":
			keyCode = (KeyCode)324;
			return true;
		case "中键":
		case "鼠标中键":
		case "middlemouse":
			keyCode = (KeyCode)325;
			return true;
		default:
			return Enum.TryParse<KeyCode>(text, ignoreCase: true, out keyCode);
		}
	}

	private void OnDestroy()
	{
		if (itemRotationHarmony != null)
		{
			itemRotationHarmony.UnpatchSelf();
			itemRotationHarmony = null;
		}
		if ((Object)(object)overlayObject != (Object)null)
		{
			Object.Destroy((Object)(object)overlayObject);
			overlayObject = null;
			overlayRect = null;
			overlayLabel = null;
		}
		if ((Object)(object)overlayCanvasObject != (Object)null)
		{
			Object.Destroy((Object)(object)overlayCanvasObject);
			overlayCanvasObject = null;
			overlayCanvas = null;
		}
	}

	private static void DrawKeyBinding(ConfigEntryBase entry)
	{
		if (entry is ConfigEntry<string> val)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			string text = (string.IsNullOrWhiteSpace(val.Value) ? "T" : val.Value.Trim());
			string text2 = GUILayout.TextField(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			if (text2 != text)
			{
				val.Value = text2.Trim();
			}
			bool flag = keyCaptureEntry == val;
			if (GUILayout.Button(flag ? "按下按键..." : "录入按键", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) }))
			{
				keyCaptureEntry = (flag ? null : val);
			}
			if (flag)
			{
				CaptureKeyInput(val);
			}
			GUILayout.EndHorizontal();
		}
	}

	private static void CaptureKeyInput(ConfigEntry<string> keyEntry)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Invalid comparison between Unknown and I4
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Invalid comparison between Unknown and I4
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		Event current = Event.current;
		if (current == null)
		{
			return;
		}
		if ((int)current.type == 4 && (int)current.keyCode != 0)
		{
			if ((int)current.keyCode != 27)
			{
				KeyCode keyCode = current.keyCode;
				keyEntry.Value = ((object)(KeyCode)(ref keyCode)).ToString();
			}
			keyCaptureEntry = null;
			current.Use();
		}
		else if ((int)current.type == 0)
		{
			keyEntry.Value = "Mouse" + current.button;
			keyCaptureEntry = null;
			current.Use();
		}
	}

	private static void DrawDisplayMode(ConfigEntryBase entry)
	{
		if (entry is ConfigEntry<DisplayMode> val)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(entry.Definition.Key, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			DisplayMode value = val.Value;
			if (GUILayout.Button(ConfigText.TranslateDisplayMode(value), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }))
			{
				val.Value = ((value == DisplayMode.文字显示) ? DisplayMode.原生UI显示 : DisplayMode.文字显示);
			}
			GUILayout.EndHorizontal();
		}
	}
}
internal static class HudText
{
	public const string UnknownLevel = "未知";

	public const string UnknownEnemy = "未知怪物";

	public const string EnemyTotal = "怪物总数";

	public const string MapLostValue = "损失价值";

	public const string MapTotalValue = "地图价值";

	public const string Level = "当前关卡";

	public const string PlayerCounts = "玩家数量";

	public const string Dead = "死亡";

	public const string Alive = "存活";

	public const string Total = "总数";
}
internal static class ConfigText
{
	public const string SectionBasic = "C1.右下角基础设置";

	public const string SectionValue = "C2.右下角价值统计";

	public const string SectionEnemy = "C3.右下角怪物统计";

	public const string SectionOther = "C4.右下角其他信息";

	public const string Enabled = "启用显示";

	public const string SectionSpacing = "不同分区空行";

	public const string DisplayMode = "显示模式";

	public const string FontSize = "字体大小";

	public const string UpdateInterval = "