Decompiled source of ShipSortNexus v1.3.5

BepInEx\plugins\ShipSortNexus\ShipSortNexus.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalShipSort;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;

[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("ShipSortNexus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.5.0")]
[assembly: AssemblyInformationalVersion("1.3.5")]
[assembly: AssemblyProduct("ShipSortNexus")]
[assembly: AssemblyTitle("ShipSortNexus")]
[assembly: AssemblyVersion("1.3.5.0")]
namespace ShipSortNexus;

public sealed class LayoutAnchor
{
	public string Key;

	public string Display;

	public string Type;

	public float X;

	public float Y;

	public float Z;

	public int Rotation;

	public bool FollowFirst;

	public DateTime CapturedAt;

	public Vector3 LocalPosition
	{
		get
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(X, Y, Z);
		}
		set
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			X = value.x;
			Y = value.y;
			Z = value.z;
		}
	}

	public string PrettyName
	{
		get
		{
			if (!string.IsNullOrWhiteSpace(Display))
			{
				return Display;
			}
			if (!string.IsNullOrWhiteSpace(Key))
			{
				return Key;
			}
			return "Unknown";
		}
	}
}
public enum BulkCategory
{
	Tool,
	OneHandScrap,
	TwoHandScrap
}
public sealed class AnchorStore
{
	private const string Header = "# SHIPSORT NEXUS // ANCHORS v2";

	private readonly string _filePath;

	private readonly int _limit;

	private readonly List<LayoutAnchor> _anchors = new List<LayoutAnchor>();

	private readonly LayoutAnchor[] _bulkGroups = new LayoutAnchor[3];

	private static readonly string[] ForcedToolNames = new string[2] { "KnifeItem", "ShotgunItem" };

	public IReadOnlyList<LayoutAnchor> Anchors => _anchors;

	public string FilePath => _filePath;

	public bool HasAnyLayout
	{
		get
		{
			if (_anchors.Count > 0)
			{
				return true;
			}
			for (int i = 0; i < _bulkGroups.Length; i++)
			{
				if (_bulkGroups[i] != null)
				{
					return true;
				}
			}
			return false;
		}
	}

	public int LayoutPointCount
	{
		get
		{
			int num = _anchors.Count;
			for (int i = 0; i < _bulkGroups.Length; i++)
			{
				if (_bulkGroups[i] != null)
				{
					num++;
				}
			}
			return num;
		}
	}

	public static bool IsForcedToolName(string key)
	{
		if (string.IsNullOrEmpty(key))
		{
			return false;
		}
		for (int i = 0; i < ForcedToolNames.Length; i++)
		{
			if (string.Equals(ForcedToolNames[i], key, StringComparison.Ordinal))
			{
				return true;
			}
		}
		return false;
	}

	public AnchorStore(string directory, int limit)
	{
		_limit = Math.Max(1, limit);
		Directory.CreateDirectory(directory);
		_filePath = Path.Combine(directory, "anchors.tsv");
	}

	public LayoutAnchor GetGroup(BulkCategory category)
	{
		return _bulkGroups[(int)category];
	}

	public bool HasGroup(BulkCategory category)
	{
		return _bulkGroups[(int)category] != null;
	}

	public void Load()
	{
		_anchors.Clear();
		for (int i = 0; i < _bulkGroups.Length; i++)
		{
			_bulkGroups[i] = null;
		}
		if (!File.Exists(_filePath))
		{
			return;
		}
		string[] array;
		try
		{
			array = File.ReadAllLines(_filePath, Encoding.UTF8);
		}
		catch (Exception ex)
		{
			NexusPlugin.Log.LogWarning((object)("Could not read anchors: " + ex.Message));
			return;
		}
		string[] array2 = array;
		foreach (string text in array2)
		{
			if (string.IsNullOrWhiteSpace(text) || text.StartsWith("#", StringComparison.Ordinal))
			{
				continue;
			}
			string[] array3 = text.Split('\t');
			float result5;
			float result6;
			float result7;
			int result8;
			if (array3.Length >= 6 && string.Equals(array3[0], "@GROUP", StringComparison.Ordinal))
			{
				if (TryParseGroupCategory(array3[1], out var category) && float.TryParse(array3[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && float.TryParse(array3[3], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array3[4], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3) && int.TryParse(array3[5], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result4))
				{
					_bulkGroups[(int)category] = new LayoutAnchor
					{
						Key = GroupKey(category),
						Display = GroupDisplay(category),
						Type = "GROUP",
						X = result,
						Y = result2,
						Z = result3,
						Rotation = NormalizeRotation(result4),
						CapturedAt = DateTime.UtcNow
					};
				}
			}
			else if (array3.Length >= 6 && float.TryParse(array3[1], NumberStyles.Float, CultureInfo.InvariantCulture, out result5) && float.TryParse(array3[2], NumberStyles.Float, CultureInfo.InvariantCulture, out result6) && float.TryParse(array3[3], NumberStyles.Float, CultureInfo.InvariantCulture, out result7) && int.TryParse(array3[4], NumberStyles.Integer, CultureInfo.InvariantCulture, out result8))
			{
				_anchors.Add(new LayoutAnchor
				{
					Key = Unescape(array3[0]),
					Display = Unescape(array3[5]),
					Type = ((array3.Length > 6) ? Unescape(array3[6]) : string.Empty),
					X = result5,
					Y = result6,
					Z = result7,
					Rotation = NormalizeRotation(result8),
					FollowFirst = (array3.Length > 8 && array3[8] == "1"),
					CapturedAt = ((array3.Length > 7 && long.TryParse(array3[7], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result9)) ? new DateTime(result9, DateTimeKind.Utc) : DateTime.UtcNow)
				});
				if (_anchors.Count >= _limit)
				{
					break;
				}
			}
		}
		NexusPlugin.Log.LogInfo((object)("Loaded " + _anchors.Count + " anchor(s) from " + _filePath));
	}

	public void Save()
	{
		try
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("# SHIPSORT NEXUS // ANCHORS v2");
			stringBuilder.AppendLine("# key\tx\ty\tz\trotation\tdisplay\ttype\tutc_ticks\tfollow_first");
			for (int i = 0; i < _bulkGroups.Length; i++)
			{
				BulkCategory category = (BulkCategory)i;
				LayoutAnchor layoutAnchor = _bulkGroups[i];
				if (layoutAnchor != null)
				{
					AppendGroupLine(stringBuilder, GroupKind(category), layoutAnchor);
				}
			}
			foreach (LayoutAnchor anchor in _anchors)
			{
				stringBuilder.Append(Escape(anchor.Key)).Append('\t').Append(F(anchor.X))
					.Append('\t')
					.Append(F(anchor.Y))
					.Append('\t')
					.Append(F(anchor.Z))
					.Append('\t')
					.Append(anchor.Rotation.ToString(CultureInfo.InvariantCulture))
					.Append('\t')
					.Append(Escape(anchor.Display))
					.Append('\t')
					.Append(Escape(anchor.Type))
					.Append('\t')
					.Append(anchor.CapturedAt.ToUniversalTime().Ticks.ToString(CultureInfo.InvariantCulture))
					.Append('\t')
					.Append(anchor.FollowFirst ? "1" : "0")
					.AppendLine();
			}
			string text = _filePath + ".tmp";
			File.WriteAllText(text, stringBuilder.ToString(), new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
			if (File.Exists(_filePath))
			{
				File.Delete(_filePath);
			}
			File.Move(text, _filePath);
		}
		catch (Exception ex)
		{
			NexusPlugin.Log.LogWarning((object)("Could not save anchors: " + ex.Message));
		}
	}

	public bool Add(LayoutAnchor anchor)
	{
		if (anchor == null || string.IsNullOrWhiteSpace(anchor.Key))
		{
			return false;
		}
		if (_anchors.Count >= _limit)
		{
			return false;
		}
		anchor.Rotation = NormalizeRotation(anchor.Rotation);
		_anchors.Add(anchor);
		Save();
		return true;
	}

	public int IndexOf(LayoutAnchor anchor)
	{
		if (anchor != null)
		{
			return _anchors.IndexOf(anchor);
		}
		return -1;
	}

	public void Remove(LayoutAnchor anchor)
	{
		if (anchor != null && _anchors.Remove(anchor))
		{
			Save();
		}
	}

	public void Clear()
	{
		_anchors.Clear();
		for (int i = 0; i < _bulkGroups.Length; i++)
		{
			_bulkGroups[i] = null;
		}
		Save();
	}

	public void SetGroup(BulkCategory category, LayoutAnchor anchor)
	{
		if (anchor != null)
		{
			anchor.Rotation = NormalizeRotation(anchor.Rotation);
			_bulkGroups[(int)category] = anchor;
			Save();
		}
	}

	public void ClearGroup(BulkCategory category)
	{
		_bulkGroups[(int)category] = null;
		Save();
	}

	public void SetTypeLeader(LayoutAnchor anchor, bool leader)
	{
		if (anchor == null || string.IsNullOrWhiteSpace(anchor.Key))
		{
			return;
		}
		foreach (LayoutAnchor anchor2 in _anchors)
		{
			if (string.Equals(anchor2.Key, anchor.Key, StringComparison.Ordinal))
			{
				anchor2.FollowFirst = false;
			}
		}
		if (leader)
		{
			anchor.FollowFirst = true;
		}
		Save();
	}

	public LayoutAnchor FindLeader(string key)
	{
		foreach (LayoutAnchor anchor in _anchors)
		{
			if (anchor.FollowFirst && string.Equals(anchor.Key, key, StringComparison.Ordinal))
			{
				return anchor;
			}
		}
		return null;
	}

	public LayoutAnchor FindFirst(string key)
	{
		foreach (LayoutAnchor anchor in _anchors)
		{
			if (string.Equals(anchor.Key, key, StringComparison.Ordinal))
			{
				return anchor;
			}
		}
		return null;
	}

	public LayoutAnchor FindNear(string key, Vector3 localPosition, float radius)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		float num = radius * radius;
		LayoutAnchor result = null;
		foreach (LayoutAnchor anchor in _anchors)
		{
			if (string.Equals(anchor.Key, key, StringComparison.Ordinal))
			{
				Vector3 val = anchor.LocalPosition - localPosition;
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				if (sqrMagnitude <= num)
				{
					num = sqrMagnitude;
					result = anchor;
				}
			}
		}
		return result;
	}

	public string BuildLua()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.AppendLine("-- ShipSort Nexus generated layout. Do not edit while the game is running.");
		stringBuilder.AppendLine("local tool = " + PointLua(GetGroup(BulkCategory.Tool)));
		stringBuilder.AppendLine("local one_scrap = " + PointLua(GetGroup(BulkCategory.OneHandScrap)));
		stringBuilder.AppendLine("local two_scrap = " + PointLua(GetGroup(BulkCategory.TwoHandScrap)));
		stringBuilder.Append("local tool_names = {");
		for (int i = 0; i < ForcedToolNames.Length; i++)
		{
			if (i > 0)
			{
				stringBuilder.Append(", ");
			}
			stringBuilder.Append("[\"").Append(LuaEscape(ForcedToolNames[i])).Append("\"]=true");
		}
		stringBuilder.AppendLine(" }");
		Dictionary<string, List<LayoutAnchor>> dictionary = new Dictionary<string, List<LayoutAnchor>>(StringComparer.Ordinal);
		List<string> list = new List<string>();
		foreach (LayoutAnchor anchor2 in _anchors)
		{
			if (!dictionary.TryGetValue(anchor2.Key, out var value))
			{
				value = new List<LayoutAnchor>();
				dictionary[anchor2.Key] = value;
				list.Add(anchor2.Key);
			}
			value.Add(anchor2);
		}
		stringBuilder.AppendLine("local leaders = {");
		foreach (string item in list)
		{
			LayoutAnchor layoutAnchor = null;
			foreach (LayoutAnchor item2 in dictionary[item])
			{
				if (item2.FollowFirst)
				{
					layoutAnchor = item2;
					break;
				}
			}
			if (layoutAnchor != null)
			{
				stringBuilder.Append("  [\"").Append(LuaEscape(item)).Append("\"] = ")
					.Append(PointLua(layoutAnchor))
					.AppendLine(",");
			}
		}
		stringBuilder.AppendLine("}");
		stringBuilder.AppendLine("local anchors = {");
		foreach (string item3 in list)
		{
			stringBuilder.Append("  [\"").Append(LuaEscape(item3)).Append("\"] = {");
			List<LayoutAnchor> list2 = dictionary[item3];
			for (int j = 0; j < list2.Count; j++)
			{
				LayoutAnchor anchor = list2[j];
				if (j > 0)
				{
					stringBuilder.Append(", ");
				}
				stringBuilder.Append(PointLua(anchor));
			}
			stringBuilder.AppendLine("},");
		}
		stringBuilder.AppendLine("}");
		stringBuilder.AppendLine("local used = {}");
		stringBuilder.AppendLine("local out = {}");
		stringBuilder.AppendLine("local function is_tool(item)");
		stringBuilder.AppendLine("  return tool_names[item.name] or not item.scrap");
		stringBuilder.AppendLine("end");
		stringBuilder.AppendLine("local function anchor_point(item)");
		stringBuilder.AppendLine("  if leaders[item.name] then return leaders[item.name] end");
		stringBuilder.AppendLine("  local list = anchors[item.name]");
		stringBuilder.AppendLine("  if list then");
		stringBuilder.AppendLine("    local n = (used[item.name] or 0) + 1");
		stringBuilder.AppendLine("    used[item.name] = n");
		stringBuilder.AppendLine("    return list[n]");
		stringBuilder.AppendLine("  end");
		stringBuilder.AppendLine("  return nil");
		stringBuilder.AppendLine("end");
		stringBuilder.AppendLine("local function spread(point, i)");
		stringBuilder.AppendLine("  if not point then return nil end");
		stringBuilder.AppendLine("  local angle = i * 2.399963229728653");
		stringBuilder.AppendLine("  local radius = 0.07 + (i % 4) * 0.045");
		stringBuilder.AppendLine("  local r = (point.r + ((i * 37) % 45) - 22) % 360");
		stringBuilder.AppendLine("  if r < 0 then r = r + 360 end");
		stringBuilder.AppendLine("  return {x=point.x+math.cos(angle)*radius, y=point.y, z=point.z+math.sin(angle)*radius, r=math.floor(r)}");
		stringBuilder.AppendLine("end");
		stringBuilder.AppendLine("for i, item in ipairs(items) do");
		stringBuilder.AppendLine("  local point = nil");
		stringBuilder.AppendLine("  if is_tool(item) then");
		stringBuilder.AppendLine("    -- KnifeItem / ShotgunItem are tools even when itemProperties.isScrap is true.");
		stringBuilder.AppendLine("    -- Tool suction overrides existing coordinates and only uses the tool point.");
		stringBuilder.AppendLine("    point = tool");
		stringBuilder.AppendLine("    if not point then point = anchor_point(item) end");
		stringBuilder.AppendLine("  else");
		stringBuilder.AppendLine("    -- Scrap keeps its existing single/type anchors; group is only a fallback.");
		stringBuilder.AppendLine("    point = anchor_point(item)");
		stringBuilder.AppendLine("    if not point then");
		stringBuilder.AppendLine("      if item.large == true then point = two_scrap else point = one_scrap end");
		stringBuilder.AppendLine("    end");
		stringBuilder.AppendLine("  end");
		stringBuilder.AppendLine("  if point then");
		stringBuilder.AppendLine("    local p = spread(point, i)");
		stringBuilder.AppendLine("    if p then");
		stringBuilder.AppendLine("      out[i] = ItemPos(Vector3(p.x, p.y, p.z)):with_rotation(p.r)");
		stringBuilder.AppendLine("    end");
		stringBuilder.AppendLine("  end");
		stringBuilder.AppendLine("end");
		stringBuilder.AppendLine("return out");
		return stringBuilder.ToString();
	}

