From 4b60fa18b61e5220db6c5336d08d40af8b549615 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Sat, 3 Sep 2022 12:17:21 +0200 Subject: [PATCH] add ui option for activity context profiles --- .../Configuration/PluginConfiguration.cs | 1 + .../Configuration/PluginConfigurationUI.cs | 73 ++++++++++-- PlayerTags/Resources/Strings.Designer.cs | 108 ++++++++++++++++++ PlayerTags/Resources/Strings.de.resx | 36 +++--- PlayerTags/Resources/Strings.resx | 36 ++++++ 5 files changed, 227 insertions(+), 27 deletions(-) diff --git a/PlayerTags/Configuration/PluginConfiguration.cs b/PlayerTags/Configuration/PluginConfiguration.cs index aa5e778..2d9efb7 100644 --- a/PlayerTags/Configuration/PluginConfiguration.cs +++ b/PlayerTags/Configuration/PluginConfiguration.cs @@ -36,6 +36,7 @@ namespace PlayerTags.Configuration public bool IsPlayersTabAllianceVisible = true; public bool IsPlayersTabEnemiesVisible = true; public bool IsPlayersTabOthersVisible = false; + public bool IsGeneralOptionsAllTheSameEnabled = true; [JsonProperty(TypeNameHandling = TypeNameHandling.None, ItemTypeNameHandling = TypeNameHandling.None)] public Dictionary AllTagsChanges = new Dictionary(); diff --git a/PlayerTags/Configuration/PluginConfigurationUI.cs b/PlayerTags/Configuration/PluginConfigurationUI.cs index ef4fd27..ae73ad4 100644 --- a/PlayerTags/Configuration/PluginConfigurationUI.cs +++ b/PlayerTags/Configuration/PluginConfigurationUI.cs @@ -65,6 +65,12 @@ namespace PlayerTags.Configuration DrawCheckbox(nameof(m_PluginConfiguration.IsCustomTagsContextMenuEnabled), true, ref m_PluginConfiguration.IsCustomTagsContextMenuEnabled, () => SaveSettings()); + ImGui.Spacing(); + ImGui.Spacing(); + DrawHeading(Strings.Loc_Static_CurrentActivityProfile); + DrawComboBox(true, true, false, ref propertyProxy.CurrentActivityContext, () => SaveSettings(false)); + + ImGui.Spacing(); ImGui.Spacing(); DrawHeading(Strings.Loc_Static_Nameplates); @@ -72,13 +78,17 @@ namespace PlayerTags.Configuration DrawComboBox(true, true, false, ref propertyProxy.NameplateTitleVisibility, () => SaveSettings(true)); DrawComboBox(true, true, false, ref propertyProxy.NameplateTitlePosition, () => SaveSettings(true)); + ImGui.Spacing(); + ImGui.Spacing(); + DrawHeading(Strings.Loc_Static_ChatExperimental); + DrawCheckbox(nameof(propertyProxy.IsLinkSelfInChatEnabled), true, ref propertyProxy.IsLinkSelfInChatEnabled, () => SaveSettings(true)); + DrawCheckbox(nameof(propertyProxy.IsApplyTagsToAllChatMessagesEnabled), true, ref propertyProxy.IsApplyTagsToAllChatMessagesEnabled, () => SaveSettings(true)); + ImGui.Spacing(); ImGui.Spacing(); - DrawHeading(Strings.Loc_Static_Experimental); + DrawHeading(Strings.Loc_Static_OtherExperimental); DrawCheckbox(nameof(m_PluginConfiguration.IsPlayerNameRandomlyGenerated), true, ref m_PluginConfiguration.IsPlayerNameRandomlyGenerated, () => SaveSettings()); - DrawCheckbox(nameof(propertyProxy.IsLinkSelfInChatEnabled), true, ref propertyProxy.IsLinkSelfInChatEnabled, () => SaveSettings(true)); - DrawCheckbox(nameof(propertyProxy.IsApplyTagsToAllChatMessagesEnabled), true, ref propertyProxy.IsApplyTagsToAllChatMessagesEnabled, () => SaveSettings(true)); ImGui.EndTabItem(); } @@ -1176,6 +1186,7 @@ namespace PlayerTags.Configuration { private PluginConfiguration pluginConfig; + public ActivityContextSelection CurrentActivityContext; public NameplateFreeCompanyVisibility NameplateFreeCompanyVisibility; public NameplateTitleVisibility NameplateTitleVisibility; public NameplateTitlePosition NameplateTitlePosition; @@ -1185,20 +1196,34 @@ namespace PlayerTags.Configuration public PropertyProxy(PluginConfiguration config) { pluginConfig = config; + CurrentActivityContext = config.IsGeneralOptionsAllTheSameEnabled ? ActivityContextSelection.All : ActivityContextSelection.None; } public void LoadData() { - NameplateFreeCompanyVisibility = pluginConfig.GeneralOptions[ActivityContext.None].NameplateFreeCompanyVisibility; - NameplateTitleVisibility = pluginConfig.GeneralOptions[ActivityContext.None].NameplateTitleVisibility; - NameplateTitlePosition = pluginConfig.GeneralOptions[ActivityContext.None].NameplateTitlePosition; - IsApplyTagsToAllChatMessagesEnabled = pluginConfig.GeneralOptions[ActivityContext.None].IsApplyTagsToAllChatMessagesEnabled; - IsLinkSelfInChatEnabled = pluginConfig.GeneralOptions[ActivityContext.None].IsLinkSelfInChatEnabled; + var currentActivityContext = GetActivityContext(CurrentActivityContext); + NameplateFreeCompanyVisibility = pluginConfig.GeneralOptions[currentActivityContext].NameplateFreeCompanyVisibility; + NameplateTitleVisibility = pluginConfig.GeneralOptions[currentActivityContext].NameplateTitleVisibility; + NameplateTitlePosition = pluginConfig.GeneralOptions[currentActivityContext].NameplateTitlePosition; + IsApplyTagsToAllChatMessagesEnabled = pluginConfig.GeneralOptions[currentActivityContext].IsApplyTagsToAllChatMessagesEnabled; + IsLinkSelfInChatEnabled = pluginConfig.GeneralOptions[currentActivityContext].IsLinkSelfInChatEnabled; } public void SaveData() { - foreach (var key in pluginConfig.GeneralOptions.Keys) + if (CurrentActivityContext == ActivityContextSelection.All) + { + pluginConfig.IsGeneralOptionsAllTheSameEnabled = true; + foreach (var key in pluginConfig.GeneralOptions.Keys) + applyChanges(key); + } + else + { + pluginConfig.IsGeneralOptionsAllTheSameEnabled = false; + applyChanges(GetActivityContext(CurrentActivityContext)); + } + + void applyChanges(ActivityContext key) { pluginConfig.GeneralOptions[key].NameplateFreeCompanyVisibility = NameplateFreeCompanyVisibility; pluginConfig.GeneralOptions[key].NameplateTitleVisibility = NameplateTitleVisibility; @@ -1207,6 +1232,36 @@ namespace PlayerTags.Configuration pluginConfig.GeneralOptions[key].IsLinkSelfInChatEnabled = IsLinkSelfInChatEnabled; } } + + private ActivityContext GetActivityContext(ActivityContextSelection selection) + { + ActivityContext result; + + switch (selection) + { + case ActivityContextSelection.PveDuty: + result = ActivityContext.PveDuty; + break; + case ActivityContextSelection.PvpDuty: + result = ActivityContext.PvpDuty; + break; + case ActivityContextSelection.All: + case ActivityContextSelection.None: + default: + result = ActivityContext.None; + break; + } + + return result; + } + } + + private enum ActivityContextSelection + { + All, + None, + PveDuty, + PvpDuty } } } diff --git a/PlayerTags/Resources/Strings.Designer.cs b/PlayerTags/Resources/Strings.Designer.cs index 24f48a9..be0b1f5 100644 --- a/PlayerTags/Resources/Strings.Designer.cs +++ b/PlayerTags/Resources/Strings.Designer.cs @@ -69,6 +69,87 @@ namespace PlayerTags.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Below options to be apply for ähnelt. + /// + public static string Loc_ActivityContextSelection { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Everywhere ähnelt. + /// + public static string Loc_ActivityContextSelection_All { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_All", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die The most options below will apply everywhere you are. They will be the same in Overworld, in PvE Duties and PvP Duties. Your options defined specifically for another context will be overwritten. ähnelt. + /// + public static string Loc_ActivityContextSelection_All_Description { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_All_Description", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die No Duty ähnelt. + /// + public static string Loc_ActivityContextSelection_None { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_None", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die The most options below will apply only if you are outside of any duty. ähnelt. + /// + public static string Loc_ActivityContextSelection_None_Description { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_None_Description", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die PvE Duties ähnelt. + /// + public static string Loc_ActivityContextSelection_PveDuty { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_PveDuty", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die The most options below will apply only to PvE Duties. ähnelt. + /// + public static string Loc_ActivityContextSelection_PveDuty_Description { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_PveDuty_Description", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die PvP Duties ähnelt. + /// + public static string Loc_ActivityContextSelection_PvpDuty { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_PvpDuty", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die The most options below will apply only to PvP Duties. ähnelt. + /// + public static string Loc_ActivityContextSelection_PvpDuty_Description { + get { + return ResourceManager.GetString("Loc_ActivityContextSelection_PvpDuty_Description", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Custom ähnelt. /// @@ -1113,6 +1194,15 @@ namespace PlayerTags.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Chat (Erperimental) ähnelt. + /// + public static string Loc_Static_ChatExperimental { + get { + return ResourceManager.GetString("Loc_Static_ChatExperimental", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Add tag: {0} ähnelt. /// @@ -1131,6 +1221,15 @@ namespace PlayerTags.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Current Activity Profile ähnelt. + /// + public static string Loc_Static_CurrentActivityProfile { + get { + return ResourceManager.GetString("Loc_Static_CurrentActivityProfile", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Development ähnelt. /// @@ -1203,6 +1302,15 @@ namespace PlayerTags.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Other (Experimental) ähnelt. + /// + public static string Loc_Static_OtherExperimental { + get { + return ResourceManager.GetString("Loc_Static_OtherExperimental", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die Player ähnelt. /// diff --git a/PlayerTags/Resources/Strings.de.resx b/PlayerTags/Resources/Strings.de.resx index a67b4aa..41de432 100644 --- a/PlayerTags/Resources/Strings.de.resx +++ b/PlayerTags/Resources/Strings.de.resx @@ -59,46 +59,46 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - - + + - + - - - - + + + + - - + + - - + + - - - - + + + + - + - + @@ -127,7 +127,7 @@ Generell - Quick Tag + Schnell-Tag Getaggte Spieler diff --git a/PlayerTags/Resources/Strings.resx b/PlayerTags/Resources/Strings.resx index d7f1ecf..1f99ebc 100644 --- a/PlayerTags/Resources/Strings.resx +++ b/PlayerTags/Resources/Strings.resx @@ -585,4 +585,40 @@ Whether the color will be applied to the free company in nameplates. + + Everywhere + + + No Duty + + + PvE Duties + + + PvP Duties + + + Current Activity Profile + + + Below options to be apply for + + + The most options below will apply everywhere you are. They will be the same in Overworld, in PvE Duties and PvP Duties. Your options defined specifically for another context will be overwritten. + + + The most options below will apply only if you are outside of any duty. + + + The most options below will apply only to PvE Duties. + + + The most options below will apply only to PvP Duties. + + + Chat (Erperimental) + + + Other (Experimental) + \ No newline at end of file