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

- 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
@@ -17,6 +17,7 @@ namespace GeometryTD.UI
{
public string Title;
public string TypeText;
public string Description;
public TagType[] Tags;
}
@@ -128,7 +129,11 @@ namespace GeometryTD.UI
IconAreaContext = BuildIconAreaContext(tower)
});
AddItemDescSeed(tower.InstanceId, tower.Name, "Tower",
AddItemDescSeed(
tower.InstanceId,
tower.Name,
"Tower",
ItemDescUtility.BuildTowerDesc(tower.Stats) ?? string.Empty,
tower.Stats != null ? tower.Stats.Tags : null);
}
}
@@ -151,7 +156,12 @@ namespace GeometryTD.UI
IconAreaContext = BuildIconAreaContext(item)
});
AddItemDescSeed(item.InstanceId, item.Name, BuildComponentTypeText(item.SlotType), item.Tags);
AddItemDescSeed(
item.InstanceId,
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildMuzzleDesc(item) ?? string.Empty,
item.Tags);
}
}
@@ -172,7 +182,12 @@ namespace GeometryTD.UI
IconAreaContext = BuildIconAreaContext(item)
});
AddItemDescSeed(item.InstanceId, item.Name, BuildComponentTypeText(item.SlotType), item.Tags);
AddItemDescSeed(
item.InstanceId,
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildBearingDesc(item) ?? string.Empty,
item.Tags);
}
}
@@ -194,14 +209,19 @@ namespace GeometryTD.UI
IconAreaContext = BuildIconAreaContext(item)
});
AddItemDescSeed(item.InstanceId, item.Name, BuildComponentTypeText(item.SlotType), item.Tags);
AddItemDescSeed(
item.InstanceId,
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildBaseDesc(item) ?? string.Empty,
item.Tags);
}
}
return itemContexts.ToArray();
}
private void AddItemDescSeed(long itemId, string title, string typeText, TagType[] tags)
private void AddItemDescSeed(long itemId, string title, string typeText, string description, TagType[] tags)
{
if (itemId <= 0)
{
@@ -212,6 +232,7 @@ namespace GeometryTD.UI
{
Title = string.IsNullOrWhiteSpace(title) ? $"Item {itemId}" : title,
TypeText = typeText ?? string.Empty,
Description = description ?? string.Empty,
Tags = CloneTags(tags)
};
}
@@ -233,7 +254,7 @@ namespace GeometryTD.UI
};
}
private static IconAreaContext BuildIconAreaContext(DefenseTowerItemData tower)
private static IconAreaContext BuildIconAreaContext(TowerItemData tower)
{
if (tower == null)
{
@@ -308,7 +329,7 @@ namespace GeometryTD.UI
{
Title = seed.Title,
TypeText = seed.TypeText,
Description = string.Empty,
Description = seed.Description ?? string.Empty,
Price = 0,
TargetPos = args.TargetPos,
Tags = CloneTags(seed.Tags)