Added tabs for config UI
- Added tabs for quick party and vicinity assignment - Added tab to track all tagged players
This commit is contained in:
@@ -69,7 +69,7 @@ namespace PlayerTags
|
||||
m_PluginConfiguration = PluginInterface.GetPluginConfig() as PluginConfiguration ?? new PluginConfiguration();
|
||||
m_PluginConfiguration.Initialize(PluginInterface);
|
||||
m_PluginData.Initialize(DataManager, m_PluginConfiguration);
|
||||
m_PluginConfigurationUI = new PluginConfigurationUI(m_PluginConfiguration, m_PluginData, ClientState, PartyList);
|
||||
m_PluginConfigurationUI = new PluginConfigurationUI(m_PluginConfiguration, m_PluginData, ClientState, PartyList, ObjectTable);
|
||||
|
||||
ClientState.Login += ClientState_Login;
|
||||
ClientState.Logout += ClientState_Logout;
|
||||
|
||||
@@ -20,14 +20,16 @@ namespace PlayerTags
|
||||
private PluginData m_PluginData;
|
||||
private ClientState m_ClientState;
|
||||
private PartyList m_PartyList;
|
||||
private ObjectTable m_ObjectTable;
|
||||
private InheritableValue<ushort>? m_ColorPickerPopupDataContext;
|
||||
|
||||
public PluginConfigurationUI(PluginConfiguration config, PluginData pluginData, ClientState clientState, PartyList partyList)
|
||||
public PluginConfigurationUI(PluginConfiguration config, PluginData pluginData, ClientState clientState, PartyList partyList, ObjectTable objectTable)
|
||||
{
|
||||
m_PluginConfiguration = config;
|
||||
m_PluginData = pluginData;
|
||||
m_ClientState = clientState;
|
||||
m_PartyList = partyList;
|
||||
m_ObjectTable = objectTable;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -43,145 +45,179 @@ 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));
|
||||
DrawComboBox(true, true, false, ref m_PluginConfiguration.NameplateTitleVisibility, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
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();
|
||||
DrawCheckbox(nameof(m_PluginConfiguration.IsShowInheritedPropertiesEnabled), true, ref m_PluginConfiguration.IsShowInheritedPropertiesEnabled, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.BeginGroup();
|
||||
ImGui.Columns(2);
|
||||
|
||||
ImGui.BeginGroup();
|
||||
DrawTree(m_PluginData.AllTags);
|
||||
ImGui.EndGroup();
|
||||
|
||||
ImGui.NextColumn();
|
||||
var selectedTag = m_PluginData.AllTags.Descendents.SingleOrDefault(descendent => descendent.IsSelected.Value);
|
||||
if (selectedTag != null)
|
||||
if (ImGui.BeginTabBar("MainTabs"))
|
||||
{
|
||||
DrawControls(selectedTag);
|
||||
}
|
||||
|
||||
ImGui.EndGroup();
|
||||
ImGui.TreePop();
|
||||
ImGui.Columns(1);
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_PartyAssign);
|
||||
ImGui.TreePush();
|
||||
if (ImGui.BeginTable("##PartyAssignTable", 1 + m_PluginData.CustomTags.Count))
|
||||
{
|
||||
ImGui.TableHeader(Strings.Loc_Static_PlayerName);
|
||||
ImGui.TableSetupColumn(Strings.Loc_Static_PlayerName);
|
||||
ImGui.NextColumn();
|
||||
foreach (var customTag in m_PluginData.CustomTags)
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_General))
|
||||
{
|
||||
ImGui.TableHeader(customTag.Text.InheritedValue);
|
||||
ImGui.TableSetupColumn(customTag.Text.InheritedValue);
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.TreePush();
|
||||
DrawCheckbox(nameof(m_PluginConfiguration.IsCustomTagContextMenuEnabled), true, ref m_PluginConfiguration.IsCustomTagContextMenuEnabled, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.TreePop();
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
DrawHeading(Strings.Loc_Static_Nameplates);
|
||||
ImGui.TreePush();
|
||||
DrawComboBox(true, true, false, ref m_PluginConfiguration.NameplateFreeCompanyVisibility, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
DrawComboBox(true, true, false, ref m_PluginConfiguration.NameplateTitleVisibility, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
DrawComboBox(true, true, false, ref m_PluginConfiguration.NameplateTitlePosition, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.TreePop();
|
||||
|
||||
|
||||
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.EndTabItem();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_Tags))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.TreePush();
|
||||
DrawCheckbox(nameof(m_PluginConfiguration.IsShowInheritedPropertiesEnabled), true, ref m_PluginConfiguration.IsShowInheritedPropertiesEnabled, () => m_PluginConfiguration.Save(m_PluginData));
|
||||
ImGui.BeginGroup();
|
||||
ImGui.Columns(2);
|
||||
|
||||
ImGui.BeginGroup();
|
||||
DrawTree(m_PluginData.AllTags);
|
||||
ImGui.EndGroup();
|
||||
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var drawPartyMember = (string playerName, int rowIndex) =>
|
||||
{
|
||||
ImGui.PushID(playerName);
|
||||
|
||||
ImGui.TableNextRow();
|
||||
|
||||
if (rowIndex % 2 != 0)
|
||||
var selectedTag = m_PluginData.AllTags.Descendents.SingleOrDefault(descendent => descendent.IsSelected.Value);
|
||||
if (selectedTag != null)
|
||||
{
|
||||
var backgroundColor = ImGui.ColorConvertFloat4ToU32(new Vector4(1, 1, 1, 0.05f));
|
||||
ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg1, backgroundColor);
|
||||
DrawControls(selectedTag);
|
||||
}
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.EndGroup();
|
||||
ImGui.TreePop();
|
||||
ImGui.Columns(1);
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(playerName);
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
foreach (Tag customTag in m_PluginData.CustomTags)
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_Party))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.TreePush();
|
||||
if (ImGui.BeginTable("##PartyAssignTable", 1 + m_PluginData.CustomTags.Count))
|
||||
{
|
||||
ImGui.PushID(customTag.GetHashCode().ToString());
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
bool isTagAssigned = customTag.IncludesGameObjectNameToApplyTo(playerName);
|
||||
|
||||
DrawSimpleCheckbox(string.Format(Strings.Loc_Static_Format_AddTagToPlayer, customTag.Text.InheritedValue, playerName), ref isTagAssigned, () =>
|
||||
ImGui.TableHeader(Strings.Loc_Static_PlayerName);
|
||||
ImGui.TableSetupColumn(Strings.Loc_Static_PlayerName);
|
||||
ImGui.NextColumn();
|
||||
foreach (var customTag in m_PluginData.CustomTags)
|
||||
{
|
||||
if (isTagAssigned)
|
||||
{
|
||||
customTag.AddGameObjectNameToApplyTo(playerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
customTag.RemoveGameObjectNameToApplyTo(playerName);
|
||||
}
|
||||
ImGui.TableHeader(customTag.Text.InheritedValue);
|
||||
ImGui.TableSetupColumn(customTag.Text.InheritedValue);
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
});
|
||||
int rowIndex = 0;
|
||||
foreach (var partyMember in m_PartyList.OrderBy(obj => obj.Name.TextValue).ToArray())
|
||||
{
|
||||
DrawPlayerAssignmentRow(partyMember.Name.TextValue, rowIndex);
|
||||
++rowIndex;
|
||||
}
|
||||
|
||||
ImGui.PopID();
|
||||
if (m_PartyList.Length == 0 && m_ClientState.LocalPlayer != null)
|
||||
{
|
||||
DrawPlayerAssignmentRow(m_ClientState.LocalPlayer.Name.TextValue, 0);
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.TreePop();
|
||||
|
||||
ImGui.PopID();
|
||||
};
|
||||
|
||||
int rowIndex = 0;
|
||||
foreach (var partyMember in m_PartyList)
|
||||
{
|
||||
drawPartyMember(partyMember.Name.TextValue, rowIndex);
|
||||
++rowIndex;
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
if (m_PartyList.Length == 0 && m_ClientState.LocalPlayer != null)
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_Vicinity))
|
||||
{
|
||||
drawPartyMember(m_ClientState.LocalPlayer.Name.TextValue, 0);
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.TreePush();
|
||||
if (ImGui.BeginTable("##VicinityAssignTable", 1 + m_PluginData.CustomTags.Count))
|
||||
{
|
||||
ImGui.TableHeader(Strings.Loc_Static_PlayerName);
|
||||
ImGui.TableSetupColumn(Strings.Loc_Static_PlayerName);
|
||||
ImGui.NextColumn();
|
||||
foreach (var customTag in m_PluginData.CustomTags)
|
||||
{
|
||||
ImGui.TableHeader(customTag.Text.InheritedValue);
|
||||
ImGui.TableSetupColumn(customTag.Text.InheritedValue);
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
int rowIndex = 0;
|
||||
foreach (var gameObject in m_ObjectTable.Where(obj => obj is PlayerCharacter).OrderBy(obj => obj.Name.TextValue))
|
||||
{
|
||||
DrawPlayerAssignmentRow(gameObject.Name.TextValue, rowIndex);
|
||||
++rowIndex;
|
||||
}
|
||||
|
||||
if (m_ObjectTable.Length == 0 && m_ClientState.LocalPlayer != null)
|
||||
{
|
||||
DrawPlayerAssignmentRow(m_ClientState.LocalPlayer.Name.TextValue, 0);
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.TreePop();
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
if (ImGui.BeginTabItem(Strings.Loc_Static_TaggedPlayers))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.TreePush();
|
||||
if (ImGui.BeginTable("##TaggedPlayersTable", 1 + m_PluginData.CustomTags.Count))
|
||||
{
|
||||
ImGui.TableHeader(Strings.Loc_Static_PlayerName);
|
||||
ImGui.TableSetupColumn(Strings.Loc_Static_PlayerName);
|
||||
ImGui.NextColumn();
|
||||
foreach (var customTag in m_PluginData.CustomTags)
|
||||
{
|
||||
ImGui.TableHeader(customTag.Text.InheritedValue);
|
||||
ImGui.TableSetupColumn(customTag.Text.InheritedValue);
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
int rowIndex = 0;
|
||||
foreach (var gameObjectName in m_PluginData.CustomTags.SelectMany(customTag => customTag.SplitGameObjectNamesToApplyTo).Distinct().OrderBy(name => name).ToArray())
|
||||
{
|
||||
DrawPlayerAssignmentRow(gameObjectName, rowIndex);
|
||||
++rowIndex;
|
||||
}
|
||||
|
||||
if (m_ObjectTable.Length == 0 && m_ClientState.LocalPlayer != null)
|
||||
{
|
||||
DrawPlayerAssignmentRow(m_ClientState.LocalPlayer.Name.TextValue, 0);
|
||||
}
|
||||
|
||||
ImGui.EndTable();
|
||||
}
|
||||
ImGui.TreePop();
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
ImGui.EndTabBar();
|
||||
}
|
||||
ImGui.TreePop();
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.End();
|
||||
}
|
||||
@@ -192,6 +228,51 @@ namespace PlayerTags
|
||||
}
|
||||
}
|
||||
|
||||
void DrawPlayerAssignmentRow(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)
|
||||
{
|
||||
ImGui.PushID(customTag.GetHashCode().ToString());
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
bool isTagAssigned = customTag.IncludesGameObjectNameToApplyTo(playerName);
|
||||
|
||||
DrawSimpleCheckbox(string.Format(Strings.Loc_Static_Format_AddTagToPlayer, customTag.Text.InheritedValue, playerName), ref isTagAssigned, () =>
|
||||
{
|
||||
if (isTagAssigned)
|
||||
{
|
||||
customTag.AddGameObjectNameToApplyTo(playerName);
|
||||
}
|
||||
else
|
||||
{
|
||||
customTag.RemoveGameObjectNameToApplyTo(playerName);
|
||||
}
|
||||
|
||||
m_PluginConfiguration.Save(m_PluginData);
|
||||
});
|
||||
|
||||
ImGui.PopID();
|
||||
}
|
||||
|
||||
ImGui.PopID();
|
||||
}
|
||||
|
||||
public string GetTreeItemName(Tag tag)
|
||||
{
|
||||
string itemName = tag.Name.Value;
|
||||
|
||||
28
PlayerTags/Resources/Strings.Designer.cs
generated
28
PlayerTags/Resources/Strings.Designer.cs
generated
@@ -133,7 +133,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Enable context menu integration.
|
||||
/// Looks up a localized string similar to Context menu integration.
|
||||
/// </summary>
|
||||
public static string Loc_IsCustomTagContextMenuEnabled {
|
||||
get {
|
||||
@@ -142,7 +142,7 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to When opening the player context menu, options will be available to add and remove custom tags for the selected player..
|
||||
/// Looks up a localized string similar to Options will be available in context menus for adding and removing custom tags from players..
|
||||
/// </summary>
|
||||
public static string Loc_IsCustomTagContextMenuEnabled_Description {
|
||||
get {
|
||||
@@ -682,11 +682,11 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Add custom tags to party members.
|
||||
/// Looks up a localized string similar to Party.
|
||||
/// </summary>
|
||||
public static string Loc_Static_PartyAssign {
|
||||
public static string Loc_Static_Party {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_PartyAssign", resourceCulture);
|
||||
return ResourceManager.GetString("Loc_Static_Party", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -726,6 +726,15 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tagged Players.
|
||||
/// </summary>
|
||||
public static string Loc_Static_TaggedPlayers {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_TaggedPlayers", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tags.
|
||||
/// </summary>
|
||||
@@ -735,6 +744,15 @@ namespace PlayerTags.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Vicinity.
|
||||
/// </summary>
|
||||
public static string Loc_Static_Vicinity {
|
||||
get {
|
||||
return ResourceManager.GetString("Loc_Static_Vicinity", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to This plugin can modify nameplates. When combined with other plugins that modify nameplates, you are likely to see unexpected behavior..
|
||||
/// </summary>
|
||||
|
||||
@@ -126,8 +126,14 @@
|
||||
<data name="Loc_Static_General" xml:space="preserve">
|
||||
<value>General</value>
|
||||
</data>
|
||||
<data name="Loc_Static_PartyAssign" xml:space="preserve">
|
||||
<value>Add custom tags to party members</value>
|
||||
<data name="Loc_Static_Party" xml:space="preserve">
|
||||
<value>Party</value>
|
||||
</data>
|
||||
<data name="Loc_Static_Vicinity" xml:space="preserve">
|
||||
<value>Vicinity</value>
|
||||
</data>
|
||||
<data name="Loc_Static_TaggedPlayers" xml:space="preserve">
|
||||
<value>Tagged Players</value>
|
||||
</data>
|
||||
<data name="Loc_Static_PlayerName" xml:space="preserve">
|
||||
<value>Player</value>
|
||||
@@ -154,10 +160,10 @@
|
||||
<value>Expanded</value>
|
||||
</data>
|
||||
<data name="Loc_IsCustomTagContextMenuEnabled" xml:space="preserve">
|
||||
<value>Enable context menu integration</value>
|
||||
<value>Context menu integration</value>
|
||||
</data>
|
||||
<data name="Loc_IsCustomTagContextMenuEnabled_Description" xml:space="preserve">
|
||||
<value>When opening the player context menu, options will be available to add and remove custom tags for the selected player.</value>
|
||||
<value>Options will be available in context menus for adding and removing custom tags from players.</value>
|
||||
</data>
|
||||
<data name="Loc_IsShowInheritedPropertiesEnabled" xml:space="preserve">
|
||||
<value>Show inherited properties</value>
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace PlayerTags
|
||||
|
||||
public InheritableReference<string> GameObjectNamesToApplyTo = new InheritableReference<string>("");
|
||||
|
||||
private string[] SplitGameObjectNamesToApplyTo
|
||||
public string[] SplitGameObjectNamesToApplyTo
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user