补全防御塔组装与介绍描述功能

- RepoForm.CombineArea:防御塔组装,直接继承所有组件的属性
- ItemDescUtility:根据属性构建不同的 ItemDescForm 的文本
This commit is contained in:
SepComet
2026-03-04 18:17:10 +08:00
parent e12d2e73b2
commit 1e5803f4c5
29 changed files with 832 additions and 168 deletions
@@ -1,4 +1,5 @@
using GeometryTD.Definition;
using GeometryTD.CustomEvent;
using UnityEngine;
using UnityEngine.EventSystems;
@@ -42,7 +43,14 @@ namespace GeometryTD.UI
public void OnCombineClick()
{
// TODO: Combine logic.
if (!TryGetBoundItemId(TowerCompSlotType.Muzzle, out long muzzleItemId) ||
!TryGetBoundItemId(TowerCompSlotType.Bearing, out long bearingItemId) ||
!TryGetBoundItemId(TowerCompSlotType.Base, out long baseItemId))
{
return;
}
GameEntry.Event.Fire(this, RepoCombineRequestedEventArgs.Create(muzzleItemId, bearingItemId, baseItemId));
}
public bool TryAssignItem(RepoItemContext itemContext)
@@ -127,5 +135,18 @@ namespace GeometryTD.UI
return null;
}
private bool TryGetBoundItemId(TowerCompSlotType slotType, out long boundItemId)
{
boundItemId = 0;
CombineSlotItem slot = FindSlot(slotType);
if (slot == null || !slot.HasItem || slot.BoundItemId <= 0)
{
return false;
}
boundItemId = slot.BoundItemId;
return true;
}
}
}