S4-07 process 1

This commit is contained in:
SepComet
2026-03-11 10:18:14 +08:00
parent 52f9e212b9
commit 9de2e50262
32 changed files with 803 additions and 194 deletions
@@ -18,7 +18,8 @@ namespace GeometryTD.UI
public string Title;
public string TypeText;
public string Description;
public string[] TagTexts;
public TagType[] Tags;
public TagRuntimeData[] TagRuntimes;
}
protected override UIFormType UIFormTypeId => UIFormType.CombatFinishForm;
@@ -138,7 +139,8 @@ namespace GeometryTD.UI
tower.Name,
"Tower",
ItemDescUtility.BuildTowerDesc(tower, muzzleMap, bearingMap, baseMap) ?? string.Empty,
TagDisplayUtility.BuildTowerTagTexts(tower.Stats));
tower.Stats?.Tags,
tower.Stats?.TagRuntimes);
}
}
@@ -166,7 +168,8 @@ namespace GeometryTD.UI
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildMuzzleDesc(item) ?? string.Empty,
TagDisplayUtility.BuildTagTexts(item.Tags));
item.Tags,
null);
}
}
@@ -194,7 +197,8 @@ namespace GeometryTD.UI
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildBearingDesc(item) ?? string.Empty,
TagDisplayUtility.BuildTagTexts(item.Tags));
item.Tags,
null);
}
}
@@ -222,7 +226,8 @@ namespace GeometryTD.UI
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildBaseDesc(item) ?? string.Empty,
TagDisplayUtility.BuildTagTexts(item.Tags));
item.Tags,
null);
}
}
@@ -261,7 +266,13 @@ namespace GeometryTD.UI
return Color.white;
}
private void AddItemDescSeed(long itemId, string title, string typeText, string description, string[] tagTexts)
private void AddItemDescSeed(
long itemId,
string title,
string typeText,
string description,
TagType[] tags,
TagRuntimeData[] tagRuntimes)
{
if (itemId <= 0)
{
@@ -273,13 +284,19 @@ namespace GeometryTD.UI
Title = string.IsNullOrWhiteSpace(title) ? $"Item {itemId}" : title,
TypeText = typeText ?? string.Empty,
Description = description ?? string.Empty,
TagTexts = CloneTagTexts(tagTexts)
Tags = CloneTags(tags),
TagRuntimes = CloneTagRuntimes(tagRuntimes)
};
}
private static string[] CloneTagTexts(string[] tagTexts)
private static TagType[] CloneTags(TagType[] tags)
{
return tagTexts != null ? (string[])tagTexts.Clone() : System.Array.Empty<string>();
return tags != null ? (TagType[])tags.Clone() : System.Array.Empty<TagType>();
}
private static TagRuntimeData[] CloneTagRuntimes(TagRuntimeData[] tagRuntimes)
{
return InventoryCloneUtility.CloneTagRuntimes(tagRuntimes);
}
private static string BuildComponentTypeText(TowerCompSlotType slotType)
@@ -374,7 +391,8 @@ namespace GeometryTD.UI
Description = seed.Description ?? string.Empty,
Price = 0,
TargetPos = args.TargetPos,
TagTexts = CloneTagTexts(seed.TagTexts)
Tags = CloneTags(seed.Tags),
TagRuntimes = CloneTagRuntimes(seed.TagRuntimes)
});
}
@@ -402,6 +420,3 @@ namespace GeometryTD.UI
}
}
}
@@ -43,7 +43,8 @@ namespace GeometryTD.UI
tower.Name,
"Tower",
ItemDescUtility.BuildTowerDesc(tower, muzzleMap, bearingMap, baseMap) ?? string.Empty,
TagDisplayUtility.BuildTowerTagTexts(tower.Stats));
tower.Stats?.Tags,
tower.Stats?.TagRuntimes);
}
}
@@ -71,7 +72,8 @@ namespace GeometryTD.UI
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildMuzzleDesc(item) ?? string.Empty,
TagDisplayUtility.BuildTagTexts(item.Tags));
item.Tags,
null);
}
}
@@ -99,7 +101,8 @@ namespace GeometryTD.UI
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildBearingDesc(item) ?? string.Empty,
TagDisplayUtility.BuildTagTexts(item.Tags));
item.Tags,
null);
}
}
@@ -127,7 +130,8 @@ namespace GeometryTD.UI
item.Name,
BuildComponentTypeText(item.SlotType),
ItemDescUtility.BuildBaseDesc(item) ?? string.Empty,
TagDisplayUtility.BuildTagTexts(item.Tags));
item.Tags,
null);
}
}
@@ -169,7 +173,13 @@ namespace GeometryTD.UI
_compAreaTowerIds.Add(itemContext.InstanceId);
}
private void AddItemDescSeed(long itemId, string title, string typeText, string description, string[] tagTexts)
private void AddItemDescSeed(
long itemId,
string title,
string typeText,
string description,
TagType[] tags,
TagRuntimeData[] tagRuntimes)
{
if (itemId <= 0)
{
@@ -181,7 +191,8 @@ namespace GeometryTD.UI
Title = string.IsNullOrWhiteSpace(title) ? $"Item {itemId}" : title,
TypeText = typeText ?? string.Empty,
Description = description ?? string.Empty,
TagTexts = tagTexts != null ? (string[])tagTexts.Clone() : Array.Empty<string>()
Tags = CloneTags(tags),
TagRuntimes = CloneTagRuntimes(tagRuntimes)
};
}
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using GeometryTD.CustomEvent;
using GeometryTD.CustomUtility;
using GeometryTD.Definition;
using GameFramework.Event;
using UnityEngine;
@@ -22,7 +23,8 @@ namespace GeometryTD.UI
public string Title;
public string TypeText;
public string Description;
public string[] TagTexts;
public TagType[] Tags;
public TagRuntimeData[] TagRuntimes;
}
protected override UIFormType UIFormTypeId => UIFormType.RepoForm;
@@ -151,10 +153,21 @@ namespace GeometryTD.UI
Description = seed.Description ?? string.Empty,
Price = 0,
TargetPos = args.TargetPos,
TagTexts = CloneTagTexts(seed.TagTexts)
Tags = CloneTags(seed.Tags),
TagRuntimes = CloneTagRuntimes(seed.TagRuntimes)
});
}
private static TagType[] CloneTags(TagType[] tags)
{
return tags != null ? (TagType[])tags.Clone() : System.Array.Empty<TagType>();
}
private static TagRuntimeData[] CloneTagRuntimes(TagRuntimeData[] tagRuntimes)
{
return InventoryCloneUtility.CloneTagRuntimes(tagRuntimes);
}
private void OnRepoItemDragEnded(object sender, GameEventArgs e)
{
if (!IsEventFromCurrentForm(sender))
@@ -32,20 +32,39 @@ namespace GeometryTD.UI
{
Title = rawData.Title,
TypeText = rawData.TypeText,
Description = rawData.Description,
Description = BuildDescription(rawData),
Price = rawData.Price,
TargetPos = rawData.TargetPos,
Tags = BuildTags(rawData)
};
}
private static string BuildDescription(ItemDescFormRawData rawData)
{
string baseDescription = rawData?.Description ?? string.Empty;
string tagDescription = rawData?.TagRuntimes != null && rawData.TagRuntimes.Length > 0
? TagDisplayUtility.BuildTagDescriptionText(rawData.TagRuntimes)
: TagDisplayUtility.BuildTagDescriptionText(rawData?.Tags);
if (string.IsNullOrWhiteSpace(tagDescription))
{
return baseDescription;
}
if (string.IsNullOrWhiteSpace(baseDescription))
{
return tagDescription;
}
return $"{baseDescription}\n{tagDescription}";
}
private static TagItemContext[] BuildTags(ItemDescFormRawData rawData)
{
string[] tagTexts = rawData?.TagTexts;
if ((tagTexts == null || tagTexts.Length <= 0) && rawData?.Tags != null)
{
tagTexts = TagDisplayUtility.BuildTagTexts(rawData.Tags);
}
string[] tagTexts = rawData?.TagRuntimes != null && rawData.TagRuntimes.Length > 0
? TagDisplayUtility.BuildTagTexts(rawData.TagRuntimes)
: rawData?.Tags != null
? TagDisplayUtility.BuildTagTexts(rawData.Tags)
: null;
if (tagTexts == null || tagTexts.Length <= 0)
{
@@ -11,6 +11,6 @@ namespace GeometryTD.UI
public int Price;
public Vector3 TargetPos;
public TagType[] Tags;
public string[] TagTexts;
public TagRuntimeData[] TagRuntimes;
}
}