mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-09 04:31:06 +00:00
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:
parent
1bf04ed33e
commit
479e4a64dc
33 changed files with 427 additions and 305 deletions
|
|
@ -12,12 +12,20 @@ namespace ServerManagerTool.Lib
|
|||
{
|
||||
public const string RCONINPUTMODE_COMMAND = "Command";
|
||||
|
||||
public static event EventHandler GameDataLoaded;
|
||||
|
||||
public static string MainDataFolder = Path.Combine(Environment.CurrentDirectory, Config.Default.GameDataRelativePath);
|
||||
public static string UserDataFolder = Path.Combine(Config.Default.DataPath, Config.Default.GameDataRelativePath);
|
||||
|
||||
private static MainGameData gameData = null;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
Load();
|
||||
OnGameDataLoaded();
|
||||
}
|
||||
|
||||
private static void Load()
|
||||
{
|
||||
// read static game data
|
||||
GameDataUtils.ReadAllData(out gameData, MainDataFolder, Config.Default.GameDataExtension, Config.Default.GameDataApplication);
|
||||
|
|
@ -74,6 +82,19 @@ namespace ServerManagerTool.Lib
|
|||
}
|
||||
}
|
||||
|
||||
private static void OnGameDataLoaded()
|
||||
{
|
||||
GameDataLoaded?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public static void Reload()
|
||||
{
|
||||
gameData = null;
|
||||
|
||||
Load();
|
||||
OnGameDataLoaded();
|
||||
}
|
||||
|
||||
public static string FriendlyNameForClass(string className, bool returnNullIfNotFound = false) => string.IsNullOrWhiteSpace(className) ? (returnNullIfNotFound ? null : string.Empty) : GlobalizedApplication.Instance.GetResourceString(className) ?? (returnNullIfNotFound ? null : className);
|
||||
|
||||
#region Game Maps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue