diff --git a/src/ARKServerManager/ARKServerManager.csproj b/src/ARKServerManager/ARKServerManager.csproj index fc38de06..cb4c8f93 100644 --- a/src/ARKServerManager/ARKServerManager.csproj +++ b/src/ARKServerManager/ARKServerManager.csproj @@ -239,9 +239,6 @@ ServerMonitorWindow.xaml - - SupplyCrateOverridesWindow.xaml - VersionFeedWindow.xaml @@ -314,6 +311,11 @@ SettingsWindow.xaml + + + + + Always @@ -417,10 +419,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile diff --git a/src/ARKServerManager/Art/Collapse.ico b/src/ARKServerManager/Art/Collapse.ico new file mode 100644 index 00000000..7b5a3cf5 Binary files /dev/null and b/src/ARKServerManager/Art/Collapse.ico differ diff --git a/src/ARKServerManager/Art/Expand.ico b/src/ARKServerManager/Art/Expand.ico new file mode 100644 index 00000000..8fb70ffa Binary files /dev/null and b/src/ARKServerManager/Art/Expand.ico differ diff --git a/src/ARKServerManager/Art/StatusBad.ico b/src/ARKServerManager/Art/StatusBad.ico new file mode 100644 index 00000000..2baffa9d Binary files /dev/null and b/src/ARKServerManager/Art/StatusBad.ico differ diff --git a/src/ARKServerManager/Art/StatusGood.ico b/src/ARKServerManager/Art/StatusGood.ico new file mode 100644 index 00000000..c1c810bd Binary files /dev/null and b/src/ARKServerManager/Art/StatusGood.ico differ diff --git a/src/ARKServerManager/Art/StatusWarning.ico b/src/ARKServerManager/Art/StatusWarning.ico new file mode 100644 index 00000000..67b2ce82 Binary files /dev/null and b/src/ARKServerManager/Art/StatusWarning.ico differ diff --git a/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs b/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs index db6daa2d..5dffb92d 100644 --- a/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs +++ b/src/ARKServerManager/Lib/Model/SupplyCrateOverride.cs @@ -3,6 +3,10 @@ using ServerManagerTool.Common.Model; using ServerManagerTool.Lib.ViewModel; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Collections.Specialized; +using System.ComponentModel; +using System.Linq; using System.Runtime.Serialization; using System.Windows; @@ -37,14 +41,16 @@ namespace ServerManagerTool.Lib errors.Add($"Missing Supply Crate Item Weight: Crate '{supplyCrate.SupplyCrateClassString}'; Set '{itemSet.SetName}'; Entry '{itemEntry.ItemEntryName}'; Item '{itemEntry.ItemClassStrings[index]}'."); itemEntry.Items.Add(new SupplyCrateItemEntrySettings { - ItemClassString = itemEntry.ItemClassStrings[index], - ItemWeight = itemsWeight, - }); + ItemClassString = itemEntry.ItemClassStrings[index], + ItemWeight = itemsWeight, + }); } } } } + Update(); + return errors.ToArray(); } @@ -72,6 +78,14 @@ namespace ServerManagerTool.Lib public void UpdateForLocalization() { } + + public void Update(bool recursive = true) + { + IsEnabled = this.Count > 0; + + foreach (var supplyCrate in this) + supplyCrate.Update(recursive); + } } [DataContract] @@ -167,7 +181,10 @@ namespace ServerManagerTool.Lib public override void InitializeFromINIValue(string value) { if (string.IsNullOrWhiteSpace(value)) + { + Update(); return; + } var kvPair = value.Split(new[] { '=' }, 2); var kvValue = kvPair[1].Trim(' '); @@ -186,7 +203,34 @@ namespace ServerManagerTool.Lib public string DisplayName => GameData.FriendlySupplyCrateNameForClass(SupplyCrateClassString); - public bool IsValid => !string.IsNullOrWhiteSpace(SupplyCrateClassString) && ItemSets.Count > 0; + public string DisplayNameFull + { + get + { + var modName = GameData.FriendlySupplyCrateModNameForClass(SupplyCrateClassString); ; + return $"{(string.IsNullOrWhiteSpace(modName) ? string.Empty : $"({modName}) ")}{DisplayName}"; + } + } + + public bool IsViewValid => !string.IsNullOrWhiteSpace(SupplyCrateClassString) && (ItemSets?.Count ?? 0) > 0; + + public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(SupplyCrateOverride), new PropertyMetadata("N")); + public string ValidStatus + { + get { return (string)GetValue(ValidStatusProperty); } + set { SetValue(ValidStatusProperty, value); } + } + + public void Update(bool recursive = true) + { + if (recursive && ItemSets != null) + { + foreach (var itemSet in ItemSets) + itemSet.Update(recursive); + } + + ValidStatus = IsViewValid ? (ItemSets.Any(i => i.ValidStatus == "N") ? "N" : (ItemSets.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + } } [DataContract] @@ -280,7 +324,27 @@ namespace ServerManagerTool.Lib return base.ToComplexINIValue(false); } - public bool IsValid => ItemEntries.Count > 0; + public string DisplayNameFull => SetName; + + public bool IsViewValid => (ItemEntries?.Count ?? 0) > 0; + + public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(SupplyCrateItemSet), new PropertyMetadata("N")); + public string ValidStatus + { + get { return (string)GetValue(ValidStatusProperty); } + set { SetValue(ValidStatusProperty, value); } + } + + public void Update(bool recursive = true) + { + if (recursive && ItemEntries != null) + { + foreach (var itemEntry in ItemEntries) + itemEntry.Update(recursive); + } + + ValidStatus = IsViewValid ? (ItemEntries.Any(i => i.ValidStatus == "N") ? "N" : (ItemEntries.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + } } [DataContract] @@ -411,8 +475,30 @@ namespace ServerManagerTool.Lib return base.ToComplexINIValue(false); } + public string DisplayNameFull => ItemEntryName; + + public float ChanceToBeBlueprint => ForceBlueprint ? 1 : ChanceToBeBlueprintOverride; + public bool IsModelValid => ItemClassStrings.Count > 0 && ItemClassStrings.Count == ItemsWeights.Count; - public bool IsViewValid => Items.Count > 0; + public bool IsViewValid => (Items?.Count ?? 0) > 0; + + public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(SupplyCrateItemSetEntry), new PropertyMetadata("N")); + public string ValidStatus + { + get { return (string)GetValue(ValidStatusProperty); } + set { SetValue(ValidStatusProperty, value); } + } + + public void Update(bool recursive = true) + { + if (recursive && Items != null) + { + foreach (var item in Items) + item.Update(); + } + + ValidStatus = IsViewValid ? (Items.Any(i => i.ValidStatus == "N") ? "N" : (Items.Any(i => i.ValidStatus == "W") ? "W" : "Y")) : "N"; + } } } diff --git a/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs b/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs index a714d2aa..07d81387 100644 --- a/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs +++ b/src/ARKServerManager/Lib/ViewModel/SupplyCrateSettings.cs @@ -18,8 +18,29 @@ namespace ServerManagerTool.Lib.ViewModel set { SetValue(ItemWeightProperty, value); } } - public string DisplayName => GameData.FriendlySupplyCrateNameForClass(ItemClassString); + public string DisplayName => GameData.FriendlyItemNameForClass(ItemClassString); - public bool IsValid => !string.IsNullOrWhiteSpace(ItemClassString); + public string DisplayNameFull + { + get + { + var modName = GameData.FriendlyItemModNameForClass(ItemClassString); ; + return $"{(string.IsNullOrWhiteSpace(modName) ? string.Empty : $"({modName}) ")}{DisplayName}"; + } + } + + public bool IsViewValid => !string.IsNullOrWhiteSpace(ItemClassString); + + public static readonly DependencyProperty ValidStatusProperty = DependencyProperty.Register(nameof(ValidStatus), typeof(string), typeof(SupplyCrateItemEntrySettings), new PropertyMetadata("N")); + public string ValidStatus + { + get { return (string)GetValue(ValidStatusProperty); } + set { SetValue(ValidStatusProperty, value); } + } + + public void Update() + { + ValidStatus = IsViewValid ? (GameData.HasItemForClass(ItemClassString) ? "Y" : "W") : "N"; + } } } diff --git a/src/ARKServerManager/VersionFeed.xml b/src/ARKServerManager/VersionFeed.xml index b26e506a..8133d50e 100644 --- a/src/ARKServerManager/VersionFeed.xml +++ b/src/ARKServerManager/VersionFeed.xml @@ -19,6 +19,7 @@ CHANGES
    +
  • Server Settings - Supply Crate Section - Added indicator icons to each grid row, for better troubleshooting of possible issues.
  • ru-RU Translation file updated.

