LauncherEngine инициализируется во время загрухки клиента

This commit is contained in:
Gravit 2018-10-26 22:29:26 +07:00
parent 49f6316417
commit 89027479c1
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
3 changed files with 9 additions and 1 deletions

View file

@ -204,7 +204,7 @@ public void start(String... args) throws Throwable {
// Load init.js script // Load init.js script
loadScript(Launcher.API_SCRIPT_FILE); loadScript(Launcher.API_SCRIPT_FILE);
loadScript(Launcher.INIT_SCRIPT_FILE); loadScript(Launcher.INIT_SCRIPT_FILE);
loadScript("config.js"); loadScript(Launcher.CONFIG_SCRIPT_FILE);
loadScript("dialog/dialog.js"); loadScript("dialog/dialog.js");
LogHelper.info("Invoking start() function"); LogHelper.info("Invoking start() function");
Invocable invoker = (Invocable) engine; Invocable invoker = (Invocable) engine;
@ -216,4 +216,8 @@ public void start(String... args) throws Throwable {
Launcher.modulesManager.postInitModules(); Launcher.modulesManager.postInitModules();
invoker.invokeFunction("start", (Object) args); invoker.invokeFunction("start", (Object) args);
} }
public static LauncherEngine clientInstance()
{
return new LauncherEngine();
}
} }

View file

@ -401,6 +401,9 @@ else if(isDownloadJava)
public static void main(String... args) throws Throwable { public static void main(String... args) throws Throwable {
Launcher.modulesManager = new ClientModuleManager(null); Launcher.modulesManager = new ClientModuleManager(null);
LauncherConfig.getAutogenConfig().initModules(); //INIT LauncherConfig.getAutogenConfig().initModules(); //INIT
LauncherEngine engine = LauncherEngine.clientInstance();
engine.loadScript(Launcher.API_SCRIPT_FILE);
engine.loadScript(Launcher.CONFIG_SCRIPT_FILE);
Launcher.modulesManager.preInitModules(); Launcher.modulesManager.preInitModules();
if (Launcher.isUsingAvanguard()) { if (Launcher.isUsingAvanguard()) {
AvanguardStarter.load(); AvanguardStarter.load();

View file

@ -59,6 +59,7 @@ static int readBuildNumber() {
public static final String INIT_SCRIPT_FILE = "init.js"; public static final String INIT_SCRIPT_FILE = "init.js";
@LauncherAPI @LauncherAPI
public static final String API_SCRIPT_FILE = "engine/api.js"; public static final String API_SCRIPT_FILE = "engine/api.js";
public static final String CONFIG_SCRIPT_FILE = "config.js";
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL); private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);
public static int MAJOR = 4; public static int MAJOR = 4;