Only show context buttons if they can be clicked

This commit is contained in:
r00telement
2021-12-07 23:46:43 +00:00
parent 2d15a10c05
commit 18e296271d
2 changed files with 9 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>r00telement</Authors>
<Version>1.0.1.0</Version>
<Version>1.1.0.0</Version>
</PropertyGroup>
<PropertyGroup>

View File

@@ -147,7 +147,6 @@ namespace PlayerTags
string gameObjectName = args.Text.TextValue;
var removedTags = m_PluginData.CustomTags.Where(tag => !tag.IncludesGameObjectNameToApplyTo(gameObjectName));
var addTagItem = new NormalContextSubMenuItem(Strings.Loc_Static_ContextMenu_AddTag, (itemArgs =>
{
foreach (var removedTag in removedTags)
@@ -170,7 +169,10 @@ namespace PlayerTags
addTagItem.Enabled = false;
}
args.Items.Add(addTagItem);
if (removedTags.Any())
{
args.Items.Add(addTagItem);
}
var addedTags = m_PluginData.CustomTags.Where(tag => tag.IncludesGameObjectNameToApplyTo(gameObjectName));
@@ -196,7 +198,10 @@ namespace PlayerTags
removeTagItem.Enabled = false;
}
args.Items.Add(removeTagItem);
if (addedTags.Any())
{
args.Items.Add(removeTagItem);
}
}
private void UiBuilder_Draw()