	private static string PointLua(LayoutAnchor anchor)
	{
		if (anchor == null)
		{
			return "nil";
		}
		return "{x=" + F(anchor.X) + ",y=" + F(anchor.Y) + ",z=" + F(anchor.Z) + ",r=" + anchor.Rotation + "}";
	}

	private static bool TryParseGroupCategory(string kind, out BulkCategory category)
	{
		switch (kind)
		{
		case "one":
		case "two":
		case "one_tool":
		case "two_tool":
		case "tool":
			category = BulkCategory.Tool;
			return true;
		case "one_scrap":
			category = BulkCategory.OneHandScrap;
			return true;
		case "two_scrap":
			category = BulkCategory.TwoHandScrap;
			return true;
		default:
			category = BulkCategory.Tool;
			return false;
		}
	}

	private static string GroupKind(BulkCategory category)
	{
		return category switch
		{
			BulkCategory.OneHandScrap => "one_scrap", 
			BulkCategory.TwoHandScrap => "two_scrap", 
			_ => "tool", 
		};
	}

	private static string GroupKey(BulkCategory category)
	{
		return category switch
		{
			BulkCategory.OneHandScrap => "__ONE_SCRAP__", 
			BulkCategory.TwoHandScrap => "__TWO_SCRAP__", 
			_ => "__TOOL__", 
		};
	}

	private static string GroupDisplay(BulkCategory category)
	{
		return category switch
		{
			BulkCategory.OneHandScrap => "单手废料集中点", 
			BulkCategory.TwoHandScrap => "双手废料集中点", 
			_ => "工具集中点", 
		};
	}

	private static void AppendGroupLine(StringBuilder sb, string kind, LayoutAnchor anchor)
	{
		sb.Append("@GROUP").Append('\t').Append(kind)
			.Append('\t')
			.Append(F(anchor.X))
			.Append('\t')
			.Append(F(anchor.Y))
			.Append('\t')
			.Append(F(anchor.Z))
			.Append('\t')
			.Append(anchor.Rotation.ToString(CultureInfo.InvariantCulture))
			.AppendLine();
	}

	private static string F(float value)
	{
		if (float.IsNaN(value) || float.IsInfinity(value))
		{
			return "0";
		}
		return value.ToString("0.######", CultureInfo.InvariantCulture);
	}

	private static int NormalizeRotation(int rot)
	{
		rot %= 360;
		if (rot < 0)
		{
			rot += 360;
		}
		return rot;
	}

	private static string Escape(string value)
	{
		if (value == null)
		{
			return string.Empty;
		}
		return value.Replace("\\", "\\\\").Replace("\t", "\\t").Replace("\r", "\\r")
			.Replace("\n", "\\n");
	}

	private static string Unescape(string value)
	{
		if (string.IsNullOrEmpty(value))
		{
			return string.Empty;
		}
		StringBuilder stringBuilder = new StringBuilder(value.Length);
		for (int i = 0; i < value.Length; i++)
		{
			char c = value[i];
			if (c == '\\' && i + 1 < value.Length)
			{
				char c2 = value[++i];
				switch (c2)
				{
				case 't':
					stringBuilder.Append('\t');
					break;
				case 'r':
					stringBuilder.Append('\r');
					break;
				case 'n':
					stringBuilder.Append('\n');
					break;
				case '\\':
					stringBuilder.Append('\\');
					break;
				default:
					stringBuilder.Append('\\').Append(c2);
					break;
				}
			}
			else
			{
				stringBuilder.Append(c);
			}
		}
		return stringBuilder.ToString();
	}

