feat: 新增设备孵化器,包含通量控制、幼虫交互和孵化进度管理功能

This commit is contained in:
2025-12-23 18:35:41 +08:00
parent 25b1f563f6
commit a18e7d3c18
11 changed files with 54 additions and 30 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -393,11 +393,8 @@ namespace ArachnaeSwarm
public override IEnumerable<Gizmo> CompGetGizmosExtra()
{
foreach (var g in base.CompGetGizmosExtra()) yield return g;
if (parent.Faction != Faction.OfPlayer) yield break;
yield return new Gizmo_NeutronFlux(this);
yield return new Gizmo_DualProgressBar(this);
yield return new Gizmo_NeutronFlux(this) { Order = -150f };
yield return new Gizmo_DualProgressBar(this) { Order = -140f };
if (orders.Count < Props.productionQueueLimit)
{
@@ -406,7 +403,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_AddOrder".Translate(orders.Count, Props.productionQueueLimit),
defaultDesc = "ARA_Gizmo_AddOrderDesc_Item".Translate(),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_NodeSwarmIcon", false),
action = ShowOrderMenu
action = ShowOrderMenu,
Order = 100f
};
}
@@ -418,7 +416,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_CallLarva".Translate(),
defaultDesc = "ARA_Gizmo_CallLarvaDesc".Translate(WaitingForLarvaCount),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
action = CallLarvae
action = CallLarvae,
Order = 100f
};
}
else if (WaitingForLarvaCount > 0 && assignedLarvae.Count > 0)
@@ -428,7 +427,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_LarvaWorking".Translate(),
defaultDesc = "ARA_Gizmo_LarvaWorkingDesc".Translate(WaitingForLarvaCount),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
Disabled = true
Disabled = true,
Order = 100f
};
}
}

View File

@@ -412,11 +412,11 @@ namespace ArachnaeSwarm
public override IEnumerable<Gizmo> CompGetGizmosExtra()
{
foreach (var g in base.CompGetGizmosExtra()) yield return g;
if (parent.Faction != Faction.OfPlayer) yield break;
yield return new Gizmo_NeutronFlux(this);
yield return new Gizmo_PawnProgressBar(this);
// 对于组件,我们不控制 base 的返回(通常是空的),
// 而是让排序值在这个返回的 Gizmo 对象上生效。
yield return new Gizmo_NeutronFlux(this) { Order = -150f };
yield return new Gizmo_PawnProgressBar(this) { Order = -140f };
if (orders.Count < Props.productionQueueLimit)
{
@@ -425,7 +425,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_AddOrder".Translate(orders.Count, Props.productionQueueLimit),
defaultDesc = "ARA_Gizmo_AddOrderDesc_Pawn".Translate(),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_NodeSwarmIcon", false),
action = ShowOrderMenu
action = ShowOrderMenu,
Order = 100f
};
}
@@ -437,7 +438,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_CallLarva".Translate(),
defaultDesc = "ARA_Gizmo_CallLarvaDesc".Translate(WaitingForLarvaCount),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
action = CallLarvae
action = CallLarvae,
Order = 100f
};
}
else if (WaitingForLarvaCount > 0 && assignedLarvae.Count > 0)
@@ -448,7 +450,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_LarvaWorking".Translate(),
defaultDesc = "ARA_Gizmo_LarvaWorkingDesc".Translate(WaitingForLarvaCount),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
Disabled = true
Disabled = true,
Order = 100f
};
}
}

View File

@@ -85,12 +85,11 @@ namespace ArachnaeSwarm
base.Refuel(amount);
}
// 调整 Gizmo 排序,让虫蜜 Gizmo 排在活性和进度 Gizmo 之后
public override IEnumerable<Gizmo> CompGetGizmosExtra()
{
foreach (var gizmo in base.CompGetGizmosExtra())
{
gizmo.Order = -90f; // 活性=-100, 进度=-99/-98, 虫蜜=-90
gizmo.Order = -135f; // 活性-150 -> 进度-140 -> 虫蜜-135
yield return gizmo;
}
}

View File

