Decompiled source of MiniMapAndMapPlus v3.18.0

MiniMapAndMapPlus.dll

Decompiled 12 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RepoMapFix
{
	internal static class ConfigLocalization
	{
		internal const string RepoConfigGuid = "nickklmao.repoconfig";

		private const string RepoConfigTypeName = "REPOConfig.ConfigMenu";

		private const string RepoConfigMethodName = "FixNaming";

		private static readonly Dictionary<string, string> Translations = new Dictionary<string, string>
		{
			{ "全般", "General" },
			{ "ミニマップ", "Minimap" },
			{ "画質", "Quality" },
			{ "マーカー", "Markers" },
			{ "納品場所の色", "Extraction Colors" },
			{ "自分の位置", "Player Marker" },
			{ "Tabマップ", "Tab Map" },
			{ "部屋チェック", "Room Check" },
			{ "デバッグ", "Debug" },
			{ "有効", "Enabled" },
			{ "解像度プリセット", "Resolution Preset" },
			{ "表示する", "Show" },
			{ "北向きに固定", "Fix North" },
			{ "表示方式", "Display Mode" },
			{ "ズーム", "Zoom" },
			{ "表示位置", "Position" },
			{ "大きさ", "Size" },
			{ "画面端の余白", "Screen Margin" },
			{ "不透明度", "Opacity" },
			{ "Tab中は隠す", "Hide While Tab Open" },
			{ "右上の下げ幅", "Right Offset" },
			{ "左上の下げ幅", "Left Offset" },
			{ "描画解像度", "Render Resolution" },
			{ "アンチエイリアス", "Anti-Aliasing" },
			{ "映す階", "Floor Mode" },
			{ "発見済み納品場所", "Discovered Extraction Points" },
			{ "味方の位置を表示", "Show Teammates" },
			{ "マーカーの大きさ", "Marker Size" },
			{ "納品場所の印の大きさ", "Extraction Marker Size" },
			{ "起動中の納品場所に波紋", "Ripple Active Points" },
			{ "起動中の納品場所の波紋の広がり", "Active Ripple Spread" },
			{ "ドアを目立たせる", "Highlight Doors" },
			{ "ドアの色", "Door Color" },
			{ "未起動", "Inactive" },
			{ "起動中", "Active" },
			{ "納品済み", "Completed" },
			{ "色", "Color" },
			{ "光らせる", "Glow" },
			{ "波紋を出す", "Ripple" },
			{ "波紋の大きさ", "Ripple Size" },
			{ "拡大率を変更", "Override Zoom" },
			{ "拡大率", "Zoom" },
			{ "味方マーカー", "Teammate Marker" },
			{ "自分の色", "My Color" },
			{ "自分を光らせる", "Glow Self" },
			{ "自分の波紋", "My Ripple" },
			{ "印のキー", "Mark Key" },
			{ "印のキーを設定", "Set Mark Key" },
			{ "印の色", "Mark Color" },
			{ "印の大きさ", "Mark Size" },
			{ "Tabにも表示", "Also on Tab Map" },
			{ "解除済み", "Unlocked" },
			{ "構造ログのキー", "Diagnostics Key" },
			{ "ログの保存先", "Log Save Path" }
		};

		private static readonly Dictionary<string, string> ColorNames = new Dictionary<string, string>
		{
			{ "標準のまま", "Default" },
			{ "黄色", "Yellow" },
			{ "水色", "Cyan" },
			{ "赤", "Red" },
			{ "オレンジ", "Orange" },
			{ "緑", "Green" },
			{ "青", "Blue" },
			{ "紫", "Purple" },
			{ "ピンク", "Pink" },
			{ "白", "White" },
			{ "灰色", "Gray" },
			{ "黒", "Black" }
		};

		private static readonly Dictionary<string, string> CornerNames = new Dictionary<string, string>
		{
			{ "右上", "Top Right" },
			{ "左上", "Top Left" },
			{ "右下", "Bottom Right" },
			{ "左下", "Bottom Left" }
		};

		private static readonly Dictionary<string, string> ViewModeNames = new Dictionary<string, string>
		{
			{ "ステージ全体を固定表示", "Fit Whole Stage" },
			{ "プレイヤーに追従", "Follow Player" }
		};

		private static readonly Dictionary<string, string> FloorModeNames = new Dictionary<string, string>
		{
			{ "自分のいる階", "Current Floor" },
			{ "全ての階", "All Floors" },
			{ "地上1階で固定", "Fixed Ground Floor" }
		};

		private static readonly List<Dictionary<string, string>> EnumValueSets = new List<Dictionary<string, string>> { ColorNames, CornerNames, ViewModeNames, FloorModeNames };

		private const string LanguageSettingKey = "言語";

		internal static void TryPatch(Harmony harmony, ManualLogSource logger)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			try
			{
				Type type = AccessTools.TypeByName("REPOConfig.ConfigMenu");
				if (type == null)
				{
					return;
				}
				MethodInfo methodInfo = AccessTools.Method(type, "FixNaming", (Type[])null, (Type[])null);
				if (methodInfo == null)
				{
					logger.LogWarning((object)"REPOConfigの表示名の作り方が変わっているため、英語表示は使えません。");
					return;
				}
				harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(ConfigLocalization), "Prefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				logger.LogInfo((object)"設定画面の英語表示を用意しました。");
			}
			catch (Exception ex)
			{
				logger.LogWarning((object)("設定画面の英語表示を用意できませんでした(日本語表示のまま動作します): " + ex.Message));
			}
			TryPatchSliderOptions(harmony, logger);
		}

		private static void TryPatchSliderOptions(Harmony harmony, ManualLogSource logger)
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			try
			{
				Type type = AccessTools.TypeByName("MenuLib.MenuAPI");
				Type type2 = AccessTools.TypeByName("MenuLib.MonoBehaviors.REPOSlider");
				Type type3 = ((type2 != null) ? AccessTools.Inner(type2, "BarBehavior") : null);
				if (!(type == null) && !(type3 == null))
				{
					MethodInfo methodInfo = AccessTools.Method(type, "CreateREPOSlider", new Type[10]
					{
						typeof(string),
						typeof(string),
						typeof(Action<int>),
						typeof(Transform),
						typeof(string[]),
						typeof(string),
						typeof(Vector2),
						typeof(string),
						typeof(string),
						type3
					}, (Type[])null);
					if (methodInfo == null)
					{
						logger.LogWarning((object)"選択肢一覧の作り方が変わっているため、選択肢の英語表示は使えません。");
					}
					else
					{
						harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(ConfigLocalization), "SliderOptionsPrefix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					}
				}
			}
			catch (Exception ex)
			{
				logger.LogWarning((object)("選択肢一覧の英語表示を用意できませんでした(日本語表示のまま動作します): " + ex.Message));
			}
		}

		private static bool SliderOptionsPrefix(ref string[] stringOptions, ref string defaultOption)
		{
			if (Plugin.CurrentLanguage != Plugin.Language.English || stringOptions == null)
			{
				return true;
			}
			Dictionary<string, string> dictionary = MatchEnumSet(stringOptions);
			if (dictionary == null)
			{
				return true;
			}
			string[] array = new string[stringOptions.Length];
			for (int i = 0; i < stringOptions.Length; i++)
			{
				array[i] = (dictionary.TryGetValue(stringOptions[i], out var value) ? value : stringOptions[i]);
			}
			stringOptions = array;
			if (defaultOption != null && dictionary.TryGetValue(defaultOption, out var value2))
			{
				defaultOption = value2;
			}
			return true;
		}

		private static Dictionary<string, string> MatchEnumSet(string[] options)
		{
			foreach (Dictionary<string, string> enumValueSet in EnumValueSets)
			{
				if (options.Length != enumValueSet.Count)
				{
					continue;
				}
				bool flag = true;
				foreach (string key in options)
				{
					if (!enumValueSet.ContainsKey(key))
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					return enumValueSet;
				}
			}
			return null;
		}

		private static bool Prefix(string input, ref string __result)
		{
			if (input == "言語")
			{
				__result = ((Plugin.CurrentLanguage == Plugin.Language.English) ? "Language / 言語" : "言語 / Language");
				return false;
			}
			if (Plugin.CurrentLanguage != Plugin.Language.English)
			{
				return true;
			}
			if (input != null && Translations.TryGetValue(input, out var value))
			{
				__result = value;
				return false;
			}
			return true;
		}

		internal static bool TryShowPopup(string header, Color headerColor, string content)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Type type = AccessTools.TypeByName("MenuLib.MenuAPI");
				if (type == null)
				{
					return false;
				}
				MethodInfo methodInfo = AccessTools.Method(type, "OpenPopup", new Type[5]
				{
					typeof(string),
					typeof(Color),
					typeof(string),
					typeof(Action),
					typeof(Action)
				}, (Type[])null);
				if (methodInfo == null)
				{
					return false;
				}
				methodInfo.Invoke(null, new object[5] { header, headerColor, content, null, null });
				return true;
			}
			catch (Exception)
			{
				return false;
			}
		}
	}
	internal static class Diagnostics
	{
		internal static void Dump(ManualLogSource logger, MinimapView view, EntityMarkers markers, FullMapView fullMap, string savePath)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine();
			stringBuilder.AppendLine("========== RepoMapFix Diagnostics ==========");
			DumpScreen(stringBuilder);
			DumpMinimapCamera(stringBuilder, view);
			view?.DescribeFitInto(stringBuilder);
			markers?.DescribeInto(stringBuilder);
			fullMap?.DescribeInto(stringBuilder);
			DumpExtractionColors(stringBuilder);
			DumpCamera(stringBuilder);
			DumpMapRoot(stringBuilder);
			DumpPlayerMarker(stringBuilder);
			DumpModules(stringBuilder);
			stringBuilder.AppendLine("========== End Diagnostics ==========");
			logger.LogInfo((object)stringBuilder.ToString());
			Save(logger, stringBuilder.ToString(), savePath);
		}

		private static void Save(ManualLogSource logger, string text, string savePath)
		{
			try
			{
				string text2 = (string.IsNullOrEmpty(savePath) ? Path.Combine(Paths.BepInExRootPath, "RepoMapFix_diagnostics.txt") : savePath);
				string directoryName = Path.GetDirectoryName(text2);
				if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				File.WriteAllText(text2, text);
				logger.LogInfo((object)("診断内容を書き出しました: " + text2));
			}
			catch (Exception ex)
			{
				logger.LogWarning((object)("診断内容の書き出しに失敗しました: " + ex.Message));
			}
		}

		private static void DumpScreen(StringBuilder sb)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- 画面とUIの拡大率 ---");
			sb.AppendLine($"画面            : {Screen.width}x{Screen.height}");
			Canvas[] array = Object.FindObjectsOfType<Canvas>();
			foreach (Canvas val in array)
			{
				if (val.isRootCanvas)
				{
					sb.AppendLine($"  [{((Object)val).name}] 拡大率={val.scaleFactor:F3}");
					CanvasScaler component = ((Component)val).GetComponent<CanvasScaler>();
					if ((Object)(object)component != (Object)null)
					{
						sb.AppendLine($"        方式={component.uiScaleMode} 基準={component.referenceResolution}");
					}
				}
			}
		}

		private static void DumpMinimapCamera(StringBuilder sb, MinimapView view)
		{
			//IL_0085: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- Minimap Camera (self) ---");
			if (view == null || (Object)(object)view.Camera == (Object)null)
			{
				sb.AppendLine("NOT BUILT");
				return;
			}
			Camera camera = view.Camera;
			sb.AppendLine("path            : " + GetPath(((Component)camera).transform));
			sb.AppendLine($"enabled         : {((Behaviour)camera).enabled} activeInHierarchy={((Component)camera).gameObject.activeInHierarchy}");
			sb.AppendLine($"world position  : {((Component)camera).transform.position}");
			Quaternion rotation = ((Component)camera).transform.rotation;
			sb.AppendLine($"world rotation  : {((Quaternion)(ref rotation)).eulerAngles}");
			sb.AppendLine($"orthographic    : {camera.orthographic} size={camera.orthographicSize}");
			sb.AppendLine($"clip            : near={camera.nearClipPlane} far={camera.farClipPlane}");
			sb.AppendLine($"cullingMask     : {camera.cullingMask}");
			sb.AppendLine($"clearFlags      : {camera.clearFlags} color={camera.backgroundColor}");
			sb.AppendLine($"depth           : {camera.depth} rect={camera.rect}");
			DumpTexture(sb, "targetTexture", camera.targetTexture);
			if ((Object)(object)view.Texture != (Object)null)
			{
				sb.AppendLine($"texture created : {view.Texture.IsCreated()}");
			}
		}

		private static void DumpExtractionColors(StringBuilder sb)
		{
			sb.AppendLine("--- 納品所の地図タイルの色 ---");
			if ((Object)(object)Map.Instance == (Object)null)
			{
				sb.AppendLine("NOT FOUND");
				return;
			}
			DumpPrefabColor(sb, "起動中(Active)相当の通常床", Map.Instance.FloorObject1x1);
			DumpPrefabColor(sb, "納品済み(Used)の床", Map.Instance.FloorUsed);
			DumpPrefabColor(sb, "納品済み(Used)の壁", Map.Instance.WallUsed);
			DumpPrefabColor(sb, "未起動(Inactive)の床", Map.Instance.FloorInactive);
			DumpPrefabColor(sb, "未起動(Inactive)の壁", Map.Instance.WallInactive);
			DumpPrefabColor(sb, "トラックの床", Map.Instance.FloorTruck);
			DumpExtractionPoints(sb);
		}

		private static void DumpExtractionPoints(StringBuilder sb)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>();
			sb.AppendLine($"--- 納品所 {array.Length}個 ---");
			FieldInfo fieldInfo = AccessTools.Field(typeof(ExtractionPoint), "currentState");
			sb.AppendLine($"  プレイヤーの階 : {Map.Instance.PlayerLayer}");
			for (int i = 0; i < array.Length; i++)
			{
				ExtractionPoint val = array[i];
				object obj = fieldInfo?.GetValue(val);
				int layer = Map.Instance.GetLayerParent(((Component)val).transform.position.y + 0.01f).layer;
				int num = Mathf.Abs(layer - Map.Instance.PlayerLayer);
				string arg = ((num <= 1) ? "表示される階" : $"表示されない階({num}階ぶん離れている)");
				sb.AppendLine(string.Format("  [{0}] 状態={1} 施錠={2}", i, obj ?? "取得不可", val.isLocked));
				sb.AppendLine($"      階={layer} → {arg}");
				sb.AppendLine("      未起動時のタイル : " + DescribeTypes(val.mapInactive));
				sb.AppendLine("      起動中のタイル   : " + DescribeTypes(val.mapActive));
				sb.AppendLine("      納品済みのタイル : " + DescribeTypes(val.mapUsed));
			}
		}

		private static string DescribeTypes(DirtFinderMapFloor[] floors)
		{
			if (floors == null || floors.Length == 0)
			{
				return "なし";
			}
			HashSet<string> hashSet = new HashSet<string>();
			foreach (DirtFinderMapFloor val in floors)
			{
				if ((Object)(object)val != (Object)null)
				{
					hashSet.Add(((object)Unsafe.As<FloorType, FloorType>(ref val.Type)/*cast due to .constrained prefix*/).ToString());
				}
			}
			return string.Format("{0}枚 [{1}]", floors.Length, string.Join(", ", hashSet));
		}

		private static void DumpPrefabColor(StringBuilder sb, string label, GameObject prefab)
		{
			//IL_0073: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)prefab == (Object)null)
			{
				sb.AppendLine($"{label,-26}: なし");
				return;
			}
			Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
			if (componentsInChildren.Length == 0)
			{
				sb.AppendLine($"{label,-26}: 描画物なし");
				return;
			}
			Renderer[] array = componentsInChildren;
			for (int i = 0; i < array.Length; i++)
			{
				Material sharedMaterial = array[i].sharedMaterial;
				if (!((Object)(object)sharedMaterial == (Object)null))
				{
					string text = (sharedMaterial.HasProperty("_Color") ? ((object)sharedMaterial.GetColor("_Color")/*cast due to .constrained prefix*/).ToString() : "(色の項目なし)");
					string text2 = (sharedMaterial.HasProperty("_EmissionColor") ? ((object)sharedMaterial.GetColor("_EmissionColor")/*cast due to .constrained prefix*/).ToString() : "-");
					object[] obj = new object[4] { label, null, null, null };
					Shader shader = sharedMaterial.shader;
					obj[1] = ((shader != null) ? ((Object)shader).name : null);
					obj[2] = text;
					obj[3] = text2;
					sb.AppendLine(string.Format("{0,-26}: shader={1} color={2} emission={3}", obj));
					return;
				}
			}
			sb.AppendLine($"{label,-26}: 素材なし");
		}

		private static void DumpCamera(StringBuilder sb)
		{
			//IL_007e: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			Camera val = null;
			Camera[] array = Object.FindObjectsOfType<Camera>(true);
			foreach (Camera val2 in array)
			{
				if (((Object)val2).name == "Dirt Finder Map Camera")
				{
					val = val2;
					break;
				}
			}
			sb.AppendLine("--- Map Camera ---");
			if ((Object)(object)val == (Object)null)
			{
				sb.AppendLine("NOT FOUND");
				return;
			}
			sb.AppendLine("path            : " + GetPath(((Component)val).transform));
			Quaternion val3 = ((Component)val).transform.rotation;
			sb.AppendLine($"world rotation  : {((Quaternion)(ref val3)).eulerAngles}");
			val3 = ((Component)val).transform.localRotation;
			sb.AppendLine($"local rotation  : {((Quaternion)(ref val3)).eulerAngles}");
			sb.AppendLine($"local position  : {((Component)val).transform.localPosition}");
			sb.AppendLine($"orthographic    : {val.orthographic} size={val.orthographicSize}");
			sb.AppendLine($"cullingMask     : {val.cullingMask}");
			DumpTexture(sb, "targetTexture", val.targetTexture);
			DumpTexture(sb, "activeTexture", val.activeTexture);
			sb.AppendLine("--- Camera ancestors (rotation of each) ---");
			Transform parent = ((Component)val).transform.parent;
			while ((Object)(object)parent != (Object)null)
			{
				string name = ((Object)parent).name;
				val3 = parent.localRotation;
				object arg = ((Quaternion)(ref val3)).eulerAngles;
				val3 = parent.rotation;
				sb.AppendLine($"  {name,-32} localRot={arg} worldRot={((Quaternion)(ref val3)).eulerAngles}");
				parent = parent.parent;
			}
			if (!((Object)(object)((Component)val).transform.parent != (Object)null))
			{
				return;
			}
			sb.AppendLine("--- Siblings under camera's parent ---");
			foreach (Transform item in ((Component)val).transform.parent)
			{
				Transform val4 = item;
				Renderer component = ((Component)val4).GetComponent<Renderer>();
				object[] obj = new object[4]
				{
					((Object)val4).name,
					((Component)val4).gameObject.activeSelf,
					((Object)(object)component == (Object)null) ? "-" : ((object)component).GetType().Name,
					null
				};
				val3 = val4.localRotation;
				obj[3] = ((Quaternion)(ref val3)).eulerAngles;
				sb.AppendLine(string.Format("  {0,-32} active={1} renderer={2} localRot={3}", obj));
			}
		}

		private static void DumpTexture(StringBuilder sb, string label, RenderTexture rt)
		{
			//IL_0059: 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)
			if ((Object)(object)rt == (Object)null)
			{
				sb.AppendLine($"{label,-16}: null");
				return;
			}
			sb.AppendLine($"{label,-16}: {((Texture)rt).width}x{((Texture)rt).height} AA={rt.antiAliasing} filter={((Texture)rt).filterMode} format={rt.format}");
		}

		private static void DumpMapRoot(StringBuilder sb)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- Map.Instance ---");
			if ((Object)(object)Map.Instance == (Object)null)
			{
				sb.AppendLine("NOT FOUND");
				return;
			}
			sb.AppendLine("path            : " + GetPath(((Component)Map.Instance).transform));
			Quaternion rotation = ((Component)Map.Instance).transform.rotation;
			sb.AppendLine($"world rotation  : {((Quaternion)(ref rotation)).eulerAngles}");
			sb.AppendLine($"Active          : {Map.Instance.Active}");
			sb.AppendLine($"Scale           : {Map.Instance.Scale}");
			sb.AppendLine($"PlayerLayer     : {Map.Instance.PlayerLayer}");
			if ((Object)(object)Map.Instance.OverLayerParent != (Object)null)
			{
				string path = GetPath(Map.Instance.OverLayerParent);
				rotation = Map.Instance.OverLayerParent.rotation;
				sb.AppendLine($"OverLayerParent : {path} worldRot={((Quaternion)(ref rotation)).eulerAngles}");
			}
			if (!((Object)(object)Map.Instance.ActiveParent != (Object)null))
			{
				return;
			}
			sb.AppendLine("--- Children under Map.ActiveParent ---");
			foreach (Transform item in Map.Instance.ActiveParent.transform)
			{
				Transform val = item;
				Renderer component = ((Component)val).GetComponent<Renderer>();
				object[] obj = new object[4]
				{
					((Object)val).name,
					((Component)val).gameObject.activeSelf,
					((Object)(object)component == (Object)null) ? "-" : ((object)component).GetType().Name,
					null
				};
				rotation = val.rotation;
				obj[3] = ((Quaternion)(ref rotation)).eulerAngles;
				sb.AppendLine(string.Format("  {0,-32} active={1} renderer={2} worldRot={3}", obj));
			}
		}

		private static void DumpPlayerMarker(StringBuilder sb)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- DirtFinderMapPlayer ---");
			if ((Object)(object)DirtFinderMapPlayer.Instance == (Object)null)
			{
				sb.AppendLine("NOT FOUND");
				return;
			}
			Transform transform = ((Component)DirtFinderMapPlayer.Instance).transform;
			sb.AppendLine("path            : " + GetPath(transform));
			Quaternion val = transform.rotation;
			sb.AppendLine($"world rotation  : {((Quaternion)(ref val)).eulerAngles}");
			val = transform.localRotation;
			sb.AppendLine($"local rotation  : {((Quaternion)(ref val)).eulerAngles}");
			sb.AppendLine("--- Children ---");
			foreach (Transform item in transform)
			{
				Transform val2 = item;
				string name = ((Object)val2).name;
				val = val2.localRotation;
				sb.AppendLine($"  {name,-32} localRot={((Quaternion)(ref val)).eulerAngles}");
			}
			if ((Object)(object)Map.Instance != (Object)null && (Object)(object)Map.Instance.PlayerGraphicTransform != (Object)null)
			{
				Transform playerGraphicTransform = Map.Instance.PlayerGraphicTransform;
				string path = GetPath(playerGraphicTransform);
				val = playerGraphicTransform.rotation;
				sb.AppendLine($"PlayerGraphic   : {path} worldRot={((Quaternion)(ref val)).eulerAngles}");
			}
		}

		private static void DumpModules(StringBuilder sb)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- MapModule (first 3) ---");
			MapModule[] array = Object.FindObjectsOfType<MapModule>();
			sb.AppendLine($"count           : {array.Length}");
			int num = ((array.Length < 3) ? array.Length : 3);
			for (int i = 0; i < num; i++)
			{
				MapModule val = array[i];
				sb.AppendLine($"  [{i}] {GetPath(((Component)val).transform)}");
				Quaternion rotation = ((Component)val).transform.rotation;
				sb.AppendLine($"      worldRot={((Quaternion)(ref rotation)).eulerAngles} scale={((Component)val).transform.localScale}");
				if ((Object)(object)val.graphic != (Object)null)
				{
					string path = GetPath(val.graphic);
					rotation = val.graphic.rotation;
					sb.AppendLine($"      graphic={path} worldRot={((Quaternion)(ref rotation)).eulerAngles}");
				}
			}
		}

		private static string GetPath(Transform t)
		{
			if ((Object)(object)t == (Object)null)
			{
				return "(null)";
			}
			StringBuilder stringBuilder = new StringBuilder(((Object)t).name);
			Transform parent = t.parent;
			while ((Object)(object)parent != (Object)null)
			{
				stringBuilder.Insert(0, ((Object)parent).name + "/");
				parent = parent.parent;
			}
			return stringBuilder.ToString();
		}
	}
	internal sealed class DoorMarkers
	{
		private sealed class DoorMarkerWidth : MonoBehaviour
		{
			internal float Width = 1f;
		}

		private const float ScanIntervalSeconds = 2f;

		private const float SettleSeconds = 3f;

		private readonly Dictionary<DirtFinderMapWall, GameObject> _markers = new Dictionary<DirtFinderMapWall, GameObject>();

		private readonly List<DirtFinderMapWall> _stale = new List<DirtFinderMapWall>();

		private Transform _boundOverlay;

		private Sprite _sprite;

		private float _timer;

		private float _settle;

		private const float Thickness = 0.5f;

		internal int Count => _markers.Count;

		internal void Tick(float deltaTime, bool enabled, PaletteColor colorChoice)
		{
			Map instance = Map.Instance;
			if (!enabled || (Object)(object)instance == (Object)null || (Object)(object)instance.OverLayerParent == (Object)null)
			{
				Clear();
				return;
			}
			if ((Object)(object)_boundOverlay != (Object)(object)instance.OverLayerParent)
			{
				Clear();
				_boundOverlay = instance.OverLayerParent;
			}
			if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated)
			{
				_settle = 0f;
				return;
			}
			if (_settle < 3f)
			{
				_settle += deltaTime;
				return;
			}
			_timer -= deltaTime;
			if (_timer <= 0f)
			{
				_timer = 2f;
				Scan(instance);
			}
			Apply(colorChoice);
		}

		internal void Clear()
		{
			foreach (GameObject value in _markers.Values)
			{
				if ((Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)value);
				}
			}
			_markers.Clear();
			_boundOverlay = null;
			_settle = 0f;
		}

		private void Scan(Map map)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			DirtFinderMapWall[] array = Object.FindObjectsOfType<DirtFinderMapWall>();
			foreach (DirtFinderMapWall val in array)
			{
				if (!((Object)(object)val == (Object)null) && !_markers.ContainsKey(val) && TryGetDoorWidth(val.Type, out var width))
				{
					GameObject val2 = Create(map, val, width);
					if ((Object)(object)val2 != (Object)null)
					{
						_markers[val] = val2;
					}
				}
			}
			_stale.Clear();
			foreach (KeyValuePair<DirtFinderMapWall, GameObject> marker in _markers)
			{
				if ((Object)(object)marker.Key == (Object)null || (Object)(object)marker.Value == (Object)null)
				{
					_stale.Add(marker.Key);
				}
			}
			foreach (DirtFinderMapWall item in _stale)
			{
				if ((Object)(object)item != (Object)null && _markers.TryGetValue(item, out var value) && (Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)value);
				}
				_markers.Remove(item);
			}
		}

		private static bool TryGetDoorWidth(WallType type, out float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected I4, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected I4, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Invalid comparison between Unknown and I4
			switch (type - 1)
			{
			default:
				switch (type - 10)
				{
				default:
					if ((int)type == 19)
					{
						break;
					}
					goto end_IL_0003;
				case 0:
				case 4:
					width = 0.5f;
					return true;
				case 1:
				case 5:
					break;
				case 2:
				case 3:
					goto end_IL_0003;
				}
				goto case 0;
			case 1:
				width = 2f;
				return true;
			case 0:
			case 3:
				width = 1f;
				return true;
			case 2:
				break;
				end_IL_0003:
				break;
			}
			width = 0f;
			return false;
		}

		private void Apply(PaletteColor colorChoice)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			Color color;
			bool flag = MapPalette.TryResolve(colorChoice, out color);
			Vector3 val = default(Vector3);
			foreach (KeyValuePair<DirtFinderMapWall, GameObject> marker in _markers)
			{
				GameObject value = marker.Value;
				if (!((Object)(object)value == (Object)null))
				{
					DoorMarkerWidth component = value.GetComponent<DoorMarkerWidth>();
					float num = (((Object)(object)component != (Object)null) ? component.Width : 1f);
					((Vector3)(ref val))..ctor(num, 0.5f, 1f);
					if (value.transform.localScale != val)
					{
						value.transform.localScale = val;
					}
					SpriteRenderer component2 = value.GetComponent<SpriteRenderer>();
					if ((Object)(object)component2 != (Object)null && flag && component2.color != color)
					{
						component2.color = color;
					}
				}
			}
		}

		private GameObject Create(Map map, DirtFinderMapWall wall, float width)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			MapLayer layerParent = map.GetLayerParent(((Component)wall).transform.position.y);
			if ((Object)(object)layerParent == (Object)null)
			{
				return null;
			}
			GameObject val = new GameObject("RepoMapFix Door Marker");
			val.transform.SetParent(((Component)layerParent).transform, false);
			val.layer = ((Component)layerParent).gameObject.layer;
			val.AddComponent<DoorMarkerWidth>().Width = width;
			SpriteRenderer obj = val.AddComponent<SpriteRenderer>();
			obj.sprite = GetSprite();
			((Renderer)obj).sortingOrder = 60;
			val.transform.position = ((Component)wall).transform.position * map.Scale + ((Component)layerParent).transform.position + map.GetLayerPosition(layerParent.layer);
			val.transform.rotation = Quaternion.Euler(90f, ((Component)wall).transform.eulerAngles.y, 0f);
			return val;
		}

		private Sprite GetSprite()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_sprite != (Object)null)
			{
				return _sprite;
			}
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false)
			{
				name = "RepoMapFix Door",
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Color32[] array = (Color32[])(object)new Color32[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = Mathf.Abs(((float)i + 0.5f) / 64f - 0.5f) * 2f;
					float num2 = Mathf.Clamp01((0.22f - num) / 0.03f);
					array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num2 * 255f));
				}
			}
			val.SetPixels32(array);
			val.Apply(false, true);
			_sprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 64f);
			((Object)_sprite).name = "RepoMapFix Door";
			return _sprite;
		}
	}
	internal sealed class EntityMarkers
	{
		private sealed class Marker
		{
			internal GameObject Object;

			internal SpriteRenderer Renderer;
		}

		private const float ScanIntervalSeconds = 0.5f;

		private static readonly FieldInfo PlayerDisabledField = AccessTools.Field(typeof(PlayerAvatar), "isDisabled");

		private static readonly FieldInfo ColorsEquippedField = AccessTools.Field(typeof(PlayerCosmetics), "colorsEquipped");

		private const int HeadColorSlot = 5;

		private static readonly Color DeadPlayerColor = new Color(0.75f, 0.75f, 0.75f);

		private static readonly Color FallbackPlayerColor = Color.cyan;

		private readonly Dictionary<PlayerAvatar, Marker> _players = new Dictionary<PlayerAvatar, Marker>();

		private readonly List<PlayerAvatar> _stalePlayers = new List<PlayerAvatar>();

		private Transform _boundOverlay;

		private Sprite _sprite;

		private float _scanTimer;

		private List<MinimapView.RendererOverride> _overrides;

		internal void DescribeInto(StringBuilder sb)
		{
			sb.AppendLine("--- Entity Markers ---");
			List<PlayerAvatar> list = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.PlayerList : null);
			sb.AppendLine("GameDirector    : " + (((Object)(object)GameDirector.instance != (Object)null) ? "あり" : "なし"));
			sb.AppendLine("プレイヤー総数  : " + ((list != null) ? list.Count.ToString() : "取得不可") + "(自分を含む)");
			if (list != null)
			{
				int num = 0;
				foreach (PlayerAvatar item in list)
				{
					if ((Object)(object)item != (Object)null && (Object)(object)item != (Object)(object)PlayerAvatar.instance)
					{
						num++;
					}
				}
				sb.AppendLine($"自分以外        : {num}");
			}
			sb.AppendLine($"作成済みマーカー: 味方={_players.Count}");
			sb.AppendLine("差し替え登録数  : " + ((_overrides != null) ? _overrides.Count.ToString() : "未設定"));
			DescribeFirstMarker(sb, "味方", _players.Values);
		}

		private static void DescribeFirstMarker(StringBuilder sb, string label, IEnumerable<Marker> markers)
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			foreach (Marker marker in markers)
			{
				if (!((Object)(object)marker?.Object == (Object)null) && !((Object)(object)marker.Renderer == (Object)null))
				{
					sb.AppendLine($"  [{label}] active={marker.Object.activeSelf} renderer={((Renderer)marker.Renderer).enabled} " + "sprite=" + (((Object)(object)marker.Renderer.sprite != (Object)null) ? ((Object)marker.Renderer.sprite).name : "なし") + " " + $"color={marker.Renderer.color} layer={marker.Object.layer}");
					sb.AppendLine($"           pos={marker.Object.transform.position} scale={marker.Object.transform.localScale}");
					return;
				}
			}
			sb.AppendLine("  [" + label + "] マーカーなし");
		}

		internal void Tick(float deltaTime, bool showPlayers, bool playersOnFullMap, float scale, List<MinimapView.RendererOverride> overrides)
		{
			_overrides = overrides;
			Map instance = Map.Instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)instance.CustomObject == (Object)null || (Object)(object)instance.OverLayerParent == (Object)null)
			{
				Clear();
				return;
			}
			if ((Object)(object)_boundOverlay != (Object)(object)instance.OverLayerParent)
			{
				Clear();
				_boundOverlay = instance.OverLayerParent;
			}
			if (!showPlayers)
			{
				ClearPlayers();
			}
			_scanTimer -= deltaTime;
			if (_scanTimer <= 0f)
			{
				_scanTimer = 0.5f;
				if (showPlayers)
				{
					ScanPlayers(instance);
				}
			}
			UpdatePlayers(instance, scale);
			RefreshRendererList(playersOnFullMap);
		}

		internal void Clear()
		{
			foreach (Marker value in _players.Values)
			{
				Destroy(value);
			}
			_players.Clear();
			_boundOverlay = null;
		}

		private void ClearPlayers()
		{
			if (_players.Count == 0)
			{
				return;
			}
			foreach (Marker value in _players.Values)
			{
				Destroy(value);
			}
			_players.Clear();
		}

		private static void Destroy(Marker marker)
		{
			if ((Object)(object)marker?.Object != (Object)null)
			{
				Object.Destroy((Object)(object)marker.Object);
			}
		}

		private void ScanPlayers(Map map)
		{
			List<PlayerAvatar> list = (((Object)(object)GameDirector.instance != (Object)null) ? GameDirector.instance.PlayerList : null);
			if (list == null)
			{
				return;
			}
			foreach (PlayerAvatar item in list)
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)PlayerAvatar.instance) && !_players.ContainsKey(item))
				{
					Marker marker = Create(map, "Player");
					if (marker != null)
					{
						_players[item] = marker;
					}
				}
			}
			_stalePlayers.Clear();
			foreach (KeyValuePair<PlayerAvatar, Marker> player in _players)
			{
				if ((Object)(object)player.Key == (Object)null || !list.Contains(player.Key))
				{
					_stalePlayers.Add(player.Key);
				}
			}
			foreach (PlayerAvatar stalePlayer in _stalePlayers)
			{
				if (_players.TryGetValue(stalePlayer, out var value))
				{
					Destroy(value);
					_players.Remove(stalePlayer);
				}
			}
		}

		private void UpdatePlayers(Map map, float scale)
		{
			//IL_0057: 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)
			foreach (KeyValuePair<PlayerAvatar, Marker> player in _players)
			{
				PlayerAvatar key = player.Key;
				Marker value = player.Value;
				if (!((Object)(object)key == (Object)null) && !((Object)(object)value.Object == (Object)null))
				{
					bool flag = IsDisabled(key);
					value.Renderer.color = (flag ? DeadPlayerColor : ResolvePlayerColor(key));
					Place(map, value, ((Component)key).transform, visible: true, scale);
				}
			}
		}

		private static void Place(Map map, Marker marker, Transform target, bool visible, float scale)
		{
			//IL_0039: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (marker.Object.activeSelf != visible)
			{
				marker.Object.SetActive(visible);
			}
			if (visible && !((Object)(object)target == (Object)null))
			{
				map.CustomPositionSet(marker.Object.transform, target);
				Vector3 val = Vector3.one * scale;
				if (marker.Object.transform.localScale != val)
				{
					marker.Object.transform.localScale = val;
				}
			}
		}

		private void RefreshRendererList(bool playersOnFullMap)
		{
			foreach (Marker value in _players.Values)
			{
				RegisterRenderer(value, playersOnFullMap);
			}
		}

		private void RegisterRenderer(Marker marker, bool showOnFullMap)
		{
			if (!((Object)(object)marker.Renderer == (Object)null))
			{
				if (showOnFullMap)
				{
					((Renderer)marker.Renderer).enabled = true;
					return;
				}
				((Renderer)marker.Renderer).enabled = false;
				_overrides?.Add(new MinimapView.RendererOverride((Renderer)(object)marker.Renderer, enabled: true));
			}
		}

		private Marker Create(Map map, string kind)
		{
			GameObject val = Object.Instantiate<GameObject>(map.CustomObject, map.OverLayerParent);
			((Object)val).name = "RepoMapFix " + kind + " Marker";
			MapCustomEntity component = val.GetComponent<MapCustomEntity>();
			SpriteRenderer val2 = (((Object)(object)component != (Object)null) ? component.spriteRenderer : val.GetComponentInChildren<SpriteRenderer>());
			if ((Object)(object)val2 == (Object)null)
			{
				Object.Destroy((Object)(object)val);
				return null;
			}
			if ((Object)(object)val2.sprite == (Object)null)
			{
				val2.sprite = GetSprite();
			}
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			return new Marker
			{
				Object = val,
				Renderer = val2
			};
		}

		private Sprite GetSprite()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0104: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_sprite != (Object)null)
			{
				return _sprite;
			}
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
			{
				name = "RepoMapFix Marker",
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0);
			Color32 val3 = default(Color32);
			((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(15.5f, 15.5f);
			float num = 15f;
			Color32[] array = (Color32[])(object)new Color32[1024];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val4);
					array[i * 32 + j] = ((num2 <= num) ? val3 : val2);
				}
			}
			val.SetPixels32(array);
			val.Apply(false, true);
			_sprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 32f);
			((Object)_sprite).name = "RepoMapFix Marker";
			return _sprite;
		}

		private static bool IsDisabled(PlayerAvatar player)
		{
			bool flag = default(bool);
			int num;
			if (PlayerDisabledField != null)
			{
				object value = PlayerDisabledField.GetValue(player);
				if (value is bool)
				{
					flag = (bool)value;
					num = 1;
				}
				else
				{
					num = 0;
				}
			}
			else
			{
				num = 0;
			}
			return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
		}

		private static Color ResolvePlayerColor(PlayerAvatar player)
		{
			//IL_0034: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if (ColorsEquippedField == null || (Object)(object)player.playerCosmetics == (Object)null || (Object)(object)MetaManager.instance == (Object)null || MetaManager.instance.colors == null)
			{
				return FallbackPlayerColor;
			}
			if (!(ColorsEquippedField.GetValue(player.playerCosmetics) is int[] array) || array.Length <= 5)
			{
				return FallbackPlayerColor;
			}
			int num = array[5];
			if (num < 0 || num >= MetaManager.instance.colors.Count || (Object)(object)MetaManager.instance.colors[num] == (Object)null)
			{
				return FallbackPlayerColor;
			}
			Color color = MetaManager.instance.colors[num].color;
			color.a = 1f;
			return color;
		}
	}
	internal sealed class ExtractionColors
	{
		private sealed class Painted
		{
			internal Renderer Renderer;

			internal Color Color;

			internal Color Emission;

			internal bool HasEmission;
		}

		private const float RefreshIntervalSeconds = 1f;

		private static readonly FieldInfo MapObjectField = AccessTools.Field(typeof(DirtFinderMapFloor), "MapObject");

		private readonly List<Painted> _painted = new List<Painted>();

		private float _timer;

		internal void Tick(float deltaTime, bool enabled, PaletteColor inactiveChoice, PaletteColor activeChoice, PaletteColor usedChoice)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (!enabled || (Object)(object)Map.Instance == (Object)null)
			{
				Restore();
				return;
			}
			_timer -= deltaTime;
			if (_timer > 0f)
			{
				return;
			}
			_timer = 1f;
			Color color;
			bool flag = MapPalette.TryResolve(inactiveChoice, out color);
			Color color2;
			bool flag2 = MapPalette.TryResolve(activeChoice, out color2);
			Color color3;
			bool flag3 = MapPalette.TryResolve(usedChoice, out color3);
			if (!flag && !flag2 && !flag3)
			{
				Restore();
				return;
			}
			ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>();
			foreach (ExtractionPoint val in array)
			{
				if (flag)
				{
					Paint(val.mapInactive, color);
				}
				if (flag2)
				{
					Paint(val.mapActive, color2);
				}
				if (flag3)
				{
					Paint(val.mapUsed, color3);
				}
			}
		}

		internal void Restore()
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (_painted.Count == 0)
			{
				return;
			}
			foreach (Painted item in _painted)
			{
				if ((Object)(object)item.Renderer == (Object)null)
				{
					continue;
				}
				Material material = item.Renderer.material;
				if (!((Object)(object)material == (Object)null))
				{
					if (material.HasProperty("_Color"))
					{
						material.SetColor("_Color", item.Color);
					}
					if (item.HasEmission && material.HasProperty("_EmissionColor"))
					{
						material.SetColor("_EmissionColor", item.Emission);
					}
				}
			}
			_painted.Clear();
		}

		private void Paint(DirtFinderMapFloor[] floors, Color color)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (floors == null || MapObjectField == null)
			{
				return;
			}
			foreach (DirtFinderMapFloor val in floors)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				object? value = MapObjectField.GetValue(val);
				MapObject val2 = (MapObject)((value is MapObject) ? value : null);
				if (val2 == null || (Object)(object)val2 == (Object)null)
				{
					continue;
				}
				Renderer[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val3 in componentsInChildren)
				{
					Material material = val3.material;
					if (!((Object)(object)material == (Object)null) && material.HasProperty("_Color"))
					{
						Remember(val3, material);
						if (material.GetColor("_Color") != color)
						{
							material.SetColor("_Color", color);
						}
						if (material.HasProperty("_EmissionColor"))
						{
							material.SetColor("_EmissionColor", color);
						}
					}
				}
			}
		}

		private void Remember(Renderer renderer, Material material)
		{
			//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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			foreach (Painted item in _painted)
			{
				if ((Object)(object)item.Renderer == (Object)(object)renderer)
				{
					return;
				}
			}
			bool flag = material.HasProperty("_EmissionColor");
			_painted.Add(new Painted
			{
				Renderer = renderer,
				Color = material.GetColor("_Color"),
				Emission = (Color)(flag ? material.GetColor("_EmissionColor") : default(Color)),
				HasEmission = flag
			});
		}
	}
	internal sealed class ExtractionMarkers
	{
		private sealed class Marker
		{
			internal GameObject Root;

			internal SpriteRenderer Icon;

			internal readonly SpriteRenderer[] Ripples = (SpriteRenderer[])(object)new SpriteRenderer[2];
		}

		private const float SettleSeconds = 3f;

		private const int RippleCount = 2;

		private const float RippleSeconds = 2f;

		private static readonly FieldInfo StateField = AccessTools.Field(typeof(ExtractionPoint), "currentState");

		private readonly Dictionary<ExtractionPoint, Marker> _markers = new Dictionary<ExtractionPoint, Marker>();

		private readonly List<ExtractionPoint> _stale = new List<ExtractionPoint>();

		private Transform _boundOverlay;

		private Sprite _sprite;

		private Sprite _ringSprite;

		private float _scanTimer;

		private float _settle;

		private float _time;

		private static bool _missingStateFieldWarned;

		internal int Count => _markers.Count;

		internal void Tick(float deltaTime, bool enabled, float scale, PaletteColor inactiveChoice, PaletteColor activeChoice, PaletteColor usedChoice, bool rippleEnabled, float rippleScale)
		{
			Map instance = Map.Instance;
			if (!enabled || (Object)(object)instance == (Object)null || (Object)(object)instance.OverLayerParent == (Object)null)
			{
				Clear();
				return;
			}
			if ((Object)(object)_boundOverlay != (Object)(object)instance.OverLayerParent)
			{
				Clear();
				_boundOverlay = instance.OverLayerParent;
			}
			if ((Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated)
			{
				_settle = 0f;
				return;
			}
			if (_settle < 3f)
			{
				_settle += deltaTime;
				return;
			}
			_time += deltaTime;
			_scanTimer -= deltaTime;
			if (_scanTimer <= 0f)
			{
				_scanTimer = 1f;
				Scan(instance);
			}
			Apply(scale, inactiveChoice, activeChoice, usedChoice, rippleEnabled, rippleScale);
		}

		internal void Clear()
		{
			foreach (Marker value in _markers.Values)
			{
				if ((Object)(object)value.Root != (Object)null)
				{
					Object.Destroy((Object)(object)value.Root);
				}
			}
			_markers.Clear();
			_boundOverlay = null;
			_settle = 0f;
		}

		private void Scan(Map map)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			ExtractionPoint[] array = Object.FindObjectsOfType<ExtractionPoint>();
			foreach (ExtractionPoint val in array)
			{
				if (!((Object)(object)val == (Object)null) && !_markers.ContainsKey(val) && IsDiscovered(map, val))
				{
					_markers[val] = Create(map, ((Component)val).transform.position);
				}
			}
			_stale.Clear();
			foreach (KeyValuePair<ExtractionPoint, Marker> marker in _markers)
			{
				if ((Object)(object)marker.Key == (Object)null || (Object)(object)marker.Value.Root == (Object)null)
				{
					_stale.Add(marker.Key);
				}
			}
			foreach (ExtractionPoint item in _stale)
			{
				if ((Object)(object)item != (Object)null && _markers.TryGetValue(item, out var value) && (Object)(object)value.Root != (Object)null)
				{
					Object.Destroy((Object)(object)value.Root);
				}
				_markers.Remove(item);
			}
		}

		private static bool IsDiscovered(Map map, ExtractionPoint point)
		{
			Module componentInParent = ((Component)point).GetComponentInParent<Module>();
			if ((Object)(object)componentInParent == (Object)null || map.MapModules == null)
			{
				return true;
			}
			foreach (MapModule mapModule in map.MapModules)
			{
				if ((Object)(object)mapModule != (Object)null && (Object)(object)mapModule.module == (Object)(object)componentInParent)
				{
					return false;
				}
			}
			return true;
		}

		private void Apply(float scale, PaletteColor inactiveChoice, PaletteColor activeChoice, PaletteColor usedChoice, bool rippleEnabled, float rippleScale)
		{
			//IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Invalid comparison between Unknown and I4
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.one * scale;
			foreach (KeyValuePair<ExtractionPoint, Marker> marker in _markers)
			{
				ExtractionPoint key = marker.Key;
				Marker value = marker.Value;
				if (!((Object)(object)key == (Object)null) && !((Object)(object)value.Root == (Object)null) && !((Object)(object)value.Icon == (Object)null))
				{
					if (((Component)value.Icon).transform.localScale != val)
					{
						((Component)value.Icon).transform.localScale = val;
					}
					State val2 = ResolveState(key);
					Color color;
					bool flag = MapPalette.TryResolve(ResolveChoice(val2, inactiveChoice, activeChoice, usedChoice), out color);
					if (flag && value.Icon.color != color)
					{
						value.Icon.color = color;
					}
					bool show = rippleEnabled && (int)val2 == 2;
					ApplyRipples(value, show, scale, rippleScale, flag ? color : Color.white);
				}
			}
		}

		private void ApplyRipples(Marker marker, bool show, float baseScale, float rippleScale, Color color)
		{
			//IL_0071: 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_0082: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < marker.Ripples.Length; i++)
			{
				SpriteRenderer val = marker.Ripples[i];
				if (!((Object)(object)val == (Object)null))
				{
					if (((Renderer)val).enabled != show)
					{
						((Renderer)val).enabled = show;
					}
					if (show)
					{
						float num = Mathf.Repeat(_time / 2f + (float)i / (float)marker.Ripples.Length, 1f);
						float a = (1f - num) * 0.55f;
						float num2 = Mathf.Lerp(baseScale, baseScale * rippleScale, num);
						((Component)val).transform.localScale = Vector3.one * num2;
						Color color2 = color;
						color2.a = a;
						val.color = color2;
					}
				}
			}
		}

		private static State ResolveState(ExtractionPoint point)
		{
			//IL_0046: 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 (StateField == null)
			{
				if (!_missingStateFieldWarned)
				{
					_missingStateFieldWarned = true;
					ManualLogSource log = Plugin.Log;
					if (log != null)
					{
						log.LogWarning((object)"納品場所の状態を読み取れません(currentStateが見つかりません)。ゲームの更新で内部の作りが変わった可能性があります。全ての納品場所が起動中として表示されます。");
					}
				}
				return (State)2;
			}
			object value = StateField.GetValue(point);
			if (value is State)
			{
				return (State)value;
			}
			return (State)2;
		}

		private static PaletteColor ResolveChoice(State state, PaletteColor inactiveChoice, PaletteColor activeChoice, PaletteColor usedChoice)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			if ((int)state != 1)
			{
				if ((int)state == 7)
				{
					return usedChoice;
				}
				return activeChoice;
			}
			return inactiveChoice;
		}

		private Marker Create(Map map, Vector3 worldPosition)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("RepoMapFix Extraction Marker");
			val.transform.SetParent(map.OverLayerParent, false);
			val.layer = ((Component)map.OverLayerParent).gameObject.layer;
			val.transform.position = worldPosition * map.Scale + map.OverLayerParent.position;
			val.transform.localPosition = new Vector3(val.transform.localPosition.x, 0f, val.transform.localPosition.z);
			val.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
			Marker marker = new Marker
			{
				Root = val
			};
			for (int i = 0; i < marker.Ripples.Length; i++)
			{
				GameObject val2 = new GameObject($"Ripple {i + 1}")
				{
					layer = val.layer
				};
				val2.transform.SetParent(val.transform, false);
				SpriteRenderer val3 = val2.AddComponent<SpriteRenderer>();
				val3.sprite = GetRingSprite();
				((Renderer)val3).sortingOrder = 94;
				((Renderer)val3).enabled = false;
				marker.Ripples[i] = val3;
			}
			GameObject val4 = new GameObject("Icon")
			{
				layer = val.layer
			};
			val4.transform.SetParent(val.transform, false);
			SpriteRenderer val5 = val4.AddComponent<SpriteRenderer>();
			val5.sprite = GetSprite();
			((Renderer)val5).sortingOrder = 95;
			marker.Icon = val5;
			return marker;
		}

		private Sprite GetSprite()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_sprite != (Object)null)
			{
				return _sprite;
			}
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
			{
				name = "RepoMapFix Extraction",
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Color32[] array = (Color32[])(object)new Color32[1024];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = Mathf.Abs(((float)j + 0.5f) / 32f - 0.5f) * 2f;
					float num2 = Mathf.Abs(((float)i + 0.5f) / 32f - 0.5f) * 2f;
					float num3 = Mathf.Max(num, num2);
					float num4 = Mathf.Clamp01((0.92f - num3) / 0.08f);
					array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num4 * 255f));
				}
			}
			val.SetPixels32(array);
			val.Apply(false, true);
			_sprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 32f);
			((Object)_sprite).name = "RepoMapFix Extraction";
			return _sprite;
		}

		private Sprite GetRingSprite()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_ringSprite != (Object)null)
			{
				return _ringSprite;
			}
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false)
			{
				name = "RepoMapFix Extraction Ripple",
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(31.5f, 31.5f);
			float num = 32f;
			Color32[] array = (Color32[])(object)new Color32[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val2) / num;
					float num3 = 1f - Mathf.Abs(num2 - 0.85f) / 0.15f;
					float num4 = ((num2 > 1f) ? 0f : Mathf.Clamp01(num3));
					array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num4 * 255f));
				}
			}
			val.SetPixels32(array);
			val.Apply(false, true);
			_ringSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 64f);
			((Object)_ringSprite).name = "RepoMapFix Extraction Ripple";
			return _ringSprite;
		}
	}
	internal sealed class FullMapView
	{
		private static readonly Quaternion LookDown = Quaternion.Euler(90f, 0f, 0f);

		private static readonly Quaternion PlayerGraphicDefault = Quaternion.Euler(90f, 0f, 0f);

		private const float MapFitMargin = 1.1f;

		private const float BackdropMargin = 1.6f;

		private Camera _camera;

		private float _vanillaZoom = -1f;

		private bool _zoomApplied;

		private bool _northApplied;

		private Vector3 _cameraLocalPosition;

		private bool _cameraMoved;

		private readonly List<Transform> _backdrop = new List<Transform>();

		private readonly List<Vector3> _backdropScales = new List<Vector3>();

		private readonly List<Vector3> _backdropPositions = new List<Vector3>();

		private readonly List<float> _backdropSizes = new List<float>();

		private float _lastRequiredSize;

		private float _lastFactor;

		internal void Tick(bool northFixed, bool centerOnMap, bool overrideZoom, float zoom, int resolution, int antiAliasing)
		{
			if ((Object)(object)Map.Instance == (Object)null)
			{
				Forget();
				return;
			}
			ResolveCamera();
			CollectBackdrop();
			ApplyNorthFix(northFixed);
			ApplyBackdropScale(ApplyView(centerOnMap, overrideZoom, zoom));
			ApplyQuality(resolution, antiAliasing);
		}

		internal void Forget()
		{
			_camera = null;
			_vanillaZoom = -1f;
			_zoomApplied = false;
			_northApplied = false;
			_cameraMoved = false;
			_backdrop.Clear();
			_backdropScales.Clear();
			_backdropPositions.Clear();
			_backdropSizes.Clear();
		}

		private void ResolveCamera()
		{
			//IL_004a: 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)
			if ((Object)(object)_camera != (Object)null)
			{
				return;
			}
			Camera[] array = Object.FindObjectsOfType<Camera>(true);
			foreach (Camera val in array)
			{
				if (((Object)val).name == "Dirt Finder Map Camera")
				{
					_camera = val;
					_vanillaZoom = val.orthographicSize;
					_cameraLocalPosition = ((Component)val).transform.localPosition;
					break;
				}
			}
		}

		private void CollectBackdrop()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_00c5: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (_backdrop.Count > 0 && (Object)(object)_backdrop[0] != (Object)null)
			{
				return;
			}
			_backdrop.Clear();
			_backdropScales.Clear();
			_backdropPositions.Clear();
			_backdropSizes.Clear();
			DirtFinderMapPlayer instance = DirtFinderMapPlayer.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (Transform item in ((Component)instance).transform)
			{
				Transform val = item;
				if (!(((Object)val).name != "Background") || !(((Object)val).name != "Fog") || !(((Object)val).name != "Scanlines"))
				{
					_backdrop.Add(val);
					_backdropScales.Add(val.localScale);
					_backdropPositions.Add(val.localPosition);
					Quaternion rotation = val.rotation;
					val.rotation = Quaternion.identity;
					_backdropSizes.Add(MeasureSize(val));
					val.rotation = rotation;
				}
			}
		}

		private float ApplyView(bool centerOnMap, bool overrideZoom, float zoom)
		{
			//IL_00b0: 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_0034: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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)
			if ((Object)(object)_camera == (Object)null)
			{
				return _vanillaZoom;
			}
			if (centerOnMap && MapBounds.TryGet(out var bounds))
			{
				Vector3 position = ((Component)_camera).transform.position;
				((Component)_camera).transform.position = new Vector3(((Bounds)(ref bounds)).center.x, position.y, ((Bounds)(ref bounds)).center.z);
				_cameraMoved = true;
				float num = Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z) * 1.1f;
				SetZoom(num);
				return num;
			}
			if (_cameraMoved)
			{
				((Component)_camera).transform.localPosition = _cameraLocalPosition;
				_cameraMoved = false;
			}
			if (overrideZoom)
			{
				SetZoom(zoom);
				return zoom;
			}
			if (_zoomApplied && _vanillaZoom > 0f)
			{
				_camera.orthographicSize = _vanillaZoom;
				_zoomApplied = false;
			}
			return _vanillaZoom;
		}

		private void SetZoom(float zoom)
		{
			if (_camera.orthographicSize != zoom)
			{
				_camera.orthographicSize = zoom;
			}
			_zoomApplied = true;
		}

		private void ApplyNorthFix(bool northFixed)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			DirtFinderMapPlayer instance = DirtFinderMapPlayer.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			if (!northFixed)
			{
				if (_northApplied)
				{
					_northApplied = false;
					((Component)instance).transform.rotation = GetPlayerRotation();
					if ((Object)(object)Map.Instance.PlayerGraphicTransform != (Object)null)
					{
						Map.Instance.PlayerGraphicTransform.localRotation = PlayerGraphicDefault;
					}
				}
				return;
			}
			Quaternion playerRotation = GetPlayerRotation();
			float y = ((Quaternion)(ref playerRotation)).eulerAngles.y;
			if (((Component)instance).transform.rotation != Quaternion.identity)
			{
				((Component)instance).transform.rotation = Quaternion.identity;
			}
			Transform playerGraphicTransform = Map.Instance.PlayerGraphicTransform;
			if ((Object)(object)playerGraphicTransform != (Object)null)
			{
				Quaternion val = Quaternion.Euler(0f, y, 0f) * LookDown;
				if (playerGraphicTransform.localRotation != val)
				{
					playerGraphicTransform.localRotation = val;
				}
			}
			MapModule[] array = Object.FindObjectsOfType<MapModule>();
			for (int i = 0; i < array.Length; i++)
			{
				Transform graphic = array[i].graphic;
				if ((Object)(object)graphic != (Object)null && graphic.rotation != LookDown)
				{
					graphic.rotation = LookDown;
				}
			}
			_northApplied = true;
		}

		private void ApplyBackdropScale(float zoom)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			if (_backdrop.Count == 0 || zoom <= 0f)
			{
				return;
			}
			float num = (_lastRequiredSize = zoom * 2f * 1.6f);
			Vector3 val3 = default(Vector3);
			for (int i = 0; i < _backdrop.Count; i++)
			{
				Transform val = _backdrop[i];
				float num2 = _backdropSizes[i];
				if (!((Object)(object)val == (Object)null) && !(num2 <= 0.0001f))
				{
					float num3 = (_lastFactor = Mathf.Max(1f, num / num2));
					Vector3 val2 = _backdropScales[i];
					((Vector3)(ref val3))..ctor(val2.x * num3, val2.y, val2.z * num3);
					if (val.localScale != val3)
					{
						val.localScale = val3;
					}
					if (_cameraMoved)
					{
						Vector3 position = val.position;
						Vector3 position2 = ((Component)_camera).transform.position;
						val.position = new Vector3(position2.x, position.y, position2.z);
					}
					else if (val.localPosition != _backdropPositions[i])
					{
						val.localPosition = _backdropPositions[i];
					}
				}
			}
		}

		internal void DescribeInto(StringBuilder sb)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- Tabマップ ---");
			if ((Object)(object)_camera == (Object)null)
			{
				sb.AppendLine("カメラ        : 未検出");
				return;
			}
			sb.AppendLine($"本来の拡大率  : {_vanillaZoom:F2}");
			sb.AppendLine($"現在の拡大率  : {_camera.orthographicSize:F2}");
			sb.AppendLine($"カメラ位置    : {((Component)_camera).transform.position}(中心へ移動={_cameraMoved})");
			sb.AppendLine($"視界の広さ    : {_camera.orthographicSize * 2f:F2}");
			sb.AppendLine($"背景の必要広さ: {_lastRequiredSize:F2}(余白{1.6f}倍込み)");
			sb.AppendLine($"背景の倍率    : {_lastFactor:F2}");
			for (int i = 0; i < _backdrop.Count; i++)
			{
				Transform val = _backdrop[i];
				if ((Object)(object)val == (Object)null)
				{
					sb.AppendLine($"  [{i}] 失われた参照");
					continue;
				}
				sb.AppendLine($"  [{((Object)val).name}] 本来の広さ={_backdropSizes[i]:F2} 現在の広さ={MeasureSize(val):F2}");
				sb.AppendLine($"        位置={val.position} 大きさ={val.localScale}");
			}
		}

		private void ApplyQuality(int resolution, int antiAliasing)
		{
			if (!((Object)(object)_camera == (Object)null))
			{
				RenderTexture targetTexture = _camera.targetTexture;
				if (!((Object)(object)targetTexture == (Object)null) && (((Texture)targetTexture).width != resolution || ((Texture)targetTexture).height != resolution || targetTexture.antiAliasing != antiAliasing))
				{
					targetTexture.Release();
					((Texture)targetTexture).width = resolution;
					((Texture)targetTexture).height = resolution;
					targetTexture.antiAliasing = antiAliasing;
					targetTexture.Create();
				}
			}
		}

		private static float MeasureSize(Transform target)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0025: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			Bounds val = default(Bounds);
			Renderer[] componentsInChildren = ((Component)target).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren)
			{
				if (!flag)
				{
					val = val2.bounds;
					flag = true;
				}
				else
				{
					((Bounds)(ref val)).Encapsulate(val2.bounds);
				}
			}
			if (!flag)
			{
				return 0f;
			}
			return Mathf.Max(((Bounds)(ref val)).size.x, ((Bounds)(ref val)).size.z);
		}

		private static Quaternion GetPlayerRotation()
		{
			//IL_002b: 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)
			Transform val = (((Object)(object)Map.Instance != (Object)null) ? Map.Instance.playerTransformSource : null);
			if (!((Object)(object)val != (Object)null))
			{
				return Quaternion.identity;
			}
			return val.rotation;
		}
	}
	internal sealed class HudShift
	{
		private sealed class Target
		{
			internal SemiUI Ui;

			internal Vector2 Origin;

			internal bool IsLeft;
		}

		private readonly List<Target> _targets = new List<Target>();

		internal void Apply(bool shiftRight, bool shiftLeft, float rightOffset, float leftOffset)
		{
			//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)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			Track((SemiUI)(object)HaulUI.instance, isLeft: false);
			Track((SemiUI)(object)GoalUI.instance, isLeft: false);
			Track((SemiUI)(object)HealthUI.instance, isLeft: true);
			Track((SemiUI)(object)EnergyUI.instance, isLeft: true);
			Vector2 val = default(Vector2);
			foreach (Target target in _targets)
			{
				if (!((Object)(object)target.Ui == (Object)null))
				{
					bool flag = (target.IsLeft ? shiftLeft : shiftRight);
					float num = (target.IsLeft ? leftOffset : rightOffset);
					((Vector2)(ref val))..ctor(target.Origin.x, target.Origin.y + (flag ? (0f - num) : 0f));
					if (target.Ui.showPosition != val)
					{
						target.Ui.showPosition = val;
					}
				}
			}
		}

		internal void Forget()
		{
			_targets.Clear();
		}

		private void Track(SemiUI ui, bool isLeft)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ui == (Object)null)
			{
				return;
			}
			foreach (Target target in _targets)
			{
				if ((Object)(object)target.Ui == (Object)(object)ui)
				{
					return;
				}
				if (target.IsLeft == isLeft && (Object)(object)target.Ui == (Object)null)
				{
					_targets.Remove(target);
					break;
				}
			}
			if (!((Object)(object)ui.textRectTransform == (Object)null))
			{
				_targets.Add(new Target
				{
					Ui = ui,
					Origin = ui.showPosition,
					IsLeft = isLeft
				});
			}
		}
	}
	internal sealed class LogMirror : ILogListener, IDisposable
	{
		private const string DevelopmentFolder = "C:\\repo_mod\\logs";

		private const int KeepFiles = 15;

		private StreamWriter _writer;

		internal string Path { get; private set; }

		public LogLevel LogLevelFilter => (LogLevel)63;

		internal bool Start(string configuredFolder)
		{
			try
			{
				string text = ResolveFolder(configuredFolder);
				Directory.CreateDirectory(text);
				Path = System.IO.Path.Combine(text, $"MiniMapAndMapPlus-{DateTime.Now:yyyyMMdd-HHmmss}.log");
				_writer = new StreamWriter(new FileStream(Path, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
				{
					AutoFlush = true
				};
				_writer.WriteLine(string.Format("=== {0} {1} / {2:yyyy-MM-dd HH:mm:ss} ===", "Mini Map & Map+", "3.18.0", DateTime.Now));
				Prune(text);
				Logger.Listeners.Add((ILogListener)(object)this);
				return true;
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				if (log != null)
				{
					log.LogWarning((object)("ログの書き写しを始められませんでした: " + ex.Message));
				}
				_writer = null;
				return false;
			}
		}

		private static string ResolveFolder(string configuredFolder)
		{
			if (!string.IsNullOrEmpty(configuredFolder))
			{
				return configuredFolder;
			}
			string text = Directory.GetParent("C:\\repo_mod\\logs")?.FullName;
			if (!string.IsNullOrEmpty(text) && Directory.Exists(text))
			{
				return "C:\\repo_mod\\logs";
			}
			return System.IO.Path.Combine(Paths.BepInExRootPath, "MiniMapAndMapPlus-logs");
		}

		private static void Prune(string folder)
		{
			try
			{
				List<FileInfo> list = new List<FileInfo>(new DirectoryInfo(folder).GetFiles("MiniMapAndMapPlus-*.log"));
				if (list.Count > 15)
				{
					list.Sort((FileInfo a, FileInfo b) => b.LastWriteTimeUtc.CompareTo(a.LastWriteTimeUtc));
					for (int num = 15; num < list.Count; num++)
					{
						list[num].Delete();
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public void LogEvent(object sender, LogEventArgs eventArgs)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			StreamWriter writer = _writer;
			if (writer == null)
			{
				return;
			}
			try
			{
				writer.WriteLine($"{DateTime.Now:HH:mm:ss.fff} [{eventArgs.Level,-7}:{eventArgs.Source.SourceName}] {eventArgs.Data}");
			}
			catch (Exception)
			{
				_writer = null;
			}
		}

		internal void Mark(string reason)
		{
			StreamWriter writer = _writer;
			if (writer == null)
			{
				return;
			}
			try
			{
				writer.WriteLine($"--- {DateTime.Now:HH:mm:ss.fff} {reason} ---");
				writer.WriteLine(Environment.StackTrace);
			}
			catch (Exception)
			{
				_writer = null;
			}
		}

		public void Dispose()
		{
			try
			{
				Logger.Listeners.Remove((ILogListener)(object)this);
			}
			catch (Exception)
			{
			}
			StreamWriter writer = _writer;
			_writer = null;
			try
			{
				writer?.Dispose();
			}
			catch (Exception)
			{
			}
		}
	}
	internal static class MapBounds
	{
		private const float RefreshSeconds = 1f;

		private static Bounds _bounds;

		private static bool _has;

		private static float _nextRefresh;

		internal static void Forget()
		{
			_has = false;
			_nextRefresh = 0f;
		}

		internal static bool TryGet(out Bounds bounds)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (_has && Time.time < _nextRefresh)
			{
				bounds = _bounds;
				return true;
			}
			if ((Object)(object)Map.Instance == (Object)null)
			{
				bounds = _bounds;
				return _has;
			}
			_nextRefresh = Time.time + 1f;
			bool flag = false;
			Bounds bounds2 = default(Bounds);
			Renderer[] componentsInChildren = ((Component)Map.Instance).GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				if (!flag)
				{
					bounds2 = val.bounds;
					flag = true;
				}
				else
				{
					((Bounds)(ref bounds2)).Encapsulate(val.bounds);
				}
			}
			if (flag)
			{
				_bounds = bounds2;
				_has = true;
			}
			bounds = _bounds;
			return _has;
		}
	}
	internal enum PaletteColor
	{
		標準のまま,
		黄色,
		水色,
		,
		オレンジ,
		,
		,
		,
		ピンク,
		,
		灰色,
		
	}
	internal static class MapPalette
	{
		internal static bool TryResolve(PaletteColor choice, out Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			color = default(Color);
			switch (choice)
			{
			case PaletteColor.標準のまま:
				return false;
			case PaletteColor.黄色:
				color = new Color(1f, 0.83f, 0f);
				return true;
			case PaletteColor.水色:
				color = new Color(0f, 0.8f, 0.85f);
				return true;
			case PaletteColor.:
				color = new Color(0.85f, 0.09f, 0.09f);
				return true;
			case PaletteColor.オレンジ:
				color = new Color(1f, 0.5f, 0f);
				return true;
			case PaletteColor.:
				color = new Color(0.13f, 0.8f, 0.2f);
				return true;
			case PaletteColor.:
				color = new Color(0.16f, 0.4f, 1f);
				return true;
			case PaletteColor.:
				color = new Color(0.65f, 0.3f, 0.95f);
				return true;
			case PaletteColor.ピンク:
				color = new Color(1f, 0.35f, 0.65f);
				return true;
			case PaletteColor.:
				color = Color.white;
				return true;
			case PaletteColor.灰色:
				color = new Color(0.45f, 0.45f, 0.45f);
				return true;
			case PaletteColor.:
				color = new Color(0.05f, 0.05f, 0.05f);
				return true;
			default:
				return false;
			}
		}
	}
	internal sealed class MinimapView
	{
		internal readonly struct RendererOverride
		{
			internal readonly Renderer Renderer;

			internal readonly bool Enabled;

			internal RendererOverride(Renderer renderer, bool enabled)
			{
				Renderer = renderer;
				Enabled = enabled;
			}
		}

		internal readonly struct ScaleOverride
		{
			internal readonly Transform Transform;

			internal readonly Vector3 Scale;

			internal ScaleOverride(Transform transform, Vector3 scale)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				Transform = transform;
				Scale = scale;
			}
		}

		internal readonly struct ColorOverride
		{
			internal readonly SpriteRenderer Renderer;

			internal readonly Color Color;

			internal ColorOverride(SpriteRenderer renderer, Color color)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				Renderer = renderer;
				Color = color;
			}
		}

		private const string RigName = "RepoMapFix Minimap Rig";

		private const float MapFitMargin = 1.1f;

		private const float BackdropMargin = 1.8f;

		private static readonly Quaternion LookDown = Quaternion.Euler(90f, 0f, 0f);

		private Transform _rig;

		private Camera _camera;

		private Color? _backdropColor;

		private RenderTexture _texture;

		private readonly List<Renderer> _sharedBackdrop = new List<Renderer>();

		private readonly List<Transform> _swappedModules = new List<Transform>();

		private readonly List<Quaternion> _swappedRotations = new List<Quaternion>();

		private bool _northFixed = true;

		private float _appliedZoom = -1f;

		private int _appliedResolution;

		private int _appliedAntiAliasing;

		private readonly List<MapModule> _moduleCache = new List<MapModule>();

		private float _moduleCacheTimer;

		private Bounds _bounds;

		private bool _hasBounds;

		private readonly List<Renderer> _ownBackdrop = new List<Renderer>();

		private readonly List<Vector3> _ownBackdropScales = new List<Vector3>();

		private readonly List<float> _ownBackdropSizes = new List<float>();

		private readonly List<Renderer> _swappedRenderers = new List<Renderer>();

		private readonly List<bool> _originalEnabled = new List<bool>();

		private readonly List<Transform> _swappedScales = new List<Transform>();

		private readonly List<Vector3> _originalScales = new List<Vector3>();

		private readonly List<SpriteRenderer> _recoloredRenderers = new List<SpriteRenderer>();

		private readonly List<Color> _originalColors = new List<Color>();

		internal RenderTexture Texture => _texture;

		internal bool IsReady
		{
			get
			{
				if ((Object)(object)_camera != (Object)null)
				{
					return (Object)(object)_texture != (Object)null;
				}
				return false;
			}
		}

		internal Camera Camera => _camera;

		internal List<RendererOverride> RendererOverrides { get; set; }

		internal List<ScaleOverride> ScaleOverrides { get; set; }

		internal List<ColorOverride> ColorOverrides { get; set; }

		internal List<Transform> UprightTransforms { get; set; }

		internal void DescribeFitInto(StringBuilder sb)
		{
			//IL_002d: 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_006f: 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_00de: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			sb.AppendLine("--- Map Fit ---");
			if (!_hasBounds)
			{
				sb.AppendLine("地図の広がり  : 未計測");
				return;
			}
			sb.AppendLine($"中心          : {((Bounds)(ref _bounds)).center}");
			sb.AppendLine($"大きさ        : {((Bounds)(ref _bounds)).size}");
			sb.AppendLine($"半径(X,Z)     : {((Bounds)(ref _bounds)).extents.x:F2}, {((Bounds)(ref _bounds)).extents.z:F2}");
			sb.AppendLine($"適用ズーム    : {_appliedZoom:F2}(必要値の{1.1f}倍)");
			if ((Object)(object)_rig != (Object)null)
			{
				sb.AppendLine($"カメラ中心    : {_rig.position}");
				sb.AppendLine($"中心とのズレ  : X={_rig.position.x - ((Bounds)(ref _bounds)).center.x:F2} Z={_rig.position.z - ((Bounds)(ref _bounds)).center.z:F2}");
			}
		}

		internal MinimapView()
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(HandlePreCull));
			Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(HandlePostRender));
		}

		internal void Dispose()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: