More ui polish
This commit is contained in:
@@ -157,11 +157,11 @@ namespace PlayerTags
|
||||
})));
|
||||
}
|
||||
|
||||
// TODO: Temp hack because when opening somewhere other than the chat log, the last added item for some reason is added to the <Return button.
|
||||
if (args.ParentAddonName != "ChatLog")
|
||||
{
|
||||
itemArgs.Items.Add(new NormalContextMenuItem("ReturnDummy", (args => { })));
|
||||
}
|
||||
//// TODO: Temp hack because when opening somewhere other than the chat log, the last added item for some reason is added to the <Return button.
|
||||
//if (args.ParentAddonName != "ChatLog")
|
||||
//{
|
||||
// itemArgs.Items.Add(new NormalContextMenuItem("ReturnDummy", (args => { })));
|
||||
//}
|
||||
}));
|
||||
|
||||
if (!removedTags.Any())
|
||||
@@ -186,11 +186,11 @@ namespace PlayerTags
|
||||
})));
|
||||
}
|
||||
|
||||
// TODO: Temp hack because when opening somewhere other than the chat log, the last added item for some reason is added to the <Return button.
|
||||
if (args.ParentAddonName != "ChatLog")
|
||||
{
|
||||
itemArgs.Items.Add(new NormalContextMenuItem("ReturnDummy", (args => { })));
|
||||
}
|
||||
//// TODO: Temp hack because when opening somewhere other than the chat log, the last added item for some reason is added to the <Return button.
|
||||
//if (args.ParentAddonName != "ChatLog")
|
||||
//{
|
||||
// itemArgs.Items.Add(new NormalContextMenuItem("ReturnDummy", (args => { })));
|
||||
//}
|
||||
}));
|
||||
|
||||
if (!addedTags.Any())
|
||||
|
||||
@@ -41,11 +41,19 @@ namespace PlayerTags
|
||||
ImGui.TextWrapped(Strings.Loc_Static_WarningMessage);
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_General);
|
||||
ImGui.TreePush();
|
||||
DrawCheckbox(nameof(m_PluginConfiguration.IsCustomTagContextMenuEnabled), true, ref m_PluginConfiguration.IsCustomTagContextMenuEnabled, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.TreePop();
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_Nameplates);
|
||||
ImGui.TreePush();
|
||||
DrawComboBox(true, true, false, ref m_PluginConfiguration.NameplateFreeCompanyVisibility, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
@@ -53,18 +61,28 @@ namespace PlayerTags
|
||||
DrawComboBox(true, true, false, ref m_PluginConfiguration.NameplateTitlePosition, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.TreePop();
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_Development);
|
||||
ImGui.TreePush();
|
||||
DrawCheckbox(nameof(m_PluginConfiguration.IsPlayerNameRandomlyGenerated), true, ref m_PluginConfiguration.IsPlayerNameRandomlyGenerated, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.TreePop();
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_Tags);
|
||||
ImGui.TreePush();
|
||||
Draw(m_PluginData.AllTags);
|
||||
ImGui.TreePop();
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_PartyAssign);
|
||||
ImGui.TreePush();
|
||||
if (ImGui.BeginTable("##PartyAssignTable", 1 + m_PluginData.CustomTags.Count))
|
||||
@@ -80,13 +98,21 @@ namespace PlayerTags
|
||||
}
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var drawPartyMember = (string playerName) =>
|
||||
var drawPartyMember = (string playerName, int rowIndex) =>
|
||||
{
|
||||
ImGui.PushID(playerName);
|
||||
|
||||
ImGui.TableNextRow();
|
||||
|
||||
if (rowIndex % 2 != 0)
|
||||
{
|
||||
var backgroundColor = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 1, 1, 0.05f));
|
||||
ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg1, backgroundColor);
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(playerName);
|
||||
|
||||
foreach (Tag customTag in m_PluginData.CustomTags)
|
||||
@@ -96,8 +122,8 @@ namespace PlayerTags
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
bool isTagAssigned = customTag.IncludesGameObjectNameToApplyTo(playerName);
|
||||
|
||||
DrawCheckbox("IsEnabled", false, ref isTagAssigned, () =>
|
||||
|
||||
DrawSimpleCheckbox(string.Format(Strings.Loc_Static_Format_AddTagToPlayer, customTag.Text.InheritedValue, playerName), ref isTagAssigned, () =>
|
||||
{
|
||||
if (isTagAssigned)
|
||||
{
|
||||
@@ -117,20 +143,28 @@ namespace PlayerTags
|
||||
ImGui.PopID();
|
||||
};
|
||||
|
||||
int rowIndex = 0;
|
||||
foreach (var partyMember in m_PartyList)
|
||||
{
|
||||
drawPartyMember(partyMember.Name.TextValue);
|
||||
drawPartyMember(partyMember.Name.TextValue, rowIndex);
|
||||
++rowIndex;
|
||||
}
|
||||
|
||||
if (m_PartyList.Length == 0 && m_ClientState.LocalPlayer != null)
|
||||
{
|
||||
drawPartyMember(m_ClientState.LocalPlayer.Name.TextValue);
|
||||
drawPartyMember(m_ClientState.LocalPlayer.Name.TextValue, 0);
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.TreePop();
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.End();
|
||||
}
|
||||
|
||||
@@ -182,6 +216,60 @@ namespace PlayerTags
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0.2f, 0.6f, 0.2f, 1));
|
||||
|
||||
ImGui.Text("");
|
||||
|
||||
// Add custom tag button
|
||||
if (tag == m_PluginData.AllCustomTags)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0.1f, 0.3f, 0.1f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Vector4(0.2f, 0.6f, 0.2f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0.2f, 0.6f, 0.2f, 1));
|
||||
if (ImGui.Button(Strings.Loc_Static_AddCustomTag))
|
||||
{
|
||||
var newTag = new Tag(new LocalizedPluginString(nameof(PluginData.CustomTags)))
|
||||
{
|
||||
IsExpanded = true,
|
||||
Text = "",
|
||||
GameObjectNamesToApplyTo = ""
|
||||
};
|
||||
|
||||
m_PluginData.CustomTags.Add(newTag);
|
||||
newTag.Parent = m_PluginData.AllCustomTags;
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip(Strings.Loc_Static_AddCustomTag_Description);
|
||||
}
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
// Remove custom tag button
|
||||
if (m_PluginData.CustomTags.Contains(tag))
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0.3f, 0.1f, 0.1f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Vector4(0.6f, 0.2f, 0.2f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0.6f, 0.2f, 0.2f, 1));
|
||||
if (ImGui.Button(Strings.Loc_Static_RemoveCustomTag))
|
||||
{
|
||||
m_PluginData.AllCustomTags.Children.Remove(tag);
|
||||
m_PluginData.CustomTags.Remove(tag);
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip(Strings.Loc_Static_RemoveCustomTag_Description);
|
||||
}
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
ImGui.SameLine();
|
||||
}
|
||||
|
||||
if (ImGui.Button("+", addButtonSize))
|
||||
{
|
||||
ImGui.OpenPopup("AddPopup");
|
||||
@@ -247,6 +335,7 @@ namespace PlayerTags
|
||||
{
|
||||
ImGui.SetTooltip(Strings.Loc_Static_AddPropertyOverride_Description);
|
||||
}
|
||||
|
||||
ImGui.EndGroup();
|
||||
|
||||
var selectedInheritables = tag.Inheritables.Where(inheritable => inheritable.Value.Behavior != InheritableBehavior.Inherit).ToDictionary(item => item.Key, item => item.Value);
|
||||
@@ -299,56 +388,11 @@ namespace PlayerTags
|
||||
}
|
||||
}
|
||||
|
||||
if (m_PluginData.CustomTags.Contains(tag))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.BeginGroup();
|
||||
ImGui.Indent();
|
||||
ImGui.Text("");
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0.3f, 0.1f, 0.1f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Vector4(0.6f, 0.2f, 0.2f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0.6f, 0.2f, 0.2f, 1));
|
||||
if (ImGui.Button(Strings.Loc_Static_RemoveCustomTag))
|
||||
{
|
||||
m_PluginData.AllCustomTags.Children.Remove(tag);
|
||||
m_PluginData.CustomTags.Remove(tag);
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
}
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.EndGroup();
|
||||
}
|
||||
|
||||
foreach (var childTag in tag.Children.ToArray())
|
||||
{
|
||||
Draw(childTag);
|
||||
}
|
||||
|
||||
if (tag == m_PluginData.AllCustomTags)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0.1f, 0.3f, 0.1f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Vector4(0.2f, 0.6f, 0.2f, 1));
|
||||
ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0.2f, 0.6f, 0.2f, 1));
|
||||
if (ImGui.Button(Strings.Loc_Static_AddCustomTag))
|
||||
{
|
||||
var newTag = new Tag(new LocalizedPluginString(nameof(PluginData.CustomTags)))
|
||||
{
|
||||
IsExpanded = true,
|
||||
Text = "",
|
||||
GameObjectNamesToApplyTo = ""
|
||||
};
|
||||
|
||||
m_PluginData.CustomTags.Add(newTag);
|
||||
newTag.Parent = m_PluginData.AllCustomTags;
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
}
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
|
||||
ImGui.EndGroup();
|
||||
ImGui.TreePop();
|
||||
}
|
||||
@@ -614,6 +658,19 @@ namespace PlayerTags
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSimpleCheckbox(string localizedString, ref bool isChecked, System.Action changed)
|
||||
{
|
||||
if (ImGui.Checkbox($"###{localizedString}", ref isChecked))
|
||||
{
|
||||
changed();
|
||||
}
|
||||
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip(localizedString);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawColorButton(string colorId, Vector4 color, System.Action clicked)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, color);
|
||||
|
||||
35
PlayerTags/Resources/Strings.Designer.cs
generated
35
PlayerTags/Resources/Strings.Designer.cs
generated
@@ -556,7 +556,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add a custom tag.
|
||||
/// Looks up a localized string similar to Add.
|
||||
/// </summary>
|
||||
public static string Loc_Static_AddCustomTag {
|
||||
get {
|
||||
@@ -564,6 +564,15 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add a new custom tag..
|
||||
/// </summary>
|
||||
public static string Loc_Static_AddCustomTag_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_AddCustomTag_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add an override..
|
||||
/// </summary>
|
||||
@@ -600,6 +609,15 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add '{0}' to {1}..
|
||||
/// </summary>
|
||||
public static string Loc_Static_Format_AddTagToPlayer {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_Format_AddTagToPlayer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to General.
|
||||
/// </summary>
|
||||
@@ -619,7 +637,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Assign custom tags to party.
|
||||
/// Looks up a localized string similar to Add custom tags to party members.
|
||||
/// </summary>
|
||||
public static string Loc_Static_PartyAssign {
|
||||
get {
|
||||
@@ -628,7 +646,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Player name.
|
||||
/// Looks up a localized string similar to Player.
|
||||
/// </summary>
|
||||
public static string Loc_Static_PlayerName {
|
||||
get {
|
||||
@@ -646,7 +664,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove this custom tag.
|
||||
/// Looks up a localized string similar to Remove.
|
||||
/// </summary>
|
||||
public static string Loc_Static_RemoveCustomTag {
|
||||
get {
|
||||
@@ -654,6 +672,15 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove this custom tag..
|
||||
/// </summary>
|
||||
public static string Loc_Static_RemoveCustomTag_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_RemoveCustomTag_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove this override. The value will be inherited..
|
||||
/// </summary>
|
||||
|
||||
@@ -127,10 +127,10 @@
|
||||
<value>General</value>
|
||||
</data>
|
||||
<data name="Loc_Static_PartyAssign" xml:space="preserve">
|
||||
<value>Assign custom tags to party</value>
|
||||
<value>Add custom tags to party members</value>
|
||||
</data>
|
||||
<data name="Loc_Static_PlayerName" xml:space="preserve">
|
||||
<value>Player name</value>
|
||||
<value>Player</value>
|
||||
</data>
|
||||
<data name="Loc_Static_ContextMenu_AddTag" xml:space="preserve">
|
||||
<value>Add tag</value>
|
||||
@@ -141,6 +141,9 @@
|
||||
<data name="Loc_Static_Nameplates" xml:space="preserve">
|
||||
<value>Nameplates</value>
|
||||
</data>
|
||||
<data name="Loc_Static_Format_AddTagToPlayer" xml:space="preserve">
|
||||
<value>Add '{0}' to {1}.</value>
|
||||
</data>
|
||||
<data name="Loc_IsCustomTagContextMenuEnabled" xml:space="preserve">
|
||||
<value>Enable context menu options for custom tags</value>
|
||||
</data>
|
||||
@@ -274,12 +277,17 @@
|
||||
<value>Remove this override. The value will be inherited.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_AddCustomTag" xml:space="preserve">
|
||||
<value>Add a custom tag</value>
|
||||
<value>Add</value>
|
||||
</data>
|
||||
<data name="Loc_Static_AddCustomTag_Description" xml:space="preserve">
|
||||
<value>Add a new custom tag.</value>
|
||||
</data>
|
||||
<data name="Loc_Static_RemoveCustomTag" xml:space="preserve">
|
||||
<value>Remove this custom tag</value>
|
||||
<value>Remove</value>
|
||||
</data>
|
||||
<data name="Loc_Static_RemoveCustomTag_Description" xml:space="preserve">
|
||||
<value>Remove this custom tag.</value>
|
||||
</data>
|
||||
|
||||
<data name="Loc_Icon" xml:space="preserve">
|
||||
<value>Icon</value>
|
||||
</data>
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace PlayerTags
|
||||
return new string[] { };
|
||||
}
|
||||
|
||||
return GameObjectNamesToApplyTo.InheritedValue.Split(';', ',');
|
||||
return GameObjectNamesToApplyTo.InheritedValue.Split(';', ',').Where(item => !string.IsNullOrEmpty(item)).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace PlayerTags
|
||||
|
||||
newSplitGameObjectNamesToApplyTo.Add(gameObjectName);
|
||||
|
||||
GameObjectNamesToApplyTo = string.Join(";", newSplitGameObjectNamesToApplyTo);
|
||||
GameObjectNamesToApplyTo = string.Join(",", newSplitGameObjectNamesToApplyTo);
|
||||
}
|
||||
|
||||
public void RemoveGameObjectNameToApplyTo(string gameObjectName)
|
||||
@@ -142,7 +142,7 @@ namespace PlayerTags
|
||||
var index = Array.IndexOf(CleanGameObjectNamesToApplyTo, gameObjectName.ToLower());
|
||||
newSplitGameObjectNamesToApplyTo.RemoveAt(index);
|
||||
|
||||
GameObjectNamesToApplyTo = string.Join(";", newSplitGameObjectNamesToApplyTo);
|
||||
GameObjectNamesToApplyTo = string.Join(",", newSplitGameObjectNamesToApplyTo);
|
||||
}
|
||||
|
||||
public Dictionary<string, InheritableData> GetChanges(Dictionary<string, InheritableData>? defaultChanges = null)
|
||||
|
||||
Reference in New Issue
Block a user