diff --git a/src/ARKServerManager/VersionFeedBeta.xml b/src/ARKServerManager/VersionFeedBeta.xml index 95b87594..ed373e6e 100644 --- a/src/ARKServerManager/VersionFeedBeta.xml +++ b/src/ARKServerManager/VersionFeedBeta.xml @@ -19,6 +19,7 @@ CHANGES
    +
  • Server Settings - Supply Crate Section - Added indicator icons to each grid row, for better troubleshooting of possible issues.
  • ru-RU Translation file updated.

diff --git a/src/ARKServerManager/Windows/ServerSettingsControl.xaml b/src/ARKServerManager/Windows/ServerSettingsControl.xaml index 497dfc5f..799085e4 100644 --- a/src/ARKServerManager/Windows/ServerSettingsControl.xaml +++ b/src/ARKServerManager/Windows/ServerSettingsControl.xaml @@ -27,7 +27,6 @@ - @@ -5089,10 +5088,10 @@ - - - - + + + + @@ -5121,7 +5120,7 @@ - + + + + + + @@ -5145,24 +5166,24 @@ - + - - + + - - + + - - + + @@ -5252,7 +5273,7 @@ - + + + + + + - + - - + + - - + + - - + + - - + + @@ -5342,7 +5385,7 @@ - + + + + + + - + - - + + - - + + - - + + - - + + - - + + @@ -5411,8 +5476,8 @@ - - + + @@ -5444,7 +5509,7 @@ - + + + + + + @@ -5468,11 +5555,11 @@ - + - + diff --git a/src/ARKServerManager/Windows/ServerSettingsControl.xaml.cs b/src/ARKServerManager/Windows/ServerSettingsControl.xaml.cs index a9770d05..9b53372e 100644 --- a/src/ARKServerManager/Windows/ServerSettingsControl.xaml.cs +++ b/src/ARKServerManager/Windows/ServerSettingsControl.xaml.cs @@ -1288,6 +1288,11 @@ namespace ServerManagerTool } } + private void SupplyCratesGrids_SourceUpdated(object sender, DataTransferEventArgs e) + { + Settings.ConfigOverrideSupplyCrateItems.Update(); + } + #region Dinos private void DinoCustomization_Reset(object sender, RoutedEventArgs e) { @@ -3003,7 +3008,7 @@ namespace ServerManagerTool private void AddSupplyCrate_Click(object sender, RoutedEventArgs e) { Settings.ConfigOverrideSupplyCrateItems.Add(new SupplyCrateOverride()); - Settings.ConfigOverrideSupplyCrateItems.IsEnabled = true; + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void AddSupplyCrateItemSet_Click(object sender, RoutedEventArgs e) @@ -3015,6 +3020,7 @@ namespace ServerManagerTool } SelectedSupplyCrateOverride.ItemSets.Add(new SupplyCrateItemSet()); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void AddSupplyCrateItemSetEntry_Click(object sender, RoutedEventArgs e) @@ -3026,6 +3032,7 @@ namespace ServerManagerTool } SelectedSupplyCrateItemSet.ItemEntries.Add(new SupplyCrateItemSetEntry()); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void AddSupplyCrateItem_Click(object sender, RoutedEventArgs e) @@ -3037,6 +3044,7 @@ namespace ServerManagerTool } SelectedSupplyCrateItemSetEntry.Items.Add(new SupplyCrateItemEntrySettings()); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void ClearSupplyCrates_Click(object sender, RoutedEventArgs e) @@ -3048,7 +3056,7 @@ namespace ServerManagerTool SelectedSupplyCrateItemSet = null; SelectedSupplyCrateOverride = null; Settings.ConfigOverrideSupplyCrateItems.Clear(); - Settings.ConfigOverrideSupplyCrateItems.IsEnabled = false; + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void ClearSupplyCrateItemSets_Click(object sender, RoutedEventArgs e) @@ -3059,6 +3067,7 @@ namespace ServerManagerTool SelectedSupplyCrateItemSetEntry = null; SelectedSupplyCrateItemSet = null; SelectedSupplyCrateOverride?.ItemSets.Clear(); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void ClearSupplyCrateItemSetEntries_Click(object sender, RoutedEventArgs e) @@ -3068,6 +3077,7 @@ namespace ServerManagerTool SelectedSupplyCrateItemSetEntry = null; SelectedSupplyCrateItemSet?.ItemEntries.Clear(); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void ClearSupplyCrateItems_Click(object sender, RoutedEventArgs e) @@ -3076,6 +3086,7 @@ namespace ServerManagerTool return; SelectedSupplyCrateItemSetEntry?.Items.Clear(); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void PasteSupplyCrate_Click(object sender, RoutedEventArgs e) @@ -3127,7 +3138,7 @@ namespace ServerManagerTool var item = ((SupplyCrateOverride)((Button)e.Source).DataContext); Settings.ConfigOverrideSupplyCrateItems.Remove(item); - Settings.ConfigOverrideSupplyCrateItems.IsEnabled = Settings.ConfigOverrideSupplyCrateItems.Count > 0; + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void RemoveSupplyCrateItemSet_Click(object sender, RoutedEventArgs e) @@ -3140,6 +3151,7 @@ namespace ServerManagerTool var item = ((SupplyCrateItemSet)((Button)e.Source).DataContext); SelectedSupplyCrateOverride.ItemSets.Remove(item); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void RemoveSupplyCrateItemSetEntry_Click(object sender, RoutedEventArgs e) @@ -3152,6 +3164,7 @@ namespace ServerManagerTool var item = ((SupplyCrateItemSetEntry)((Button)e.Source).DataContext); SelectedSupplyCrateItemSet.ItemEntries.Remove(item); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void RemoveSupplyCrateItem_Click(object sender, RoutedEventArgs e) @@ -3164,6 +3177,7 @@ namespace ServerManagerTool var item = ((SupplyCrateItemEntrySettings)((Button)e.Source).DataContext); SelectedSupplyCrateItemSetEntry.Items.Remove(item); + Settings.ConfigOverrideSupplyCrateItems.Update(); } private void SaveSupplyCrates_Click(object sender, RoutedEventArgs e) diff --git a/src/ARKServerManager/Windows/SupplyCrateOverridesWindow.xaml b/src/ARKServerManager/Windows/SupplyCrateOverridesWindow.xaml deleted file mode 100644 index 7e46d4f7..00000000 --- a/src/ARKServerManager/Windows/SupplyCrateOverridesWindow.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - diff --git a/src/ARKServerManager/Windows/SupplyCrateOverridesWindow.xaml.cs b/src/ARKServerManager/Windows/SupplyCrateOverridesWindow.xaml.cs deleted file mode 100644 index 59f5b683..00000000 --- a/src/ARKServerManager/Windows/SupplyCrateOverridesWindow.xaml.cs +++ /dev/null @@ -1,49 +0,0 @@ -using NLog; -using ServerManagerTool.Common.Utils; -using ServerManagerTool.Lib; -using System; -using System.ComponentModel; -using System.Windows; -using WPFSharp.Globalizer; - -namespace ServerManagerTool -{ - /// - /// Interaction logic for SupplyCrateOverridesWindow.xaml - /// - public partial class SupplyCrateOverridesWindow : Window - { - private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); - - public EventHandler SavePerformed; - - private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance; - private readonly ServerProfile _profile = null; - - public SupplyCrateOverridesWindow(ServerProfile profile) - { - InitializeComponent(); - WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile); - - _profile = profile; - this.Title = $"{this.Title} - {_profile?.ProfileName}"; // string.Format(_globalizer.GetResourceString("SupplyCrateOverridesWindow_ProfileTitle"), _profile?.ProfileName); - - this.DataContext = this; - } - - private async void Window_Loaded(object sender, RoutedEventArgs e) - { - - } - - private void Window_Closing(object sender, CancelEventArgs e) - { - - } - - protected void OnSavePerformed() - { - SavePerformed?.Invoke(this, new ProfileEventArgs(_profile)); - } - } -}