Launcher/Launcher/runtime/init.js
Zaxar163 3dd775807e [FIX][RUNTIME] Исправлено перемещение мышки после смены оверлея. (#140)
* [UPD] Submodule `modules` updated.

* [FIX] Profiles property: "info" + [FIX] Recenter mouse on stage. + [FIX] Auto-generating config generation (param: "isWarningMissArchJava").

* [FIXED] Access rules in ServerWrapper agent.

* [FIX] Фикс ошибки мержа с master.

* [FIX] AuthProvider в дефолтном конфиге.
2019-01-13 22:51:39 +07:00

73 lines
2.1 KiB
JavaScript

var app, stage, scene, loginScene, menuScene;
var rootPane, loginPane, authPane, menuPane;
// Override application class
var LauncherApp = Java.extend(JSApplication, {
init: function() {
app = JSApplication.getInstance();
cliParams.init(app.getParameters());
settings.load();
cliParams.applySettings();
}, start: function(primaryStage) {
stage = primaryStage;
stage.initStyle(javafx.stage.StageStyle.TRANSPARENT);
stage.setResizable(false);
stage.setTitle(config.title);
// Set icons
config.icons.forEach(function(icon) {
var iconURL = Launcher.getResourceURL(icon).toString();
stage.getIcons().add(new javafx.scene.image.Image(iconURL));
});
// Load launcher FXML
loginPane = loadFXML("dialog/login.fxml");
menuPane = loadFXML("dialog/mainmenu.fxml");
loginScene = new javafx.scene.Scene(loginPane);
loginScene.setFill(javafx.scene.paint.Color.TRANSPARENT);
menuScene = new javafx.scene.Scene(menuPane);
menuScene.setFill(javafx.scene.paint.Color.TRANSPARENT);
setCurrentScene(loginScene);
initLauncher();
}, stop: function() {
settings.save();
options.save();
}
});
// Helper functions
function loadFXML(name) {
var loader = new javafx.fxml.FXMLLoader(Launcher.getResourceURL(name));
loader.setCharset(IOHelper.UNICODE_CHARSET);
return loader.load();
}
function setCurrentScene(scene) {
stage.setScene(scene);
rootPane = scene.getRoot();
dimPane = rootPane.lookup("#mask");
stage.sizeToScene();
stage.show();
}
function setRootParent(parent) {
scene.setRoot(parent);
}
// Start function - there all begins
function start(args) {
// Set font rendering properties
LogHelper.debug("Setting FX properties");
java.lang.System.setProperty("prism.lcdtext", "false");
// Start laucher JavaFX stage
LogHelper.debug("Launching JavaFX application");
javafx.application.Application.launch(LauncherApp.class, args);
}
launcher.loadScript("dialog/dialog.js");