	private static string LuaEscape(string value)
	{
		if (value == null)
		{
			return string.Empty;
		}
		return value.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\r", "\\r")
			.Replace("\n", "\\n");
	}
}
internal static class ChineseNames
{
	private static readonly Dictionary<string, string> Fallback = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "Knife", "小刀" },
		{ "KnifeItem", "小刀" },
		{ "Shotgun", "霰弹枪" },
		{ "ShotgunItem", "霰弹枪" },
		{ "Shotgun shell", "霰弹枪子弹" },
		{ "Ammo", "弹药" },
		{ "Shovel", "铲子" },
		{ "Weed killer", "除草喷剂" },
		{ "Sticky note", "便签纸" },
		{ "clipboard", "文件夹板" },
		{ "Flashlight", "手电筒" },
		{ "Pro-flashlight", "专业手电" },
		{ "Walkie-talkie", "对讲机" },
		{ "Jetpack", "喷气背包" },
		{ "Extension ladder", "伸缩梯" },
		{ "Lockpicker", "开锁器" },
		{ "Stun grenade", "眩晕手雷" },
		{ "TZP-Inhalant", "TZP 吸入剂" },
		{ "Radar booster", "雷达增幅器" },
		{ "Spray paint", "喷漆" },
		{ "Boombox", "手提音响" },
		{ "Airhorn", "气喇叭" },
		{ "Bell", "铃铛" },
		{ "Big bolt", "大螺栓" },
		{ "Bone", "骨头" },
		{ "Bottles", "瓶子" },
		{ "Brush", "刷子" },
		{ "Bubblegum", "泡泡糖" },
		{ "Candy", "糖果" },
		{ "Cash register", "收银机" },
		{ "Chemical jug", "化学液罐" },
		{ "Clock", "时钟" },
		{ "Clown horn", "小丑喇叭" },
		{ "Comedy", "喜剧面具" },
		{ "Control pad", "控制面板" },
		{ "Cookie pan", "饼干烤盘" },
		{ "Dust pan", "簸箕" },
		{ "Ear", "耳朵" },
		{ "Easter egg", "彩蛋" },
		{ "Egg", "蛋" },
		{ "Egg beater", "打蛋器" },
		{ "Fancy lamp", "华丽台灯" },
		{ "Flask", "酒壶" },
		{ "Foot", "脚" },
		{ "Garbage lid", "垃圾桶盖" },
		{ "Gift", "礼物" },
		{ "Gold bar", "金条" },
		{ "Golden cup", "金杯" },
		{ "Hairdryer", "吹风机" },
		{ "Hand", "手" },
		{ "Heart", "心脏" },
		{ "Hive", "蜂巢" },
		{ "Homemade flashbang", "自制闪光弹" },
		{ "Apparatus", "核心装置" },
		{ "Belt bag", "腰包" },
		{ "Binoculars", "望远镜" },
		{ "Body", "尸体" },
		{ "Inverse Teleporter", "逆向传送器" },
		{ "Teleporter", "传送器" }
	};

	private static readonly Dictionary<string, string> Cache = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

	private static MethodInfo _tryTranslate;

	private static bool _searched;

	public static string Translate(string source)
	{
		if (string.IsNullOrWhiteSpace(source) || HasChinese(source))
		{
			return source;
		}
		if (Cache.TryGetValue(source, out var value))
		{
			return value;
		}
		string translated = source;
		if (TryExternal(source, out translated) && HasChinese(translated))
		{
			Cache[source] = translated;
			return translated;
		}
		if (Fallback.TryGetValue(source, out translated))
		{
			Cache[source] = translated;
			return translated;
		}
		Cache[source] = source;
		return source;
	}

	private static bool TryExternal(string source, out string translated)
	{
		translated = source;
		try
		{
			if (!_searched)
			{
				_searched = true;
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				for (int i = 0; i < assemblies.Length; i++)
				{
					Type type = assemblies[i].GetType("V81TestChn.TranslationService", throwOnError: false);
					if (!(type == null))
					{
						_tryTranslate = type.GetMethod("TryTranslate", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
						{
							typeof(string),
							typeof(string).MakeByRefType()
						}, null);
						if (_tryTranslate != null)
						{
							break;
						}
					}
				}
			}
			if (_tryTranslate == null)
			{
				return false;
			}
			object[] array = new object[2] { source, null };
			object obj = _tryTranslate.Invoke(null, array);
			if (obj is bool && (bool)obj && array[1] is string text)
			{
				translated = text;
				return true;
			}
		}
		catch
		{
		}
		return false;
	}

	private static bool HasChinese(string value)
	{
		for (int i = 0; i < value.Length; i++)
		{
			if (value[i] >= '一' && value[i] <= '鿿')
			{
				return true;
			}
		}
		return false;
	}
}
internal static class InputBlockPatches
{
	[HarmonyPatch(typeof(PlayerControllerB), "ActivateItem_performed")]
	private static class ActivateItemPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "ItemSecondaryUse_performed")]
	private static class ItemSecondaryUsePatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "ItemTertiaryUse_performed")]
	private static class ItemTertiaryUsePatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Discard_performed")]
	private static class DiscardPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")]
	private static class JumpPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")]
	private static class InteractPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")]
	private static class ScrollMousePatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "UseUtilitySlot_performed")]
	private static class UseUtilitySlotPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "OpenMenu_performed")]
	private static class OpenMenuPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "Crouch_performed")]
	private static class CrouchPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "InspectItem_performed")]
	private static class InspectItemPatch
	{
		private static bool Prefix()
		{
			return !Blocked();
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "DropAllHeldItemsAndSyncNonexact")]
	private static class PreserveHeldPatch
	{
		private static bool Prefix()
		{
			return !NexusPlugin.PreserveHeldDuringSort;
		}
	}

	private static bool Blocked()
	{
		return NexusPlugin.BlockGameplayInput;
	}
}
public sealed class NexusMenu
{
	private readonly NexusPlugin _plugin;

	private int _tab;

	private Vector2 _layoutScroll;

	private Vector2 _itemsScroll;

	private string _itemFilter = "ALL";

	private bool _draggingSpeed;

	private float _clearArmedUntil;

	private float _anim;

	private static readonly string[] Tabs = new string[5] { "总览|OVERVIEW", "布局|LAYOUT", "灵魂|SOUL", "物资|ITEMS", "设置|SETTINGS" };

	public NexusMenu(NexusPlugin plugin)
	{
		_plugin = plugin;
	}

