- S4-03 | 先固化 Tag 系统设计与首发范围

- S4-04 | 实现组件实例 Tag 的统一生成入口
- S4-05 | 实现组塔后的 Tag 汇总与展示入口
This commit is contained in:
SepComet
2026-03-09 21:06:43 +08:00
parent 73b7adedb8
commit 34ef001ef3
31 changed files with 1280 additions and 178 deletions
@@ -1,6 +1,4 @@
using System.Collections.Generic;
using GeometryTD.DataTable;
using GeometryTD.Definition;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@@ -249,11 +247,11 @@ namespace GeometryTD.UI
return value >= min && value <= max;
}
private void RefreshTags(List<TagType> tags)
private void RefreshTags(TagItemContext[] tags)
{
ClearTags();
if (_tagAreaParent == null || _tagItemPrefab == null || tags == null || tags.Count <= 0)
if (_tagAreaParent == null || _tagItemPrefab == null || tags == null || tags.Length <= 0)
{
return;
}
@@ -263,10 +261,10 @@ namespace GeometryTD.UI
_tagItemPrefab.SetActive(false);
}
for (int i = 0; i < tags.Count; i++)
for (int i = 0; i < tags.Length; i++)
{
string tagName = ResolveTagName(tags[i]);
if (string.IsNullOrWhiteSpace(tagName))
TagItemContext tagContext = tags[i];
if (tagContext == null || string.IsNullOrWhiteSpace(tagContext.TagName))
{
continue;
}
@@ -276,17 +274,14 @@ namespace GeometryTD.UI
if (tagGo.TryGetComponent(out TagItem tagItem))
{
tagItem.OnInit(new TagItemContext
{
TagName = tagName
});
tagItem.OnInit(tagContext);
}
else
{
TMP_Text tagText = tagGo.GetComponentInChildren<TMP_Text>(true);
if (tagText != null)
{
tagText.text = tagName;
tagText.text = tagContext.TagName;
}
}
@@ -308,26 +303,6 @@ namespace GeometryTD.UI
_runtimeTagItems.Clear();
}
private static string ResolveTagName(TagType tagType)
{
if (tagType == TagType.None)
{
return string.Empty;
}
var tagTable = GameEntry.DataTable.GetDataTable<DRTag>();
if (tagTable != null)
{
DRTag tagRow = tagTable.GetDataRow((int)tagType);
if (tagRow != null && !string.IsNullOrWhiteSpace(tagRow.Name))
{
return tagRow.Name;
}
}
return tagType.ToString();
}
private void CloseSelf()
{
GameEntry.UI.CloseUIForm(this);