Decompiled source of RemoteStorage v1.6.0
BepInEx\plugins\RemoteStorage\RemoteStorage.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using RemoteStorage.Game; using RemoteStorage.UI; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RemoteStorage")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyInformationalVersion("1.6.0")] [assembly: AssemblyProduct("RemoteStorage")] [assembly: AssemblyTitle("RemoteStorage")] [assembly: AssemblyVersion("1.6.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RemoteStorage { public sealed class AppState { public const string PackageKey = "__package__"; public static readonly AppState Instance = new AppState(); public bool Open; public bool Visible; public float X = -1f; public float Y = -1f; public float W = 1240f; public float H = 760f; public float Scale = 1f; public bool PositionInitialized; public List<PlanetGroup> Groups = new List<PlanetGroup>(); public readonly List<StorageInfo> Filtered = new List<StorageInfo>(); public readonly List<StorageInfo>[] Categories = new List<StorageInfo>[4] { new List<StorageInfo>(), new List<StorageInfo>(), new List<StorageInfo>(), new List<StorageInfo>() }; public const int TabDropsBuilding = 10; public const int TabDropsMaterial = 11; public readonly List<int> Tabs = new List<int>(); public int TabIndex; public readonly DropState Drops = new DropState(); public int PlanetFilter = -1; public int CategoryFilter = -1; public string Search = ""; public bool ShowEmpty; public StorageInfo Selected; public readonly CarryState Carry = new CarryState(); public bool FilterDirty = true; public double LastScan; public Vector2 PlanetScroll; public Vector2 BoxScroll; public Vector2 BoxItemScroll; public Vector2 InventoryScroll; public bool SearchFocused; public int MatchedTypes; public long MatchedCount; public int NonEmptyBoxes; public int Tab { get { if (Tabs.Count == 0) { return 0; } int index = ((TabIndex >= 0) ? ((TabIndex >= Tabs.Count) ? (Tabs.Count - 1) : TabIndex) : 0); return Tabs[index]; } } public bool IsDropTab { get { int tab = Tab; if (tab != 10) { return tab == 11; } return true; } } public bool IsBuildingDropTab => Tab == 10; public bool IsCarrying { get { if (Carry.Active) { return Carry.Count > 0; } return false; } } public int TabCount => Tabs.Count; public void LoadFromConfig() { try { ShowEmpty = ModConfig.ShowEmptyBoxes != null && ModConfig.ShowEmptyBoxes.Value; X = ((ModConfig.WindowX != null) ? ModConfig.WindowX.Value : (-1f)); Y = ((ModConfig.WindowY != null) ? ModConfig.WindowY.Value : (-1f)); PositionInitialized = X >= 0f && Y >= 0f; Drops.LoadFromConfig(); } catch (Exception ex) { Log.Warn("读取配置失败: " + ex.Message); } } public void SaveWindowPosition() { try { if (ModConfig.WindowX != null) { ModConfig.WindowX.Value = X; } if (ModConfig.WindowY != null) { ModConfig.WindowY.Value = Y; } if (ModConfig.ShowEmptyBoxes != null) { ModConfig.ShowEmptyBoxes.Value = ShowEmpty; } Drops.SaveConfig(); } catch { } } public void Toggle() { if (Open) { Close(); } else { OpenPanel(); } } public void OpenPanel() { Open = true; try { ModConfig.RefreshLocale(); ItemDb.Clear(); FilterDirty = true; Scan(manual: true); Drops.Scan(); TabIndex = IndexOfTab(PickDefaultTab()); } catch (Exception ex) { Log.Error("打开面板失败: " + ex); } } public void Close() { Open = false; SearchFocused = false; CancelCarry(silent: true); SaveWindowPosition(); } public void SetStatus(string text, bool error) { if (!string.IsNullOrEmpty(text)) { if (error) { Log.Warn(text); } else { Log.Info(text); } } } public void Scan(bool manual) { try { Dictionary<string, StorageInfo> dictionary = new Dictionary<string, StorageInfo>(); for (int i = 0; i < Groups.Count; i++) { PlanetGroup planetGroup = Groups[i]; for (int j = 0; j < planetGroup.Storages.Count; j++) { StorageInfo storageInfo = planetGroup.Storages[j]; if (storageInfo.Key != null) { dictionary[storageInfo.Key] = storageInfo; } } } List<PlanetGroup> list = (Groups = StorageScanner.Scan(dictionary)); LastScan = Time.realtimeSinceStartup; if (PlanetFilter >= 0 && !HasPlanet(PlanetFilter)) { PlanetFilter = -1; } if (!ContainsKey((Selected != null) ? Selected.Key : null)) { Selected = null; } ValidateCarry(); RebuildFiltered(); if (Selected == null) { SelectFirstFiltered(); } if (manual) { if (list.Count == 0) { SetStatus(Locale.T("没有找到任何储物箱:先在地面上放几个储物箱吧。", "No storage boxes found. Place some storage boxes first."), error: true); } else { SetStatus(string.Format(Locale.T("已刷新:{0} 个星球,{1} 个储物箱,{2} 个有物品。", "Refreshed: {0} planets, {1} boxes, {2} non-empty."), list.Count, CountBoxes(), NonEmptyBoxes), error: false); } } } catch (Exception ex) { Log.Error("扫描储物箱失败: " + ex); SetStatus("扫描失败: " + ex.Message, error: true); } } private void ValidateCarry() { if (!Carry.Active) { return; } if (Carry.SourceBox != null) { StorageInfo storageInfo = FindByKey(Carry.SourceKey); if (storageInfo == null || storageInfo.Storage == null || storageInfo.Storage != Carry.Source) { Carry.Clear(); SetStatus(Locale.T("手持物品所在的储物箱已不存在,手持状态已取消。", "The source box is gone; held item cancelled."), error: true); } } else if (Carry.Source == null) { Carry.Clear(); } } public int CountBoxes() { int num = 0; for (int i = 0; i < Groups.Count; i++) { num += Groups[i].Storages.Count; } return num; } public bool HasPlanet(int planetId) { for (int i = 0; i < Groups.Count; i++) { if (Groups[i].PlanetId == planetId) { return true; } } return false; } public bool ContainsKey(string key) { if (string.IsNullOrEmpty(key)) { return false; } for (int i = 0; i < Groups.Count; i++) { PlanetGroup planetGroup = Groups[i]; for (int j = 0; j < planetGroup.Storages.Count; j++) { if (planetGroup.Storages[j].Key == key) { return true; } } } return false; } public StorageInfo FindByKey(string key) { if (string.IsNullOrEmpty(key)) { return null; } for (int i = 0; i < Groups.Count; i++) { PlanetGroup planetGroup = Groups[i]; for (int j = 0; j < planetGroup.Storages.Count; j++) { if (planetGroup.Storages[j].Key == key) { return planetGroup.Storages[j]; } } } return null; } public void RebuildFiltered() { Filtered.Clear(); NonEmptyBoxes = 0; MatchedTypes = 0; long num = 0L; string text = (Search ?? "").Trim(); bool flag = text.Length > 0 || CategoryFilter >= 0; for (int i = 0; i < Groups.Count; i++) { PlanetGroup planetGroup = Groups[i]; if (PlanetFilter >= 0 && planetGroup.PlanetId != PlanetFilter) { continue; } for (int j = 0; j < planetGroup.Storages.Count; j++) { StorageInfo storageInfo = planetGroup.Storages[j]; if (storageInfo.TotalCount > 0) { NonEmptyBoxes++; } if (!ShowEmpty && storageInfo.TotalCount <= 0) { storageInfo.Matches = false; storageInfo.MatchTypes = 0; storageInfo.MatchCount = 0; continue; } bool flag2 = text.Length > 0 && CategoryFilter < 0 && MatchesBoxName(storageInfo, text); if (!flag || flag2) { storageInfo.Matches = true; storageInfo.MatchTypes = storageInfo.Items.Count; storageInfo.MatchCount = storageInfo.TotalCount; Filtered.Add(storageInfo); continue; } int num2 = 0; long num3 = 0L; for (int k = 0; k < storageInfo.Items.Count; k++) { ItemStack itemStack = storageInfo.Items[k]; if (ItemDb.Matches(itemStack.ItemId, text, CategoryFilter)) { num2++; num3 += itemStack.Count; } } storageInfo.Matches = num2 > 0; storageInfo.MatchTypes = num2; storageInfo.MatchCount = (int)Math.Min(2147483647L, num3); if (storageInfo.Matches) { Filtered.Add(storageInfo); MatchedTypes += num2; num += num3; } } } MatchedCount = num; RebuildCategories(); FilterDirty = false; } public void RebuildCategories() { for (int i = 0; i < Categories.Length; i++) { Categories[i].Clear(); } for (int j = 0; j < Filtered.Count; j++) { StorageInfo storageInfo = Filtered[j]; int num = storageInfo.Category; if (num < 0 || num >= Categories.Length) { num = 2; } Categories[num].Add(storageInfo); } for (int k = 0; k < Categories.Length; k++) { Categories[k].Sort(CompareByItemOrder); } RebuildTabs(); } private void RebuildTabs() { int tab = Tab; Tabs.Clear(); Tabs.Add(0); Tabs.Add(1); Tabs.Add(2); if (Categories[3].Count > 0) { Tabs.Add(3); } Tabs.Add(10); Tabs.Add(11); int num = Tabs.IndexOf(tab); TabIndex = ((num >= 0) ? num : 0); } private static int CompareByItemOrder(StorageInfo a, StorageInfo b) { int num = a.SortOrder.CompareTo(b.SortOrder); if (num != 0) { return num; } num = a.PlanetId.CompareTo(b.PlanetId); if (num != 0) { return num; } return a.EntityId.CompareTo(b.EntityId); } public int IndexOfTab(int tab) { int num = Tabs.IndexOf(tab); if (num < 0) { return 0; } return num; } public void SelectTab(int index) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (index >= 0 && index < Tabs.Count && TabIndex != index) { TabIndex = index; BoxScroll = Vector2.zero; Drops.Scroll = Vector2.zero; } } public int PickDefaultTab() { int result = 0; int num = 0; for (int i = 0; i <= 2; i++) { int count = Categories[i].Count; if (count > num) { num = count; result = i; } } if (num > 0) { return result; } if (Categories[3].Count > 0) { return 3; } if (Drops.Building.Count > 0) { return 10; } if (Drops.Material.Count > 0) { return 11; } return 0; } public void OnFilterChanged() { FilterDirty = true; RebuildFiltered(); } private static bool MatchesBoxName(StorageInfo box, string q) { if (box == null) { return false; } if (!string.IsNullOrEmpty(box.BuildingName) && box.BuildingName.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (!string.IsNullOrEmpty(box.PlanetName) && box.PlanetName.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (!string.IsNullOrEmpty(box.StarName) && box.StarName.IndexOf(q, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return false; } public void OnPlanetChanged() { FilterDirty = true; RebuildFiltered(); if (Selected == null || (PlanetFilter >= 0 && Selected.PlanetId != PlanetFilter)) { SelectFirstFiltered(); } } public void SelectFirstFiltered() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) Selected = ((Filtered.Count > 0) ? Filtered[0] : null); BoxItemScroll = Vector2.zero; } public bool IsLocalPlanet(PlanetGroup g) { try { return g != null && GameMain.localPlanet != null && g.Planet == GameMain.localPlanet; } catch { return false; } } public int EffectiveGridCount(StorageComponent storage, int gridIndex) { if (storage == null || storage.grids == null) { return 0; } if (gridIndex < 0 || gridIndex >= storage.grids.Length) { return 0; } int num = storage.grids[gridIndex].count; if (Carry.Active && Carry.Source == storage) { num -= Carry.ReservedAt(gridIndex); } return Math.Max(0, num); } public int CarriedFrom(StorageInfo box) { if (box == null || !Carry.Active || Carry.SourceBox != box) { return 0; } return Carry.Count; } public int AdjustedTotal(StorageInfo box) { if (box == null) { return 0; } return Math.Max(0, box.TotalCount - CarriedFrom(box)); } public bool PickFrom(StorageComponent storage, string key, StorageInfo box, int gridIndex, bool half, bool allSame) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if (IsCarrying || storage == null || storage.grids == null) { return false; } int num = Math.Min(storage.size, storage.grids.Length); if (gridIndex < 0 || gridIndex >= num) { return false; } GRID val = storage.grids[gridIndex]; if (val.itemId <= 0 || val.count <= 0) { return false; } Carry.Clear(); Carry.Active = true; Carry.ItemId = val.itemId; Carry.Source = storage; Carry.SourceKey = key; Carry.SourceBox = box; if (allSame) { for (int i = 0; i < num; i++) { GRID val2 = storage.grids[i]; if (val2.itemId == val.itemId && val2.count > 0) { Carry.Reservations.Add(new CarryReservation { GridIndex = i, Count = val2.count }); Carry.Count += val2.count; } } } else { int count = (half ? Math.Max(1, (val.count + 1) / 2) : val.count); Carry.Reservations.Add(new CarryReservation { GridIndex = gridIndex, Count = count }); Carry.Count = count; } if (Carry.Count <= 0) { Carry.Clear(); return false; } SetStatus(Locale.T("拿起了 ", "Holding ") + ItemDb.Name(Carry.ItemId) + " ×" + Locale.Exact(Carry.Count) + Locale.T(":点击储物箱或背包放入,右键取消", " - click a box or your inventory to put it down; RMB cancels"), error: false); return true; } public bool PickFromBox(StorageInfo box, int gridIndex, bool half, bool allSame) { if (box == null || box.Storage == null || box.Storage.id != box.StorageId) { return false; } return PickFrom(box.Storage, box.Key, box, gridIndex, half, allSame); } public bool PickFromInventory(int gridIndex, bool half, bool allSame) { Player mainPlayer = GameMain.mainPlayer; if (mainPlayer == null || mainPlayer.package == null) { return false; } return PickFrom(mainPlayer.package, "__package__", null, gridIndex, half, allSame); } public void DropInto(StorageComponent target, StorageInfo targetBox) { if (!IsCarrying) { return; } if (target == null || Carry.Source == null) { CancelCarry(silent: true); SetStatus(Locale.T("目标不存在,手持已取消。", "Target is gone; hold cancelled."), error: true); return; } if (target == Carry.Source) { CancelCarry(silent: true); SetStatus(Locale.T("已放回原处。", "Put back where it was."), error: false); return; } int stackSize = ItemDb.StackSize(Carry.ItemId); TakeResult takeResult = RemoteTransfer.TakeInto(Carry.Source, target, Carry.ItemId, Carry.Count, stackSize); if (takeResult.Taken > 0) { Carry.Count -= takeResult.Taken; if (targetBox != null) { try { targetBox.Refresh(); } catch { } } if (Carry.SourceBox != null) { try { Carry.SourceBox.Refresh(); } catch { } } if (Carry.Count <= 0) { string text = ItemDb.Name(Carry.ItemId); int taken = takeResult.Taken; CancelCarry(silent: true); SetStatus(Locale.T("放入 ", "Stored ") + text + " ×" + Locale.Exact(taken), error: false); } else { RebuildReservations(); SetStatus(Locale.T("目标空间不足:已放入 ", "Target is full; stored ") + Locale.Exact(takeResult.Taken) + Locale.T(",手中还剩 ", " - still holding ") + Locale.Exact(Carry.Count), error: true); } } else { SetStatus((takeResult.Status == TakeStatus.PackageFull) ? Locale.T("目标已满,放不进去。", "Target is full.") : Locale.T("放不进去。", "Cannot store here."), error: true); } } public void DropIntoBox(StorageInfo box) { if (IsCarrying && box != null) { if (box.Storage == null || box.Storage.id != box.StorageId) { Scan(manual: true); SetStatus(Locale.T("这个储物箱已经不存在了,已重新扫描。", "That box no longer exists; rescanning."), error: true); } else { DropInto(box.Storage, box); } } } public void DropIntoInventory() { if (IsCarrying) { Player mainPlayer = GameMain.mainPlayer; if (mainPlayer != null && mainPlayer.package != null) { DropInto(mainPlayer.package, null); } } } public void CancelCarry(bool silent) { if (Carry.Active) { Carry.Clear(); if (!silent) { SetStatus(Locale.T("已取消手持。", "Hold cancelled."), error: false); } } } private void RebuildReservations() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) Carry.Reservations.Clear(); if (!Carry.Active || Carry.Source == null || Carry.Source.grids == null) { Carry.Clear(); return; } int num = Carry.Count; int num2 = Math.Min(Carry.Source.size, Carry.Source.grids.Length); for (int i = 0; i < num2; i++) { if (num <= 0) { break; } GRID val = Carry.Source.grids[i]; if (val.itemId == Carry.ItemId && val.count > 0) { int num3 = Math.Min(val.count, num); Carry.Reservations.Add(new CarryReservation { GridIndex = i, Count = num3 }); num -= num3; } } if (num > 0) { Carry.Count -= num; if (Carry.Count <= 0) { Carry.Clear(); } } } public int EffectiveUsedSlots(StorageInfo box) { if (box == null || box.Storage == null || box.Storage.grids == null) { return 0; } int num = Math.Min(box.Storage.size, box.Storage.grids.Length); int num2 = 0; for (int i = 0; i < num; i++) { if (box.Storage.grids[i].itemId > 0 && EffectiveGridCount(box.Storage, i) > 0) { num2++; } } return num2; } public static int PackageFreeSlots() { try { Player mainPlayer = GameMain.mainPlayer; if (mainPlayer == null || mainPlayer.package == null || mainPlayer.package.grids == null) { return 0; } int num = Math.Min(mainPlayer.package.size, mainPlayer.package.grids.Length); AppState instance = Instance; int num2 = 0; for (int i = 0; i < num; i++) { if (mainPlayer.package.grids[i].itemId == 0) { num2++; } else if (instance.Carry.Active && instance.Carry.Source == mainPlayer.package && instance.EffectiveGridCount(mainPlayer.package, i) <= 0) { num2++; } } return num2; } catch { return 0; } } public static int PackageSlotCount() { try { Player mainPlayer = GameMain.mainPlayer; if (mainPlayer == null || mainPlayer.package == null) { return 0; } return mainPlayer.package.size; } catch { return 0; } } } public struct DropEntry { public int ItemId; public long Count; public int Order; } public sealed class DropState { private readonly Dictionary<int, long> _totals = new Dictionary<int, long>(); public readonly List<DropEntry> Building = new List<DropEntry>(); public readonly List<DropEntry> Material = new List<DropEntry>(); public int LiveStacks; public int TypeCount; public long TotalCount; public Vector2 Scroll; public double LastScan; public bool SortByCount; public int HoverItemId; public long HoverCount; public string Status = ""; public bool StatusError; private double _statusUntil; public string CurrentStatus { get { if (string.IsNullOrEmpty(Status)) { return ""; } if ((double)Time.realtimeSinceStartup > _statusUntil) { return ""; } return Status; } } public void LoadFromConfig() { try { SortByCount = ModConfig.DropsSortByCount != null && ModConfig.DropsSortByCount.Value; } catch (Exception ex) { Log.Warn("读取掉落物配置失败: " + ex.Message); } } public void SaveConfig() { try { if (ModConfig.DropsSortByCount != null) { ModConfig.DropsSortByCount.Value = SortByCount; } } catch { } } public void Scan() { try { LastScan = Time.realtimeSinceStartup; LiveStacks = TrashAccess.Scan(_totals); Rebuild(); } catch (Exception ex) { Log.Error("统计掉落物失败: " + ex); } } public void ScanIfDue(float interval) { if (interval < 0.1f) { interval = 0.1f; } if (!((double)Time.realtimeSinceStartup - LastScan < (double)interval)) { Scan(); } } private void Rebuild() { Building.Clear(); Material.Clear(); TypeCount = 0; TotalCount = 0L; foreach (KeyValuePair<int, long> total in _totals) { if (total.Value > 0) { DropEntry item = new DropEntry { ItemId = total.Key, Count = total.Value, Order = ItemDb.GridOrder(total.Key) }; if (ItemDb.IsBuilding(total.Key)) { Building.Add(item); } else { Material.Add(item); } TypeCount++; TotalCount += total.Value; } } Building.Sort(SortByCount ? new Comparison<DropEntry>(CompareByCount) : new Comparison<DropEntry>(CompareByType)); Material.Sort(SortByCount ? new Comparison<DropEntry>(CompareByCount) : new Comparison<DropEntry>(CompareByType)); HoverItemId = 0; } private static int CompareByType(DropEntry a, DropEntry b) { int num = a.Order.CompareTo(b.Order); if (num != 0) { return num; } return a.ItemId.CompareTo(b.ItemId); } private static int CompareByCount(DropEntry a, DropEntry b) { if (a.Count != b.Count) { return b.Count.CompareTo(a.Count); } return CompareByType(a, b); } public void Take(int itemId) { try { if (!TrashAccess.Ready) { SetStatus(Locale.T("还没有载入存档,拿不了。", "No save is loaded."), error: true); return; } if (!TrashAccess.CanTake) { SetStatus(Locale.T("角色已死亡,暂时不能拿取。", "You cannot take items right now."), error: true); return; } TakeOutcome r = TrashAccess.Take(itemId); if (r.Stacks == 0) { SetStatus(Locale.T("没有可拿取的掉落物。", "Nothing to take."), error: true, 2.0); Scan(); return; } TrashAccess.NotifyPickup(itemId, r.Added); string text = ItemDb.Name(itemId); SetStatus(BuildTakeMessage(text, r), r.Added == 0); Log.Info("拿取掉落物 " + text + ":入包 " + r.Added + ",掉脚下 " + r.Dropped + ",清理 " + r.Stacks + " 件,跳过 " + r.Skipped); Scan(); } catch (Exception ex) { Log.Error("拿取掉落物失败: " + ex); SetStatus(Locale.T("拿取失败,详见 BepInEx 日志。", "Take failed; see the log."), error: true); } } public void TakeAll(bool building) { try { if (!TrashAccess.Ready) { SetStatus(Locale.T("还没有载入存档,拿不了。", "No save is loaded."), error: true); return; } if (!TrashAccess.CanTake) { SetStatus(Locale.T("角色已死亡,暂时不能拿取。", "You cannot take items right now."), error: true); return; } List<DropEntry> list = (building ? Building : Material); List<int> list2 = new List<int>(list.Count); for (int i = 0; i < list.Count; i++) { list2.Add(list[i].ItemId); } if (list2.Count == 0) { SetStatus(Locale.T("没有可拿取的掉落物。", "Nothing to take."), error: true, 2.0); return; } long num = 0L; long num2 = 0L; int num3 = 0; int num4 = 0; bool popup = list2.Count <= 8; for (int j = 0; j < list2.Count; j++) { TakeOutcome takeOutcome = TrashAccess.Take(list2[j]); if (takeOutcome.Stacks > 0) { num3++; num += takeOutcome.Added; num2 += takeOutcome.Dropped; num4 += takeOutcome.Stacks; TrashAccess.NotifyPickup(list2[j], takeOutcome.Added, popup); } } if (num3 == 0) { SetStatus(Locale.T("没有可拿取的掉落物。", "Nothing to take."), error: true, 2.0); Scan(); return; } string text = Locale.T("全部拿取:" + Locale.Exact(num3) + " 类 · " + Locale.Exact(num) + " 个", "Took all: " + Locale.Exact(num3) + " kinds · " + Locale.Exact(num) + " items"); if (num2 > 0) { text += Locale.T(";背包已满,另有 " + Locale.Exact(num2) + " 个掉在脚下", "; bag full, " + Locale.Exact(num2) + " dropped at your feet"); } SetStatus(text, num2 > 0, 6.0); Log.Info("全部拿取(" + (building ? "建筑掉落" : "材料掉落") + "):" + num3 + " 类 / " + num4 + " 件地面掉落 / 入包 " + num + " / 掉脚下 " + num2); Scan(); } catch (Exception ex) { Log.Error("全部拿取失败: " + ex); SetStatus(Locale.T("拿取失败,详见 BepInEx 日志。", "Take failed; see the log."), error: true); } } private static string BuildTakeMessage(string name, TakeOutcome r) { string text = name + " ×" + Locale.Exact(r.Added); if (r.Added == 0L) { return Locale.T("背包已满:" + text + " 没装进背包,已全部掉在脚下", "Bag full: " + text + " did not fit and was dropped at your feet"); } if (r.Dropped > 0) { return Locale.T("已拿取 " + text + ";背包已满,另有 " + Locale.Exact(r.Dropped) + " 个掉在脚下", "Took " + text + "; bag full, " + Locale.Exact(r.Dropped) + " dropped at your feet"); } return Locale.T("已拿取 " + text, "Took " + text); } public void SetStatus(string text, bool error, double seconds = 4.0) { Status = text ?? ""; StatusError = error; _statusUntil = (double)Time.realtimeSinceStartup + seconds; } } public static class Locale { public static bool IsZh = true; public static string T(string zh, string en) { if (!IsZh) { return en; } return zh; } public static string Fmt(long v) { if (v < 0) { v = 0L; } if (v >= 100000000) { return ((double)(v / 10000000) / 10.0).ToString("0.#") + (IsZh ? "亿" : "00M"); } if (v >= 10000) { return ((double)(v / 1000) / 10.0).ToString("0.#") + (IsZh ? "万" : "0K"); } return v.ToString(); } public static string Compact(long v) { if (v < 0) { v = 0L; } if (v < 10000) { return v.ToString(); } if (IsZh) { if (v >= 100000000) { return Trim((double)v / 100000000.0) + "亿"; } return Trim((double)v / 10000.0) + "W"; } if (v >= 1000000) { return Trim((double)v / 1000000.0) + "M"; } return Trim((double)v / 1000.0) + "K"; } private static string Trim(double d) { if (d >= 100.0) { return ((long)d).ToString(CultureInfo.InvariantCulture); } return d.ToString("0.#", CultureInfo.InvariantCulture); } public static string Exact(long v) { return v.ToString("N0"); } public static string CategoryName(int type) { return type switch { 1 => T("资源", "Resource"), 2 => T("材料", "Material"), 3 => T("组件", "Component"), 4 => T("成品", "Product"), 5 => T("物流", "Logistics"), 6 => T("生产", "Production"), 7 => T("装饰", "Decoration"), 8 => T("炮塔", "Turret"), 9 => T("防御", "Defense"), 10 => T("黑雾", "Dark Fog"), 11 => T("矩阵", "Matrix"), _ => T("未知", "Unknown"), }; } public static string ShortCategoryName(int type) { return type switch { 1 => T("资源", "Res"), 2 => T("材料", "Mat"), 3 => T("组件", "Comp"), 4 => T("成品", "Prod"), 5 => T("物流", "Logi"), 6 => T("生产", "Build"), 7 => T("装饰", "Deco"), 8 => T("炮塔", "Turret"), 9 => T("防御", "Def"), 10 => T("黑雾", "DF"), 11 => T("矩阵", "Matrix"), _ => T("未知", "?"), }; } } internal static class Log { public static ManualLogSource Source; public static void Info(string msg) { if (Source != null) { Source.LogInfo((object)msg); } } public static void Warn(string msg) { if (Source != null) { Source.LogWarning((object)msg); } } public static void Error(string msg) { if (Source != null) { Source.LogError((object)msg); } } } public static class ModConfig { public static ConfigEntry<KeyboardShortcut> Hotkey; public static ConfigEntry<string> Language; public static ConfigEntry<int> RefreshSeconds; public static ConfigEntry<bool> ShowEmptyBoxes; public static ConfigEntry<float> DropsRefreshSeconds; public static ConfigEntry<bool> DropsSortByCount; public static ConfigEntry<bool> KeepEnemyDrops; public static ConfigEntry<float> WindowX; public static ConfigEntry<float> WindowY; public static void Init(ConfigFile cfg) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown Hotkey = cfg.Bind<KeyboardShortcut>("General", "Hotkey", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "打开/关闭「远程储物箱」面板的快捷键。默认 F9。"); Language = cfg.Bind<string>("General", "Language", "auto", new ConfigDescription("界面语言:auto / zh / en", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "auto", "zh", "en" }), Array.Empty<object>())); RefreshSeconds = cfg.Bind<int>("General", "RefreshSeconds", 2, new ConfigDescription("面板打开时自动重新扫描所有星球储物箱的间隔(秒)。0 = 只手动刷新。", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 60), Array.Empty<object>())); ShowEmptyBoxes = cfg.Bind<bool>("General", "ShowEmptyBoxes", true, "面板是否显示空储物箱。"); DropsRefreshSeconds = cfg.Bind<float>("Drops", "RefreshSeconds", 0.4f, new ConfigDescription("面板打开时重新统计地面掉落物的间隔(秒)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); DropsSortByCount = cfg.Bind<bool>("Drops", "SortByCount", false, "掉落物标签页:true = 按数量从多到少排序;false = 按游戏物品格位排序。"); KeepEnemyDrops = cfg.Bind<bool>("Drops", "KeepEnemyDrops", false, "兜底开关:开启后黑雾掉落物不会再自动消失(仍留在地上,等待你在面板里拿取)。默认关闭——如果你的游戏里掉落物本来就不会消失,不需要打开。"); WindowX = cfg.Bind<float>("Window", "X", -1f, "面板左上角 X 坐标(-1 = 自动居中)。"); WindowY = cfg.Bind<float>("Window", "Y", -1f, "面板左上角 Y 坐标(-1 = 自动居中)。"); } public static void RefreshLocale() { Locale.IsZh = ResolveChinese(); } private static bool ResolveChinese() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 try { string a = ((Language != null) ? Language.Value : "auto"); if (string.Equals(a, "zh", StringComparison.OrdinalIgnoreCase)) { return true; } if (string.Equals(a, "en", StringComparison.OrdinalIgnoreCase)) { return false; } return Localization.isZHCN; } catch { try { return (int)Application.systemLanguage == 40; } catch { return true; } } } } internal static class UIGameInspecteeChangePatch { private static bool Prefix() { return !NativeStorage.SuppressInspect; } } internal static class UIStorageWindowUpdatePatch { private static void Prefix(UIStorageWindow __instance) { NativeStorage.PrepareUpdate(__instance); } } internal static class UIGameUpdateEscapeGuardPatch { private static void Prefix() { if (!NativeStorage.Opening && !NativeStorage.SessionActive) { return; } try { VFInput.escape = false; VFInput.delayedEscape = false; } catch { } } } internal static class UIStorageWindowOpenInterceptPatch { private static bool Prefix(UIStorageWindow __instance) { return !NativeStorage.TryConsumePendingOpen(__instance); } } internal static class UIStorageWindowClosePatch { private static void Postfix() { NativeStorage.ClearSession(); } private static Exception Finalizer(Exception __exception) { NativeStorage.ClearSession(); return __exception; } } [BepInPlugin("com.yourname.remotestorage", "Remote Storage", "1.6.0")] public class Plugin : BaseUnityPlugin { internal static class VFInputUpdateGameStatesPatch { private static void Postfix() { try { if (NativeStorage.Opening || NativeStorage.SessionActive) { VFInput.escape = false; VFInput.delayedEscape = false; } AppState instance = AppState.Instance; if (instance.Open && instance.Visible) { VFInput.escape = false; VFInput.delayedEscape = false; if (MainWindow.PointerOverWindow) { VFInput.onGUI = true; VFInput.onGUIOperate = true; } } } catch { } } } internal static class TrashDropLifePatch { private const int MaxKeptTrash = 20000; private static void Prefix(TrashSystem __instance, ref int life) { try { if (ModConfig.KeepEnemyDrops != null && ModConfig.KeepEnemyDrops.Value && __instance != null && __instance.trashCount < 20000) { life = 0; } } catch { } } } public const string Guid = "com.yourname.remotestorage"; public const string DisplayName = "Remote Storage"; public const string Version = "1.6.0"; private Harmony _harmony; private void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) Log.Source = ((BaseUnityPlugin)this).Logger; try { ModConfig.Init(((BaseUnityPlugin)this).Config); ModConfig.RefreshLocale(); AppState.Instance.LoadFromConfig(); _harmony = new Harmony("com.yourname.remotestorage"); PatchCritical(); Log.Info("RemoteStorage 已加载(" + (Locale.IsZh ? "中文" : "English") + "),热键 " + ((ModConfig.Hotkey != null) ? ((object)ModConfig.Hotkey.Value/*cast due to .constrained prefix*/).ToString() : "F9") + "(储物箱 / 掉落物)"); } catch (Exception ex) { Log.Error("初始化失败: " + ex); } } private void Update() { try { MainWindow.Tick(); } catch (Exception ex) { Log.Error("Update 异常: " + ex); } } private void OnGUI() { try { MainWindow.Draw(); } catch (Exception ex) { Log.Error("OnGUI 异常: " + ex); } } private void OnDestroy() { try { if (_harmony != null) { _harmony.UnpatchSelf(); } } catch { } try { UiBlocker.Dispose(); } catch { } Log.Info("RemoteStorage 已卸载。"); } private void PatchCritical() { Patch(typeof(VFInput), "UpdateGameStates", null, null, AccessTools.Method(typeof(VFInputUpdateGameStatesPatch), "Postfix", (Type[])null, (Type[])null), null, "VFInput.UpdateGameStates"); Patch(typeof(UIGame), "OnPlayerInspecteeChange", new Type[2] { typeof(EObjectType), typeof(int) }, AccessTools.Method(typeof(UIGameInspecteeChangePatch), "Prefix", (Type[])null, (Type[])null), null, null, "UIGame.OnPlayerInspecteeChange"); Patch(typeof(UIStorageWindow), "_OnUpdate", null, AccessTools.Method(typeof(UIStorageWindowUpdatePatch), "Prefix", (Type[])null, (Type[])null), null, null, "UIStorageWindow._OnUpdate"); Patch(typeof(UIStorageWindow), "_OnClose", null, null, AccessTools.Method(typeof(UIStorageWindowClosePatch), "Postfix", (Type[])null, (Type[])null), AccessTools.Method(typeof(UIStorageWindowClosePatch), "Finalizer", (Type[])null, (Type[])null), "UIStorageWindow._OnClose"); Patch(typeof(UIStorageWindow), "_OnOpen", null, AccessTools.Method(typeof(UIStorageWindowOpenInterceptPatch), "Prefix", (Type[])null, (Type[])null), null, null, "UIStorageWindow._OnOpen(intercept)"); Patch(typeof(UIGame), "_OnUpdate", null, AccessTools.Method(typeof(UIGameUpdateEscapeGuardPatch), "Prefix", (Type[])null, (Type[])null), null, null, "UIGame._OnUpdate(escape guard)"); Patch(typeof(TrashSystem), "AddTrashFromGroundEnemy", new Type[5] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(PlanetFactory) }, AccessTools.Method(typeof(TrashDropLifePatch), "Prefix", (Type[])null, (Type[])null), null, null, "TrashSystem.AddTrashFromGroundEnemy", required: false); } private void Patch(Type type, string name, Type[] args, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null, string label = null, bool required = true) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) string text = label ?? (type.Name + "." + name); try { MethodInfo methodInfo = AccessTools.Method(type, name, args, (Type[])null); if (methodInfo == null) { if (required) { Log.Error("挂钩失败,找不到方法:" + text); } else { Log.Warn("可选补丁未挂载(找不到方法):" + text); } } else { _harmony.Patch((MethodBase)methodInfo, (!(prefix != null)) ? ((HarmonyMethod)null) : new HarmonyMethod(prefix), (!(postfix != null)) ? ((HarmonyMethod)null) : new HarmonyMethod(postfix), (HarmonyMethod)null, (!(finalizer != null)) ? ((HarmonyMethod)null) : new HarmonyMethod(finalizer), (HarmonyMethod)null); Log.Info("已挂钩 " + text); } } catch (Exception ex) { Log.Error("挂钩失败 " + text + ":" + ex); } } } } namespace RemoteStorage.UI { public static class Fonts { public static Font UiFont; private static bool _isZh = true; private static bool _resolved; public static void Ensure(bool zh) { if (_resolved && (Object)(object)UiFont != (Object)null && _isZh == zh) { return; } _resolved = true; _isZh = zh; UiFont = null; string[] array = new string[10] { "Microsoft YaHei UI", "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans CN", "WenQuanYi Micro Hei", "SimHei", "Arial Unicode MS" }; string[] array2 = new string[8] { "Segoe UI", "Microsoft YaHei UI", "Arial", "Helvetica Neue", "Noto Sans", "PingFang SC", "Source Han Sans CN", "Microsoft YaHei" }; try { UiFont = Font.CreateDynamicFontFromOSFont(zh ? array : array2, 14); } catch (Exception ex) { Log.Warn("创建系统字体失败: " + ex.Message); } if (!Usable(UiFont)) { UiFont = FindGameFont() ?? UiFont; } if ((Object)(object)UiFont == (Object)null) { try { UiFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); } catch { } } if ((Object)(object)UiFont == (Object)null) { try { UiFont = (((Object)(object)GUI.skin != (Object)null) ? GUI.skin.font : null); } catch { } } Log.Info("界面字体: " + (((Object)(object)UiFont != (Object)null) ? ((Object)UiFont).name : "(default)")); } private static bool Usable(Font f) { if ((Object)(object)f == (Object)null) { return false; } try { return f.HasCharacter('A') && f.HasCharacter('测') && f.HasCharacter('箱'); } catch { return true; } } private static Font FindGameFont() { Font val = null; try { Font[] array = Resources.FindObjectsOfTypeAll<Font>(); if (array == null) { return null; } foreach (Font val2 in array) { if (!((Object)(object)val2 == (Object)null) && Usable(val2)) { if ((Object)(object)val == (Object)null) { val = val2; } string text = (((Object)val2).name ?? "").ToLowerInvariant(); if (text.Contains("cjk") || text.Contains("han") || text.Contains("yahei") || text.Contains("hei")) { return val2; } } } } catch (Exception ex) { Log.Warn("查找游戏字体失败: " + ex.Message); } return val; } } public static class MainWindow { private const int Cols = 12; private const int MaxRows = 8; private const float Cell = 60f; private const float Gap = 4f; private const float Pitch = 64f; private const float Pad = 10f; private const float TopBar = 24f; private const float TabH = 28f; private const float Gutter = 14f; private const float GridW = 764f; private const float GridH = 508f; private const float WinW = 798f; private const float WinH = 580f; private static GUIStyle _frame; private static GUIStyle _hint; private static GUIStyle _count; private static GUIStyle _countShadow; private static GUIStyle _toast; private static GUIStyle _toastBad; private static int _styleVersion = -1; private static bool _closeRequested; private static bool _dragging; private static Vector2 _dragLast; public static bool PointerOverWindow { get; private set; } public static void Tick() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) AppState instance = AppState.Instance; try { NativeStorage.Tick(); if (GameMain.data == null || GameMain.mainPlayer == null) { if (instance.Open) { instance.Close(); } PointerOverWindow = false; UiBlocker.SetBlocking(on: false); return; } if (ModConfig.Hotkey != null && !VFInput.inputing) { KeyboardShortcut value = ModConfig.Hotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { instance.Toggle(); } } if (!instance.Open) { ResetInputState(); PointerOverWindow = false; UiBlocker.SetBlocking(on: false); return; } bool flag = false; bool flag2 = false; try { flag = GameMain.isPaused; } catch { } try { flag2 = VFInput.inFullscreenGUI; } catch { } instance.Visible = !flag && !flag2; if (!instance.Visible) { ResetInputState(); PointerOverWindow = false; UiBlocker.SetBlocking(on: false); return; } instance.W = 798f; instance.H = 580f; UpdatePointerOverWindow(instance); UiBlocker.SetBlocking(PointerOverWindow); int num = ((ModConfig.RefreshSeconds != null) ? ModConfig.RefreshSeconds.Value : 2); if (num > 0 && (double)Time.realtimeSinceStartup - instance.LastScan >= (double)num) { instance.Scan(manual: false); } float interval = ((ModConfig.DropsRefreshSeconds != null) ? ModConfig.DropsRefreshSeconds.Value : 0.4f); instance.Drops.ScanIfDue(interval); } catch (Exception ex) { UiBlocker.SetBlocking(on: false); Log.Error("Update 异常: " + ex); } } public static void ResetInputState() { _dragging = false; } private static void UpdatePointerOverWindow(AppState st) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) try { float num = ((st.Scale > 0.01f) ? st.Scale : 1f); Vector3 mousePosition = Input.mousePosition; float num2 = mousePosition.x / num; float num3 = ((float)Screen.height - mousePosition.y) / num; Rect val = new Rect(st.X, st.Y, st.W, st.H); PointerOverWindow = ((Rect)(ref val)).Contains(new Vector2(num2, num3)); } catch { PointerOverWindow = false; } } public static void Draw() { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_014c: Invalid comparison between Unknown and I4 //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Invalid comparison between Unknown and I4 AppState instance = AppState.Instance; if (!instance.Open || !instance.Visible) { return; } Matrix4x4 matrix = GUI.matrix; try { UiKit.Ensure(); EnsureStyles(); float num = (instance.Scale = Mathf.Clamp((float)Screen.height / 1080f, 0.75f, 1.5f)); GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num, num, 1f)); float num2 = (float)Screen.width / num; float num3 = (float)Screen.height / num; instance.W = 798f; instance.H = 580f; if (!instance.PositionInitialized) { instance.X = Mathf.Max(0f, Mathf.Round((num2 - instance.W) * 0.5f)); instance.Y = Mathf.Max(0f, Mathf.Round((num3 - instance.H) * 0.5f)); instance.PositionInitialized = true; } instance.X = Mathf.Clamp(instance.X, 0f, Mathf.Max(0f, num2 - instance.W)); instance.Y = Mathf.Clamp(instance.Y, 0f, Mathf.Max(0f, num3 - instance.H)); if (Event.current != null && (int)Event.current.type == 4 && (int)Event.current.keyCode == 27) { _closeRequested = true; Event.current.Use(); } GUI.BeginGroup(new Rect(instance.X, instance.Y, instance.W, instance.H)); try { DrawPanel(instance, num); } finally { GUI.EndGroup(); } if (_closeRequested) { _closeRequested = false; instance.Close(); } if (PointerOverWindow && Event.current != null) { VFInput.onGUI = true; } } catch (Exception ex) { Log.Error("面板绘制异常: " + ex); } finally { GUI.matrix = matrix; } } private static void DrawPanel(AppState st, float scale) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) GUI.Box(new Rect(0f, 0f, st.W, st.H), GUIContent.none, _frame); Rect val = default(Rect); ((Rect)(ref val))..ctor(st.W - 10f - 20f, 3f, 20f, 20f); Rect area = default(Rect); ((Rect)(ref area))..ctor(0f, 0f, st.W - 34f, 24f); HandleDrag(st, area, val, scale); if (GUI.Button(val, "×", UiKit.CloseButton)) { _closeRequested = true; } DrawTabs(st, new Rect(10f, 24f, 778f, 28f)); UiKit.Divider(new Rect(10f, 51f, 778f, 1f)); DrawGrid(st, new Rect(10f, 52f, 778f, 508f)); if (st.IsDropTab) { DrawDropStatus(st); } } private static void DrawTabs(AppState st, Rect area) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref area)).x; float num2 = ((Rect)(ref area)).y + 2f; for (int i = 0; i < st.Tabs.Count; i++) { bool flag = st.TabIndex == i; if (GUI.Button(new Rect(num, num2, 104f, 22f), TabLabel(st.Tabs[i]), flag ? UiKit.ButtonOn : UiKit.Button)) { st.SelectTab(i); } num += 110f; } if (st.IsDropTab && GUI.Button(new Rect(((Rect)(ref area)).xMax - 104f, num2, 104f, 22f), Locale.T("全部拿取", "Take all"), UiKit.ButtonOn)) { st.Drops.TakeAll(st.IsBuildingDropTab); } } private static string TabLabel(int tab) { return tab switch { 0 => Locale.T("建筑", "Buildings"), 1 => Locale.T("原材料", "Materials"), 2 => Locale.T("混合", "Mixed"), 3 => Locale.T("空箱", "Empty"), 10 => Locale.T("建筑掉落", "Building drops"), 11 => Locale.T("材料掉落", "Material drops"), _ => "?", }; } private static void DrawGrid(AppState st, Rect view) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00b8: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) if (st.IsDropTab) { DrawDropGrid(st, view); return; } List<StorageInfo> list = st.Categories[st.Tab]; int count = list.Count; if (count == 0) { GUI.Label(view, Locale.T("没有储物箱", "No storage boxes"), _hint); return; } int num = (count + 12 - 1) / 12; float num2 = Mathf.Max(((Rect)(ref view)).height, (float)num * 64f - 4f); float num3 = Mathf.Max(0f, num2 - ((Rect)(ref view)).height); if (st.BoxScroll.y > num3) { st.BoxScroll.y = num3; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, 764f, num2); st.BoxScroll = GUI.BeginScrollView(view, st.BoxScroll, val, false, num > 8); try { int num4 = Mathf.Clamp(Mathf.FloorToInt(st.BoxScroll.y / 64f), 0, num - 1); int num5 = Mathf.Min(num, num4 + 8 + 1); int num6 = Mathf.Max(num5, 8); for (int i = num4; i < num6; i++) { for (int j = 0; j < 12; j++) { GUI.Box(new Rect((float)j * 64f, (float)i * 64f, 60f, 60f), GUIContent.none, UiKit.SlotEmpty); } } bool flag = false; for (int k = num4; k < num5; k++) { if (flag) { break; } for (int l = 0; l < 12; l++) { int num7 = k * 12 + l; if (num7 >= list.Count) { flag = true; break; } DrawCell(st, new Rect((float)l * 64f, (float)k * 64f, 60f, 60f), list[num7]); } } } finally { GUI.EndScrollView(); } } private static void DrawCell(AppState st, Rect r, StorageInfo box) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (GUI.Button(r, GUIContent.none, UiKit.Slot)) { OpenBox(st, box); } UiKit.DrawStorageIcon(new Rect(((Rect)(ref r)).x + 5f, ((Rect)(ref r)).y + 5f, ((Rect)(ref r)).width - 10f, ((Rect)(ref r)).height - 10f), box); if (box != null && box.ShowCount && box.TotalCount > 0) { DrawCount(r, box.TotalCount); } if (box != null && st.Selected != null && st.Selected.Key == box.Key) { UiKit.DrawCorners(r, new Color(UiKit.Accent.r, UiKit.Accent.g, UiKit.Accent.b, 0.85f), 9f, 2f); } } private static void DrawDropGrid(AppState st, Rect view) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) DropState drops = st.Drops; List<DropEntry> list = (st.IsBuildingDropTab ? drops.Building : drops.Material); if (list.Count == 0) { GUI.Label(view, (drops.TypeCount > 0) ? Locale.T("这个分类下没有掉落物", "No drops in this category") : Locale.T("地面上没有掉落物", "No drops on the ground"), _hint); drops.HoverItemId = 0; return; } int num = (list.Count + 12 - 1) / 12; float num2 = Mathf.Max(((Rect)(ref view)).height, (float)num * 64f - 4f); float num3 = Mathf.Max(0f, num2 - ((Rect)(ref view)).height); if (drops.Scroll.y > num3) { drops.Scroll.y = num3; } if (drops.Scroll.y < 0f) { drops.Scroll.y = 0f; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, 764f, num2); drops.Scroll = GUI.BeginScrollView(view, drops.Scroll, val, false, num > 8); int num4 = 0; int num5 = 0; long num6 = 0L; try { int num7 = Mathf.Clamp(Mathf.FloorToInt(drops.Scroll.y / 64f), 0, num - 1); int num8 = Mathf.Min(num, num7 + 8 + 1); int num9 = Mathf.Max(num8, 8); for (int i = num7; i < num9; i++) { for (int j = 0; j < 12; j++) { GUI.Box(new Rect((float)j * 64f, (float)i * 64f, 60f, 60f), GUIContent.none, UiKit.SlotEmpty); } } Rect val2 = default(Rect); for (int k = num7; k < num8; k++) { for (int l = 0; l < 12; l++) { int num10 = k * 12 + l; if (num10 >= list.Count) { break; } DropEntry dropEntry = list[num10]; ((Rect)(ref val2))..ctor((float)l * 64f, (float)k * 64f, 60f, 60f); if (GUI.Button(val2, GUIContent.none, UiKit.Slot)) { num4 = dropEntry.ItemId; } UiKit.DrawItemIcon(new Rect(((Rect)(ref val2)).x + 5f, ((Rect)(ref val2)).y + 5f, ((Rect)(ref val2)).width - 10f, ((Rect)(ref val2)).height - 10f), dropEntry.ItemId); DrawCount(val2, dropEntry.Count); if (Event.current != null && ((Rect)(ref val2)).Contains(Event.current.mousePosition)) { num5 = dropEntry.ItemId; num6 = dropEntry.Count; } } } } finally { GUI.EndScrollView(); } drops.HoverItemId = num5; drops.HoverCount = num6; if (num5 > 0) { DrawDropTooltip(st, num5, num6); } if (num4 > 0) { drops.Take(num4); } } private static void DrawDropTooltip(AppState st, int itemId, long count) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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) string text = ItemDb.Name(itemId); string text2 = ItemDb.TypeText(itemId); string text3 = text + "\n" + text2 + " · " + Locale.Exact(count) + Locale.T(" 个", " items"); if (itemId == 1099) { text3 = text3 + "\n" + Locale.T("(沙土:拿取后存入沙土池)", "(soil pile: goes to the sand pool)"); } text3 = text3 + "\n" + Locale.T("点击 → 全部拿取", "Click -> take all"); GUIContent val = new GUIContent(text3); float num = Mathf.Min(300f, st.W - 24f); float num2 = UiKit.Tooltip.CalcHeight(val, num); Vector2 mousePosition = Event.current.mousePosition; float num3 = mousePosition.x + 16f; float num4 = mousePosition.y + 12f; if (num3 + num > st.W - 6f) { num3 = st.W - 6f - num; } if (num4 + num2 > st.H - 6f) { num4 = mousePosition.y - num2 - 8f; } if (num3 < 4f) { num3 = 4f; } if (num4 < 4f) { num4 = 4f; } GUI.Box(new Rect(num3, num4, num, num2), val, UiKit.Tooltip); } private static void DrawDropStatus(AppState st) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) string currentStatus = st.Drops.CurrentStatus; if (!string.IsNullOrEmpty(currentStatus)) { GUIContent val = new GUIContent(currentStatus); float num = Mathf.Min(460f, st.W - 32f); float num2 = UiKit.Tooltip.CalcHeight(val, num); float num3 = Mathf.Round((st.W - num) * 0.5f); GUI.Box(new Rect(num3, st.H - num2 - 12f, num, num2), val, st.Drops.StatusError ? _toastBad : _toast); } } private static void DrawCount(Rect cell, long count) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_00d5: Unknown result type (might be due to invalid IL or missing references) string text = Locale.Compact(count); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.38f); GUI.DrawTexture(new Rect(((Rect)(ref cell)).x + 3f, ((Rect)(ref cell)).yMax - 15f, ((Rect)(ref cell)).width - 6f, 13f), (Texture)(object)UiKit.WhiteTex); GUI.color = color; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref cell)).x + 2f, ((Rect)(ref cell)).yMax - 17f, ((Rect)(ref cell)).width - 7f, 16f); GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, _countShadow); GUI.Label(val, text, _count); } private static void OpenBox(AppState st, StorageInfo box) { if (box == null) { return; } if (box.StorageId <= 0) { Log.Warn("储物箱已失效,重新扫描:storageId=" + box.StorageId); st.Scan(manual: true); return; } if (NativeStorage.TryOpen(box)) { st.Selected = box; _closeRequested = true; return; } string text = NativeStorage.LastFailure; if (string.IsNullOrEmpty(text)) { text = "unknown"; } Log.Error("远程储物箱打开失败:" + text); } private static void HandleDrag(AppState st, Rect area, Rect close, float scale) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Invalid comparison between Unknown and I4 //IL_0064: 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_0071: 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_00a6: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current == null) { return; } if (!_dragging) { if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref area)).Contains(current.mousePosition) && !((Rect)(ref close)).Contains(current.mousePosition)) { _dragging = true; _dragLast = ScreenMouse(scale); current.Use(); } } else if ((int)current.type == 3) { Vector2 val = ScreenMouse(scale); st.X += val.x - _dragLast.x; st.Y += val.y - _dragLast.y; _dragLast = val; float num = (float)Screen.width / scale; float num2 = (float)Screen.height / scale; st.X = Mathf.Clamp(st.X, 0f, Mathf.Max(0f, num - st.W)); st.Y = Mathf.Clamp(st.Y, 0f, Mathf.Max(0f, num2 - st.H)); current.Use(); } else if ((int)current.type == 1 || (int)current.rawType == 1) { _dragging = false; } } private static Vector2 ScreenMouse(float scale) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 mousePosition = Input.mousePosition; return new Vector2(mousePosition.x / scale, ((float)Screen.height - mousePosition.y) / scale); } private static void EnsureStyles() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) if (_styleVersion != UiKit.Version) { _styleVersion = UiKit.Version; _frame = new GUIStyle(UiKit.Window); _frame.padding = new RectOffset(0, 0, 0, 0); _hint = new GUIStyle(UiKit.Small); _hint.normal.textColor = UiKit.Dim; _hint.alignment = (TextAnchor)4; _hint.clipping = (TextClipping)1; _count = new GUIStyle(UiKit.Small); _count.fontSize = 11; _count.fontStyle = (FontStyle)1; _count.alignment = (TextAnchor)8; _count.normal.textColor = new Color(1f, 1f, 1f, 0.96f); _count.clipping = (TextClipping)1; _countShadow = new GUIStyle(_count); _countShadow.normal.textColor = new Color(0f, 0f, 0f, 0.82f); _toast = new GUIStyle(UiKit.Tooltip); _toast.fontSize = 11; _toast.alignment = (TextAnchor)4; _toastBad = new GUIStyle(_toast); _toastBad.normal.textColor = UiKit.Warn; } } } public static class UiBlocker { private static GameObject _root; private static Image _image; private static bool _failed; private static bool _active; public static void Ensure() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e2: 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_0101: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null || _failed) { return; } try { _root = new GameObject("RemoteStorage.InputBlocker"); Object.DontDestroyOnLoad((Object)(object)_root); ((Object)_root).hideFlags = (HideFlags)61; Canvas obj = _root.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 32000; _root.AddComponent<GraphicRaycaster>(); GameObject val = new GameObject("Mask") { hideFlags = (HideFlags)61 }; val.transform.SetParent(_root.transform, false); _image = val.AddComponent<Image>(); ((Graphic)_image).color = new Color(0f, 0f, 0f, 0f); ((Graphic)_image).raycastTarget = true; RectTransform rectTransform = ((Graphic)_image).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; rectTransform.pivot = new Vector2(0.5f, 0.5f); _root.SetActive(false); } catch (Exception ex) { _failed = true; Log.Warn("创建输入遮罩失败(不影响取物,仅可能点到下层 UI): " + ex.Message); if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); _root = null; } } } public static void SetBlocking(bool on) { Ensure(); if (!((Object)(object)_root == (Object)null) && _active != on) { _active = on; _root.SetActive(on); } } public static void Dispose() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); _root = null; } _image = null; _active = false; } } public static class UiKit { public static readonly Color BgTop = new Color(0.043f, 0.07f, 0.098f, 0.965f); public static readonly Color BgBottom = new Color(0.024f, 0.043f, 0.065f, 0.965f); public static readonly Color PanelTop = new Color(0.055f, 0.094f, 0.124f, 0.93f); public static readonly Color PanelBottom = new Color(0.039f, 0.07f, 0.094f, 0.93f); public static readonly Color Edge = new Color(0.11f, 0.235f, 0.275f, 0.95f); public static readonly Color EdgeSoft = new Color(0.08f, 0.155f, 0.19f, 0.9f); public static readonly Color Accent = new Color(0.36f, 0.87f, 0.965f, 1f); public static readonly Color AccentDim = new Color(0.14f, 0.38f, 0.44f, 1f); public static readonly Color TextColor = new Color(0.86f, 0.945f, 0.975f, 1f); public static readonly Color Muted = new Color(0.5f, 0.65f, 0.71f, 1f); public static readonly Color Dim = new Color(0.32f, 0.44f, 0.5f, 1f); public static readonly Color Good = new Color(0.47f, 0.95f, 0.7f, 1f); public static readonly Color Bad = new Color(1f, 0.5f, 0.48f, 1f); public static readonly Color Warn = new Color(1f, 0.8f, 0.4f, 1f); public static readonly Color RowSelColor = new Color(0.075f, 0.24f, 0.29f, 0.85f); public static readonly Color RowDropColor = new Color(0.1f, 0.32f, 0.38f, 0.88f); public static GUIStyle Window; public static GUIStyle Title; public static GUIStyle Subtitle; public static GUIStyle Section; public static GUIStyle Label; public static GUIStyle Small; public static GUIStyle Tiny; public static GUIStyle Name; public static GUIStyle Count; public static GUIStyle SlotCount; public static GUIStyle Button; public static GUIStyle ButtonOn; public static GUIStyle Chip; public static GUIStyle ChipOn; public static GUIStyle TextField; public static GUIStyle Placeholder; public static GUIStyle Box; public static GUIStyle Row; public static GUIStyle RowSel; public static GUIStyle RowDrop; public static GUIStyle Slot; public static GUIStyle SlotEmpty; public static GUIStyle SlotHover; public static GUIStyle Tooltip; public static GUIStyle CloseButton; public static GUIStyle Blank; public static GUIStyle IconFallback; public static Texture2D AccentTex; public static Texture2D DividerTex; public static Texture2D WhiteTex; public static int Version; private static bool _built; private static bool _builtZh; private static float _builtHeight = -1f; private static Texture2D _windowTex; private static Texture2D _panelTex; private static Texture2D _slotTex; private static Texture2D _slotEmptyTex; private static Texture2D _slotHoverTex; private static Texture2D _rowTex; private static Texture2D _rowHoverTex; private static Texture2D _rowSelTex; private static Texture2D _rowDropTex; private static Texture2D _buttonTex; private static Texture2D _buttonHoverTex; private static Texture2D _buttonActiveTex; private static Texture2D _buttonOnTex; private static Texture2D _buttonOnHoverTex; private static Texture2D _chipTex; private static Texture2D _fieldTex; private static Texture2D _fieldFocusTex; private static Texture2D _tooltipTex; private static Texture2D _barTex; private static Texture2D _thumbTex; private static Texture2D _thumbHoverTex; public static void Ensure() { if (_built && _builtZh == Locale.IsZh && Mathf.Abs(_builtHeight - (float)Screen.height) < 0.5f) { if ((Object)(object)Fonts.UiFont != (Object)null && (Object)(object)GUI.skin.font != (Object)(object)Fonts.UiFont) { GUI.skin.font = Fonts.UiFont; } return; } _built = true; _builtZh = Locale.IsZh; _builtHeight = Screen.height; Fonts.Ensure(Locale.IsZh); if ((Object)(object)Fonts.UiFont != (Object)null) { GUI.skin.font = Fonts.UiFont; } BuildTextures(); BuildStyles(); ApplyScrollbarSkin(); Version++; } private static void BuildTextures() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00d0: 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_0114: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0281: 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_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: 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_02fa: 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_0343: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_windowTex != (Object)null)) { _windowTex = Chamfer(96, 16, BgTop, BgBottom, Edge, 1f); _panelTex = Chamfer(64, 10, PanelTop, PanelBottom, EdgeSoft, 1f); _slotTex = Chamfer(58, 8, new Color(0.07f, 0.128f, 0.16f, 1f), new Color(0.04f, 0.08f, 0.104f, 1f), EdgeSoft, 1f); _slotHoverTex = Chamfer(58, 8, new Color(0.11f, 0.22f, 0.26f, 1f), new Color(0.055f, 0.12f, 0.15f, 1f), Accent, 1.6f); _slotEmptyTex = Chamfer(58, 8, new Color(0.03f, 0.055f, 0.072f, 0.92f), new Color(0.02f, 0.04f, 0.055f, 0.92f), new Color(0.055f, 0.1f, 0.12f, 0.75f), 1f); _rowTex = Chamfer(40, 6, new Color(0f, 0f, 0f, 0f), new Color(0f, 0f, 0f, 0f), Color.clear, 0f); _rowHoverTex = Chamfer(40, 6, new Color(0.08f, 0.2f, 0.24f, 0.35f), new Color(0.06f, 0.16f, 0.195f, 0.35f), new Color(0.12f, 0.28f, 0.32f, 0.7f), 1f); _rowSelTex = Chamfer(40, 6, RowSelColor, new Color(0.06f, 0.2f, 0.245f, 0.85f), Accent, 1.4f); _rowDropTex = Chamfer(40, 6, RowDropColor, new Color(0.08f, 0.26f, 0.31f, 0.88f), Accent, 1.8f); _buttonTex = Chamfer(48, 8, new Color(0.075f, 0.145f, 0.18f, 1f), new Color(0.05f, 0.1f, 0.125f, 1f), Edge, 1f); _buttonHoverTex = Chamfer(48, 8, new Color(0.115f, 0.24f, 0.29f, 1f), new Color(0.075f, 0.17f, 0.205f, 1f), Accent, 1.4f); _buttonActiveTex = Chamfer(48, 8, new Color(0.135f, 0.28f, 0.33f, 1f), new Color(0.09f, 0.2f, 0.24f, 1f), Accent, 1.4f); _buttonOnTex = Chamfer(48, 8, new Color(0.095f, 0.31f, 0.37f, 1f), new Color(0.07f, 0.23f, 0.28f, 1f), Accent, 1.6f); _buttonOnHoverTex = Chamfer(48, 8, new Color(0.12f, 0.37f, 0.43f, 1f), new Color(0.085f, 0.27f, 0.32f, 1f), Accent, 1.8f); _chipTex = Chamfer(32, 6, new Color(0.06f, 0.12f, 0.15f, 1f), new Color(0.042f, 0.085f, 0.108f, 1f), EdgeSoft, 1f); _fieldTex = Chamfer(48, 8, new Color(0.025f, 0.05f, 0.068f, 1f), new Color(0.02f, 0.04f, 0.055f, 1f), new Color(0.1f, 0.22f, 0.26f, 1f), 1f); _fieldFocusTex = Chamfer(48, 8, new Color(0.03f, 0.062f, 0.082f, 1f), new Color(0.022f, 0.046f, 0.062f, 1f), Accent, 1.4f); _tooltipTex = Chamfer(64, 8, new Color(0.045f, 0.08f, 0.1f, 0.99f), new Color(0.035f, 0.062f, 0.08f, 0.99f), new Color(0.24f, 0.5f, 0.58f, 1f), 1f); _barTex = Solid(new Color(0.03f, 0.06f, 0.08f, 0.65f)); _thumbTex = Chamfer(16, 4, new Color(0.18f, 0.42f, 0.48f, 0.95f), new Color(0.12f, 0.3f, 0.35f, 0.95f), new Color(0.3f, 0.65f, 0.72f, 1f), 1f); _thumbHoverTex = Chamfer(16, 4, new Color(0.25f, 0.56f, 0.62f, 1f), new Color(0.17f, 0.4f, 0.45f, 1f), Accent, 1.2f); AccentTex = Solid(Accent); DividerTex = Solid(new Color(0.11f, 0.235f, 0.275f, 0.75f)); WhiteTex = Solid(Color.white); } } private static void ApplyScrollbarSkin() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown try { GUIStyle verticalScrollbar = GUI.skin.verticalScrollbar; if (verticalScrollbar != null) { verticalScrollbar.normal.background = _barTex; verticalScrollbar.hover.background = _barTex; verticalScrollbar.active.background = _barTex; verticalScrollbar.fixedWidth = 10f; verticalScrollbar.border = new RectOffset(0, 0, 0, 0); } GUIStyle verticalScrollbarThumb = GUI.skin.verticalScrollbarThumb; if (verticalScrollbarThumb != null) { verticalScrollbarThumb.normal.background = _thumbTex; verticalScrollbarThumb.hover.background = _thumbHoverTex; verticalScrollbarThumb.active.background = _thumbHoverTex; verticalScrollbarThumb.fixedWidth = 10f; verticalScrollbarThumb.border = new RectOffset(4, 4, 4, 4); } BlankScrollButton(GUI.skin.verticalScrollbarUpButton); BlankScrollButton(GUI.skin.verticalScrollbarDownButton); } catch (Exception ex) { Log.Warn("滚动条样式设置失败(忽略): " + ex.Message); } } private static void BlankScrollButton(GUIStyle style) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if (style != null) { style.normal.background = null; style.hover.background = null; style.active.background = null; style.border = new RectOffset(0, 0, 0, 0); } } private static void BuildStyles() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00b3: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_01a8: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02ff: 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_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Expected O, but got Unknown //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Expected O, but got Unknown //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Expected O, but got Unknown //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Expected O, but got Unknown //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Expected O, but got Unknown //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Expected O, but got Unknown //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Expected O, but got Unknown //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Expected O, but got Unknown //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Expected O, but got Unknown //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Expected O, but got Unknown //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Expected O, but got Unknown //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Expected O, but got Unknown //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Expected O, but got Unknown //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Expected O, but got Unknown //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Expected O, but got Unknown //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Expected O, but got Unknown //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Expected O, but got Unknown //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Expected O, but got Unknown //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Expected O, but got Unknown //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Expected O, but got Unknown //IL_0768: Unknown result type (might be due to invalid IL or missing references) Window = new GUIStyle(GUI.skin.window); Window.normal.background = _windowTex; Window.hover.background = _windowTex; Window.active.background = _windowTex; Window.onNormal.background = _windowTex; Window.border = new RectOffset(20, 20, 20, 20); Window.padding = new RectOffset(16, 16, 14, 14); Window.font = Fonts.UiFont; Title = LabelStyle(18, (FontStyle)1, new Color(0.9f, 0.985f, 1f)); Subtitle = LabelStyle(11, (FontStyle)0, Muted); Section = LabelStyle(12, (FontStyle)1, TextColor); Label = LabelStyle(12, (FontStyle)0, TextColor); Small = LabelStyle(11, (FontStyle)0, Muted); Tiny = LabelStyle(10, (FontStyle)0, Dim); Name = LabelStyle(12, (FontStyle)1, TextColor); Count = LabelStyle(11, (FontStyle)1, new Color(0.8f, 0.96f, 1f)); Count.alignment = (TextAnchor)5; SlotCount = LabelStyle(11, (FontStyle)1, new Color(0.82f, 0.96f, 1f)); SlotCount.alignment = (TextAnchor)8; SlotCount.padding = new RectOffset(0, 4, 0, 2); Button = ButtonStyle(_buttonTex, _buttonHoverTex, _buttonActiveTex, TextColor, 11); ButtonOn = ButtonStyle(_buttonOnTex, _buttonOnHoverTex, _buttonOnHoverTex, new Color(0.9f, 0.995f, 1f), 11); ButtonOn.fontStyle = (FontStyle)1; Chip = ButtonStyle(_chipTex, _buttonHoverTex, _buttonActiveTex, Muted, 10); Chip.padding = new RectOffset(5, 5, 1, 1); Chip.border = new RectOffset(7, 7, 7, 7); ChipOn = ButtonStyle(_buttonOnTex, _buttonOnHoverTex, _buttonOnHoverTex, Color.white, 10); ChipOn.fontStyle = (FontStyle)1; ChipOn.padding = new RectOffset(5, 5, 1, 1); ChipOn.border = new RectOffset(7, 7, 7, 7); TextField = new GUIStyle(GUI.skin.textField); TextField.font = Fonts.UiFont; TextField.fontSize = 12; TextField.normal.background = _fieldTex; TextField.focused.background = _fieldFocusTex; TextField.hover.background = _fieldFocusTex; TextField.normal.textColor = TextColor; TextField.focused.textColor = Color.white; TextField.padding = new RectOffset(9, 9, 4, 4); TextField.border = new RectOffset(10, 10, 10, 10); TextField.alignment = (TextAnchor)3; TextField.clipping = (TextClipping)1; Placeholder = LabelStyle(11, (FontStyle)0, Dim); Placeholder.alignment = (TextAnchor)3; Placeholder.clipping = (TextClipping)1; Box = new GUIStyle(GUI.skin.box); Box.font = Fonts.UiFont; Box.normal.background = _panelTex; Box.padding = new RectOffset(8, 8, 8, 8); Box.border = new RectOffset(14, 14, 14, 14); Box.margin = new RectOffset(0, 0, 0, 0); Row = new GUIStyle(GUI.skin.button); Row.font = Fonts.UiFont; Row.normal.background = _rowTex; Row.hover.background = _rowHoverTex; Row.active.background = _rowHoverTex; Row.border = new RectOffset(8, 8, 8, 8); Row.padding = new RectOffset(0, 0, 0, 0); Row.margin = new RectOffset(0, 0, 0, 0); RowSel = new GUIStyle(Row); RowSel.normal.background = _rowSelTex; RowSel.hover.background = _rowSelTex; RowSel.active.background = _rowSelTex; RowDrop = new GUIStyle(Row); RowDrop.normal.background = _rowDropTex; RowDrop.hover.background = _rowDropTex; RowDrop.active.background = _rowDropTex; Slot = new GUIStyle(GUI.skin.button); Slot.font = Fonts.UiFont; Slot.normal.background = _slotTex; Slot.hover.background = _slotHoverTex; Slot.active.background = _slotHoverTex; Slot.border = new RectOffset(10, 10, 10, 10); Slot.padding = new RectOffset(0, 0, 0, 0); Slot.margin = new RectOffset(0, 0, 0, 0); SlotEmpty = new GUIStyle(Slot); SlotEmpty.normal.background = _slotEmptyTex; SlotEmpty.hover.background = _slotHoverTex; SlotHover = new GUIStyle(Slot); Tooltip = new GUIStyle(GUI.skin.box); Tooltip.font = Fonts.UiFont; Tooltip.fontSize = 10; Tooltip.normal.background = _tooltipTex; Tooltip.normal.textColor = TextColor; Tooltip.padding = new RectOffset(9, 9, 7, 7); Tooltip.border = new RectOffset(10, 10, 10, 10); Tooltip.wordWrap = true; Tooltip.richText = false; CloseButton = ButtonStyle(_chipTex, _buttonHoverTex, _buttonActiveTex, Muted, 14); CloseButton.padding = new RectOffset(0, 2, 0, 2); CloseButton.alignment = (TextAnchor)4; Blank = new GUIStyle(); Blank.normal.background = null; Blank.hover.background = null; Blank.active.background = null; Blank.focused.background = null; Blank.border = new RectOffset(0, 0, 0, 0); Blank.margin = new RectOffset(0, 0, 0, 0); Blank.padding = new RectOffset(0, 0, 0, 0); IconFallback = LabelStyle(11, (FontStyle)1, Dim); IconFallback.alignment = (TextAnchor)4; } private static GUIStyle LabelStyle(int size, FontStyle fontStyle, Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //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_0067: Expected O, but got Unknown //IL_0068: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { font = Fonts.UiFont, fontSize = size, fontStyle = fontStyle }; val.normal.textColor = color; val.alignment = (TextAnchor)3; val.clipping = (TextClipping)1; val.wordWrap = false; val.padding = new RectOffset(0, 0, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); return val; } private static GUIStyle ButtonStyle(Texture2D normal, Texture2D hover, Texture2D active, Color text, int size) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button) { font = Fonts.UiFont, fontSize = size }; val.normal.background = normal; val.hover.background = hover; val.active.background = active; val.focused.background = normal; val.normal.textColor = text; val.hover.textColor = Color.white; val.active.textColor = Color.white; val.border = new RectOffset(10, 10, 10, 10); val.padding = new RectOffset(8, 8, 3, 3); val.alignment = (TextAnchor)4; return val; } public static void DrawItemIcon(Rect rect, int itemId) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) Sprite val = ItemDb.Icon(itemId); if (!((Object)(object)val != (Object)null) || !DrawSprite(rect, val)) { GUI.color = new Color(1f, 1f, 1f, 0.05f); GUI.DrawTexture(rect, (Texture)(object)WhiteTex); GUI.color = Color.white; GUI.Label(rect, "?", IconFallback); } } public static void DrawStorageIcon(Rect rect, StorageInfo box) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_00e5: 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) if (box == null) { return; } if (box.TopItems.Count == 1) { DrawItemIcon(rect, box.TopItems[0].ItemId); } else if (box.TopItems.Count >= 2) { int num = Mathf.Min(4, box.TopItems.Count); if