补全防御塔组装与介绍描述功能
- RepoForm.CombineArea:防御塔组装,直接继承所有组件的属性 - ItemDescUtility:根据属性构建不同的 ItemDescForm 的文本
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user