GameData Changes

- when changing the gamedata files (add, delete, reload) it will reload all the gamedata files and repopulate the server managers.
- updated the viewmodels to check for valid class names.
This commit is contained in:
Brett Hewitson 2022-06-17 18:41:05 +10:00
parent 1bf04ed33e
commit 479e4a64dc
33 changed files with 427 additions and 305 deletions

View file

@ -65,6 +65,8 @@ namespace ServerManagerTool
}
this.DataContext = this;
GameData.GameDataLoaded += GameData_GameDataLoaded;
}
public App AppInstance
@ -396,15 +398,21 @@ namespace ServerManagerTool
e.Handled = true;
}
private void GameData_GameDataLoaded(object sender, EventArgs e)
{
PopulateRconMessageModesComboBox();
}
private void LanguageSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Config.CultureName = AvailableLanguages.Instance.SelectedLanguage;
PopulateWindowsStatesMainWindowComboBox();
PopulateWindowsStatesServerMonitorWindowComboBox();
PopulateRconMessageModesComboBox();
PopulateTaskPrioritiesComboBox();
GameData_GameDataLoaded(sender, e);
App.Instance.OnResourceDictionaryChanged(Config.CultureName);
}
@ -490,6 +498,11 @@ namespace ServerManagerTool
}
}
public void CloseControl()
{
GameData.GameDataLoaded -= GameData_GameDataLoaded;
}
private void PopulateWindowsStatesMainWindowComboBox()
{
var selectedValue = this.WindowStateMainWindowComboBox?.SelectedValue ?? Config.MainWindow_WindowState;

View file

@ -342,9 +342,36 @@ namespace ServerManagerTool
// hook into the language change event
GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent;
GameData.GameDataLoaded += GameData_GameDataLoaded;
}
#region Event Methods
private void GameData_GameDataLoaded(object sender, EventArgs e)
{
this.RefreshBaseDinoModList();
this.RefreshBaseEngramModList();
this.RefreshBaseResourceModList();
this.RefreshBaseDinoList();
this.RefreshBaseMapSpawnerList();
this.RefreshBasePrimalItemList();
this.RefreshBaseSupplyCrateList();
this.RefreshBaseGameMapsList();
this.RefreshBaseTotalConversionsList();
this.RefreshBaseBranchesList();
this.RefreshBaseEventsList();
this.RefreshProcessPrioritiesList();
this.RefreshCustomLevelProgressionsInformation();
this.HarvestResourceItemAmountClassMultipliersListBox.Items.Refresh();
this.Settings.ConfigOverrideItemCraftingCosts.Update();
this.Settings.ConfigOverrideItemMaxQuantity.Update();
this.Settings.ConfigOverrideSupplyCrateItems.Update();
this.Settings.NPCSpawnSettings.Update();
this.Settings.PreventTransferForClassNames.Update();
}
private static void ServerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ssc = (ServerSettingsControl)d;
@ -378,30 +405,8 @@ namespace ServerManagerTool
{
this.CurrentCulture = Thread.CurrentThread.CurrentCulture;
this.Settings.DinoSettings.UpdateForLocalization();
this.Settings.EngramSettings.UpdateForLocalization();
this.Settings.NPCSpawnSettings.UpdateForLocalization();
this.Settings.ConfigOverrideSupplyCrateItems.UpdateForLocalization();
this.Settings.ConfigOverrideItemMaxQuantity.UpdateForLocalization();
this.RefreshBaseDinoModList();
this.RefreshBaseEngramModList();
this.RefreshBaseResourceModList();
this.RefreshBaseDinoList();
this.RefreshBaseMapSpawnerList();
this.RefreshBasePrimalItemList();
this.RefreshBaseSupplyCrateList();
this.RefreshBaseGameMapsList();
this.RefreshBaseTotalConversionsList();
this.RefreshBaseBranchesList();
this.RefreshBaseEventsList();
this.RefreshProcessPrioritiesList();
this.HarvestResourceItemAmountClassMultipliersListBox.Items.Refresh();
this.RefreshCustomLevelProgressionsInformation();
this.UpdateLastStartedDetails(false);
GameData_GameDataLoaded(source, e);
Runtime.UpdateServerStatusString();
}
@ -3487,6 +3492,12 @@ namespace ServerManagerTool
#endregion
#region Methods
public void CloseControl()
{
GameData.GameDataLoaded -= GameData_GameDataLoaded;
GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent -= ResourceDictionaryChangedEvent;
}
public void RefreshBaseDinoModList()
{
var selectedValue = SelectedModDino;