Skip to content

Commit 3fb4cac

Browse files
authored
Append trigger names on tag selection for differently named triggers
1 parent 3e42aaf commit 3fb4cac

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/TSMapEditor/UI/Windows/SelectTagWindow.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,26 @@ protected override void ListObjects()
4242
{
4343
Color color = lbObjectList.DefaultItemColor;
4444
var trigger = tag.Trigger;
45-
if (trigger != null && !string.IsNullOrWhiteSpace(trigger.EditorColor))
46-
color = trigger.XNAColor;
45+
string tagText = $"{tag.Name} ({tag.ID})";
4746

48-
lbObjectList.AddItem(new XNAListBoxItem() { Text = $"{tag.Name} ({tag.ID})", TextColor = color, Tag = tag });
47+
if (trigger != null)
48+
{
49+
if (!string.IsNullOrWhiteSpace(trigger.EditorColor))
50+
color = trigger.XNAColor;
51+
52+
string tagName = tag.Name;
53+
54+
int index = tag.Name.IndexOf(" (tag)");
55+
if (index >= 0)
56+
{
57+
tagName = tag.Name.Substring(0, index).Trim();
58+
}
59+
60+
if (!tagName.Equals(trigger.Name.Trim()))
61+
tagText += $" [{trigger.Name}]";
62+
}
63+
64+
lbObjectList.AddItem(new XNAListBoxItem() { Text = tagText, TextColor = color, Tag = tag });
4965
if (tag == SelectedObject)
5066
lbObjectList.SelectedIndex = lbObjectList.Items.Count - 1;
5167
}

0 commit comments

Comments
 (0)