@@ -403,6 +403,13 @@ namespace ArachnaeSwarm
if (label.Contains("拆除") || label.Contains("Deconstruct") || label.Contains("半径") || label.Contains("Radius"))
continue;
}
// 强制将基础组件(如 Refuelable甚至默认排序为 -100 的东西移到后面
if (gizmo.Order >= -100f && gizmo.Order <= 0f)
{
gizmo.Order = -90f;
}
yield return gizmo;
}
@@ -421,7 +428,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_AddOrder".Translate(config != null ? 1 : 0, 1),
defaultDesc = "ARA_Gizmo_AddOrderDesc_Item".Translate(),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_NodeSwarmIcon", false),
action = () => EquipmentIncubatorData?.ShowFloatMenu()
action = () => EquipmentIncubatorData?.ShowFloatMenu(),
Order = 100f
};
}
@@ -435,7 +443,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_CallLarva".Translate(),
defaultDesc = BuildCallLarvaDescription(config),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
action = CallLarva
action = CallLarva,
Order = 100f
};
}
else
@@ -448,7 +457,8 @@ namespace ArachnaeSwarm
defaultLabel = statusText,
defaultDesc = "ARA_Gizmo_LarvaWorkingDesc".Translate(0),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
Disabled = true
Disabled = true,
Order = 100f
};
}
}
@@ -459,7 +469,8 @@ namespace ArachnaeSwarm
{
defaultLabel = "ARA_OothecaIncubator.CancelIncubation".Translate(),
icon = ContentFinder<Texture2D>.Get("UI/Commands/Cancel", false),
action = CancelIncubation
action = CancelIncubation,
Order = 100f
};
}
}

View File

@@ -412,6 +412,13 @@ namespace ArachnaeSwarm
if (label.Contains("拆除") || label.Contains("Deconstruct") || label.Contains("半径") || label.Contains("Radius"))
continue;
}
// 强制将基础组件(如 Refuelable甚至默认排序为 -100 的东西移到后面
if (gizmo.Order >= -100f && gizmo.Order <= 0f)
{
gizmo.Order = -90f;
}
yield return gizmo;
}
@@ -430,7 +437,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_AddOrder".Translate(config != null ? 1 : 0, 1),
defaultDesc = "ARA_Gizmo_AddOrderDesc_Pawn".Translate(),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_NodeSwarmIcon", false),
action = () => IncubatorData?.ShowFloatMenu()
action = () => IncubatorData?.ShowFloatMenu(),
Order = 100f
};
}
@@ -445,7 +453,8 @@ namespace ArachnaeSwarm
defaultLabel = "ARA_Gizmo_CallLarva".Translate(),
defaultDesc = BuildCallLarvaDescription(config),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
action = CallLarva
action = CallLarva,
Order = 100f
};
}
else
@@ -459,7 +468,8 @@ namespace ArachnaeSwarm
defaultLabel = statusText,
defaultDesc = "ARA_Gizmo_LarvaWorkingDesc".Translate(0),
icon = ContentFinder<Texture2D>.Get("ArachnaeSwarm/UI/Commands/ARA_CallLarva", false),
Disabled = true
Disabled = true,
Order = 100f
};
}
}
@@ -470,7 +480,8 @@ namespace ArachnaeSwarm
{
defaultLabel = "ARA_OothecaIncubator.CancelIncubation".Translate(),
icon = ContentFinder<Texture2D>.Get("UI/Commands/Cancel", false),
action = CancelIncubation
action = CancelIncubation,
Order = 100f
};
}
}

View File

@@ -28,7 +28,7 @@ namespace ArachnaeSwarm
public Gizmo_DualProgressBar(CompQueuedInteractiveProducerWithFlux comp)
{
this.comp = comp;
this.Order = -98f;
this.Order = -140f;
}
public override float GetWidth(float maxWidth) => Mathf.Min(Width, maxWidth);

View File

@@ -27,7 +27,7 @@ namespace ArachnaeSwarm
public Gizmo_IncubationProgress(Building_Ootheca ootheca)
{
this.ootheca = ootheca;
Order = -99f; // 在通量 Gizmo 之后显示
Order = -140f;
}
public override float GetWidth(float maxWidth)

View File

@@ -30,7 +30,7 @@ namespace ArachnaeSwarm
{
this.controller = controller;
this.parentThing = controller as Thing;
Order = -100f;
Order = -150f;
}
public override float GetWidth(float maxWidth)

View File

@@ -28,7 +28,7 @@ namespace ArachnaeSwarm
public Gizmo_PawnProgressBar(CompQueuedPawnSpawnerWithFlux comp)
{
this.comp = comp;
this.Order = -98f;
this.Order = -140f;
}
public override float GetWidth(float maxWidth) => Mathf.Min(Width, maxWidth);