dev: 更新代码,并准备LuaMod
This commit is contained in:
@ -2,23 +2,26 @@ using System.Collections.Generic;
|
||||
using Godot;
|
||||
|
||||
public partial class GlobalManager : Node {
|
||||
private static readonly Logging.Logger logger = Logging.GetLogger("GlobalManager");
|
||||
public static GlobalManager Instance { get; private set; } = null!;
|
||||
public static string ConfigPath { get; private set; } = "user://config.json";
|
||||
private GlobalManager() {
|
||||
ConfigManager.SetFilePath(ProjectSettings.GlobalizePath(ConfigPath));
|
||||
ConfigManager.SetDefault(_default_config);
|
||||
ConfigManager.LoadFromFile();
|
||||
GD.Print("GameSystem Singleton Initialized");
|
||||
private GlobalManager() {
|
||||
ConfigManager.SetFilePath(ProjectSettings.GlobalizePath(ConfigPath));
|
||||
ConfigManager.SetDefault(_default_config);
|
||||
ConfigManager.LoadFromFile();
|
||||
|
||||
Mods = new GlobalModManager(ConfigManager.GetValue<string>("mods_fpath"));
|
||||
Mods.SearchAllMods();
|
||||
}
|
||||
|
||||
// TODO Will Change It
|
||||
public readonly GlobalModManager Mods = null!;
|
||||
public readonly IConfigManager ConfigManager = new JsonConfigManager();
|
||||
private static readonly Dictionary<string, object> _default_config = new() {
|
||||
{"font_size", 20},
|
||||
{"server_url", "wss://game.zzyxyz.com/"},
|
||||
{"server_addr", "wss://game.zzyxyz.com/"},
|
||||
{"user_name", "undefined"},
|
||||
|
||||
{"mods_fpath", "user://Mods/"},
|
||||
{"mods_fpath", "user://mods"},
|
||||
{"mods_allowed", false},
|
||||
};
|
||||
|
||||
@ -39,23 +42,15 @@ public partial class GlobalManager : Node {
|
||||
Instance = this;
|
||||
}
|
||||
else {
|
||||
GD.PushError("GlobalManager already exists");
|
||||
logger.Error("GlobalManager already exists");
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
if (OS.GetName() == "Android") {
|
||||
bool ret = OS.RequestPermissions();
|
||||
GD.Print($"RequestPermissions ret is {ret}");
|
||||
logger.Warning($"RequestPermissions ret is {ret}");
|
||||
}
|
||||
|
||||
// OS.RequestPermissions();
|
||||
// RPClient.OnRPCError += (errCode, type, cmd, errMsg) => {
|
||||
// GD.PrintErr($"errCode {errCode}, type/cmd {type}/{cmd}, errMsg {errMsg}");
|
||||
// };
|
||||
// RPClient.OnClose += (eventName, args) => {
|
||||
// SetProcess(false);
|
||||
// };
|
||||
|
||||
Viewport root = GetTree().Root;
|
||||
CurrentScene = root.GetChild(root.GetChildCount() - 1);
|
||||
|
||||
|
Reference in New Issue
Block a user