diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll
index b67ee4bf..c7b2d922 100644
Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ
diff --git a/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Drop.xml b/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Drop.xml
index a8c15187..4f0bc0dc 100644
--- a/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Drop.xml
+++ b/1.6/1.6/Defs/ThingDefs_Buildings/Buildings_Drop.xml
@@ -836,46 +836,4 @@
0.10
-
- WULA_ResourceSubmitter
-
- 乌拉帝国从地面向舰队提交资源的特殊交换仓。
- WulaFallenEmpire.Building_ResourceSubmitter
-
- Things/Building/Furniture/Shelf
- Graphic_Multi
- (1,1)
-
- (1,1)
- false
- Normal
- BuildingOnTop
- PassThroughOnly
- false
- Misc12
- 0.5
- WULA_Buildings
- 2200
-
- 250
- 1600
- 0.5
-
-
- 20
-
-
-
- 500
-
-
-
- ITab_Storage
-
-
-
- PlaceWorker_NotUnderRoof
-
- 0.65
-
\ No newline at end of file
diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/Building_ResourceSubmitter.cs b/Source/WulaFallenEmpire/GlobalWorkTable/Building_ResourceSubmitter.cs
deleted file mode 100644
index 34ee548b..00000000
--- a/Source/WulaFallenEmpire/GlobalWorkTable/Building_ResourceSubmitter.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using RimWorld;
-using System.Collections.Generic;
-using System.Linq;
-using UnityEngine;
-using Verse;
-using System;
-using System.Text;
-
-namespace WulaFallenEmpire
-{
- public class Building_ResourceSubmitter : Building
- {
- public CompPowerTrader powerComp;
- public CompRefuelable refuelableComp;
- public CompFlickable flickableComp;
- public CompResourceSubmitter submitterComp;
-
- public override void SpawnSetup(Map map, bool respawningAfterLoad)
- {
- base.SpawnSetup(map, respawningAfterLoad);
- powerComp = GetComp();
- refuelableComp = GetComp();
- flickableComp = GetComp();
- submitterComp = GetComp();
- }
-
- public bool IsOperational
- {
- get
- {
- if (powerComp != null && !powerComp.PowerOn)
- return false;
- if (refuelableComp != null && !refuelableComp.HasFuel)
- return false;
- if (flickableComp != null && !flickableComp.SwitchIsOn)
- return false;
- return true;
- }
- }
-
- public string GetInoperativeReason()
- {
- if (powerComp != null && !powerComp.PowerOn)
- return "WULA_NoPower".Translate();
- if (refuelableComp != null && !refuelableComp.HasFuel)
- return "WULA_NoFuel".Translate();
- if (flickableComp != null && !flickableComp.SwitchIsOn)
- return "WULA_SwitchOff".Translate();
- return "WULA_UnknownReason".Translate();
- }
-
- public override string GetInspectString()
- {
- StringBuilder stringBuilder = new StringBuilder();
-
- string baseString = base.GetInspectString();
- if (!baseString.NullOrEmpty())
- {
- stringBuilder.Append(baseString);
- }
-
- if (!IsOperational)
- {
- if (stringBuilder.Length > 0) stringBuilder.AppendLine();
- stringBuilder.Append($"{"WULA_Status".Translate()}: {"WULA_Inoperative".Translate()} - {GetInoperativeReason()}");
- }
-
- return stringBuilder.ToString();
- }
- }
-}
diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/Command_LoadToResourceSubmitter.cs b/Source/WulaFallenEmpire/GlobalWorkTable/Command_LoadToResourceSubmitter.cs
deleted file mode 100644
index d07f1cc7..00000000
--- a/Source/WulaFallenEmpire/GlobalWorkTable/Command_LoadToResourceSubmitter.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using RimWorld;
-using UnityEngine;
-using Verse;
-
-namespace WulaFallenEmpire
-{
- public class Command_LoadToResourceSubmitter : Command
- {
- public CompResourceSubmitter submitterComp;
-
- public override void ProcessInput(Event ev)
- {
- base.ProcessInput(ev);
-
- if (submitterComp?.parent == null) return;
-
- // 打开装载界面,类似运输舱的界面
- Find.WindowStack.Add(new Dialog_LoadResourceSubmitter(submitterComp));
- }
- }
-}
diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/CompResourceSubmitter.cs b/Source/WulaFallenEmpire/GlobalWorkTable/CompResourceSubmitter.cs
deleted file mode 100644
index d3e9460b..00000000
--- a/Source/WulaFallenEmpire/GlobalWorkTable/CompResourceSubmitter.cs
+++ /dev/null
@@ -1,391 +0,0 @@
-using RimWorld;
-using System.Collections.Generic;
-using System.Linq;
-using UnityEngine;
-using Verse;
-using System;
-using System.Text;
-
-namespace WulaFallenEmpire
-{
- public class CompResourceSubmitter : ThingComp, IThingHolder
- {
- public ThingOwner innerContainer;
- public List leftToLoad;
-
- private bool massUsageDirty = true;
- private float cachedMassUsage;
-
- public CompProperties_ResourceSubmitter Props => (CompProperties_ResourceSubmitter)props;
-
- public float MassUsage
- {
- get
- {
- if (massUsageDirty)
- {
- massUsageDirty = false;
- cachedMassUsage = CollectionsMassCalculator.MassUsage(innerContainer, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, includePawnsMass: false);
- }
- return cachedMassUsage;
- }
- }
-
- public bool OverMassCapacity => MassUsage > Props.massCapacity;
-
- public bool AnythingLeftToLoad => FirstThingLeftToLoad != null;
-
- public Thing FirstThingLeftToLoad
- {
- get
- {
- if (leftToLoad == null) return null;
- for (int i = 0; i < leftToLoad.Count; i++)
- {
- if (leftToLoad[i].CountToTransfer != 0 && leftToLoad[i].HasAnyThing)
- return leftToLoad[i].AnyThing;
- }
- return null;
- }
- }
-
- public CompResourceSubmitter()
- {
- innerContainer = new ThingOwner(this);
- }
-
- public override void PostExposeData()
- {
- base.PostExposeData();
- Scribe_Deep.Look(ref innerContainer, "innerContainer", this);
- Scribe_Collections.Look(ref leftToLoad, "leftToLoad", LookMode.Deep);
-
- if (Scribe.mode == LoadSaveMode.Saving)
- {
- leftToLoad?.RemoveWhere(t => t == null);
- }
- }
-
- public ThingOwner GetDirectlyHeldThings()
- {
- return innerContainer;
- }
-
- public void GetChildHolders(List outChildren)
- {
- ThingOwnerUtility.AppendThingHoldersFromThings(outChildren, GetDirectlyHeldThings());
- }
-
- // 在 CompResourceSubmitter 类中添加或更新以下方法:
- public override void PostSpawnSetup(bool respawningAfterLoad)
- {
- base.PostSpawnSetup(respawningAfterLoad);
- massUsageDirty = true;
- }
-
- public override void PostDeSpawn(Map map, DestroyMode mode = DestroyMode.Vanish)
- {
- base.PostDeSpawn(map, mode);
- if (mode != DestroyMode.WillReplace)
- {
- innerContainer.TryDropAll(parent.Position, map, ThingPlaceMode.Near);
- }
- }
-
- public override IEnumerable CompGetGizmosExtra()
- {
- foreach (Gizmo g in base.CompGetGizmosExtra())
- {
- yield return g;
- }
-
- // 装载命令
- Command_LoadToResourceSubmitter loadCommand = new Command_LoadToResourceSubmitter();
- loadCommand.defaultLabel = "WULA_LoadResourceSubmitter".Translate();
- loadCommand.defaultDesc = "WULA_LoadResourceSubmitterDesc".Translate();
- loadCommand.icon = ContentFinder.Get("UI/Commands/LoadTransporter");
- loadCommand.submitterComp = this;
-
- // 禁用检查
- if (!parent.Spawned)
- {
- loadCommand.Disable("WULA_NotSpawned".Translate());
- }
- else if (!IsOperational())
- {
- loadCommand.Disable(GetInoperativeReason());
- }
-
- yield return loadCommand;
-
- // 取消装载/卸载命令
- if (innerContainer.Any || AnythingLeftToLoad)
- {
- Command_Action cancelCommand = new Command_Action();
- cancelCommand.defaultLabel = innerContainer.Any ? "WULA_Unload".Translate() : "WULA_CancelLoad".Translate();
- cancelCommand.defaultDesc = innerContainer.Any ? "WULA_UnloadDesc".Translate() : "WULA_CancelLoadDesc".Translate();
- cancelCommand.icon = ContentFinder.Get("UI/Designators/Cancel");
- cancelCommand.action = CancelLoad;
- yield return cancelCommand;
- }
-
- // 发射命令
- Command_Action launchCommand = new Command_Action();
- launchCommand.defaultLabel = "WULA_LaunchSubmitter".Translate();
- launchCommand.defaultDesc = "WULA_LaunchSubmitterDesc".Translate();
- launchCommand.icon = ContentFinder.Get("UI/Commands/Launch");
- launchCommand.action = TryLaunch;
-
- // 发射条件检查
- if (!parent.Spawned)
- {
- launchCommand.Disable("WULA_NotSpawned".Translate());
- }
- else if (!IsOperational())
- {
- launchCommand.Disable(GetInoperativeReason());
- }
- else if (!innerContainer.Any)
- {
- launchCommand.Disable("WULA_NoItemsToSubmit".Translate());
- }
- else if (OverMassCapacity)
- {
- launchCommand.Disable("WULA_OverMassCapacity".Translate(MassUsage.ToString("F1"), Props.massCapacity.ToString("F1")));
- }
-
- yield return launchCommand;
- }
-
- public override string CompInspectStringExtra()
- {
- StringBuilder stringBuilder = new StringBuilder();
- stringBuilder.Append("WULA_SubmitterContents".Translate() + ": " + innerContainer.ContentsString.CapitalizeFirst());
-
- string massString = "WULA_Mass".Translate() + ": " + MassUsage.ToString("F1") + " / " + Props.massCapacity.ToString("F1") + " kg";
- stringBuilder.AppendLine().Append(OverMassCapacity ? massString.Colorize(ColorLibrary.RedReadable) : massString);
-
- if (!IsOperational())
- {
- stringBuilder.AppendLine().Append("WULA_Status".Translate() + ": " + "WULA_Inoperative".Translate().Colorize(ColorLibrary.RedReadable));
- }
-
- return stringBuilder.ToString();
- }
-
- public void AddToTheToLoadList(TransferableOneWay t, int count)
- {
- if (!t.HasAnyThing || count <= 0) return;
-
- if (leftToLoad == null)
- {
- leftToLoad = new List();
- }
-
- TransferableOneWay existing = TransferableUtility.TransferableMatching(t.AnyThing, leftToLoad, TransferAsOneMode.PodsOrCaravanPacking);
- if (existing != null)
- {
- for (int i = 0; i < t.things.Count; i++)
- {
- if (!existing.things.Contains(t.things[i]))
- {
- existing.things.Add(t.things[i]);
- }
- }
- if (existing.CanAdjustBy(count).Accepted)
- {
- existing.AdjustBy(count);
- }
- }
- else
- {
- TransferableOneWay newTransferable = new TransferableOneWay();
- leftToLoad.Add(newTransferable);
- newTransferable.things.AddRange(t.things);
- newTransferable.AdjustTo(count);
- }
- }
-
- public void Notify_ThingAdded(Thing t)
- {
- SubtractFromToLoadList(t, t.stackCount);
- massUsageDirty = true;
- }
-
- public void Notify_ThingRemoved(Thing t)
- {
- massUsageDirty = true;
- }
-
- public void Notify_ThingAddedAndMergedWith(Thing t, int mergedCount)
- {
- SubtractFromToLoadList(t, mergedCount);
- massUsageDirty = true;
- }
-
- private int SubtractFromToLoadList(Thing t, int count)
- {
- if (leftToLoad == null) return 0;
-
- TransferableOneWay transferable = TransferableUtility.TransferableMatchingDesperate(t, leftToLoad, TransferAsOneMode.PodsOrCaravanPacking);
- if (transferable == null || transferable.CountToTransfer <= 0) return 0;
-
- int num = Mathf.Min(count, transferable.CountToTransfer);
- transferable.AdjustBy(-num);
-
- if (transferable.CountToTransfer <= 0)
- {
- leftToLoad.Remove(transferable);
- }
-
- return num;
- }
-
- private void CancelLoad()
- {
- if (leftToLoad != null)
- {
- leftToLoad.Clear();
- }
- innerContainer.TryDropAll(parent.Position, parent.Map, ThingPlaceMode.Near);
- massUsageDirty = true;
- }
-
- private void TryLaunch()
- {
- if (!IsOperational())
- {
- Messages.Message(GetInoperativeReason(), MessageTypeDefOf.RejectInput);
- return;
- }
-
- if (!innerContainer.Any)
- {
- Messages.Message("WULA_NoItemsToSubmit".Translate(), MessageTypeDefOf.RejectInput);
- return;
- }
-
- if (OverMassCapacity)
- {
- Messages.Message("WULA_OverMassCapacity".Translate(MassUsage.ToString("F1"), Props.massCapacity.ToString("F1")), MessageTypeDefOf.RejectInput);
- return;
- }
-
- if (SubmitContentsToStorage())
- {
- CreateLaunchEffect();
- parent.Destroy();
- }
- }
-
- private bool SubmitContentsToStorage()
- {
- try
- {
- var globalStorage = Find.World.GetComponent();
- if (globalStorage == null)
- {
- Log.Error("GlobalStorageWorldComponent not found");
- return false;
- }
-
- int submittedCount = 0;
- List processedItems = new List();
-
- // 复制列表以避免修改时迭代
- List itemsToProcess = innerContainer.ToList();
-
- foreach (Thing item in itemsToProcess)
- {
- if (item == null || item.Destroyed) continue;
-
- if (IsEquipment(item.def))
- {
- globalStorage.AddToOutputStorage(item.def, item.stackCount);
- }
- else
- {
- globalStorage.AddToInputStorage(item.def, item.stackCount);
- }
-
- processedItems.Add(item);
- submittedCount += item.stackCount;
- }
-
- // 从容器中移除已提交的物品
- foreach (Thing item in processedItems)
- {
- innerContainer.Remove(item);
- }
-
- Messages.Message("WULA_ItemsSubmitted".Translate(submittedCount), MessageTypeDefOf.PositiveEvent);
- Log.Message($"Successfully submitted {submittedCount} items to global storage");
- return submittedCount > 0;
- }
- catch (Exception ex)
- {
- Log.Error($"Error submitting items to storage: {ex}");
- Messages.Message("WULA_SubmissionFailed".Translate(), MessageTypeDefOf.NegativeEvent);
- return false;
- }
- }
-
- private bool IsEquipment(ThingDef thingDef)
- {
- return thingDef.IsApparel || thingDef.IsWeapon || thingDef.category == ThingCategory.Building;
- }
-
- private void CreateLaunchEffect()
- {
- try
- {
- // 使用自定义的 Skyfaller 定义
- ThingDef skyfallerDef = DefDatabase.GetNamedSilentFail("ResourceSubmitterSkyfaller");
- if (skyfallerDef == null)
- {
- // 备用:使用运输舱效果
- skyfallerDef = DefDatabase.GetNamedSilentFail("DropPodIncoming");
- }
-
- if (skyfallerDef != null)
- {
- Skyfaller skyfaller = (Skyfaller)ThingMaker.MakeThing(skyfallerDef);
- GenSpawn.Spawn(skyfaller, parent.Position, parent.Map);
- }
-
- // 视觉效果
- for (int i = 0; i < 3; i++)
- {
- FleckMaker.ThrowLightningGlow(parent.DrawPos, parent.Map, 2f);
- }
- FleckMaker.ThrowSmoke(parent.DrawPos, parent.Map, 3f);
- }
- catch (Exception ex)
- {
- Log.Error($"Error creating launch effect: {ex}");
- }
- }
-
- private bool IsOperational()
- {
- var building = parent as Building_ResourceSubmitter;
- return building?.IsOperational ?? false;
- }
-
- private string GetInoperativeReason()
- {
- var building = parent as Building_ResourceSubmitter;
- return building?.GetInoperativeReason() ?? "WULA_UnknownReason".Translate();
- }
- }
-
- public class CompProperties_ResourceSubmitter : CompProperties
- {
- public float massCapacity = 150f;
-
- public CompProperties_ResourceSubmitter()
- {
- compClass = typeof(CompResourceSubmitter);
- }
- }
-}
diff --git a/Source/WulaFallenEmpire/GlobalWorkTable/Dialog_LoadResourceSubmitter.cs b/Source/WulaFallenEmpire/GlobalWorkTable/Dialog_LoadResourceSubmitter.cs
deleted file mode 100644
index 739074ea..00000000
--- a/Source/WulaFallenEmpire/GlobalWorkTable/Dialog_LoadResourceSubmitter.cs
+++ /dev/null
@@ -1,354 +0,0 @@
-using RimWorld;
-using System.Collections.Generic;
-using System.Linq;
-using UnityEngine;
-using Verse;
-using Verse.AI;
-
-namespace WulaFallenEmpire
-{
- public class Dialog_LoadResourceSubmitter : Window
- {
- private CompResourceSubmitter submitterComp;
- private Vector2 scrollPosition;
- private float scrollViewHeight;
- private List transferables;
-
- public override Vector2 InitialSize => new Vector2(800f, 600f);
-
- public Dialog_LoadResourceSubmitter(CompResourceSubmitter submitterComp)
- {
- this.submitterComp = submitterComp;
- forcePause = true;
- doCloseX = true;
- doCloseButton = true;
- absorbInputAroundWindow = true;
-
- transferables = new List();
- RefreshTransferables();
- }
-
- public override void DoWindowContents(Rect inRect)
- {
- Rect titleRect = new Rect(0f, 0f, inRect.width, 35f);
- Text.Font = GameFont.Medium;
- Widgets.Label(titleRect, "WULA_LoadResourceSubmitter".Translate());
- Text.Font = GameFont.Small;
-
- // 简化的物品列表
- Rect listRect = new Rect(0f, 40f, inRect.width, inRect.height - 100f);
- DoSimpleTransferableList(listRect);
-
- // 按钮区域
- Rect buttonRect = new Rect(0f, inRect.height - 55f, inRect.width, 30f);
- DoButtons(buttonRect);
-
- // 状态信息
- Rect statusRect = new Rect(0f, inRect.height - 25f, inRect.width, 25f);
- DoStatusInfo(statusRect);
- }
-
- private void DoSimpleTransferableList(Rect rect)
- {
- Widgets.DrawMenuSection(rect);
- Rect outRect = rect.ContractedBy(10f);
- Rect viewRect = new Rect(0f, 0f, outRect.width - 16f, scrollViewHeight);
-
- Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect);
-
- float curY = 0f;
-
- // 列标题
- Rect headerRect = new Rect(0f, curY, viewRect.width, 25f);
- DoColumnHeaders(headerRect);
- curY += 30f;
-
- if (transferables.Count == 0)
- {
- Rect emptyRect = new Rect(0f, curY, viewRect.width, 30f);
- Text.Anchor = TextAnchor.MiddleCenter;
- Widgets.Label(emptyRect, "WULA_NoItemsAvailable".Translate());
- Text.Anchor = TextAnchor.UpperLeft;
- curY += 35f;
- }
- else
- {
- foreach (var transferable in transferables)
- {
- if (transferable.things.Count == 0) continue;
-
- Thing sampleThing = transferable.things[0];
- Rect rowRect = new Rect(0f, curY, viewRect.width, 30f);
-
- if (DoTransferableRow(rowRect, transferable, sampleThing))
- {
- TooltipHandler.TipRegion(rowRect, GetThingTooltip(sampleThing, transferable.CountToTransfer));
- }
-
- curY += 35f;
- }
- }
-
- if (Event.current.type == EventType.Layout)
- {
- scrollViewHeight = curY;
- }
-
- Widgets.EndScrollView();
- }
-
- private void DoColumnHeaders(Rect rect)
- {
- float columnWidth = rect.width / 4f;
-
- // 物品名称列
- Rect nameRect = new Rect(rect.x, rect.y, columnWidth * 2f, rect.height);
- Text.Anchor = TextAnchor.MiddleLeft;
- Widgets.Label(nameRect, "WULA_ItemName".Translate());
-
- // 可用数量列
- Rect availableRect = new Rect(rect.x + columnWidth * 2f, rect.y, columnWidth, rect.height);
- Text.Anchor = TextAnchor.MiddleCenter;
- Widgets.Label(availableRect, "WULA_Available".Translate());
-
- // 装载数量列
- Rect loadRect = new Rect(rect.x + columnWidth * 3f, rect.y, columnWidth, rect.height);
- Widgets.Label(loadRect, "WULA_ToLoad".Translate());
- Text.Anchor = TextAnchor.UpperLeft;
-
- // 标题下划线
- Widgets.DrawLineHorizontal(rect.x, rect.yMax - 2f, rect.width);
- }
-
- private bool DoTransferableRow(Rect rect, TransferableOneWay transferable, Thing sampleThing)
- {
- Widgets.DrawHighlightIfMouseover(rect);
-
- float columnWidth = rect.width / 4f;
-
- // 图标
- Rect iconRect = new Rect(rect.x + 2f, rect.y + 2f, 26f, 26f);
- Widgets.ThingIcon(iconRect, sampleThing);
-
- // 名称
- Rect nameRect = new Rect(rect.x + 32f, rect.y, columnWidth * 2f - 32f, rect.height);
- Text.Anchor = TextAnchor.MiddleLeft;
- string label = sampleThing.LabelCap;
- if (label.Length > 25)
- {
- label = label.Substring(0, 25) + "...";
- }
- Widgets.Label(nameRect, label);
-
- // 可用数量
- int availableCount = transferable.things.Sum(t => t.stackCount);
- Rect availableRect = new Rect(rect.x + columnWidth * 2f, rect.y, columnWidth, rect.height);
- Text.Anchor = TextAnchor.MiddleCenter;
- Widgets.Label(availableRect, availableCount.ToString());
-
- // 装载数量调整
- Rect adjustRect = new Rect(rect.x + columnWidth * 3f, rect.y, columnWidth, rect.height);
- DoCountAdjust(adjustRect, transferable, availableCount);
-
- Text.Anchor = TextAnchor.UpperLeft;
-
- return Mouse.IsOver(rect);
- }
-
- private void DoCountAdjust(Rect rect, TransferableOneWay transferable, int availableCount)
- {
- int currentCount = transferable.CountToTransfer;
-
- Rect labelRect = new Rect(rect.x, rect.y, 40f, rect.height);
- Rect minusRect = new Rect(rect.x + 45f, rect.y, 25f, rect.height);
- Rect plusRect = new Rect(rect.x + 75f, rect.y, 25f, rect.height);
- Rect maxRect = new Rect(rect.x + 105f, rect.y, 35f, rect.height);
-
- Text.Anchor = TextAnchor.MiddleCenter;
-
- // 当前数量
- Widgets.Label(labelRect, currentCount.ToString());
-
- // 减少按钮
- if (Widgets.ButtonText(minusRect, "-") && currentCount > 0)
- {
- transferable.AdjustBy(-1);
- }
-
- // 增加按钮
- if (Widgets.ButtonText(plusRect, "+") && currentCount < availableCount)
- {
- transferable.AdjustBy(1);
- }
-
- // 最大按钮
- if (Widgets.ButtonText(maxRect, "WULA_Max".Translate()) && availableCount > 0)
- {
- Find.WindowStack.Add(new Dialog_Slider(
- "WULA_SetLoadCount".Translate(transferable.AnyThing.LabelCap),
- 0, availableCount,
- value => transferable.AdjustTo(value),
- currentCount
- ));
- }
-
- Text.Anchor = TextAnchor.UpperLeft;
- }
-
- private void DoButtons(Rect rect)
- {
- float buttonWidth = rect.width / 2f - 5f;
-
- // 加载所有按钮
- Rect loadAllRect = new Rect(rect.x, rect.y, buttonWidth, rect.height);
- if (Widgets.ButtonText(loadAllRect, "WULA_LoadAll".Translate()))
- {
- foreach (var transferable in transferables)
- {
- transferable.AdjustTo(transferable.things.Sum(t => t.stackCount));
- }
- }
-
- // 清除所有按钮
- Rect clearAllRect = new Rect(rect.x + buttonWidth + 10f, rect.y, buttonWidth, rect.height);
- if (Widgets.ButtonText(clearAllRect, "WULA_ClearAll".Translate()))
- {
- foreach (var transferable in transferables)
- {
- transferable.AdjustTo(0);
- }
- }
- }
-
- private void DoStatusInfo(Rect rect)
- {
- Widgets.DrawMenuSection(rect);
- Rect innerRect = rect.ContractedBy(5f);
-
- Text.Anchor = TextAnchor.MiddleLeft;
-
- // 计算总质量
- float totalMass = 0f;
- foreach (var transferable in transferables)
- {
- if (transferable.CountToTransfer > 0)
- {
- float thingMass = transferable.AnyThing.GetStatValue(StatDefOf.Mass);
- totalMass += thingMass * transferable.CountToTransfer;
- }
- }
-
- // 质量信息
- string massText = "WULA_Mass".Translate() + ": " + totalMass.ToString("F1") + " / " + submitterComp.Props.massCapacity.ToString("F1") + " kg";
- if (totalMass > submitterComp.Props.massCapacity)
- {
- massText = massText.Colorize(ColorLibrary.RedReadable);
- }
-
- Widgets.Label(innerRect, massText);
- Text.Anchor = TextAnchor.UpperLeft;
- }
-
- private string GetThingTooltip(Thing thing, int count)
- {
- float mass = thing.GetStatValue(StatDefOf.Mass);
- float value = thing.MarketValue * count;
- return $"{thing.LabelCap}\n{"WULA_Mass".Translate()}: {mass:F2} kg\n{"WULA_Value".Translate()}: {value}\n{"WULA_Description".Translate()}: {thing.def.description}";
- }
-
- private void RefreshTransferables()
- {
- transferables.Clear();
-
- // 获取地图上所有可搬运的物品
- foreach (Thing thing in submitterComp.parent.Map.listerThings.ThingsInGroup(ThingRequestGroup.HaulableAlways))
- {
- if ((thing.IsInValidStorage() || thing.Spawned) && !thing.Position.Fogged(thing.Map))
- {
- AddToTransferables(thing);
- }
- }
-
- // 按物品类型排序
- transferables.SortBy(t => t.AnyThing.def.label);
- }
-
- private void AddToTransferables(Thing thing)
- {
- if (thing.def.category == ThingCategory.Item)
- {
- TransferableOneWay transferable = TransferableUtility.TransferableMatching(thing, transferables, TransferAsOneMode.PodsOrCaravanPacking);
- if (transferable == null)
- {
- transferable = new TransferableOneWay();
- transferables.Add(transferable);
- transferable.things.Add(thing);
- }
- else
- {
- transferable.things.Add(thing);
- }
- }
- }
-
- public override void PostClose()
- {
- base.PostClose();
-
- // 应用装载设置到提交器
- if (submitterComp != null)
- {
- submitterComp.leftToLoad?.Clear();
-
- foreach (TransferableOneWay transferable in transferables)
- {
- if (transferable.CountToTransfer > 0)
- {
- submitterComp.AddToTheToLoadList(transferable, transferable.CountToTransfer);
- }
- }
-
- // 开始装载工作
- StartLoadingJobs();
- }
- }
-
- private void StartLoadingJobs()
- {
- if (submitterComp?.parent?.Map == null) return;
-
- foreach (TransferableOneWay transferable in transferables)
- {
- if (transferable.CountToTransfer > 0)
- {
- foreach (Thing thing in transferable.things)
- {
- if (transferable.CountToTransfer <= 0) break;
-
- // 创建搬运到提交器的工作
- Job job = JobMaker.MakeJob(JobDefOf.HaulToContainer, thing, submitterComp.parent);
- job.count = Mathf.Min(thing.stackCount, transferable.CountToTransfer);
- job.haulMode = HaulMode.ToContainer;
-
- // 寻找殖民者执行工作
- Pawn pawn = FindBestPawnForJob(job);
- if (pawn != null)
- {
- pawn.jobs.TryTakeOrderedJob(job);
- transferable.AdjustBy(-job.count);
- }
- }
- }
- }
-
- Messages.Message("WULA_LoadingJobsCreated".Translate(), MessageTypeDefOf.PositiveEvent);
- }
-
- private Pawn FindBestPawnForJob(Job job)
- {
- return submitterComp.parent.Map.mapPawns.FreeColonistsSpawned
- .Where(p => p.workSettings.WorkIsActive(WorkTypeDefOf.Hauling))
- .FirstOrDefault(p => p.CanReserveAndReach(job.targetA, PathEndMode.ClosestTouch, Danger.Some));
- }
- }
-}
diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
index 4520ee44..6a4fde54 100644
--- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
+++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj
@@ -108,10 +108,6 @@
-
-
-
-