	public void OnOpened()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		_tab = 0;
		_layoutScroll = Vector2.zero;
		_itemsScroll = Vector2.zero;
	}

	public void Draw()
	{
		NexusUI.EnsureInit();
		_anim = Time.unscaledTime;
		NexusUI.Scale = Mathf.Clamp(Mathf.Min((float)Screen.width / 1360f, (float)Screen.height / 820f), 0.62f, 1.45f);
		if (!_plugin.MenuOpen && !_plugin.SoulActive)
		{
			DrawToast();
			return;
		}
		GUI.depth = -1000;
		if (_plugin.MenuOpen)
		{
			DrawMenu();
		}
		else
		{
			DrawSoulHud();
		}
		DrawToast();
	}

	private void DrawMenu()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_0093: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: 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_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
		float scale = NexusUI.Scale;
		float num = 1280f * scale;
		float num2 = 760f * scale;
		Rect rect = new Rect(0f, 0f, (float)Screen.width, (float)Screen.height);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2);
		NexusUI.Rect(rect, new Color(0.005f, 0.012f, 0.02f, 0.64f));
		NexusUI.Rect(val, new Color(0.018f, 0.037f, 0.055f, 0.975f));
		NexusUI.Grid(val, new Color(0.4f, 0.95f, 1f, 0.55f), 28f);
		Rect val2 = default(Rect);
		((Rect)(ref val2))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, NexusUI.SF(92f));
		NexusUI.Rect(val2, new Color(0.02f, 0.07f, 0.1f, 0.58f));
		NexusUI.Grid(val2, new Color(0.4f, 0.95f, 1f, 0.6f), 22f);
		NexusUI.Frame(val, new Color(0.18f, 0.78f, 0.9f, 0.65f));
		NexusUI.CornerBrackets(val, NexusUI.Cyan, 20f);
		NexusUI.Rect(new Rect(((Rect)(ref val)).x, ((Rect)(ref val2)).yMax - NexusUI.SF(1f), ((Rect)(ref val)).width, NexusUI.SF(1f)), new Color(0.35f, 0.94f, 1f, 0.55f));
		NexusUI.Scanline(val, _anim, new Color(0.45f, 1f, 1f, 0.05f));
		DrawHeader(val, val2);
		DrawNavigation(val, val2);
		DrawFooter(val);
		float num3 = NexusUI.SF(222f);
		Rect content = default(Rect);
		((Rect)(ref content))..ctor(((Rect)(ref val)).x + num3 + NexusUI.SF(26f), ((Rect)(ref val2)).yMax + NexusUI.SF(18f), ((Rect)(ref val)).width - num3 - NexusUI.SF(50f), ((Rect)(ref val)).height - ((Rect)(ref val2)).height - NexusUI.SF(18f) - NexusUI.SF(38f) - NexusUI.SF(12f));
		switch (_tab)
		{
		case 0:
			DrawOverview(content);
			break;
		case 1:
			DrawLayout(content);
			break;
		case 2:
			DrawSoul(content);
			break;
		case 3:
			DrawItems(content);
			break;
		default:
			DrawSettings(content);
			break;
		}
	}

	private void DrawHeader(Rect panel, Rect header)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: 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)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: 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_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		float num = ((Rect)(ref panel)).x + NexusUI.SF(26f);
		float num2 = ((Rect)(ref panel)).y + NexusUI.SF(13f);
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor(num + NexusUI.SF(10f), num2 + NexusUI.SF(22f));
		NexusUI.Circle(val, NexusUI.SF(11f), new Color(0.4f, 1f, 1f, 0.85f), 32);
		NexusUI.Circle(val, NexusUI.SF(5f), new Color(0.4f, 1f, 1f, 0.95f), 24, 1f);
		NexusUI.Line(val + new Vector2(0f - NexusUI.SF(16f), 0f), val + new Vector2(NexusUI.SF(16f), 0f), new Color(0.4f, 1f, 1f, 0.55f));
		NexusUI.Line(val + new Vector2(0f, 0f - NexusUI.SF(16f)), val + new Vector2(0f, NexusUI.SF(16f)), new Color(0.4f, 1f, 1f, 0.55f));
		NexusUI.Label(new Rect(num + NexusUI.SF(32f), num2 + NexusUI.SF(2f), NexusUI.SF(620f), NexusUI.SF(34f)), "SHIPSORT <color=#46F0FF>//</color> NEXUS", 27, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(num + NexusUI.SF(33f), num2 + NexusUI.SF(36f), NexusUI.SF(650f), NexusUI.SF(18f)), "星舰物资阵列 · ORBITAL CARGO MATRIX", 11, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		float num3 = NexusUI.SF(178f);
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(((Rect)(ref panel)).xMax - NexusUI.SF(24f) - num3, ((Rect)(ref panel)).y + NexusUI.SF(10f), num3, NexusUI.SF(52f));
		DrawLogo(rect);
		float num4 = ((Rect)(ref rect)).x - NexusUI.SF(16f);
		float num5 = ((Rect)(ref panel)).y + NexusUI.SF(22f);
		bool isOrbit = _plugin.IsOrbit;
		Rect rect2 = default(Rect);
		((Rect)(ref rect2))..ctor(num4 - NexusUI.SF(108f), num5, NexusUI.SF(108f), NexusUI.SF(26f));
		NexusUI.Chip(rect2, isOrbit ? "ORBIT LOCK" : "SURFACE LOCK", isOrbit ? NexusUI.Mint : NexusUI.Red, filled: true);
		Rect rect3 = default(Rect);
		((Rect)(ref rect3))..ctor(((Rect)(ref rect2)).x - NexusUI.SF(108f), num5, NexusUI.SF(100f), NexusUI.SF(26f));
		NexusUI.Chip(rect3, "CARGO " + _plugin.Items.Count.ToString("00"), NexusUI.Cyan);
		NexusUI.Chip(new Rect(((Rect)(ref rect3)).x - NexusUI.SF(108f), num5, NexusUI.SF(100f), NexusUI.SF(26f)), "ANCHOR " + _plugin.Anchors.LayoutPointCount.ToString("00"), NexusUI.Amber);
		string text = DateTime.Now.ToString("HH:mm:ss");
		NexusUI.Label(new Rect(num4 - NexusUI.SF(470f), num5 + NexusUI.SF(28f), NexusUI.SF(300f), NexusUI.SF(18f)), "UPLINK " + text + "  //  " + (_plugin.SoulActive ? "SOUL LINK ACTIVE" : "BODY SIGNAL STABLE"), 10, NexusUI.CyanDim, (TextAnchor)5, (FontStyle)0);
		NexusUI.Label(new Rect(num4 - NexusUI.SF(880f), num5 + NexusUI.SF(28f), NexusUI.SF(390f), NexusUI.SF(18f)), (_plugin.IsHost ? "HOST" : "CLIENT") + "  ·  BEPINEX PLUGIN 1.3.5  ·  F8 CONSOLE", 10, NexusUI.Muted, (TextAnchor)5, (FontStyle)0);
	}

	private void DrawLogo(Rect rect)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Invalid comparison between Unknown and I4
		//IL_0437: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0507: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: 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_00b7: 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_00c3: 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_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_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: 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)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03df: Unknown result type (might be due to invalid IL or missing references)
		float num = 0.5f + 0.5f * Mathf.Sin(_anim * 2.8f);
		Color val = Color.Lerp(NexusUI.Cyan, NexusUI.Mint, num * 0.55f);
		Vector2 val2 = default(Vector2);
		((Vector2)(ref val2))..ctor(((Rect)(ref rect)).x + NexusUI.SF(24f), ((Rect)(ref rect)).y + ((Rect)(ref rect)).height * 0.5f);
		if ((int)Event.current.type == 7)
		{
			NexusUI.Rect(rect, new Color(0.018f, 0.055f, 0.07f, 0.88f));
			NexusUI.Grid(rect, new Color(0.4f, 1f, 1f, 0.35f), 18f);
			NexusUI.Frame(rect, new Color(val.r, val.g, val.b, 0.55f + num * 0.25f));
			NexusUI.Rect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, NexusUI.SF(2f), ((Rect)(ref rect)).height), val);
			NexusUI.Glow(new Rect(val2.x - NexusUI.SF(24f), val2.y - NexusUI.SF(24f), NexusUI.SF(48f), NexusUI.SF(48f)), new Color(0.35f, 1f, 1f, 0.12f + num * 0.1f));
			NexusUI.Circle(val2, NexusUI.SF(17f), new Color(val.r, val.g, val.b, 0.32f), 40, 1f);
			NexusUI.Arc(val2, NexusUI.SF(17f), _anim * 70f, _anim * 70f + 205f, val, 26, 1.8f);
			NexusUI.Arc(val2, NexusUI.SF(12f), (0f - _anim) * 95f, (0f - _anim) * 95f + 130f, new Color(val.r, val.g, val.b, 0.75f), 20, 1.2f);
			Vector2 val3 = default(Vector2);
			for (int i = 0; i < 3; i++)
			{
				float num2 = _anim * 24f * (MathF.PI / 180f) + (float)i * (MathF.PI / 3f);
				((Vector2)(ref val3))..ctor(Mathf.Cos(num2), Mathf.Sin(num2));
				NexusUI.Line(val2 - val3 * NexusUI.SF(7f), val2 + val3 * NexusUI.SF(7f), val, 1.2f);
			}
			NexusUI.Rect(new Rect(((Rect)(ref rect)).x + Mathf.Repeat(_anim * 38f, ((Rect)(ref rect)).width), ((Rect)(ref rect)).y + NexusUI.SF(3f), NexusUI.SF(1.5f), ((Rect)(ref rect)).height - NexusUI.SF(6f)), new Color(0.6f, 1f, 1f, 0.12f));
			for (int j = 0; j < 3; j++)
			{
				float num3 = Mathf.Repeat(_anim * 0.22f + (float)j * 0.31f, 1f);
				float num4 = ((Rect)(ref rect)).x + NexusUI.SF(8f) + num3 * (((Rect)(ref rect)).width - NexusUI.SF(16f));
				float num5 = ((Rect)(ref rect)).y + NexusUI.SF(8f) + Mathf.Sin((_anim + (float)j * 1.7f) * 1.4f) * NexusUI.SF(5f) + (float)j * NexusUI.SF(9f);
				NexusUI.Rect(new Rect(num4, num5, NexusUI.SF(1.6f), NexusUI.SF(1.6f)), new Color(0.65f, 1f, 1f, 0.45f));
			}
		}
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(46f), ((Rect)(ref rect)).y + NexusUI.SF(4f), ((Rect)(ref rect)).width - NexusUI.SF(52f), NexusUI.SF(26f)), "霜华<color=#46F0FF>sama</color>", 17, Color.Lerp(NexusUI.TextPrimary, NexusUI.Mint, 0.25f + num * 0.25f), (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(47f), ((Rect)(ref rect)).y + NexusUI.SF(28f), ((Rect)(ref rect)).width - NexusUI.SF(54f), NexusUI.SF(14f)), "FROST SAMA // 霜华", 7, new Color(val.r, val.g, val.b, 0.85f), (TextAnchor)3, (FontStyle)0);
		NexusUI.Circle(new Vector2(((Rect)(ref rect)).xMax - NexusUI.SF(10f), ((Rect)(ref rect)).y + NexusUI.SF(9f)), NexusUI.SF(3f), val, 12, 1f);
	}

	private void DrawNavigation(Rect panel, Rect header)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: 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)
		float num = ((Rect)(ref panel)).x + NexusUI.SF(14f);
		float num2 = ((Rect)(ref header)).yMax + NexusUI.SF(18f);
		float num3 = NexusUI.SF(194f);
		NexusUI.Label(new Rect(num + NexusUI.SF(6f), num2, num3, NexusUI.SF(16f)), "// NAVIGATION", 9, NexusUI.CyanDim, (TextAnchor)3, (FontStyle)1);
		num2 += NexusUI.SF(22f);
		Rect rect = default(Rect);
		for (int i = 0; i < Tabs.Length; i++)
		{
			string[] array = Tabs[i].Split('|');
			((Rect)(ref rect))..ctor(num, num2 + (float)i * NexusUI.SF(56f), num3, NexusUI.SF(46f));
			if (DrawNavItem(rect, i, array[0], array[1]))
			{
				_tab = i;
				_layoutScroll = Vector2.zero;
				_itemsScroll = Vector2.zero;
			}
		}
		float num4 = ((Rect)(ref panel)).yMax - NexusUI.SF(88f);
		NexusUI.Line(new Vector2(num, num4), new Vector2(num + num3, num4), new Color(0.2f, 0.55f, 0.65f, 0.55f));
		NexusUI.Label(new Rect(num + NexusUI.SF(6f), num4 + NexusUI.SF(8f), num3, NexusUI.SF(16f)), "LINK STATUS", 9, NexusUI.CyanDim, (TextAnchor)3, (FontStyle)1);
		NexusUI.Circle(new Vector2(num + NexusUI.SF(11f), num4 + NexusUI.SF(32f)), NexusUI.SF(4f), NexusUI.Mint, 16, 1f);
		NexusUI.Label(new Rect(num + NexusUI.SF(20f), num4 + NexusUI.SF(24f), num3 - NexusUI.SF(20f), NexusUI.SF(16f)), "STABLE / 0.02s", 10, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)0);
		NexusUI.Label(new Rect(num + NexusUI.SF(6f), num4 + NexusUI.SF(44f), num3, NexusUI.SF(16f)), "NEXUS v1.3.5 · FROST SAMA", 9, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
	}

	private bool DrawNavItem(Rect rect, int index, string title, string sub)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_0036: 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_00b3: 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)
		//IL_00bf: Invalid comparison between Unknown and I4
		//IL_0093: 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_01ae: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		bool flag = _tab == index;
		bool flag2 = ((Rect)(ref rect)).Contains(Event.current.mousePosition);
		Color color = (Color)(flag ? NexusUI.Cyan : (flag2 ? new Color(0.4f, 0.85f, 0.95f, 0.65f) : new Color(0.12f, 0.28f, 0.34f, 0.55f)));
		Color color2 = (flag ? new Color(0.04f, 0.2f, 0.24f, 0.94f) : (flag2 ? new Color(0.04f, 0.12f, 0.15f, 0.85f) : new Color(0.02f, 0.05f, 0.07f, 0.55f)));
		if ((int)Event.current.type == 7)
		{
			NexusUI.Rect(rect, color2);
			NexusUI.Frame(rect, color);
			if (flag)
			{
				NexusUI.Rect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, NexusUI.SF(3f), ((Rect)(ref rect)).height), NexusUI.Cyan);
				NexusUI.Glow(new Rect(((Rect)(ref rect)).x - NexusUI.SF(10f), ((Rect)(ref rect)).y - NexusUI.SF(6f), NexusUI.SF(22f), ((Rect)(ref rect)).height + NexusUI.SF(12f)), new Color(0.3f, 1f, 1f, 0.12f));
			}
		}
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(12f), ((Rect)(ref rect)).y + NexusUI.SF(4f), NexusUI.SF(28f), ((Rect)(ref rect)).height - NexusUI.SF(8f)), "0" + (index + 1), 10, flag ? NexusUI.Cyan : NexusUI.CyanDim, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(42f), ((Rect)(ref rect)).y + NexusUI.SF(5f), ((Rect)(ref rect)).width - NexusUI.SF(50f), NexusUI.SF(20f)), title, 15, (Color)(flag ? NexusUI.TextPrimary : new Color(0.72f, 0.86f, 0.9f)), (TextAnchor)3, (FontStyle)(flag ? 1 : 0));
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(42f), ((Rect)(ref rect)).y + NexusUI.SF(22f), ((Rect)(ref rect)).width - NexusUI.SF(50f), NexusUI.SF(16f)), sub, 8, flag ? NexusUI.CyanDim : NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		return GUI.Button(rect, GUIContent.none, GUIStyle.none);
	}

	private void DrawFooter(Rect panel)
	{
		//IL_0026: 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_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		float num = ((Rect)(ref panel)).yMax - NexusUI.SF(38f);
		NexusUI.Line(new Vector2(((Rect)(ref panel)).x + NexusUI.SF(18f), num), new Vector2(((Rect)(ref panel)).xMax - NexusUI.SF(18f), num), new Color(0.2f, 0.6f, 0.7f, 0.45f));
		NexusUI.Label(new Rect(((Rect)(ref panel)).x + NexusUI.SF(22f), num, NexusUI.SF(700f), NexusUI.SF(38f)), "F8 关闭菜单  ·  ESC 返回  ·  F6 灵魂模式  ·  F9 脚下锚点  ·  F10 应用布局", 10, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		NexusUI.Label(new Rect(((Rect)(ref panel)).xMax - NexusUI.SF(360f), num, NexusUI.SF(338f), NexusUI.SF(38f)), "◈  ORBITAL CONSOLE  //  " + (_plugin.IsOrbit ? "LINK NOMINAL" : "SURFACE INTERLOCK"), 10, _plugin.IsOrbit ? NexusUI.Mint : NexusUI.Red, (TextAnchor)5, (FontStyle)0);
	}

	private void DrawPageHeader(Rect content, string code, string title, string english, string description)
	{
		//IL_001f: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: 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_0102: Unknown result type (might be due to invalid IL or missing references)
		NexusUI.Label(new Rect(((Rect)(ref content)).x, ((Rect)(ref content)).y, ((Rect)(ref content)).width, NexusUI.SF(14f)), code, 9, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref content)).x, ((Rect)(ref content)).y + NexusUI.SF(16f), ((Rect)(ref content)).width, NexusUI.SF(38f)), title, 28, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref content)).x + NexusUI.SF(2f), ((Rect)(ref content)).y + NexusUI.SF(52f), ((Rect)(ref content)).width, NexusUI.SF(18f)), english, 10, NexusUI.CyanDim, (TextAnchor)3, (FontStyle)0);
		if (!string.IsNullOrWhiteSpace(description))
		{
			NexusUI.Label(new Rect(((Rect)(ref content)).x + NexusUI.SF(2f), ((Rect)(ref content)).y + NexusUI.SF(70f), ((Rect)(ref content)).width, NexusUI.SF(18f)), description, 10, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		}
		NexusUI.Line(new Vector2(((Rect)(ref content)).x, ((Rect)(ref content)).y + NexusUI.SF(94f)), new Vector2(((Rect)(ref content)).xMax, ((Rect)(ref content)).y + NexusUI.SF(94f)), new Color(0.2f, 0.58f, 0.68f, 0.55f));
		NexusUI.Rect(new Rect(((Rect)(ref content)).x, ((Rect)(ref content)).y + NexusUI.SF(94f), NexusUI.SF(86f), NexusUI.SF(2f)), NexusUI.Cyan);
	}

	private void DrawOverview(Rect content)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Invalid comparison between Unknown and I4
		//IL_01ac: 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_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: 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_00be: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: 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_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0376: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_054c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0545: Unknown result type (might be due to invalid IL or missing references)
		//IL_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0662: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_076a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0780: Unknown result type (might be due to invalid IL or missing references)
		//IL_078a: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0847: Unknown result type (might be due to invalid IL or missing references)
		//IL_0853: Unknown result type (might be due to invalid IL or missing references)
		//IL_089f: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
		DrawPageHeader(content, "01 / OVERVIEW", "总览", "ORBITAL OVERVIEW", "轨道状态、物资数量与灵魂链路的实时摘要。");
		float num = ((Rect)(ref content)).y + NexusUI.SF(108f);
		bool isOrbit = _plugin.IsOrbit;
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(((Rect)(ref content)).x, num, ((Rect)(ref content)).width, NexusUI.SF(92f));
		Color val = (isOrbit ? NexusUI.Mint : NexusUI.Red);
		if ((int)Event.current.type == 7)
		{
			NexusUI.Rect(rect, new Color(0.02f, 0.075f, 0.085f, 0.92f));
			NexusUI.Grid(rect, new Color(0.4f, 1f, 1f, 0.45f), 20f);
			NexusUI.Frame(rect, new Color(val.r, val.g, val.b, 0.65f));
			NexusUI.Rect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, NexusUI.SF(4f), ((Rect)(ref rect)).height), val);
			NexusUI.Glow(new Rect(((Rect)(ref rect)).x - NexusUI.SF(20f), ((Rect)(ref rect)).y - NexusUI.SF(16f), NexusUI.SF(120f), ((Rect)(ref rect)).height + NexusUI.SF(32f)), new Color(val.r, val.g, val.b, 0.1f));
		}
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(20f), ((Rect)(ref rect)).y + NexusUI.SF(12f), NexusUI.SF(420f), NexusUI.SF(18f)), isOrbit ? "轨道锁定 / ORBITAL LOCK" : "地表锁定 / SURFACE INTERLOCK", 10, val, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(20f), ((Rect)(ref rect)).y + NexusUI.SF(34f), NexusUI.SF(520f), NexusUI.SF(36f)), isOrbit ? "外太空作业窗口已开启" : "已进入地表,编辑功能锁定", 22, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(21f), ((Rect)(ref rect)).y + NexusUI.SF(68f), NexusUI.SF(600f), NexusUI.SF(16f)), isOrbit ? "所有坐标均相对 /Environment/HangarShip 本地空间记录。" : "灵魂模式会自动强制返回身体,物品布局不可修改。", 9, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		NexusUI.Label(new Rect(((Rect)(ref rect)).xMax - NexusUI.SF(245f), ((Rect)(ref rect)).y + NexusUI.SF(12f), NexusUI.SF(220f), NexusUI.SF(16f)), "LAYOUT POINTS", 9, NexusUI.Muted, (TextAnchor)5, (FontStyle)0);
		NexusUI.Label(new Rect(((Rect)(ref rect)).xMax - NexusUI.SF(245f), ((Rect)(ref rect)).y + NexusUI.SF(26f), NexusUI.SF(220f), NexusUI.SF(48f)), _plugin.Anchors.LayoutPointCount.ToString("000"), 40, val, (TextAnchor)5, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).xMax - NexusUI.SF(245f), ((Rect)(ref rect)).y + NexusUI.SF(70f), NexusUI.SF(220f), NexusUI.SF(14f)), "ANCHOR BUFFER / 锚点缓存", 8, NexusUI.CyanDim, (TextAnchor)5, (FontStyle)0);
		float num2 = ((Rect)(ref rect)).yMax + NexusUI.SF(12f);
		float num3 = NexusUI.SF(10f);
		float num4 = (((Rect)(ref content)).width - num3 * 3f) / 4f;
		float num5 = NexusUI.SF(82f);
		GrabbableObject heldItem = _plugin.GetHeldItem();
		string text = (((Object)(object)heldItem != (Object)null) ? NexusPlugin.ItemDisplayName(heldItem) : "—");
		if (text.Length > 18)
		{
			text = text.Substring(0, 17) + "…";
		}
		NexusUI.Card(new Rect(((Rect)(ref content)).x, num2, num4, num5), "HELD ITEM / 手持", text, ((Object)(object)heldItem != (Object)null) ? NexusPlugin.ItemKey(heldItem) : "NO ITEM IN HAND", NexusUI.Cyan);
		NexusUI.Card(new Rect(((Rect)(ref content)).x + num4 + num3, num2, num4, num5), "CARGO / 物资", _plugin.Items.Count.ToString("00"), "SPAWNED GRABBABLES", NexusUI.Mint);
		NexusUI.Card(new Rect(((Rect)(ref content)).x + (num4 + num3) * 2f, num2, num4, num5), "ANCHORS / 锚点", _plugin.Anchors.LayoutPointCount.ToString("00"), "CUSTOM LAYOUT POINTS", NexusUI.Amber);
		NexusUI.Card(new Rect(((Rect)(ref content)).x + (num4 + num3) * 3f, num2, num4, num5), "SOUL / 灵魂", _plugin.SoulActive ? "LINK" : "IDLE", _plugin.SoulActive ? "CAMERA DISEMBODIED" : "BODY SIGNAL STABLE", _plugin.SoulActive ? NexusUI.Mint : NexusUI.CyanDim);
		float num6 = num2 + num5 + NexusUI.SF(16f);
		float num7 = (((Rect)(ref content)).width - NexusUI.SF(12f)) / 2f;
		float num8 = NexusUI.SF(52f);
		if (DrawActionButton(new Rect(((Rect)(ref content)).x, num6, num7, num8), "手持物品 → 脚下", "立即放置当前手持物品", primary: true, (Object)(object)_plugin.GetHeldItem() == (Object)null || !_plugin.IsOrbit))
		{
			_plugin.MoveHeldToFeet();
		}
		if (DrawActionButton(new Rect(((Rect)(ref content)).x + num7 + NexusUI.SF(12f), num6, num7, num8), "捕获脚下锚点", "记录物品 + 坐标到布局", primary: false, (Object)(object)_plugin.GetHeldItem() == (Object)null || !_plugin.IsOrbit))
		{
			_plugin.CaptureHeldAtFeet();
		}
		if (DrawActionButton(new Rect(((Rect)(ref content)).x, num6 + num8 + NexusUI.SF(10f), num7, num8), "应用全部锚点", "按捕获布局重排物资", primary: false, !_plugin.Anchors.HasAnyLayout || !_plugin.IsOrbit))
		{
			_plugin.ApplyAnchors();
		}
		if (DrawActionButton(new Rect(((Rect)(ref content)).x + num7 + NexusUI.SF(12f), num6 + num8 + NexusUI.SF(10f), num7, num8), _plugin.SoulActive ? "返回身体" : "进入灵魂模式", "脱离身体 / 相机自由飞行", primary: false, !_plugin.IsOrbit))
		{
			_plugin.Soul.Toggle();
		}
		float num9 = num6 + num8 * 2f + NexusUI.SF(22f);
		Rect rect2 = default(Rect);
		((Rect)(ref rect2))..ctor(((Rect)(ref content)).x, num9, ((Rect)(ref content)).width, ((Rect)(ref content)).yMax - num9);
		if (((Rect)(ref rect2)).height > NexusUI.SF(40f))
		{
			NexusUI.Rect(rect2, new Color(0.02f, 0.05f, 0.07f, 0.78f));
			NexusUI.Frame(rect2, new Color(0.12f, 0.34f, 0.4f, 0.7f));
			NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(14f), ((Rect)(ref rect2)).y + NexusUI.SF(9f), ((Rect)(ref rect2)).width - NexusUI.SF(28f), NexusUI.SF(16f)), "QUICK PROTOCOL / 快速流程", 9, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
			NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(14f), ((Rect)(ref rect2)).y + NexusUI.SF(28f), ((Rect)(ref rect2)).width - NexusUI.SF(28f), NexusUI.SF(16f)), "手持物品 → F9 捕获脚下锚点 → F6 进入灵魂模式 → 左键捕获准星 → F10 应用布局。", 10, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)0);
			NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(14f), ((Rect)(ref rect2)).y + NexusUI.SF(46f), ((Rect)(ref rect2)).width - NexusUI.SF(28f), NexusUI.SF(16f)), "灵魂模式仅限外太空;一旦进入地表,会立刻断开链路并返回身体。", 9, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		}
	}

	private void DrawLayout(Rect content)
	{
		//IL_000e: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Invalid comparison between Unknown and I4
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0426: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_0453: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0470: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_050c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0511: Unknown result type (might be due to invalid IL or missing references)
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_053b: Unknown result type (might be due to invalid IL or missing references)
		DrawPageHeader(content, "02 / LAYOUT", "布局", "ANCHOR MATRIX", "捕获物品的飞船本地坐标,并保存为可重复应用的自定义布局。");
		float num = ((Rect)(ref content)).y + NexusUI.SF(106f);
		float num2 = NexusUI.SF(150f);
		if (NexusUI.Button(new Rect(((Rect)(ref content)).x, num, num2, NexusUI.SF(36f)), "捕获手持 → 脚下", primary: true, active: false, (Object)(object)_plugin.GetHeldItem() == (Object)null || !_plugin.IsOrbit, 12))
		{
			_plugin.CaptureHeldAtFeet();
		}
		float num3 = NexusUI.SF(120f);
		if (NexusUI.Button(new Rect(((Rect)(ref content)).x + num2 + NexusUI.SF(8f), num, num3, NexusUI.SF(36f)), "应用布局", primary: false, active: false, !_plugin.Anchors.HasAnyLayout || !_plugin.IsOrbit, 12))
		{
			_plugin.ApplyAnchors();
		}
		float num4 = NexusUI.SF(110f);
		bool flag = Time.unscaledTime < _clearArmedUntil;
		if (NexusUI.Button(new Rect(((Rect)(ref content)).x + num2 + num3 + NexusUI.SF(16f), num, num4, NexusUI.SF(36f)), flag ? "确认清空?" : "清空全部", primary: false, flag, !_plugin.Anchors.HasAnyLayout, 12))
		{
			if (flag)
			{
				_plugin.Anchors.Clear();
				_clearArmedUntil = 0f;
				_plugin.Notify("锚点与集中点已清空。", NexusUI.Red);
			}
			else
			{
				_clearArmedUntil = Time.unscaledTime + 3f;
			}
		}
		NexusUI.Label(new Rect(((Rect)(ref content)).xMax - NexusUI.SF(260f), num, NexusUI.SF(260f), NexusUI.SF(36f)), "BUFFER " + _plugin.Anchors.Anchors.Count + " / " + _plugin.MaxAnchorsConfig.Value, 10, NexusUI.CyanDim, (TextAnchor)5, (FontStyle)0);
		float num5 = num + NexusUI.SF(46f);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(((Rect)(ref content)).x, num5, ((Rect)(ref content)).width, NexusUI.SF(160f));
		if ((int)Event.current.type == 7)
		{
			NexusUI.Rect(val, new Color(0.022f, 0.058f, 0.078f, 0.9f));
			NexusUI.Grid(val, new Color(0.4f, 1f, 1f, 0.35f), 24f);
			NexusUI.Frame(val, new Color(0.14f, 0.4f, 0.46f, 0.7f));
			NexusUI.Rect(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, NexusUI.SF(3f), ((Rect)(ref val)).height), NexusUI.Amber);
		}
		NexusUI.Label(new Rect(((Rect)(ref val)).x + NexusUI.SF(14f), ((Rect)(ref val)).y + NexusUI.SF(7f), NexusUI.SF(300f), NexusUI.SF(16f)), "BULK ASSIGN / 分类吸取", 9, NexusUI.Amber, (TextAnchor)3, (FontStyle)1);
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(((Rect)(ref val)).xMax - NexusUI.SF(56f), ((Rect)(ref val)).y + NexusUI.SF(6f), NexusUI.SF(42f), NexusUI.SF(22f));
		if (DrawToggle(rect, _plugin.FollowSameTypeConfig.Value))
		{
			_plugin.FollowSameTypeConfig.Value = !_plugin.FollowSameTypeConfig.Value;
		}
		NexusUI.Label(new Rect(((Rect)(ref val)).xMax - NexusUI.SF(300f), ((Rect)(ref val)).y + NexusUI.SF(6f), NexusUI.SF(238f), NexusUI.SF(22f)), "捕获时同类跟随", 10, NexusUI.TextPrimary, (TextAnchor)5, (FontStyle)0);
		DrawBulkRow(val, 0, BulkCategory.Tool, "工具", NexusUI.Cyan);
		DrawBulkRow(val, 1, BulkCategory.OneHandScrap, "单手废料", NexusUI.Amber);
		DrawBulkRow(val, 2, BulkCategory.TwoHandScrap, "双手废料", NexusUI.Red);
		NexusUI.Label(new Rect(((Rect)(ref val)).x + NexusUI.SF(14f), ((Rect)(ref val)).y + NexusUI.SF(130f), ((Rect)(ref val)).width - NexusUI.SF(28f), NexusUI.SF(16f)), "工具吸取含单手/双手工具、不含废料,会覆盖工具坐标;废料吸取保留已有坐标并保存废料集中点。", 8, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		Rect view = new Rect(((Rect)(ref content)).x, ((Rect)(ref val)).yMax + NexusUI.SF(10f), ((Rect)(ref content)).width, ((Rect)(ref content)).yMax - (((Rect)(ref val)).yMax + NexusUI.SF(10f)));
		IReadOnlyList<LayoutAnchor> anchors = _plugin.Anchors.Anchors;
		if (anchors.Count == 0)
		{
			DrawEmptyState(view, "NO ANCHORS", "没有单独锚点", "用上方分类吸取,或手持物品点击“捕获手持 → 脚下” / F9。");
			return;
		}
		float rowH = NexusUI.SF(62f);
		float num6 = Mathf.Max(((Rect)(ref view)).height, (float)anchors.Count * rowH + NexusUI.SF(8f));
		DrawScrollFrame(view, ref _layoutScroll, num6, delegate
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Invalid comparison between Unknown and I4
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			LayoutAnchor layoutAnchor = null;
			Rect rect2 = default(Rect);
			for (int i = 0; i < anchors.Count; i++)
			{
				LayoutAnchor layoutAnchor2 = anchors[i];
				((Rect)(ref rect2))..ctor(0f, (float)i * rowH, ((Rect)(ref view)).width - NexusUI.SF(10f), rowH - NexusUI.SF(4f));
				bool flag2 = ((Rect)(ref rect2)).Contains(Event.current.mousePosition);
				if ((int)Event.current.type == 7)
				{
					NexusUI.Rect(rect2, (i % 2 == 0) ? new Color(0.025f, 0.06f, 0.08f, 0.78f) : new Color(0.02f, 0.05f, 0.07f, 0.62f));
					if (flag2)
					{
						NexusUI.Rect(rect2, new Color(0.05f, 0.18f, 0.22f, 0.5f));
					}
					NexusUI.Frame(rect2, new Color(0.1f, 0.28f, 0.34f, 0.65f));
					NexusUI.Rect(new Rect(((Rect)(ref rect2)).x, ((Rect)(ref rect2)).y, NexusUI.SF(3f), ((Rect)(ref rect2)).height), (Color)((i % 2 == 0) ? NexusUI.CyanDim : new Color(0.2f, 0.55f, 0.6f, 0.8f)));
				}
				NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(12f), ((Rect)(ref rect2)).y, NexusUI.SF(40f), ((Rect)(ref rect2)).height), "#" + (i + 1).ToString("00"), 10, NexusUI.CyanDim, (TextAnchor)3, (FontStyle)1);
				NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(52f), ((Rect)(ref rect2)).y + NexusUI.SF(9f), NexusUI.SF(250f), NexusUI.SF(20f)), layoutAnchor2.PrettyName, 14, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)1);
				NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(52f), ((Rect)(ref rect2)).y + NexusUI.SF(30f), NexusUI.SF(250f), NexusUI.SF(18f)), layoutAnchor2.Key + "  ·  " + layoutAnchor2.Rotation + "°", 9, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
				NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(315f), ((Rect)(ref rect2)).y + NexusUI.SF(9f), NexusUI.SF(230f), NexusUI.SF(20f)), NexusPlugin.Fmt(new Vector3(layoutAnchor2.X, layoutAnchor2.Y, layoutAnchor2.Z)), 13, NexusUI.Cyan, (TextAnchor)3, (FontStyle)0);
				NexusUI.Label(new Rect(((Rect)(ref rect2)).x + NexusUI.SF(315f), ((Rect)(ref rect2)).y + NexusUI.SF(30f), NexusUI.SF(230f), NexusUI.SF(18f)), layoutAnchor2.FollowFirst ? "TYPE LEADER / 同类首件" : "SHIP LOCAL / 飞船坐标", 8, layoutAnchor2.FollowFirst ? NexusUI.Mint : NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
				if (NexusUI.Button(new Rect(((Rect)(ref rect2)).xMax - NexusUI.SF(224f), ((Rect)(ref rect2)).y + NexusUI.SF(13f), NexusUI.SF(66f), NexusUI.SF(30f)), "首件", primary: false, layoutAnchor2.FollowFirst, disabled: false, 11))
				{
					_plugin.ToggleTypeLeader(layoutAnchor2);
				}
				if (NexusUI.Button(new Rect(((Rect)(ref rect2)).xMax - NexusUI.SF(152f), ((Rect)(ref rect2)).y + NexusUI.SF(13f), NexusUI.SF(66f), NexusUI.SF(30f)), "定位", primary: false, active: false, !_plugin.IsOrbit, 11))
				{
					_plugin.FocusAnchor(layoutAnchor2);
				}
				if (NexusUI.Button(new Rect(((Rect)(ref rect2)).xMax - NexusUI.SF(80f), ((Rect)(ref rect2)).y + NexusUI.SF(13f), NexusUI.SF(66f), NexusUI.SF(30f)), "删除", primary: false, active: false, disabled: false, 11))
				{
					layoutAnchor = layoutAnchor2;
				}
			}
			if (layoutAnchor != null)
			{
				_plugin.Anchors.Remove(layoutAnchor);
			}
		}, ((Rect)(ref view)).height, num6);
	}

	private void DrawSoul(Rect content)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Invalid comparison between Unknown and I4
		//IL_0242: 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_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: 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_00be: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: 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_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0503: Unknown result type (might be due to invalid IL or missing references)
		//IL_050f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0543: Unknown result type (might be due to invalid IL or missing references)
		//IL_0572: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0618: Unknown result type (might be due to invalid IL or missing references)
		//IL_067c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0688: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_070a: Unknown result type (might be due to invalid IL or missing references)
		//IL_074b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0757: Unknown result type (might be due to invalid IL or missing references)
		DrawPageHeader(content, "03 / SOUL", "灵魂模式", "DISEMBODIED CAMERA", "自由飞行以检查货舱、定位落点;仅在外太空允许使用。");
		float num = ((Rect)(ref content)).y + NexusUI.SF(108f);
		Rect rect = default(Rect);
		((Rect)(ref rect))..ctor(((Rect)(ref content)).x, num, ((Rect)(ref content)).width, NexusUI.SF(142f));
		bool soulActive = _plugin.SoulActive;
		Color val = (soulActive ? NexusUI.Mint : NexusUI.Cyan);
		if ((int)Event.current.type == 7)
		{
			NexusUI.Rect(rect, new Color(0.02f, 0.07f, 0.085f, 0.92f));
			NexusUI.Grid(rect, new Color(0.4f, 1f, 1f, 0.4f), 22f);
			NexusUI.Frame(rect, new Color(val.r, val.g, val.b, 0.55f));
			NexusUI.Rect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, NexusUI.SF(4f), ((Rect)(ref rect)).height), val);
			Vector2 center = new Vector2(((Rect)(ref rect)).xMax - NexusUI.SF(98f), ((Rect)(ref rect)).y + NexusUI.SF(62f));
			NexusUI.Circle(center, NexusUI.SF(42f), new Color(val.r, val.g, val.b, 0.22f), 48, 1f);
			NexusUI.Arc(center, NexusUI.SF(42f), _anim * 55f, _anim * 55f + 210f, val, 28, 2f);
			NexusUI.Arc(center, NexusUI.SF(30f), (0f - _anim) * 80f, (0f - _anim) * 80f + 130f, new Color(val.r, val.g, val.b, 0.65f), 22);
			NexusUI.Circle(center, NexusUI.SF(8f), val, 24, 2f);
		}
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(20f), ((Rect)(ref rect)).y + NexusUI.SF(14f), NexusUI.SF(460f), NexusUI.SF(18f)), soulActive ? "SOUL LINK ACTIVE" : "SOUL LINK STANDBY", 10, val, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(20f), ((Rect)(ref rect)).y + NexusUI.SF(36f), NexusUI.SF(620f), NexusUI.SF(42f)), soulActive ? "灵魂链路已接入" : "灵魂模式待命", 28, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(21f), ((Rect)(ref rect)).y + NexusUI.SF(82f), NexusUI.SF(650f), NexusUI.SF(18f)), soulActive ? "身体留在飞船内,仅摄像机脱离。离开轨道会强制回归。" : "进入后可以穿过船体飞行,用准星定位物品摆放位置。", 10, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
		string label = (soulActive ? "返回身体" : "进入灵魂模式");
		if (NexusUI.Button(new Rect(((Rect)(ref rect)).x + NexusUI.SF(20f), ((Rect)(ref rect)).yMax - NexusUI.SF(46f), NexusUI.SF(180f), NexusUI.SF(34f)), label, primary: true, soulActive, !_plugin.IsOrbit, 12))
		{
			_plugin.Soul.Toggle();
		}
		NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(212f), ((Rect)(ref rect)).yMax - NexusUI.SF(46f), NexusUI.SF(400f), NexusUI.SF(34f)), _plugin.IsOrbit ? "ALLOWED // 外太空轨道" : "LOCKED // 地表禁用", 10, _plugin.IsOrbit ? NexusUI.Mint : NexusUI.Red, (TextAnchor)3, (FontStyle)0);
		float num2 = ((Rect)(ref rect)).yMax + NexusUI.SF(16f);
		float num3 = (((Rect)(ref content)).width - NexusUI.SF(12f)) / 2f;
		DrawInfoPanel(new Rect(((Rect)(ref content)).x, num2, num3, NexusUI.SF(126f)), "LINK PARAMETERS / 链路参数", new string[4] { "允许条件    外太空轨道", "禁用条件    地表 / 降落 / 离舰", "强制回归    是(自动)", "身体状态    留在飞船内" });
		DrawInfoPanel(new Rect(((Rect)(ref content)).x + num3 + NexusUI.SF(12f), num2, num3, NexusUI.SF(126f)), "FLIGHT CONTROL / 飞行", new string[4] { "WASD        水平移动", "SPACE/CTRL  上升 / 下降", "SHIFT       加速", "左键        选中 / 再次点击设坐标" });
		float num4 = num2 + NexusUI.SF(142f);
		NexusUI.Label(new Rect(((Rect)(ref content)).x, num4, NexusUI.SF(120f), NexusUI.SF(22f)), "CAMERA SPEED", 9, NexusUI.CyanDim, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref content)).x + NexusUI.SF(120f), num4, NexusUI.SF(80f), NexusUI.SF(22f)), _plugin.SoulSpeedConfig.Value.ToString("0.0") + " m/s", 12, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
		Rect track = default(Rect);
		((Rect)(ref track))..ctor(((Rect)(ref content)).x + NexusUI.SF(218f), num4 + NexusUI.SF(7f), ((Rect)(ref content)).width - NexusUI.SF(300f), NexusUI.SF(8f));
		DrawSlider(track, 2f, 20f, _plugin.SoulSpeedConfig);
		Rect rect2 = default(Rect);
		((Rect)(ref rect2))..ctor(((Rect)(ref content)).xMax - NexusUI.SF(62f), num4 - NexusUI.SF(2f), NexusUI.SF(40f), NexusUI.SF(22f));
		if (DrawToggle(rect2, _plugin.ShowItemMarkersConfig.Value))
		{
			_plugin.ShowItemMarkersConfig.Value = !_plugin.ShowItemMarkersConfig.Value;
		}
		NexusUI.Label(new Rect(((Rect)(ref content)).xMax - NexusUI.SF(250f), num4, NexusUI.SF(180f), NexusUI.SF(22f)), "显示物品标记", 10, NexusUI.TextPrimary, (TextAnchor)5, (FontStyle)0);
		if (!_plugin.IsOrbit)
		{
			float num5 = num4 + NexusUI.SF(42f);
			Rect rect3 = default(Rect);
			((Rect)(ref rect3))..ctor(((Rect)(ref content)).x, num5, ((Rect)(ref content)).width, NexusUI.SF(46f));
			NexusUI.Rect(rect3, new Color(0.25f, 0.04f, 0.07f, 0.75f));
			NexusUI.Frame(rect3, new Color(1f, 0.3f, 0.4f, 0.7f));
			NexusUI.Label(new Rect(((Rect)(ref rect3)).x + NexusUI.SF(14f), ((Rect)(ref rect3)).y, ((Rect)(ref rect3)).width - NexusUI.SF(28f), ((Rect)(ref rect3)).height), "地表锁定:灵魂模式不可用。若仍在灵魂模式,系统会立即强制回归身体。", 10, NexusUI.Red, (TextAnchor)3, (FontStyle)0);
		}
	}

	private void DrawItems(Rect content)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		DrawPageHeader(content, "04 / ITEMS", "物资", "CARGO INVENTORY", "扫描飞船内所有可抓取物,快速定位或移动到脚下。");
		float num = ((Rect)(ref content)).y + NexusUI.SF(106f);
		string[] array = new string[4] { "ALL", "SCRAP", "TOOLS", "HELD" };
		string[] array2 = new string[4] { "全部", "废料", "工具", "手持" };
		float num2 = ((Rect)(ref content)).x;
		for (int i = 0; i < array.Length; i++)
		{
			bool active = _itemFilter == array[i];
			if (NexusUI.Button(new Rect(num2, num, NexusUI.SF(66f), NexusUI.SF(30f)), array2[i], primary: false, active, disabled: false, 11))
			{
				_itemFilter = array[i];
				_itemsScroll = Vector2.zero;
			}
			num2 += NexusUI.SF(70f);
		}
		NexusUI.Label(new Rect(((Rect)(ref content)).xMax - NexusUI.SF(220f), num, NexusUI.SF(220f), NexusUI.SF(30f)), "SCAN " + _plugin.Items.Count + " OBJECTS", 9, NexusUI.CyanDim, (TextAnchor)5, (FontStyle)0);
		List<GrabbableObject> list = FilteredItems();
		Rect view = new Rect(((Rect)(ref content)).x, num + NexusUI.SF(42f), ((Rect)(ref content)).width, ((Rect)(ref content)).yMax - (num + NexusUI.SF(42f)));
		if (list.Count == 0)
		{
			DrawEmptyState(view, "NO SIGNALS", "当前过滤器没有物资", "切换筛选条件,或在轨道内扫描货舱。");
			return;
		}
		float rowH = NexusUI.SF(58f);
		float num3 = Mathf.Max(((Rect)(ref view)).height, (float)list.Count * rowH + NexusUI.SF(8f));
		DrawScrollFrame(view, ref _itemsScroll, num3, delegate
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Invalid comparison between Unknown and I4
			//IL_01af: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: 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)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject heldItem = _plugin.GetHeldItem();
			Rect rect = default(Rect);
			for (int j = 0; j < list.Count; j++)
			{
				GrabbableObject val = list[j];
				if (!((Object)(object)val == (Object)null))
				{
					((Rect)(ref rect))..ctor(0f, (float)j * rowH, ((Rect)(ref view)).width - NexusUI.SF(10f), rowH - NexusUI.SF(4f));
					bool flag = (Object)(object)val == (Object)(object)heldItem;
					bool flag2 = ((Rect)(ref rect)).Contains(Event.current.mousePosition);
					if ((int)Event.current.type == 7)
					{
						NexusUI.Rect(rect, flag ? new Color(0.04f, 0.15f, 0.14f, 0.75f) : ((j % 2 == 0) ? new Color(0.025f, 0.06f, 0.08f, 0.72f) : new Color(0.02f, 0.05f, 0.07f, 0.58f)));
						if (flag2)
						{
							NexusUI.Rect(rect, new Color(0.05f, 0.18f, 0.22f, 0.42f));
						}
						NexusUI.Frame(rect, new Color(0.1f, 0.28f, 0.34f, 0.6f));
						NexusUI.Rect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, NexusUI.SF(3f), ((Rect)(ref rect)).height), flag ? NexusUI.Mint : NexusUI.CyanDim);
					}
					NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(12f), ((Rect)(ref rect)).y + NexusUI.SF(8f), NexusUI.SF(300f), NexusUI.SF(20f)), NexusPlugin.ItemDisplayName(val), 13, flag ? NexusUI.Mint : NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)1);
					NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(12f), ((Rect)(ref rect)).y + NexusUI.SF(29f), NexusUI.SF(380f), NexusUI.SF(18f)), NexusPlugin.ItemKey(val) + "  ·  " + ItemType(val) + (flag ? "  ·  HELD" : ""), 9, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
					float num4 = (((Object)(object)_plugin.Player != (Object)null) ? Vector3.Distance(((Component)_plugin.Player).transform.position, ((Component)val).transform.position) : 0f);
					NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(390f), ((Rect)(ref rect)).y + NexusUI.SF(8f), NexusUI.SF(150f), NexusUI.SF(20f)), "$" + val.scrapValue.ToString("00"), 12, (val.scrapValue > 0) ? NexusUI.Amber : NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
					NexusUI.Label(new Rect(((Rect)(ref rect)).x + NexusUI.SF(390f), ((Rect)(ref rect)).y + NexusUI.SF(29f), NexusUI.SF(180f), NexusUI.SF(18f)), "DIST " + num4.ToString("0.0") + " m", 9, NexusUI.Muted, (TextAnchor)3, (FontStyle)0);
					if (NexusUI.Button(new Rect(((Rect)(ref rect)).xMax - NexusUI.SF(146f), ((Rect)(ref rect)).y + NexusUI.SF(11f), NexusUI.SF(62f), NexusUI.SF(30f)), "定位", primary: false, active: false, !_plugin.IsOrbit, 11))
					{
						_plugin.FocusItem(val);
					}
					if (NexusUI.Button(new Rect(((Rect)(ref rect)).xMax - NexusUI.SF(78f), ((Rect)(ref rect)).y + NexusUI.SF(11f), NexusUI.SF(62f), NexusUI.SF(30f)), "脚下", primary: false, flag, !_plugin.IsOrbit, 11))
					{
						_plugin.MoveItemToFeet(val);
					}
				}
			}
		}, ((Rect)(ref view)).height, num3);
	}

	private void DrawSettings(Rect content)
	{
		//IL_0001: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0419: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Unknown result type (might be due to invalid IL or missing references)
		//IL_0532: Unknown result type (might be due to invalid IL or missing references)
		DrawPageHeader(content, "05 / SETTINGS", "设置", "CONSOLE PARAMETERS", "快捷键、灵魂相机与布局缓存的本地参数。");
		float num = ((Rect)(ref content)).y + NexusUI.SF(108f);
		float num2 = (((Rect)(ref content)).width - NexusUI.SF(12f)) / 2f;
		DrawInfoPanel(new Rect(((Rect)(ref content)).x, num, num2, NexusUI.SF(174f)), "HOTKEYS / 快捷键", new string[6] { "F8       打开 / 关闭菜单", "F6       进入 / 退出灵魂模式", "F9       捕获手持物品到脚下", "F10      应用全部锚点", "ESC      关闭菜单 / 退出灵魂", "配置文件  BepInEx/config/wwaa.ShipSortNexus.cfg" });
		DrawInfoPanel(new Rect(((Rect)(ref content)).x + num2 + NexusUI.SF(12f), num, num2, NexusUI.SF(174f)), "PERSISTENCE / 持久化", new string[7]
		{
			"锚点文件  BepInEx/config/ShipSortNexus/anchors.tsv",
			"坐标空间  HangarShip local",
			"自动保存  捕获 / 删除 / 应用前",
			"锚点上限  " + _plugin.MaxAnchorsConfig.Value,
			"脚本集成  ShipSort v5 Lua runtime",
			"会话角色  " + (_plugin.IsHost ? "HOST" : "CLIENT"),
			"同步方式  ShipSort 内部 RPC"
		});
		float num3 = num + NexusUI.SF(190f);
		NexusUI.Label(new Rect(((Rect)(ref content)).x, num3, ((Rect)(ref content)).width, NexusUI.SF(18f)), "SOUL CAMERA / 灵魂相机", 10, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
		NexusUI.Label(new Rect(((Rect)(ref content)).x, num3 + NexusUI.SF(24f), NexusUI.SF(140f), NexusUI.SF(22f)), "移动速度", 11, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)0);
		NexusUI.Label(new Rect(((Rect)(ref content)).x + NexusUI.SF(120f), num3 + NexusUI.SF(24f), NexusUI.SF(90f), NexusUI.SF(22f)), _plugin.SoulSpeedConfig.Value.ToString("0.0") + " m/s", 11, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
		DrawSlider(new Rect(((Rect)(ref content)).x + NexusUI.SF(220f), num3 + NexusUI.SF(31f), ((Rect)(ref content)).width - NexusUI.SF(420f), NexusUI.SF(8f)), 2f, 20f, _plugin.SoulSpeedConfig);
		NexusUI.Label(new Rect(((Rect)(ref content)).x, num3 + NexusUI.SF(56f), NexusUI.SF(140f), NexusUI.SF(22f)), "鼠标灵敏度", 11, NexusUI.TextPrimary, (TextAnchor)3, (FontStyle)0);
		NexusUI.Label(new Rect(((Rect)(ref content)).x + NexusUI.SF(120f), num3 + NexusUI.SF(56f), NexusUI.SF(90f), NexusUI.SF(22f)), _plugin.SoulSensitivityConfig.Value.ToString("0.00"), 11, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
		DrawSlider(new Rect(((Rect)(ref content)).x + NexusUI.SF(220f), num3 + NexusUI.SF(63f), ((Rect)(ref content)).width - NexusUI.SF(420f), NexusUI.SF(8f)), 0.03f, 0.35f, _plugin.SoulSensitivityConfig);
		float num4 = num3 + NexusUI.SF(96f);
		float num5 = NexusUI.SF(150f);
		if (NexusUI.Button(new Rect(((Rect)(ref content)).x, num4, num5, NexusUI.SF(34f)), "重新载入锚点", primary: false, active: false, disabled: false, 11))
		{
			_plugin.Anchors.Load();
			_plugin.Notify("已重新载入锚点。", NexusUI.Mint);
		}
		if (NexusUI.Button(new Rect(((Rect)(ref content)).x + num5 + NexusUI.SF(8f), num4, num5, NexusUI.SF(34f)), "保存锚点", primary: false, active: false, disabled: false, 11))
		{
			_plugin.Anchors.Save();
			_plugin.Notify("锚点已写入磁盘。", NexusUI.Mint);
		}
		if (NexusUI.Button(new Rect(((Rect)(ref content)).x + (num5 + NexusUI.SF(8f)) * 2f, num4, num5, NexusUI.SF(34f)), "恢复默认速度", primary: false, active: false, disabled: false, 11))
		{
			_plugin.SoulSpeedConfig.Value = 8f;
			_plugin.SoulSensitivityConfig.Value = 0.11f;
		}
		float num6 = num4 + NexusUI.SF(52f);
		NexusUI.Label(new Rect(((Rect)(ref content)).x, num6, ((Rect)(ref content)).width, NexusUI.SF(18f)), "ABOUT / 关于", 10, NexusUI.Cyan, (TextAnchor)3, (FontStyle)1);
		NexusUI.LabelWrap(new Rect(((Rect)(ref content)).x, num6 + NexusUI.SF(22f), ((Rect)(ref content)).width, NexusUI.SF(80f)), "ShipSort Nexus 是 ShipSort v5 的客户端扩展:复用 ShipSort 的 Lua 排序运行时与物品 RPC,新增 F8 轨道控制台、脚下锚点捕获、可持久化布局和仅限外太空的灵魂相机。所有位置以 HangarShip 本地坐标保存,换图后仍可直接应用。制作与维护:shuanghuasama1145(Frost sama / 霜华sama)。", 10, NexusUI.Muted, (TextAnchor)0);
	}

	private void DrawInfoPanel(Rect rect, string title, string[] lines)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Invalid comparison between Unknown and I4
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid