[FEATURE] Удаление старого runtime

This commit is contained in:
Gravit 2019-12-04 22:37:29 +07:00
parent 40bd92229a
commit 94c19c9c56
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
43 changed files with 24 additions and 2978 deletions

View file

@ -0,0 +1,2 @@
Скопируйте в эту папку файлы в соответствии с инструкцией по установке вашего модуля GUI
Старый рантайм на JavaScript больше не поддерживается

View file

@ -1,42 +0,0 @@
var config = {
//*** Настройки лаунчера ***//
// Название папки лаунчера настраивается в LaunchServer.conf(строка projectName)
title: "GravitLauncher", // Заголовок окна
icons: ["favicon.png"], // Путь/Пути до иконки окна
links: [
//*** Ссылки ***//
{
id: "link",
text: "GravitLauncher",
url: "https://gravit.pro",
},
{
id: "discord",
text: "",
url: "https://discord.gg/aJK6nMN",
}
],
//*** Стандартные настройки клиента ***//
autoEnterDefault: false, // Автоматический вход на выбранный сервер
fullScreenDefault: false, // Клиент в полный экран
featureStoreDefault: true, // Поиск файлов в других клиентах (Используется для экономии трафика и ускорения загрузки)
ramDefault: 1024, // Количество оперативной памяти выделенной по умолчанию (0 - Автоматически)
//*** Настройка загрузки JVM ***//
/* LaunchServer: guardtype = java */
jvm: {
enable: false, // Включение загрузки своей JVM
jvmMustdie32Dir: "jre-8u231-win32", // Название папки JVM для Windows x32
jvmMustdie64Dir: "jre-8u231-win64", // Название папки JVM для Windows x64
},
settingsMagic: 0xC0DE5, // Магия вне хогвартса
};
DirBridge.defaultUpdatesDir = DirBridge.dir.resolve("updates");
if (!IOHelper.isDir(DirBridge.defaultUpdatesDir)) {
java.nio.file.Files.createDirectory(DirBridge.defaultUpdatesDir);
}

View file

@ -1,553 +0,0 @@
var authPane, dimPane, serverPane, bar, consoleBar, optionsPane, consolePane, loginPaneLayout, serverPaneLayout;
var loginField, passwordField, savePasswordBox, authOptions;
var serverList, serverInfo, serverDescription, serverEntrance, serverLabel, serverStatus;
var profilesList = [];
var movePoint = null;
var pingers = {};
var loginData;
var authTypes = {};
function initLauncher() {
initLoginScene();
initMenuScene();
initConsoleScene();
initOptionsScene();
/* ======== init Overlays ======== */
debug.initOverlay();
processing.initOverlay();
settingsOverlay.initOverlay();
update.initOverlay();
verifyLauncher();
}
/* ======== init Login window======== */
function initLoginScene() {
loginPane.setOnMousePressed(function(event) { movePoint = new javafx.geometry.Point2D(event.getSceneX(), event.getSceneY()) });
loginPane.setOnMouseDragged(function(event) {
if (movePoint === null) {
return;
}
stage.setX(event.getScreenX() - movePoint.getX());
stage.setY(event.getScreenY() - movePoint.getY());
});
var pane = loginPane.lookup("#bar");
bar = pane;
loginPane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
loginPane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
var pane = loginPane.lookup("#authPane");
authPane = pane;
var loginLayout = loginPane.lookup("#layout");
loginPaneLayout = loginLayout;
loginField = pane.lookup("#login");
loginField.setOnMouseMoved(function(event) { rootPane.fireEvent(event) });
loginField.setOnAction(goAuth);
if (settings.login !== null) {
loginField.setText(settings.login);
}
passwordField = pane.lookup("#password");
passwordField.setOnMouseMoved(function(event) { rootPane.fireEvent(event) });
passwordField.setOnAction(goAuth);
if (settings.rsaPassword !== null) {
passwordField.getStyleClass().add("hasSaved");
passwordField.setPromptText("*** Сохранённый ***");
}
savePasswordBox = pane.lookup("#rememberchb");
savePasswordBox.setSelected(settings.login === null || settings.rsaPassword !== null);
authOptions = pane.lookup("#authOptions");
pane.lookup("#goAuth").setOnAction(goAuth);
var pane = loginPane;
config.links.forEach(function(link) {
var el = pane.lookup("#link_" + link.id);
if (el === null) return;
el.setOnAction(function() {
openURL(new java.net.URL(link.url));
});
if (link.text === "") return;
el.setText(link.text);
});
}
/* ======== init Menu window======== */
function initMenuScene() {
menuPane.setOnMousePressed(function(event) { movePoint = new javafx.geometry.Point2D(event.getSceneX(), event.getSceneY()) });
menuPane.setOnMouseDragged(function(event) {
if (movePoint === null) {
return;
}
stage.setX(event.getScreenX() - movePoint.getX());
stage.setY(event.getScreenY() - movePoint.getY());
});
var pane = menuPane.lookup("#bar");
bar = pane;
pane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
pane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
pane.lookup("#settings").setOnAction(goSettings);
pane.lookup("#goConsole").setOnAction(goConsole);
var pane = menuPane.lookup("#serverPane");
serverPane = pane;
var menuLayout = menuPane.lookup("#layout");
serverPaneLayout = menuLayout;
pane.lookup("#clientSettings").setOnAction(goOptions);
serverList = pane.lookup("#serverlist").getContent();
serverInfo = pane.lookup("#serverinfo").getContent();
serverDescription = serverInfo.lookup("#serverDescription");
serverEntrance = pane.lookup("#serverentrance");
serverStatus = serverEntrance.lookup("#serverStatus");
serverLabel = serverEntrance.lookup("#serverLabel");
serverEntrance.lookup("#clientLaunch").setOnAction(function() {
doUpdate(profilesList[serverHolder.old], loginData.pp, loginData.accessToken);
});
pane.lookup("#logout").setOnAction(function() {
setCurrentScene(loginScene);
});
var pane = menuPane;
config.links.forEach(function(link) {
var el = pane.lookup("#link_" + link.id);
if (el === null) return;
el.setOnAction(function() {
openURL(new java.net.URL(link.url));
});
if (link.text === "") return;
el.setText(link.text);
});
}
/* ======== init Console window======== */
function initConsoleScene() {
consoleMenu.setOnMousePressed(function(event) { movePoint = new javafx.geometry.Point2D(event.getSceneX(), event.getSceneY()) });
consoleMenu.setOnMouseDragged(function(event) {
if (movePoint === null) {
return;
}
consoleStage.setX(event.getScreenX() - movePoint.getX());
consoleStage.setY(event.getScreenY() - movePoint.getY());
});
var pane = consoleMenu.lookup("#bar");
consoleBar = pane;
pane.lookup("#close").setOnAction(function() {
consoleStage.hide();
});
var text = consoleMenu.lookup("#textField");
var output = consoleMenu.lookup("#output");
var appendFunction = function(line) javafx.application.Platform.runLater(function() output.appendText(line));
consoleMenu.lookup("#send").setOnAction(function() {
execCommand(text.getText());
if (text.getText() == "clear") {
output.setText("");
}
text.setText("");
});
FunctionalBridge.addPlainOutput(function(string) {
appendFunction(string + "\n");
})
pane.lookup("#hide").setOnAction(function(event) { consoleStage.setIconified(true) });
var pane = consoleMenu.lookup("#consolePane");
consolePane = pane;
}
/* ======== init Options window======== */
function initOptionsScene() {
optionsMenu.setOnMousePressed(function(event) { movePoint = new javafx.geometry.Point2D(event.getSceneX(), event.getSceneY()) });
optionsMenu.setOnMouseDragged(function(event) {
if (movePoint === null) {
return;
}
stage.setX(event.getScreenX() - movePoint.getX());
stage.setY(event.getScreenY() - movePoint.getY());
});
var pane = optionsMenu.lookup("#bar");
bar = pane;
pane.lookup("#close").setOnAction(function(event) { javafx.application.Platform.exit() });
pane.lookup("#hide").setOnAction(function(event) { stage.setIconified(true) });
pane.lookup("#back").setOnAction(function() {
setCurrentScene(menuScene);
});
}
/* ======== init Offline ======== */
function initOffline() {
stage.setTitle(config.title + " [Offline]");
loginField.setPromptText("Имя пользователя");
if (!VerifyHelper.isValidUsername(settings.login)) {
loginField.setText(""); // Reset if not valid
}
passwordField.setDisable(true);
passwordField.setPromptText("Недоступно");
passwordField.setText("");
}
/* ======== Auth ======== */
function goAuth(event) {
if (overlay.current !== null) {
return;
}
var login = loginField.getText();
if (login.isEmpty()) {
return;
}
var auth = authOptions.getSelectionModel().getSelectedItem();
if (auth === null) {
return; // No auth selected
}
var rsaPassword = null;
var auth = authOptions.getSelectionModel().getSelectedItem();
if (auth === null) {
return;
}
if (!passwordField.isDisable()) {
var password = passwordField.getText();
if (password !== null && !password.isEmpty()) {
rsaPassword = settingsOverlay.setPassword(password);
} else if (settings.rsaPassword !== null) {
rsaPassword = settings.rsaPassword;
} else {
return;
}
settings.rsaPassword = savePasswordBox.isSelected() ? rsaPassword : null;
}
settings.login = login;
doAuth(login, rsaPassword, authTypes[auth]);
}
/* ======== Console ======== */
function goConsole(event) {
setConsoleCurrentScene(consoleScene);
}
/* ======== Settings ======== */
function goSettings(event) {
if (overlay.current !== null) {
return;
}
overlay.show(settingsOverlay.overlay, null);
}
/* ======== Options ======== */
function goOptions(event) {
setCurrentScene(optionsScene);
options.update();
}
/* ======== Processing functions ======== */
function verifyLauncher(e) {
processing.resetOverlay();
overlay.show(processing.overlay, function(event) makeLauncherRequest(function(result) {
settings.lastDigest = result.digest;
processing.resetOverlay();
if (settings.offline) {
initOffline();
}
overlay.swap(0, processing.overlay, function(event) makeAuthAvailabilityRequest(function(result) {
var iter = 0;
authTypes = {};
result.list.forEach(function(auth_type, i, arr) {
var serverAuth = new javafx.scene.control.ComboBox();
serverAuth.getStyleClass().add("authOptions");
authOptions.getItems().add(auth_type.displayName);
authTypes[auth_type.displayName] = auth_type.name;
iter++;
});
authOptions.getSelectionModel().select(0);
var sm = authOptions.getSelectionModel().selectedIndexProperty();
sm.addListener(new javafx.beans.value.ChangeListener({
changed: function(observableValue, oldSelection, newSelection) {
settings.auth = authTypes[authOptions.getSelectionModel().getSelectedItem()];
}
}));
overlay.swap(0, processing.overlay, function(event) makeProfilesRequest(function(result) {
settings.lastProfiles = result.profiles;
updateProfilesList(result.profiles);
options.load();
overlay.hide(0, function() {
if (cliParams.autoLogin) {
goAuth(null);
}
});
}));
}));
}));
}
function doAuth(login, rsaPassword, auth_type) {
processing.resetOverlay();
overlay.show(processing.overlay, function(event) {
FunctionalBridge.getHWID.join();
makeAuthRequest(login, rsaPassword, auth_type, function(result) {
FunctionalBridge.setAuthParams(result);
loginData = {
pp: result.playerProfile,
accessToken: result.accessToken,
permissions: result.permissions,
auth_type: settings.auth
};
overlay.hide(0, function() {
setCurrentScene(menuScene);
});
return result;
})
});
}
function doUpdate(profile, pp, accessToken) {
var digest = profile.isUpdateFastCheck();
overlay.swap(0, update.overlay, function(event) {
if (config.jvm.enable) {
makeSetProfileRequest(profile, function() {
ClientLauncher.setProfile(profile);
var jvmDir = settings.updatesDir.resolve(jvmDirName);
update.resetOverlay("Обновление файлов JVM");
makeUpdateRequest(jvmDirName, jvmDir, null, digest, function(jvmHDir) {
ClientLauncher.setJavaBinPath(jvmDir);
update.resetOverlay("Обновление файлов ресурсов");
var assetDirName = profile.getAssetDir();
var assetDir = settings.updatesDir.resolve(assetDirName);
var assetMatcher = profile.getAssetUpdateMatcher();
makeUpdateRequest(assetDirName, assetDir, assetMatcher, digest, function(assetHDir) {
settings.putHDir(assetDirName, assetDir, assetHDir.hdir);
update.resetOverlay("Обновление файлов клиента");
var clientDirName = profile.getDir();
var clientDir = settings.updatesDir.resolve(clientDirName);
var clientMatcher = profile.getClientUpdateMatcher();
makeUpdateRequest(clientDirName, clientDir, clientMatcher, digest, function(clientHDir) {
settings.putHDir(clientDirName, clientDir, clientHDir.hdir);
doLaunchClient(assetDir, assetHDir.hdir, clientDir, clientHDir.hdir, profile, pp, accessToken);
});
});
});
});
} else {
update.resetOverlay("Обновление файлов ресурсов");
var assetDirName = profile.getAssetDir();
var assetDir = settings.updatesDir.resolve(assetDirName);
var assetMatcher = profile.getAssetUpdateMatcher();
makeSetProfileRequest(profile, function() {
ClientLauncher.setProfile(profile);
makeUpdateRequest(assetDirName, assetDir, assetMatcher, digest, function(assetHDir) {
settings.putHDir(assetDirName, assetDir, assetHDir.hdir);
update.resetOverlay("Обновление файлов клиента");
var clientDirName = profile.getDir();
var clientDir = settings.updatesDir.resolve(clientDirName);
var clientMatcher = profile.getClientUpdateMatcher();
makeUpdateRequest(clientDirName, clientDir, clientMatcher, digest, function(clientHDir) {
settings.putHDir(clientDirName, clientDir, clientHDir.hdir);
doLaunchClient(assetDir, assetHDir.hdir, clientDir, clientHDir.hdir, profile, pp, accessToken);
});
});
});
}
});
}
function doLaunchClient(assetDir, assetHDir, clientDir, clientHDir, profile, pp, accessToken) {
processing.resetOverlay();
overlay.swap(0, processing.overlay, function(event) launchClient(assetHDir, clientHDir, profile, new ClientLauncherParams(settings.lastDigest,
assetDir, clientDir, pp, accessToken, settings.autoEnter, settings.fullScreen, settings.ram, 0, 0), doDebugClient));
}
function doDebugClient(process) {
if (!settings.debug) {
javafx.application.Platform.exit();
return;
}
debug.resetOverlay();
overlay.swap(0, debug.overlay, function(event) debugProcess(process));
}
/* ======== Server handler functions ======== */
function updateProfilesList(profiles) {
profilesList = [];
serverList.getChildren().clear();
var index = 0;
profiles.forEach(function(profile, i, arr) {
pingers[profile] = new ServerPinger(profile);
var serverBtn = new javafx.scene.control.ToggleButton(profile);
serverBtn.getStyleClass().add("server-button");
serverBtn.getStyleClass().add("server-button-" + profile);
(function() {
profilesList[serverBtn] = profile;
var hold = serverBtn;
var hIndex = index;
serverBtn.setOnAction(function(event) {
serverHolder.set(hold);
settings.profile = hIndex;
});
})();
serverList.getChildren().add(serverBtn);
if (profile.getOptional() != null) profile.updateOptionalGraph();
index++;
});
LogHelper.debug("Load selected %d profile", settings.profile);
if (profiles.length > 0) {
if (settings.profile >= profiles.length)
settings.profile = profiles.length - 1;
serverHolder.set(serverList.getChildren().get(settings.profile));
}
}
function pingServer(btn) {
var profile = profilesList[btn];
setServerStatus("...");
var task = newTask(function() pingers[profile].ping());
task.setOnSucceeded(function(event) {
var result = task.getValue();
if (btn == serverHolder.old) {
setServerStatus(java.lang.String.format("%d из %d", result.onlinePlayers, result.maxPlayers));
}
});
task.setOnFailed(function(event) { if (btn == serverHolder.old) { setServerStatus("Недоступен") } });
startTask(task);
}
function setServerStatus(description) {
serverStatus.setText(description);
}
/* ======== Overlay helper functions ======== */
function fade(region, delay, from, to, onFinished) {
var transition = new javafx.animation.FadeTransition(javafx.util.Duration.millis(100), region);
if (onFinished !== null) {
transition.setOnFinished(onFinished);
}
transition.setDelay(javafx.util.Duration.millis(delay));
transition.setFromValue(from);
transition.setToValue(to);
transition.play();
}
var overlay = {
current: null,
show: function(newOverlay, onFinished) {
authPane.setDisable(true);
overlay.current = newOverlay;
dimPane.setVisible(true);
dimPane.toFront();
loginPaneLayout.setEffect(new javafx.scene.effect.GaussianBlur(10));
serverPaneLayout.setEffect(new javafx.scene.effect.GaussianBlur(10));
fade(dimPane, 0.0, 0.0, 1.0, function(event) {
dimPane.requestFocus();
dimPane.getChildren().add(newOverlay);
newOverlay.setLayoutX((dimPane.getPrefWidth() - newOverlay.getPrefWidth()) / 2.0);
newOverlay.setLayoutY((dimPane.getPrefHeight() - newOverlay.getPrefHeight()) / 2.0);
fade(newOverlay, 0.0, 0.0, 1.0, onFinished);
});
},
hide: function(delay, onFinished) {
fade(overlay.current, delay, 1.0, 0.0, function(event) {
dimPane.getChildren().remove(overlay.current);
fade(dimPane, 0.0, 1.0, 0.0, function(event) {
dimPane.setVisible(false);
authPane.setDisable(false);
rootPane.requestFocus();
loginPaneLayout.setEffect(new javafx.scene.effect.GaussianBlur(0));
serverPaneLayout.setEffect(new javafx.scene.effect.GaussianBlur(0));
overlay.current = null;
if (onFinished !== null) {
onFinished();
}
});
});
},
swap: function(delay, newOverlay, onFinished) {
dimPane.toFront();
fade(overlay.current, delay, 1.0, 0.0, function(event) {
dimPane.requestFocus();
if (overlay.current == null) {
overlay.show(newOverlay, onFinished);
return;
}
if (overlay.current !== newOverlay) {
var child = dimPane.getChildren();
child.set(child.indexOf(overlay.current), newOverlay);
}
newOverlay.setLayoutX((dimPane.getPrefWidth() - newOverlay.getPrefWidth()) / 2.0);
newOverlay.setLayoutY((dimPane.getPrefHeight() - newOverlay.getPrefHeight()) / 2.0);
overlay.current = newOverlay;
fade(newOverlay, 0.0, 0.0, 1.0, onFinished);
});
}
};
var serverHolder = {
old: null,
set: function(btn) {
pingServer(btn);
serverLabel.setText(profilesList[btn]);
serverDescription.setText(profilesList[btn].info);
btn.setSelected(true);
btn.setDisable(true);
if (serverHolder.old != null) {
serverHolder.old.setSelected(false);
serverHolder.old.setDisable(false);
}
serverHolder.old = btn;
}
};
/* ======== Overlays scripts ======== */
launcher.loadScript("engine/settings.js");
launcher.loadScript("dialog/overlay/debug/debug.js");
launcher.loadScript("dialog/overlay/processing/processing.js");
launcher.loadScript("dialog/overlay/settings/settings.js");
launcher.loadScript("dialog/overlay/update/update.js");
/* ======== Scenes scripts ======== */
launcher.loadScript("dialog/scenes/options/options.js");
launcher.loadScript("dialog/scenes/console/console.js");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View file

@ -1,57 +0,0 @@
/*-- DrLeonardo Design --*/
Button {
-fx-cursor: hand;
}
/* Outputs */
#overlay>#output,
#background>#output {
-fx-background-color: white;
-fx-background-radius: 0;
-fx-font-family: monospace;
-fx-font-size: 8pt;
}
#overlay>#output .content,
#background>#output .content {
-fx-background-color: white;
-fx-background-radius: 0;
}
/* Close button */
#overlay>#copy,
#overlay>#action.close {
-fx-background-radius: 0;
-fx-text-fill: white;
-fx-background-position: center;
-fx-background-color: #2d83ce;
-fx-pref-width: 150px;
-fx-pref-height: 25px;
}
#overlay>#copy:hover,
#overlay>#copy:focused,
#overlay>#action.close:hover,
#overlay>#action.close:focused,
#overlay>#copy:pressed,
#overlay>#action.close:pressed {
-fx-background-color: #1568ce;
}
/* Kill button */
#overlay>#action.kill {
-fx-background-radius: 0;
-fx-text-fill: white;
-fx-background-position: center;
-fx-background-color: #CE5757;
-fx-pref-width: 150px;
-fx-pref-height: 25px;
}
#overlay>#action.kill:hover,
#overlay>#action.kill:focused,
#overlay>#action.kill:pressed {
-fx-background-color: #DB5252;
}
/*-- DrLeonardo Design --*/

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.Pane?>
<!-- DrLeonardo Design -->
<Pane fx:id="overlay" prefHeight="450.0" prefWidth="693.0" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<stylesheets>
<URL value="@debug.css"/>
<URL value="@../../styles.css"/>
</stylesheets>
<!-- Debug controls -->
<TextArea fx:id="output" prefHeight="405.0" prefWidth="693.0">
<padding>
<Insets left="10.0" right="10.0"/>
</padding>
</TextArea>
<Pane layoutY="405.0" prefHeight="45.0" prefWidth="693.0" style="-fx-background-color: #ffffff;"/>
<Button fx:id="copy" defaultButton="true" layoutX="373.0" layoutY="415.0" prefHeight="30.0" prefWidth="100.0"
text="Копировать"/>
<Button fx:id="action" layoutX="533.0" layoutY="415.0" prefHeight="25.0" prefWidth="150.0" text="Убить"/>
<Label fx:id="version" layoutX="14.0" layoutY="419.0" text="GravitLauncher"/>
</Pane>

View file

@ -1,102 +0,0 @@
var debug = {
overlay: null,
output: null,
action: null,
process: null,
initOverlay: function() {
debug.overlay = loadFXML("dialog/overlay/debug/debug.fxml");
debug.overlay.lookup("#version").setText(
java.lang.String.format(
"%s | Java %s x%s",
FunctionalBridge.getLauncherVersion(),
java.lang.System.getProperty("java.version"),
JVMHelper.JVM_BITS
)
);
debug.output = debug.overlay.lookup("#output");
debug.output.setEditable(false);
debug.copy = debug.overlay.lookup("#copy");
debug.copy.setOnAction(function(event) {
var content = new javafx.scene.input.ClipboardContent();
content.putString(debug.output.getText());
javafx.scene.input.Clipboard.getSystemClipboard().
setContent(content);
});
debug.action = debug.overlay.lookup("#action");
debug.action.setOnAction(function(event) {
var process = debug.process;
if (process !== null && process.isAlive()) {
process.destroyForcibly();
debug.updateActionButton(true);
return;
}
overlay.hide(0, null);
});
},
resetOverlay: function() {
debug.output.clear();
debug.action.setText("");
debug.action.getStyleClass().remove("kill");
debug.action.getStyleClass().add("close");
},
append: function(text) {
//Experimental Feature
if (debug.output.getText().length() > 32000 /* Max length */ ) {
debug.output.deleteText(0, text.length());
}
debug.output.appendText(text);
},
updateActionButton: function(forceClose) {
var process = debug.process;
var alive = !forceClose &&
process !== null && process.isAlive();
var text = alive ? "Убить" : "Закрыть";
var addClass = alive ? "kill" : "close";
var removeClass = alive ? "close" : "kill";
debug.action.setText(text);
debug.action.getStyleClass().remove(removeClass);
debug.action.getStyleClass().add(addClass);
}
};
/* Export functions */
function debugProcess(process) {
debug.process = process;
debug.updateActionButton(false);
var task = newTask(function() {
var buffer = IOHelper.newCharBuffer();
var reader = IOHelper.newReader(process.getInputStream(),
java.nio.charset.Charset.defaultCharset());
var appendFunction = function(line)
javafx.application.Platform.runLater(function() debug.append(line));
for (var length = reader.read(buffer); length >= 0; length = reader.read(buffer)) {
appendFunction(new java.lang.String(buffer, 0, length));
}
return process.waitFor();
});
task.setOnFailed(function(event) {
debug.updateActionButton(true);
debug.append(java.lang.System.lineSeparator() + task.getException());
});
task.setOnSucceeded(function(event) {
debug.updateActionButton(false);
debug.append(java.lang.System.lineSeparator() + "Exit code " + task.getValue());
});
startTask(task);
}

View file

@ -1,12 +0,0 @@
/*-- DrLeonardo Design --*/
#overlay>#description {
-fx-font-size: 12pt;
-fx-text-fill: #fff;
-fx-wrap-text: true;
}
#overlay>#description.error {
-fx-text-fill: red;
}
/*-- DrLeonardo Design --*/

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ProgressIndicator?>
<?import java.net.URL?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.Pane?>
<!-- DrLeonardo Design | Fixes by Yaroslavik -->
<Pane fx:id="overlay" prefHeight="450.0" prefWidth="692.0" xmlns="http://javafx.com/javafx/8.0.201"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<!-- Description -->
<Label fx:id="description" alignment="CENTER" contentDisplay="CENTER" layoutX="205.0" layoutY="328.0"
prefHeight="87.0" prefWidth="283.0" text="..." textAlignment="CENTER"/>
<ProgressIndicator fx:id="spinner" layoutX="291.0" layoutY="165.0" prefHeight="120.0" prefWidth="110.0"/>
</children>
<stylesheets>
<URL value="@processing.css"/>
</stylesheets>
</Pane>

View file

@ -1,137 +0,0 @@
var processing = {
overlay: null,
spinner: null,
description: null,
processingImage: null,
errorImage: null,
initOverlay: function() {
processing.overlay = loadFXML("dialog/overlay/processing/processing.fxml");
processing.spinner = processing.overlay.lookup("#spinner");
processing.description = processing.overlay.lookup("#description");
},
resetOverlay: function() {
processing.description.getStyleClass().remove("error");
processing.description.setText("...");
},
setError: function(e) {
LogHelper.error(e);
processing.description.textProperty().unbind();
processing.description.getStyleClass().add("error");
processing.description.setText(e.toString());
},
setTaskProperties: function(task, callback, errorCallback, hide) {
processing.description.textProperty().bind(task.messageProperty());
task.setOnFailed(function(event) {
processing.description.textProperty().unbind();
processing.setError(task.getException());
if (hide) {
overlay.hide(2500, errorCallback);
} else if (errorCallback !== null) {
errorCallback();
}
});
task.setOnSucceeded(function(event) {
processing.description.textProperty().unbind();
if (callback !== null) {
callback(task.getValue());
}
});
}
};
function offlineAuthRequest(login) {
return function() {
if (!VerifyHelper.isValidUsername(login)) {
Request.requestError("Имя пользователя некорректно");
return;
}
return {
pp: PlayerProfile.newOfflineProfile(login),
accessToken: SecurityHelper.randomStringToken()
}
};
}
function makeLauncherRequest(callback) {
var task = settings.offline ? newTask(FunctionalBridge.offlineLauncherRequest) :
newRequestTask(new LauncherRequest());
processing.setTaskProperties(task, callback, function() {
if (settings.offline) {
return;
}
settings.offline = true;
overlay.swap(2500, processing.overlay, function() makeLauncherRequest(callback));
}, false);
task.updateMessage("Обновление лаунчера");
startTask(task);
}
function makeProfilesRequest(callback) {
var task = newRequestTask(new ProfilesRequest());
processing.setTaskProperties(task, callback, function() {
if (settings.offline) {
return;
}
settings.offline = true;
overlay.swap(2500, processing.overlay, function() makeProfilesRequest(callback));
}, false);
task.updateMessage("Обновление профилей");
startTask(task);
}
function makeAuthAvailabilityRequest(callback) {
var task = newRequestTask(new GetAvailabilityAuthRequest());
processing.setTaskProperties(task, callback, function() {
if (settings.offline) {
return;
}
// Repeat request, but in offline mode
settings.offline = true;
overlay.swap(2500, processing.overlay, function() makeAuthAvailabilityRequest(callback));
}, false);
task.updateMessage("Обновление способов авторизации");
startTask(task);
}
function makeSetProfileRequest(profile, callback) {
var task = newRequestTask(new SetProfileRequest(profile));
processing.setTaskProperties(task, callback, function() {
if (settings.offline) {
return;
}
// Repeat request, but in offline mode
settings.offline = true;
overlay.swap(2500, processing.overlay, function() makeProfilesRequest(callback));
}, false);
task.updateMessage("Синхронизация профиля");
startTask(task);
}
function makeAuthRequest(login, rsaPassword, auth_type, callback) {
var task = rsaPassword === null ? newTask(offlineAuthRequest(login)) :
newRequestTask(new AuthRequest(login, rsaPassword, FunctionalBridge.getHWID(), auth_type));
processing.setTaskProperties(task, callback, null, true);
task.updateMessage("Авторизация на сервере");
startTask(task);
}
function launchClient(assetHDir, clientHDir, profile, params, callback) {
var task = newTask(function() ClientLauncher.launch(assetHDir, clientHDir,
profile, params, settings.debug));
processing.setTaskProperties(task, callback, null, true);
task.updateMessage("Запуск выбранного клиента");
startTask(task);
}

View file

@ -1,100 +0,0 @@
/*-- DrLeonardo Design --*/
#holder {
-fx-background-color: #fff;
}
#holder>#transferDialog {
-fx-background-color: rgba(0, 0, 0, 0.5);
-fx-pref-width: 694px;
-fx-pref-height: 425px;
}
/* Labels */
#holder>#settingsTitle {
-fx-font-size: 14pt;
-fx-alignment: baseline-center;
}
#holder #ramLabel,
#holder #dirLabel,
#holder #dirChange {
-fx-font-weight: bold;
}
/* RAM slider */
#holder>#ramSlider>.track {
-fx-background-color: #909090;
}
#holder>#ramSlider>.thumb {
-fx-background-color: #5fd97a;
}
#holder>#ramSlider>.colored-track {
-fx-background-color: #5fd97a;
}
#holder>#ramSlider>.animated-thumb {
-fx-background-color: #5fd97a;
}
#holder>#ramSlider>.slider-value {
-fx-fill: white;
-fx-stroke: white;
}
/* Dir options */
#holder>#deleteDir,
#cancelTransfer {
-fx-background-radius: 0;
-fx-text-fill: white;
-fx-background-position: center;
-fx-background-color: #CE5757;
-fx-pref-width: 150px;
-fx-pref-height: 25px;
}
#holder>#deleteDir:hover,
#cancelTransfer:hover,
#holder>#deleteDir:focused,
#cancelTransfer:focused {
-fx-background-color: #DB5252;
}
#holder>#changeDir {
-fx-background-color: transparent;
-fx-text-fill: #909090;
-fx-background-radius: 0;
}
#holder>#changeDir:focused,
#holder>#changeDir:pressed {
-fx-font-weight: bold;
}
#holder>#apply,
#applyTransfer {
-fx-background-color: #5fd97a;
-fx-background-radius: 0;
-fx-text-fill: white;
-fx-background-position: center;
-fx-pref-width: 150px;
-fx-pref-height: 25px;
}
#holder>#apply:hover,
#applyTransfer:hover,
#holder>#apply:focused,
#applyTransfer:focused {
-fx-background-color: #75e18c;
}
/*-- DrLeonardo Design --*/

View file

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.URL?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Slider?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?>
<!-- DrLeonardo Design -->
<Pane fx:id="overlay" prefHeight="450.0" prefWidth="693.0" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane id="holder" prefHeight="450.0" prefWidth="694.0">
<children>
<CheckBox fx:id="autoEnter" layoutX="28.0" layoutY="169.0" text="Автовход на сервер">
<font>
<Font size="13.0"/>
</font>
</CheckBox>
<CheckBox fx:id="fullScreen" layoutX="28.0" layoutY="229.0" text="Клиент в полный экран">
<font>
<Font size="13.0"/>
</font>
</CheckBox>
<CheckBox id="debug" layoutX="28.0" layoutY="199.0" text="Режим Отладки">
<font>
<Font size="13.0"/>
</font>
</CheckBox>
<TextFlow layoutX="126.0" layoutY="15.0" prefHeight="16.0" prefWidth="112.0">
<Text fx:id="ramLabel"/>
</TextFlow>
<Button fx:id="deleteDir" layoutX="370.0" layoutY="380.0" prefHeight="25.0" prefWidth="245.0"
text="Удалить клиенты" textAlignment="CENTER" wrapText="true"/>
<Button fx:id="changeDir" layoutY="419.0" prefHeight="30.0" prefWidth="200.0"
text="Сменить директорию загрузки" textAlignment="CENTER" wrapText="true"/>
<Hyperlink id="dirLabel" alignment="BASELINE_LEFT" layoutX="201.0" layoutY="420.0" prefHeight="30.0"
prefWidth="493.0" text="C:/Users"/>
<Button fx:id="apply" defaultButton="true" layoutX="530.0" layoutY="380.0" prefHeight="23.0"
prefWidth="100.0" text="Применить"/>
<Text layoutX="16.0" layoutY="28.0">Выделение памяти:</Text>
<Slider fx:id="ramSlider" layoutX="14.0" layoutY="76.0" prefHeight="14.0" prefWidth="663.0"/>
<Pane fx:id="transferDialog" prefHeight="425.0" prefWidth="694.0" visible="false">
<children>
<Text fill="WHITE" layoutX="147.0" layoutY="198.0" strokeType="OUTSIDE" strokeWidth="0.0"
text="Перенести все данные в новую директорию?" wrappingWidth="400.13671875">
<font>
<Font size="19.0"/>
</font>
</Text>
<Button fx:id="applyTransfer" layoutX="165.0" layoutY="226.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="124.0" text="Да, перенести!"/>
<Button fx:id="cancelTransfer" layoutX="379.0" layoutY="226.0" mnemonicParsing="false"
prefHeight="25.0" prefWidth="124.0" text="Нет, не нужно."/>
</children>
</Pane>
<Line endX="594.0" layoutX="100.0" layoutY="420.0" startX="-100.0" stroke="#5b3636"
styleClass="lineHead"/>
<CheckBox fx:id="featureStore" layoutX="28.0" layoutY="259.0" text="Поиск файлов в других клиентах">
<font>
<Font size="13.0"/>
</font>
</CheckBox>
<Text fx:id="description" layoutX="317.0" layoutY="208.0" strokeType="OUTSIDE" strokeWidth="0.0"
text="Режим отладки позволяет просмотреть лог запуска и работы программы в реальном времени прямо из лаунчера, что упрощает поиск нужной информации"
wrappingWidth="260.888671875">
<font>
<Font size="13.0"/>
</font>
</Text>
<Label fx:id="descLabel" layoutX="317.0" layoutY="169.0" text="Режим отладки">
<font>
<Font name="System Bold" size="14.0"/>
</font>
</Label>
</children>
</Pane>
</children>
<stylesheets>
<URL value="@settings.css"/>
<URL value="@../../styles.css"/>
</stylesheets>
</Pane>

View file

@ -1,255 +0,0 @@
var settingsOverlay = {
/* ===================== OVERLAY ===================== */
overlay: null,
ramLabel: null,
dirLabel: null,
transferDialog: null,
deleteDirPressedAgain: false,
count: 0,
descLabel: null,
description: null,
initOverlay: function() {
settingsOverlay.overlay = loadFXML("dialog/overlay/settings/settings.fxml");
var holder = settingsOverlay.overlay.lookup("#holder");
var autoEnterBox = holder.lookup("#autoEnter");
autoEnterBox.setSelected(settings.autoEnter);
autoEnterBox.selectedProperty()["addListener(javafx.beans.value.ChangeListener)"](
function(o, ov, nv) settings.autoEnter = nv);
autoEnterBox.setOnMouseEntered(function() {
settingsOverlay.updateDesc(autoEnterBox.getText(), "Включение авто-входа означает что вы сразу после загрузки клиента попадете на сервер");
});
settingsOverlay.dirLabel = holder.lookup("#dirLabel");
settingsOverlay.dirLabel.setOnAction(function(event) app.getHostServices().showDocument(settings.updatesDir.toUri()));
settingsOverlay.updateDirLabel();
settingsOverlay.transferDialog = holder.lookup("#transferDialog");
settingsOverlay.transferDialog.setVisible(false);
holder.lookup("#changeDir").setOnAction(function(event) {
var chooser = new javafx.stage.DirectoryChooser();
chooser.setTitle("Сменить директорию загрузок");
chooser.setInitialDirectory(DirBridge.dir.toFile());
var newDir = chooser.showDialog(stage);
if (newDir !== null) {
settingsOverlay.transferCatalogDialog(newDir.toPath());
}
});
this.descLabel = holder.lookup("#descLabel");
this.description = holder.lookup("#description");
var featureStore = holder.lookup("#featureStore");
featureStore.setSelected(settings.featureStore);
featureStore.selectedProperty()["addListener(javafx.beans.value.ChangeListener)"](
function(o, ov, nv) settings.featureStore = nv);
featureStore.setOnMouseEntered(function() {
settingsOverlay.updateDesc(featureStore.getText(), "Используется для экономии вашего трафика, аналогичные файлы будут скопированы с других игровых клиентов");
});
var fullScreenBox = holder.lookup("#fullScreen");
fullScreenBox.setSelected(settings.fullScreen);
fullScreenBox.selectedProperty()["addListener(javafx.beans.value.ChangeListener)"](
function(o, ov, nv) settings.fullScreen = nv);
fullScreenBox.setOnMouseEntered(function() {
settingsOverlay.updateDesc(fullScreenBox.getText(), "Включение данной функции позволяет запустить игру сразу в полноэкранном режиме");
});
settingsOverlay.ramLabel = holder.lookup("#ramLabel");
settingsOverlay.updateRAMLabel();
var ramSlider = holder.lookup("#ramSlider");
ramSlider.setMax(FunctionalBridge.getJVMTotalMemory());
ramSlider.setSnapToTicks(true);
ramSlider.setShowTickMarks(true);
ramSlider.setShowTickLabels(true);
ramSlider.setMinorTickCount(3);
ramSlider.setMajorTickUnit(1024);
ramSlider.setBlockIncrement(1024);
ramSlider.setValue(settings.ram);
ramSlider.valueProperty()["addListener(javafx.beans.value.ChangeListener)"](function(o, ov, nv) {
settingsOverlay.setRAM(nv);
settingsOverlay.updateRAMLabel();
});
var deleteDirButton = holder.lookup("#deleteDir");
deleteDirButton.setOnAction(function(event) {
if (!settingsOverlay.deleteDirPressedAgain) {
settingsOverlay.deleteDirPressedAgain = true;
deleteDirButton.setText("Подтвердить");
return;
}
settingsOverlay.deleteUpdatesDir();
settingsOverlay.deleteDirPressedAgain = false;
settingsOverlay.count = settingsOverlay.count + 1;
if (settingsOverlay.count > 9) {
javafx.application.Platform.exit();
}
deleteDirButton.setText(
settingsOverlay.count > 8 ? "Прощай :(" :
(settingsOverlay.count > 7 ? "Я умираю!" :
(settingsOverlay.count > 5 ? "DeathCry, спаси!" :
(settingsOverlay.count > 4 ? "Умоляю, перестань!" :
(settingsOverlay.count > 3 ? "Да хорош уже!" : "Ещё раз")
))));
});
var debugBox = settingsOverlay.overlay.lookup("#debug");
debugBox.setSelected(settings.debug);
debugBox.selectedProperty()["addListener(javafx.beans.value.ChangeListener)"](
function(o, ov, nv) settings.debug = nv);
debugBox.setOnMouseEntered(function() {
settingsOverlay.updateDesc(debugBox.getText(), "Режим отладки позволяет просмотреть лог запуска и работы программы в реальном времени прямо из лаунчера, что упрощает поиск нужной информации");
});
holder.lookup("#apply").setOnAction(function(event) overlay.hide(0, null));
},
updateDesc: function(label, desc) {
//На случай если человек решил избавится от этой фишки
if (this.descLabel == null) return;
if (this.description == null) return;
this.descLabel.setText(label);
this.description.setText(desc);
},
transferCatalogDialog: function(newDir) {
settingsOverlay.transferDialog.setVisible(true);
settingsOverlay.transferDialog.lookup("#cancelTransfer").setOnAction(function(event) {
settings.updatesDir = newDir;
DirBridge.dirUpdates = settings.updatesDir;
settingsOverlay.updateDirLabel();
settingsOverlay.transferDialog.setVisible(false);
});
settingsOverlay.transferDialog.lookup("#applyTransfer").setOnAction(function(event) {
DirBridge.move(newDir);
settings.updatesDir = newDir;
DirBridge.dirUpdates = settings.updatesDir;
settingsOverlay.updateDirLabel();
settingsOverlay.transferDialog.setVisible(false);
});
},
updateRAMLabel: function() {
settingsOverlay.ramLabel.setText(settings.ram <= 0 ? "Автоматически" : settings.ram + " MiB");
},
deleteUpdatesDir: function() {
processing.description.setText("Удаление директории загрузок");
overlay.swap(0, processing.overlay, function(event) {
var task = newTask(function() IOHelper.deleteDir(settings.updatesDir, false));
task.setOnSucceeded(function(event) overlay.swap(0, settingsOverlay.overlay, null));
task.setOnFailed(function(event) {
processing.setError(task.getException());
overlay.swap(2500, settingsOverlay.overlay, null);
});
startTask(task);
});
},
setPassword: function(password) {
var encrypted = FunctionalBridge.encryptPassword(password);
return encrypted;
},
setRAM: function(ram) {
if (ram > 762 && ram < 1024) {
settings.ram = java.lang.Math["min(int,int)"](ram, FunctionalBridge.getJVMTotalMemory());
} else {
settings.ram = java.lang.Math["min(int,int)"](((ram / 256) | 0) * 256, FunctionalBridge.getJVMTotalMemory());
}
},
updateDirLabel: function() {
settingsOverlay.dirLabel.setText(IOHelper.toString(settings.updatesDir));
}
};
LogHelper.debug("Dir: %s", DirBridge.dir);
/* ====================== CLI PARAMS ===================== */
var cliParams = {
login: null,
password: null,
profile: -1,
autoLogin: false,
updatesDir: null,
autoEnter: null,
fullScreen: null,
ram: -1,
offline: false,
featureStore: null,
init: function(params) {
var named = params.getNamed();
var unnamed = params.getUnnamed();
cliParams.login = named.get("login");
cliParams.password = named.get("password");
var profile = named.get("profile");
if (profile !== null) {
cliParams.profile = java.lang.Integer.parseInt(profile);
}
cliParams.autoLogin = unnamed.contains("--autoLogin");
var updatesDir = named.get("updatesDir");
if (updatesDir !== null) {
cliParams.updatesDir = IOHelper.toPath(named.get("updatesDir"));
}
var autoEnter = named.get("autoEnter");
if (autoEnter !== null) {
cliParams.autoEnter = java.lang.Boolean.parseBoolean(autoEnter);
}
var featureStore = named.get("featureStore");
if (featureStore !== null) {
cliParams.featureStore = java.lang.Boolean.parseBoolean(featureStore);
}
var fullScreen = named.get("fullScreen");
if (fullScreen !== null) {
cliParams.fullScreen = java.lang.Boolean.parseBoolean(fullScreen);
}
var ram = named.get("ram");
if (ram !== null) {
cliParams.ram = java.lang.Integer.parseInt(ram);
}
var offline = named.get("offline");
if (offline !== null) {
cliParams.offline = java.lang.Boolean.parseBoolean(offline);
}
},
applySettings: function() {
if (cliParams.login !== null) {
settings.login = cliParams.login;
}
if (cliParams.password !== null) {
settingsOverlay.setPassword(cliParams.password);
}
if (cliParams.profile >= 0) {
settings.profile = cliParams.profile;
}
if (cliParams.updatesDir !== null) {}
if (cliParams.autoEnter !== null) {
settings.autoLogin = cliParams.autoEnter;
}
if (cliParams.featureStore !== null) {
settings.featureStore = cliParams.featureStore;
}
if (cliParams.fullScreen !== null) {
settings.fullScreen = cliParams.fullScreen;
}
if (cliParams.ram >= 0) {
settingsOverlay.setRAM(cliParams.ram);
}
if (cliParams.offline !== null) {
settings.offline = cliParams.offline;
}
}
};

View file

@ -1,54 +0,0 @@
/*-- DrLeonardo Design --*/
/* Background */
#overlay {
-fx-background-color: transparent;
-fx-background-size: cover;
-fx-background-image: url('../../images/downloader/blured.jpg');
}
#overlay>#utitle {
-fx-alignment: top-left;
}
#overlay>#description {
-fx-alignment: top-left;
-fx-wrap-text: true;
}
#overlay>#description.error {
-fx-text-fill: #CE5757;
}
.downloadPane {
-fx-background-color: rgba(0, 0, 0, 0.2);
}
/* Progress bar */
.progress-bar {
-fx-indeterminate-bar-flip: false;
-fx-background-color: transparent;
}
.progress-indicator {
-fx-background-color: transparent;
}
.progress-indicator .indicator {
-fx-background-color: transparent;
}
.progress-bar>.bar {
-fx-background-image: url("../../images/downloader/line.png");
-fx-background-color: transparent;
-fx-background-insets: 0;
-fx-background-radius: 0;
-fx-padding: 0;
}
.progress-bar>.track {
-fx-background-color: transparent;
-fx-background-insets: 0;
-fx-background-radius: 3px;
}
/*-- DrLeonardo Design --*/

View file

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ProgressIndicator?>
<?import java.net.URL?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<!-- DrLeonardo Design -->
<Pane fx:id="overlay" prefHeight="450.0" prefWidth="694.0" xmlns="http://javafx.com/javafx/8.0.201"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane prefHeight="450.0" prefWidth="694.0" styleClass="downloadPane">
<children>
<Label fx:id="utitle" alignment="CENTER" layoutX="100.0" layoutY="125.0" prefHeight="30.0"
prefWidth="495.0" text="Загрузка обновления..." textFill="WHITE">
<font>
<Font name="System Bold" size="20.0"/>
</font>
</Label>
<ProgressIndicator fx:id="progress" layoutX="98.0" layoutY="226.0" prefHeight="100.0"
prefWidth="100.0"/>
<Label fx:id="description" layoutX="216.0" layoutY="226.0" prefHeight="100.0" prefWidth="380.0"
text="..." textFill="WHITE">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
</children>
</Pane>
<Pane id="mask" layoutX="-1.0" opacity="0.0" prefHeight="450.0" prefWidth="694.0" visible="false"/>
</children>
<stylesheets>
<URL value="@update.css"/>
<URL value="@../../styles.css"/>
</stylesheets>
</Pane>

View file

@ -1,98 +0,0 @@
var update = {
overlay: null,
title: null,
description: null,
progress: null,
initOverlay: function() {
update.overlay = loadFXML("dialog/overlay/update/update.fxml");
//var updateLayout = update.overlay.lookup("#overlay");
//serverPaneLayout = updateLayout;
update.title = update.overlay.lookup("#utitle");
update.description = update.overlay.lookup("#description");
update.progress = update.overlay.lookup("#progress");
},
resetOverlay: function(title) {
update.title.setText(title);
update.description.getStyleClass().remove("error");
update.description.setText("...");
update.progress.setProgress(-1.0);
},
setError: function(e) {
LogHelper.error(e);
update.description.getStyleClass().add("error");
update.description.setText(e.toString());
},
stateCallback: function(task, state) {
var bps = state.getBps();
var estimated = state.getEstimatedTime();
var estimatedSeconds = estimated === null ? 0 : estimated.getSeconds();
var estimatedHH = (estimatedSeconds / 3600) | 0;
var estimatedMM = ((estimatedSeconds % 3600) / 60) | 0;
var estimatedSS = (estimatedSeconds % 60) | 0;
task.updateMessage(java.lang.String.format(
"Файл: %s%n" +
"Загружено (Всего): %.2f / %.2f MiB.%n" +
"%n" +
"Средняя скорость: %.1f Kbps%n" +
"Примерно осталось: %d:%02d:%02d%n",
state.filePath,
state.getTotalDownloadedMiB() + 0.0, state.getTotalSizeMiB() + 0.0,
bps <= 0.0 ? 0.0 : bps / 1024.0,
estimatedHH, estimatedMM, estimatedSS
));
task.updateProgress(state.totalDownloaded, state.totalSize);
},
setTaskProperties: function(task, request, callback) {
update.description.textProperty().bind(task.messageProperty());
update.progress.progressProperty().bind(task.progressProperty());
request.setStateCallback(function(state) update.stateCallback(task, state));
task.setOnFailed(function(event) {
update.description.textProperty().unbind();
update.progress.progressProperty().unbind();
update.setError(task.getException());
overlay.hide(2500, null);
});
task.setOnSucceeded(function(event) {
update.description.textProperty().unbind();
update.progress.progressProperty().unbind();
if (callback !== null) {
callback(task.getValue());
}
});
}
};
function offlineUpdateRequest(dirName, dir, matcher, digest) {
return function() {
LogHelper.error("Unsupported operation");
//var hdir = settings.lastHDirs.get(dirName);
//if (hdir === null) {
// Request.requestError(java.lang.String.format("Директории '%s' нет в кэше", dirName));
// return;
//}
//return FunctionalBridge.offlineUpdateRequest(dir, hdir, matcher, digest).run();
};
}
/* Export functions */
function makeUpdateRequest(dirName, dir, matcher, digest, callback) {
var request = settings.offline ? { setStateCallback: function(stateCallback) {} } :
new UpdateRequest(dirName, dir, matcher, digest);
var task = settings.offline ? newTask(offlineUpdateRequest(dirName, dir, matcher, digest)) :
newRequestTask(request);
update.setTaskProperties(task, request, callback);
task.updateMessage("Состояние: Хеширование");
task.updateProgress(-1, -1);
startTask(task);
}

View file

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.shape.Line?>
<!-- DrLeonardo Design -->
<Pane fx:id="background" prefWidth="738.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane fx:id="bar" layoutX="692.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar">
<children>
<Button id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/hide.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="close" alignment="CENTER" contentDisplay="CENTER" minHeight="-Infinity" minWidth="-Infinity"
text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/close.png"/>
</image>
</ImageView>
</graphic>
</Button>
</children>
</Pane>
<TextArea fx:id="output" prefHeight="419.0" prefWidth="692.0">
<padding>
<Insets left="10.0" top="10.0"/>
</padding>
</TextArea>
<TextField fx:id="textField" layoutY="420.0" prefHeight="30.0" prefWidth="543.0"
promptText="Введите команду...">
<opaqueInsets>
<Insets/>
</opaqueInsets>
<padding>
<Insets left="10.0"/>
</padding>
</TextField>
<Button fx:id="send" defaultButton="true" layoutX="542.0" layoutY="420.0" prefHeight="30.0" prefWidth="147.0"
text="Выполнить"/>
<Line endX="594.0" layoutX="98.0" layoutY="420.0" startX="-100.0" stroke="#5b3636" styleClass="lineHead"/>
</children>
<stylesheets>
<URL value="@../../styles.css"/>
<URL value="@../../overlay/debug/debug.css"/>
</stylesheets>
</Pane>

View file

@ -1,3 +0,0 @@
function execCommand(cmd) {
FunctionalBridge.evalCommand(cmd);
}

View file

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.String?>
<?import java.net.URL?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.PasswordField?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.Pane?>
<!-- DrLeonardo Design -->
<Pane fx:id="loginPane" prefWidth="740.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane fx:id="layout" prefWidth="740.0">
<children>
<Pane fx:id="authPane" layoutX="424.0" prefHeight="411.0" prefWidth="286.0" styleClass="loginPane">
<children>
<Pane fx:id="logo" layoutX="72.0" layoutY="62.0" prefWidth="124.0" styleClass="logo">
</Pane>
<TextField id="login" alignment="CENTER" layoutX="34.0" layoutY="196.0" promptText="Логин"/>
<PasswordField id="password" alignment="CENTER" layoutX="34.0" layoutY="249.0"
promptText="Пароль"/>
<Button id="goAuth" layoutX="34.0" layoutY="370.0" styleClass="auth" text="ВОЙТИ"/>
<CheckBox id="rememberchb" fx:id="savePassword" contentDisplay="CENTER" layoutX="63.0"
layoutY="297.0" prefWidth="144.0" text="Сохранить пароль" textFill="#dadada"/>
<ComboBox id="authOptions" fx:id="authOptions" layoutX="34.0" layoutY="341.0" prefHeight="25.0"
prefWidth="200.0" promptText="Способ авторизации">
<styleClass>
<String fx:value="combologin"/>
<String fx:value="combologin-popup"/>
</styleClass>
</ComboBox>
<Hyperlink id="link_link" fx:id="link" layoutX="94.0" layoutY="422.0" prefHeight="19.0"
prefWidth="81.0" textAlignment="CENTER"/>
</children>
</Pane>
<Pane fx:id="news" prefHeight="432.0" prefWidth="423.0" styleClass="news"/>
</children>
</Pane>
<Pane id="mask" opacity="0.0" prefHeight="450.0" prefWidth="694.0" visible="false"/>
<Pane fx:id="bar" layoutX="694.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar">
<children>
<Button id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/hide.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="close" alignment="CENTER" contentDisplay="CENTER" minHeight="-Infinity" minWidth="-Infinity"
text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/close.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="link_discord" alignment="CENTER" contentDisplay="CENTER" layoutY="370.0"
minHeight="-Infinity" minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/discord.png"/>
</image>
</ImageView>
</graphic>
</Button>
</children>
</Pane>
</children>
<stylesheets>
<URL value="@../../styles.css"/>
</stylesheets>
</Pane>

View file

@ -1,162 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Font?>
<!-- DrLeonardo Design -->
<Pane fx:id="serverPaneLayout" maxHeight="-1.0" maxWidth="-1.0" prefWidth="740.0" visible="true"
xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane fx:id="layout" maxHeight="-1.0" maxWidth="-1.0" prefWidth="740.0" visible="true"
xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane id="serverPane" prefHeight="450.0" prefWidth="694.0">
<children>
<ScrollPane id="serverlist" hbarPolicy="NEVER" layoutX="1.0" prefHeight="450.0"
prefWidth="307.0" visible="true">
<content>
<FlowPane focusTraversable="false" prefHeight="446.0" prefWidth="306.0"
prefWrapLength="0.0" rowValignment="TOP" vgap="10.0" visible="true">
<Button id="servercontainer" text="">
<FlowPane.margin>
<Insets bottom="10.0"/>
</FlowPane.margin>
</Button>
<padding>
<Insets left="10.0" top="10.0"/>
</padding>
</FlowPane>
</content>
</ScrollPane>
<Pane id="serverentrance" layoutX="308.0" prefHeight="425.0" prefWidth="388.0"
styleClass="serverentrance">
<children>
<ScrollPane id="serverinfo" hbarPolicy="NEVER" layoutX="4.0" layoutY="53.0"
pannable="true" prefHeight="322.0" prefWidth="381.0" visible="true">
<content>
<FlowPane id="" focusTraversable="false" orientation="HORIZONTAL"
prefHeight="310.0" prefWidth="369.0" rowValignment="TOP"
visible="true">
<padding>
<Insets bottom="10.0" left="15.0" top="7.0"/>
</padding>
<children>
<Label id="serverDescription" alignment="TOP_LEFT" contentDisplay="LEFT"
nodeOrientation="LEFT_TO_RIGHT" prefHeight="274.0"
prefWidth="349.0"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis magna tellus, in bibendum tortor dignissim non. Phasellus vel tincidunt nulla, eu convallis ligula. Suspendisse ut diam vestibulum, tincidunt neque ut, posuere risus. Pellentesque posuere molestie eros, quis laoreet ante ornare quis. Morbi eu tortor fermentum, iaculis risus sit amet, fringilla augue. Aenean nulla purus, rutrum non sapien et, convallis tincidunt purus. Vivamus a eros pulvinar, dignissim leo lacinia, sodales nulla. Aliquam tortor augue, cursus a rutrum viverra, consequat non tellus. Donec porta nisl sed quam dictum commodo. Sed et vulputate dolor. Morbi ultrices justo vitae convallis semper. Donec sodales velit vel velit faucibus, et scelerisque felis finibus. Sed rutrum lacinia mauris, porta cursus mauris tempor eu. Duis turpis nulla, dictum vitae commodo rhoncus, pretium in turpis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos."
textAlignment="JUSTIFY" textFill="#141414" wrapText="true"/>
</children>
</FlowPane>
</content>
</ScrollPane>
<Button id="clientLaunch" layoutX="19.0" layoutY="380.0" prefHeight="51.0"
prefWidth="285.0" styleClass="clientLaunch" text="ИГРАТЬ">
<font>
<Font size="22.0"/>
</font>
</Button>
<Button id="clientSettings" alignment="CENTER" centerShape="false"
contentDisplay="CENTER" layoutX="305.0" layoutY="380.0" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="51.0" prefWidth="60.0"
styleClass="clientSettings" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/list.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Label id="serverStatus" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="165.0"
layoutY="12.0" prefHeight="25.0" prefWidth="97.0" text="12/100"
textAlignment="RIGHT" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0"/>
</font>
</Label>
<Label id="serverLabel" layoutX="20.0" layoutY="11.0" prefHeight="27.0"
prefWidth="203.0" text="СЕРВЕР">
<font>
<Font name="System Bold" size="18.0"/>
</font>
</Label>
<Button id="logout" alignment="CENTER" contentDisplay="CENTER" layoutX="295.0"
layoutY="12.0" prefHeight="25.0" prefWidth="81.0" text="Выйти"
textAlignment="CENTER"/>
</children>
</Pane>
</children>
</Pane>
</children>
</Pane>
<Pane fx:id="bar" layoutX="694.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar">
<children>
<Button id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/hide.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="close" alignment="CENTER" contentDisplay="CENTER" minHeight="-Infinity" minWidth="-Infinity"
text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/close.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="link_discord" alignment="CENTER" contentDisplay="CENTER" layoutY="380.0"
minHeight="-Infinity" minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/discord.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="settings" alignment="CENTER" contentDisplay="CENTER" layoutY="90.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/settings.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="goConsole" alignment="CENTER" contentDisplay="CENTER" layoutY="138.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/console.png"/>
</image>
</ImageView>
</graphic>
</Button>
</children>
</Pane>
<Pane id="mask" opacity="0.0" prefHeight="450.0" prefWidth="694.0" visible="false"/>
</children>
<stylesheets>
<URL value="@../../styles.css"/>
<URL value="@../../servers.css"/>
</stylesheets>
</Pane>

View file

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Line?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?>
<!-- DrLeonardo Design -->
<Pane fx:id="background" prefHeight="450.0" prefWidth="740.0" xmlns="http://javafx.com/javafx/8.0.171"
xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane id="optionsPane" prefHeight="450.0" prefWidth="692.0" styleClass="optionsPane">
<children>
<Line endX="595.0" layoutX="100.0" layoutY="46.0" startX="-100.0" stroke="#5b3636"
styleClass="lineHead"/>
<ScrollPane id="modlist" layoutY="46.0" prefHeight="404.0" prefWidth="693.0">
<content>
<VBox prefHeight="394.0" prefWidth="678.0">
<children>
</children>
<padding>
<Insets left="10.0" top="8.0"/>
</padding>
</VBox>
</content>
</ScrollPane>
<Text fill="#393939" layoutX="15.0" layoutY="28.0" strokeType="OUTSIDE" strokeWidth="0.0"
text="ОПЦИОНАЛЬНЫЕ МОДИФИКАЦИИ" wrappingWidth="265.904296875">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Text>
</children>
</Pane>
<Pane fx:id="bar" layoutX="694.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar">
<children>
<Button id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/hide.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="close" alignment="CENTER" contentDisplay="CENTER" minHeight="-Infinity" minWidth="-Infinity"
text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/close.png"/>
</image>
</ImageView>
</graphic>
</Button>
<Button id="back" alignment="CENTER" contentDisplay="CENTER" layoutY="405.0" minHeight="-Infinity"
minWidth="-Infinity" text="" textAlignment="CENTER">
<graphic>
<ImageView>
<image>
<Image url="@../../images/icons/back.png"/>
</image>
</ImageView>
</graphic>
</Button>
</children>
</Pane>
</children>
<stylesheets>
<URL value="@../../styles.css"/>
</stylesheets>
</Pane>

View file

@ -1,150 +0,0 @@
var options = {
file: DirBridge.dir.resolve("options.bin"),
load: function(profiles) {
LogHelper.debug("Loading options file");
try {
tryWithResources(new HInput(IOHelper.newInput(options.file)), options.read);
} catch (e) {
LogHelper.error(e);
}
},
save: function() {
LogHelper.debug("Saving options file");
try {
tryWithResources(new HOutput(IOHelper.newOutput(options.file)), options.write);
} catch (e) {
LogHelper.error(e);
}
},
read: function(input) {
var magic = input.readInt();
if (magic != config.settingsMagic) {
throw new java.io.IOException("options magic mismatch: " + java.lang.Integer.toString(magic, 16));
}
var profilesCount = input.readInt();
LogHelper.debug("Load options. ProfilesCount %d", profilesCount);
for (var i = 0; i < profilesCount; i++) {
var listSize = input.readInt();
var sortIndex = input.readInt();
var profile = null;
settings.lastProfiles.forEach(function(hprofile, i, arr) {
if (hprofile.getSortIndex() == sortIndex) {
profile = hprofile;
}
});
for (var j = 0; j < listSize; j++) {
var mark = input.readBoolean();
var modType = OptionalFile.readType(input);
var modFile = input.readString(0);
if (mark) {
profile.markOptional(modFile, modType);
LogHelper.debug("Load options %s marked", modFile);
} else {
profile.unmarkOptional(modFile, modType);
LogHelper.debug("Load options %s unmarked", modFile);
}
}
}
},
write: function(output) {
output.writeInt(config.settingsMagic);
output.writeInt(settings.lastProfiles.length);
settings.lastProfiles.forEach(function(hprofile, i, arr) {
var profile = hprofile;
LogHelper.debug("Save options %s", profile.getTitle());
var list = profile.getOptional();
output.writeInt(list.size());
output.writeInt(profile.getSortIndex());
list.forEach(function(modFile, j, arr2) {
output.writeBoolean(modFile.mark);
modFile.writeType(output);
output.writeString(modFile.name, 0);
});
});
},
count: 0,
update: function() {
var pane = optionsMenu.lookup("#optionsPane");
optionsPane = pane;
var modlist = pane.lookup("#modlist").getContent();
var nodelist = new java.util.ArrayList;
modlist.getChildren().forEach(function(node, i, arr) {
if (node instanceof javafx.scene.control.CheckBox)
nodelist.add(node);
});
nodelist.forEach(function(node, i, arr) {
modlist.getChildren().remove(node);
});
var profile = profilesList[serverHolder.old];
var list = profile.getOptional();
var checkBoxList = new java.util.ArrayList;
list.forEach(function(modFile) {
var modName = modFile.name,
modDescription = "",
subLevel = 1;
if (!modFile.visible) {
LogHelper.debug("optionalMod %s hidden", modFile.name);
return;
}
if (modFile.permissions != 0 && ((loginData.permissions.toLong() & modFile.permissions) == 0)) {
LogHelper.debug("optionalMod %s permissions deny", modFile.name);
return;
}
if (modFile.info != null)
modDescription = modFile.info;
if (modFile.subTreeLevel != null && modFile.subTreeLevel > 1)
subLevel = modFile.subTreeLevel;
var testMod = new javafx.scene.control.CheckBox(modName);
testMod.getStyleClass().add("checkboxOpt");
if (subLevel > 1)
for (var i = 1; i < subLevel; i++)
testMod.setTranslateX(25 * i);
testMod.setSelected(modFile.mark);
testMod.setOnAction(function(event) {
var isSelected = event.getSource().isSelected();
if (isSelected) {
profile.markOptional(modFile);
LogHelper.debug("Selected mod %s", modFile.name);
} else {
profile.unmarkOptional(modFile);
LogHelper.debug("Unselected mod %s", modFile.name);
}
options.update();
});
testMod.setFocusTraversable(false);
checkBoxList.add(testMod);
testMod.getStyleClass().add("modname");
if (modDescription != "") {
textDescr = new javafx.scene.text.Text(modDescription);
if (subLevel > 1) {
for (var i = 1; i < subLevel; i++) {
textDescr.setWrappingWidth(620 - (25 * i));
textDescr.setTranslateX(25 + (25 * i));
}
} else {
textDescr.setWrappingWidth(620);
textDescr.setTranslateX(25);
}
textDescr.setTextAlignment(javafx.scene.text.TextAlignment.JUSTIFY);
textDescr.getStyleClass().add("description-text");
checkBoxList.add(textDescr);
}
sep = new javafx.scene.control.Separator();
sep.getStyleClass().add("separator");
checkBoxList.add(sep);
});
modlist.getChildren().clear();
modlist.getChildren().addAll(checkBoxList);
}
};

View file

@ -1,29 +0,0 @@
/*-- DrLeonardo Design --*/
/* Server buttons */
.server-button {
-fx-font-weight: bold;
-fx-font-size: 16pt;
-fx-background-color: transparent;
-fx-background-size: cover;
-fx-background-radius: 0;
-fx-alignment: CENTER-LEFT;
-fx-padding: 0 0 0 75;
-fx-font-family: "Segoe UI";
-fx-text-fill: #323232;
-fx-pref-width: 282px;
-fx-pref-height: 75px;
}
.server-button:selected {
-fx-effect: dropshadow(gaussian, rgba(23, 25, 29, 0.3), 15, 0, 0, 3);
}
/** server-button-<your profile name> **/
.server-button-Example {
-fx-background-image: url('images/servers/example.png');
}
/*-- DrLeonardo Design --*/

View file

@ -1,435 +0,0 @@
/*-- Without jfoenix --*/
Button {
-fx-background-color: TRANSPARENT, TRANSPARENT, TRANSPARENT, TRANSPARENT;
-fx-background-radius: 3px;
-fx-background-insets: 0px;
}
CheckBox .box-container {
-fx-shape: "M 400 100 L 400 100 A 50 50 0 1 1 400 250 A 50 50 0 1 1 400 100 ";
-fx-padding: 10;
}
CheckBox .box,
CheckBox:indeterminate .box,
CheckBox:indeterminate:selected .box {
-fx-pref-width: 18;
-fx-pref-height: 18;
-fx-background-color: TRANSPARENT;
-fx-background-radius: 2;
-fx-border-color: #909090;
-fx-border-style: solid;
-fx-border-radius: 2;
-fx-border-width: 2;
}
CheckBox:selected .box {
-fx-border-color: #5fd97a;
-fx-background-color: #5fd97a;
}
CheckBox .mark {
-fx-background-color: TRANSPARENT;
}
CheckBox:selected .mark {
-fx-shape: "M384 690l452-452 60 60-512 512-238-238 60-60z";
-fx-max-width: 15;
-fx-max-height: 12;
-fx-background-color: WHITE;
-fx-border-color: WHITE;
-fx-border-width: 2;
-fx-border-radius: 2;
}
CheckBox .indeterminate-mark {
-fx-background-color: #5fd97a;
-fx-background-radius: 2;
-fx-border-width: 0;
-fx-max-width: 10;
-fx-max-height: 10;
}
/*-- DrLeonardo Design --*/
Button,
CheckBox,
ComboBox,
RadioButton {
-fx-cursor: hand;
}
/* Backgrounds */
#layout {
-fx-background-color: transparent;
-fx-background-size: cover;
-fx-pref-width: 738px;
-fx-pref-height: 450px;
-fx-background-image: url('images/background.jpg');
}
#background {
-fx-background-color: #fff;
}
/** Labels **/
#background>#settingsTitle {
-fx-font-size: 14pt;
-fx-alignment: baseline-center;
}
#serverLabel {
-fx-text-fill: #323232;
}
#serverStatus {
-fx-text-fill: #323232;
-fx-pref-width: 120px;
-fx-pref-height: 25px;
}
/* Mask */
#mask {
-fx-effect: DropShadow(gaussian, rgba(255, 255, 255, 0.5), 0, 0, 0, 1);
}
/** Errors **/
#errormessage {
-fx-background-color: transparent;
-fx-text-alignment: center;
-fx-text-fill: #CE5757;
}
.error {
-fx-text-fill: #CE5757;
}
/* bars */
#bar {
-fx-background-color: #323232;
-fx-pref-width: 46px;
-fx-pref-height: 450px;
}
/** buttons in bar **/
#close {
-fx-background-position: center;
-fx-background-radius: 0;
-fx-background-color: #CE5757;
-fx-pref-width: 46px;
-fx-pref-height: 45px;
}
#hide,
#back,
#goConsole,
#settings,
#link_discord {
-fx-background-position: center;
-fx-background-radius: 0;
-fx-pref-width: 46px;
-fx-pref-height: 45px;
}
#logout {
-fx-text-fill: #323232;
-fx-font-size: 12;
-fx-font-weight: normal;
-fx-border-color: #CE5757;
-fx-border-width: 1;
-fx-background-color: transparent;
-fx-padding: 0;
}
#logout:hover,
#logout:focus {
-fx-text-fill: #ff6a5e;
}
#logout:pressed {
-fx-border-color: #cb4d43;
}
#send {
-fx-background-radius: 0;
-fx-text-fill: black;
-fx-background-position: center;
-fx-background-color: #ffffff;
-fx-pref-width: 150px;
-fx-pref-height: 30px;
}
#send:pressed {
-fx-background-color: #d8d8d8;
}
/* LoginMenu */
#authPane {
-fx-background-color: rgba(255, 255, 255, 0.71);
-fx-pref-width: 270px;
-fx-pref-height: 450px;
}
#logo {
-fx-background-image: url('images/icons/logo.png');
-fx-background-repeat: no-repeat;
-fx-pref-width: 125px;
-fx-pref-height: 32px;
}
/** Buttons & textarea**/
.auth {
-fx-font-weight: bold;
-fx-font-size: 13pt;
-fx-background-radius: 0;
-fx-background-color: #5fd97a;
-fx-text-fill: #ffffff;
-fx-pref-width: 200px;
-fx-pref-height: 45px;
-fx-effect: dropshadow(gaussian, rgba(23, 25, 29, 0.3), 15, 0, 0, 3);
}
.auth:hover,
.auth:pressed {
-fx-background-color: #75e18c;
}
#password,
#login {
-fx-background-radius: 0;
-fx-pref-width: 200px;
-fx-pref-height: 30px;
}
.text-input {
-fx-focus-color: transparent;
-fx-background-repeat: no-repeat;
-fx-text-fill: #909090;
-fx-prompt-text-fill: #909090;
-fx-background-color: transparent;
-fx-font-family: "Segoe UI";
-fx-font-size: 13px;
-fx-font-weight: bold;
}
/** Hyperlink **/
#link_link {
-fx-font-weight: bold;
-fx-font-size: 7pt;
-fx-opacity: 0.5;
-fx-text-fill: #323232;
-fx-pref-width: 80px;
-fx-pref-height: 17px;
}
#link_link:hover,
#link_link:pressed {
-fx-opacity: 0.8;
}
/** CheckBox & ComboBox**/
#rememberchb {
-fx-font-size: 13;
-fx-text-fill: #909090;
-fx-pref-width: 145px;
-fx-pref-height: 30px;
}
#combologin {
-fx-text-fill: #909090;
-fx-prompt-text-fill: #909090;
-fx-pref-width: 200px;
-fx-pref-height: 30px;
}
.combologin,
.combologin {
-fx-font-size: 13px;
-fx-prompt-text-fill: #909090;
-fx-text-fill: #909090;
-fx-background-color: transparent;
}
.combologin .list-cell {
-fx-background: white;
-fx-background-color: transparent;
-fx-text-fill: -fx-text-base-color;
}
.combologin-popup .list-view {
-fx-background-color: white, white;
-fx-background-insets: 0, 1;
-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.6), 8, 0.0, 0, 0);
}
.combologin .list-cell:filled:selected .text,
.combologin .list-cell:filled:selected .text {
-fx-fill: #323232;
}
.combologin .arrow,
.combologin .arrow {
-fx-background-color: #5fd97a;
}
.combologin-popup .list-view .list-cell {
-fx-background-color: white;
}
.combologin-popup .list-view .list-cell:filled:selected,
.combologin-popup .list-view .list-cell:filled:selected:hover {
-fx-background: -fx-accent;
-fx-background-color: -fx-selection-bar;
-fx-text-fill: #909090;
}
.combologin-popup .list-view .list-cell:filled:hover {
-fx-background-color: white;
-fx-text-fill: #909090;
}
/** web**/
#news {
-fx-background-color: transparent;
-fx-pref-width: 423px;
-fx-pref-height: 450px;
}
/* MenuPane */
.serverentrance {
-fx-background-color: rgba(255, 255, 255, 0.71);
-fx-pref-width: 386px;
-fx-pref-height: 450px;
}
/** buttons **/
.clientLaunch {
-fx-font-weight: bold;
-fx-font-size: 16pt;
-fx-background-radius: 0;
-fx-background-color: #5fd97a;
-fx-text-fill: #ffffff;
}
.clientSettings {
-fx-background-position: center;
-fx-background-color: #5fd97a;
-fx-background-radius: 0;
}
.clientLaunch:hover,
.clientLaunch:pressed {
-fx-background-color: #75e18c;
}
/* Scrolls */
.scroll-pane {
-fx-background-color: transparent;
}
.scroll-bar:horizontal,
.scroll-bar:vertical {
-fx-background-color: transparent;
}
.increment-button,
.decrement-button,
.increment-arrow,
.decrement-arrow {
-fx-background-color: transparent;
-fx-border-color: transparent;
}
.scroll-bar:horizontal .track,
.scroll-bar:vertical .track {
-fx-background-color: transparent;
-fx-border-color: transparent;
}
.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
-fx-background-color: rgba(0, 0, 0, 0.19);
-fx-background-radius: 0;
}
.scroll-bar {
-fx-font-size: 6px;
}
.scroll-pane>.corner {
-fx-background-color: rgba(0, 0, 0, 0.19);
}
/* OptionsPane */
#optionsPane>#modlist {
-fx-background-color: transparent;
}
#optionsPane>#modlist>.viewport {
-fx-background-color: transparent;
}
.description-text {
-fx-font-smoothing-type: lcd;
-fx-fill: #8c8c8c;
-fx-font-size: 12px;
}
.modname {
-fx-text-fill: #323232;
}
.lineHead {
-fx-stroke: #d8d8d8;
-fx-stroke-width: 1;
}
.separator *.line {
-fx-border-color: transparent;
-fx-border-width: 0 0 10 0;
}
#serverlist {
-fx-background-color: transparent;
}
#serverlist>.viewport {
-fx-background-color: transparent;
}
#serverdesc {
-fx-background-color: transparent;
}
#serverdesc>.viewport {
-fx-background-color: transparent;
}
#serverinfo {
-fx-background-color: transparent;
}
#serverinfo>.viewport {
-fx-background-color: transparent;
}
#servercontainer {
-fx-background-color: transparent;
-fx-pref-width: 282px;
-fx-pref-height: 75px;
}
.toggle-button:disabled {
-fx-opacity: 1.0;
}
.heading {
-fx-text-fill: #555555;
}
/*-- DrLeonardo Design --*/

View file

@ -1,92 +0,0 @@
var Launcher = LauncherClass.static;
var LauncherConfig = LauncherConfigClass.static;
var HTTPRequest = HTTPRequestClass.static;
var DirBridge = DirBridgeClass.static;
var FunctionalBridge = FunctionalBridgeClass.static;
// Hasher class API imports
var PlayerProfile = PlayerProfileClass.static;
var PlayerProfileTexture = PlayerProfileTextureClass.static;
var ClientProfile = ClientProfileClass.static;
var ClientProfileVersion = ClientProfileVersionClass.static;
var ClientLauncher = ClientLauncherClass.static;
var ClientLauncherParams = ClientLauncherParamsClass.static;
var ServerPinger = ServerPingerClass.static;
// Request class API imports
var Request = RequestClass.static;
var RequestType = RequestTypeClass.static;
var RequestException = RequestExceptionClass.static;
//var PingRequest = PingRequestClass.static;
var AuthRequest = AuthRequestClass.static;
var JoinServerRequest = JoinServerRequestClass.static;
var CheckServerRequest = CheckServerRequestClass.static;
var UpdateRequest = UpdateRequestClass.static;
var LauncherRequest = LauncherRequestClass.static;
var ProfilesRequest = ProfilesRequestClass.static;
var SetProfileRequest = SetProfileRequestClass.static;
var ProfileByUsernameRequest = ProfileByUsernameRequestClass.static;
var ProfileByUUIDRequest = ProfileByUUIDRequestClass.static;
var BatchProfileByUsernameRequest = BatchProfileByUsernameRequestClass.static;
var GetAvailabilityAuthRequest = GetAvailabilityAuthRequestClass.static;
// Hasher class API imports
var FileNameMatcher = FileNameMatcherClass.static;
var HashedDir = HashedDirClass.static;
var HashedFile = HashedFileClass.static;
var HashedEntryType = HashedEntryTypeClass.static;
// Serialization class API imports
var HInput = HInputClass.static;
var HOutput = HOutputClass.static;
var StreamObject = StreamObjectClass.static;
var StreamObjectAdapter = StreamObjectAdapterClass.static;
var EnumSerializer = EnumSerializerClass.static;
var OptionalFile = OptionalFileClass.static;
// Helper class API imports
var CommonHelper = CommonHelperClass.static;
var IOHelper = IOHelperClass.static;
var JVMHelper = JVMHelperClass.static;
var JVMHelperOS = JVMHelperOSClass.static;
var LogHelper = LogHelperClass.static;
var EnvHelper = EnvHelperClass.static;
var SecurityHelper = SecurityHelperClass.static;
var DigestAlgorithm = DigestAlgorithmClass.static;
var VerifyHelper = VerifyHelperClass.static;
var NewLauncherSettings = NewLauncherSettingsClass.static;
var SettingsManager = SettingsManagerClass.static;
var NoHWID = NoHWIDClass.static;
var OshiHWID = OshiHWIDClass.static;
// Helper JS class API imports
var JSApplication = null;
if (typeof JSApplicationClass !== 'undefined') {
JSApplication = JSApplicationClass.static;
}
// API wrapper
function tryWithResources(closeable, f) {
try {
f(closeable);
} finally {
IOHelper.close(closeable);
}
}
function newTask(r) {
return new javafx.concurrent.Task() { call: r };
}
function newRequestTask(request) {
return newTask(function() request.request());
}
function startTask(task) {
FunctionalBridge.startTask(task);
}
function openURL(url) {
app.getHostServices().showDocument(url.toURI());
}

View file

@ -1,22 +0,0 @@
var settingsManagerClass = Java.extend(SettingsManagerClass.static, {
getDefaultConfig: function() {
var new_settings = new NewLauncherSettings;
new_settings.login = null;
new_settings.rsaPassword = null;
new_settings.profile = 0;
new_settings.updatesDir = DirBridge.defaultUpdatesDir;
new_settings.autoEnter = config.autoEnterDefault;
new_settings.fullScreen = config.fullScreenDefault;
new_settings.ram = config.ramDefault;
new_settings.featureStore = config.featureStoreDefault;
new_settings.lastDigest = null;
new_settings.lastProfiles.clear();
new_settings.lastHDirs.clear();
return new_settings;
},
});
var settingsManager = new settingsManagerClass;
var settings = SettingsManager.settings;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View file

@ -1,103 +0,0 @@
var app, stage, scene, loginScene, menuScene, consoleScene, consoleStage, optionsScene;
var rootPane, loginPane, menuPane, consoleMenu, optionsMenu;
var LauncherApp = Java.extend(JSApplication, {
init: function() {
app = JSApplication.getInstance();
cliParams.init(app.getParameters());
settingsManager.loadConfig();
settings = SettingsManager.settings;
settingsManager.loadHDirStore();
cliParams.applySettings();
},
start: function(primaryStage) {
stage = primaryStage;
stage.initStyle(javafx.stage.StageStyle.TRANSPARENT);
stage.setResizable(false);
stage.setTitle(config.title);
consoleStage = new javafx.stage.Stage();
consoleStage.initStyle(javafx.stage.StageStyle.TRANSPARENT);
consoleStage.setResizable(false);
consoleStage.setTitle(config.title);
config.icons.forEach(function(icon) {
var iconURL = Launcher.getResourceURL(icon).toString();
stage.getIcons().add(new javafx.scene.image.Image(iconURL));
});
loginPane = loadFXML("dialog/scenes/login/login.fxml");
menuPane = loadFXML("dialog/scenes/mainmenu/mainmenu.fxml");
consoleMenu = loadFXML("dialog/scenes/console/console.fxml");
optionsMenu = loadFXML("dialog/scenes/options/options.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);
consoleScene = new javafx.scene.Scene(consoleMenu);
consoleScene.setFill(javafx.scene.paint.Color.TRANSPARENT);
optionsScene = new javafx.scene.Scene(optionsMenu);
optionsScene.setFill(javafx.scene.paint.Color.TRANSPARENT);
setCurrentScene(loginScene);
initLauncher();
},
stop: function() {
settingsManager.saveConfig();
settingsManager.saveHDirStore();
options.save();
}
});
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 setConsoleCurrentScene(scene) {
consoleStage.setScene(scene);
consoleStage.sizeToScene();
consoleStage.show();
}
function setRootParent(parent) {
scene.setRoot(parent);
}
function start(args) {
if (config.jvm.enable) {
switch (JVMHelper.OS_TYPE) {
case JVMHelperOS.MUSTDIE:
jvmDirName = JVMHelper.OS_BITS === 32 ? config.jvm.jvmMustdie32Dir :
jvmDirName = JVMHelper.OS_BITS === 64 ? config.jvm.jvmMustdie64Dir : config.jvm.enable = false;
break;
default:
config.jvm.enable = false;
break;
}
}
LogHelper.debug("Setting FX properties");
java.lang.System.setProperty("prism.lcdtext", "false");
LogHelper.debug("Launching JavaFX application");
javafx.application.Application.launch(LauncherApp.class, args);
}
launcher.loadScript("dialog/dialog.js");

View file

@ -4,7 +4,7 @@
import pro.gravit.launcher.client.events.ClientEngineInitPhase;
import pro.gravit.launcher.client.events.ClientPreGuiPhase;
import pro.gravit.launcher.guard.LauncherGuardManager;
import pro.gravit.launcher.gui.JSRuntimeProvider;
import pro.gravit.launcher.gui.NoRuntimeProvider;
import pro.gravit.launcher.gui.RuntimeProvider;
import pro.gravit.launcher.hwid.HWIDProvider;
import pro.gravit.launcher.managers.ClientGsonManager;
@ -132,7 +132,7 @@ public void start(String... args) throws Throwable {
ClientPreGuiPhase event = new ClientPreGuiPhase(null);
LauncherEngine.modulesManager.invokeEvent(event);
runtimeProvider = event.runtimeProvider;
if (runtimeProvider == null) runtimeProvider = new JSRuntimeProvider();
if (runtimeProvider == null) runtimeProvider = new NoRuntimeProvider();
ClientHookManager.initGuiHook.hook(runtimeProvider);
runtimeProvider.init(false);
//runtimeProvider.preLoad();

View file

@ -1,163 +0,0 @@
package pro.gravit.launcher.gui;
import pro.gravit.launcher.*;
import pro.gravit.launcher.client.*;
import pro.gravit.launcher.client.events.ClientGuiPhase;
import pro.gravit.launcher.hasher.FileNameMatcher;
import pro.gravit.launcher.hasher.HashedDir;
import pro.gravit.launcher.hasher.HashedEntry;
import pro.gravit.launcher.hasher.HashedFile;
import pro.gravit.launcher.hwid.NoHWID;
import pro.gravit.launcher.hwid.OshiHWID;
import pro.gravit.launcher.managers.SettingsManager;
import pro.gravit.launcher.modules.events.ClosePhase;
import pro.gravit.launcher.profiles.ClientProfile;
import pro.gravit.launcher.profiles.PlayerProfile;
import pro.gravit.launcher.profiles.Texture;
import pro.gravit.launcher.profiles.optional.OptionalFile;
import pro.gravit.launcher.request.PingRequest;
import pro.gravit.launcher.request.Request;
import pro.gravit.launcher.request.RequestException;
import pro.gravit.launcher.request.RequestType;
import pro.gravit.launcher.request.auth.*;
import pro.gravit.launcher.request.update.LauncherRequest;
import pro.gravit.launcher.request.update.ProfilesRequest;
import pro.gravit.launcher.request.update.UpdateRequest;
import pro.gravit.launcher.request.uuid.BatchProfileByUsernameRequest;
import pro.gravit.launcher.request.uuid.ProfileByUUIDRequest;
import pro.gravit.launcher.request.uuid.ProfileByUsernameRequest;
import pro.gravit.launcher.serialize.HInput;
import pro.gravit.launcher.serialize.HOutput;
import pro.gravit.launcher.serialize.stream.EnumSerializer;
import pro.gravit.launcher.serialize.stream.StreamObject;
import pro.gravit.utils.HTTPRequest;
import pro.gravit.utils.helper.*;
import javax.script.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
public class JSRuntimeProvider implements RuntimeProvider {
public final ScriptEngine engine = CommonHelper.newScriptEngine();
private boolean isPreLoaded = false;
@LauncherAPI
public static void addLauncherClassBindings(Map<String, Object> bindings) {
bindings.put("LauncherClass", Launcher.class);
bindings.put("LauncherConfigClass", LauncherConfig.class);
bindings.put("HTTPRequestClass", HTTPRequest.class);
bindings.put("SettingsManagerClass", SettingsManager.class);
bindings.put("NewLauncherSettingsClass", NewLauncherSettings.class);
// Set client class bindings
bindings.put("PlayerProfileClass", PlayerProfile.class);
bindings.put("PlayerProfileTextureClass", Texture.class);
bindings.put("ClientProfileClass", ClientProfile.class);
bindings.put("ClientProfileVersionClass", ClientProfile.Version.class);
bindings.put("ClientLauncherClass", ClientLauncher.class);
bindings.put("ClientLauncherParamsClass", ClientLauncher.Params.class);
bindings.put("ServerPingerClass", ServerPinger.class);
// Set request class bindings
bindings.put("RequestClass", Request.class);
bindings.put("RequestTypeClass", RequestType.class);
bindings.put("RequestExceptionClass", RequestException.class);
bindings.put("PingRequestClass", PingRequest.class);
bindings.put("AuthRequestClass", AuthRequest.class);
bindings.put("JoinServerRequestClass", JoinServerRequest.class);
bindings.put("CheckServerRequestClass", CheckServerRequest.class);
bindings.put("UpdateRequestClass", UpdateRequest.class);
bindings.put("LauncherRequestClass", LauncherRequest.class);
bindings.put("SetProfileRequestClass", SetProfileRequest.class);
bindings.put("ProfilesRequestClass", ProfilesRequest.class);
bindings.put("ProfileByUsernameRequestClass", ProfileByUsernameRequest.class);
bindings.put("ProfileByUUIDRequestClass", ProfileByUUIDRequest.class);
bindings.put("BatchProfileByUsernameRequestClass", BatchProfileByUsernameRequest.class);
bindings.put("GetAvailabilityAuthRequestClass", GetAvailabilityAuthRequest.class);
// Set hasher class bindings
bindings.put("FileNameMatcherClass", FileNameMatcher.class);
bindings.put("HashedDirClass", HashedDir.class);
bindings.put("HashedFileClass", HashedFile.class);
bindings.put("HashedEntryTypeClass", HashedEntry.Type.class);
// Set serialization class bindings
bindings.put("HInputClass", HInput.class);
bindings.put("HOutputClass", HOutput.class);
bindings.put("StreamObjectClass", StreamObject.class);
bindings.put("StreamObjectAdapterClass", StreamObject.Adapter.class);
bindings.put("EnumSerializerClass", EnumSerializer.class);
bindings.put("OptionalFileClass", OptionalFile.class);
bindings.put("UserSettingsClass", UserSettings.class);
// Set helper class bindings
bindings.put("CommonHelperClass", CommonHelper.class);
bindings.put("IOHelperClass", IOHelper.class);
bindings.put("EnvHelperClass", EnvHelper.class);
bindings.put("JVMHelperClass", JVMHelper.class);
bindings.put("JVMHelperOSClass", JVMHelper.OS.class);
bindings.put("LogHelperClass", LogHelper.class);
bindings.put("LogHelperOutputClass", LogHelper.Output.class);
bindings.put("SecurityHelperClass", SecurityHelper.class);
bindings.put("DigestAlgorithmClass", SecurityHelper.DigestAlgorithm.class);
bindings.put("VerifyHelperClass", VerifyHelper.class);
bindings.put("DirBridgeClass", DirBridge.class);
bindings.put("FunctionalBridgeClass", FunctionalBridge.class);
bindings.put("NoHWIDClass", NoHWID.class);
bindings.put("OshiHWIDClass", OshiHWID.class);
// Load JS API if available
try {
Class.forName("javafx.application.Application");
bindings.put("JSApplicationClass", JSApplication.class);
} catch (ClassNotFoundException ignored) {
LogHelper.warning("JavaFX API isn't available");
}
}
@LauncherAPI
public Object loadScript(String path) throws IOException, ScriptException {
URL url = Launcher.getResourceURL(path);
LogHelper.debug("Loading script: '%s'", url);
try (BufferedReader reader = IOHelper.newReader(url)) {
return engine.eval(reader, engine.getBindings(ScriptContext.ENGINE_SCOPE));
}
}
private void setScriptBindings() {
LogHelper.info("Setting up script engine bindings");
Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
bindings.put("launcher", this);
// Add launcher class bindings
JSRuntimeProvider.addLauncherClassBindings(bindings);
}
@Override
public void run(String[] args) throws ScriptException, NoSuchMethodException, IOException {
preLoad();
loadScript(Launcher.INIT_SCRIPT_FILE);
LogHelper.info("Invoking start() function");
LauncherEngine.modulesManager.invokeEvent(new ClientGuiPhase(this));
((Invocable) engine).invokeFunction("start", (Object) args);
LauncherEngine.modulesManager.invokeEvent(new ClosePhase());
}
@Override
public void preLoad() throws IOException, ScriptException {
if (!isPreLoaded) {
loadScript(Launcher.API_SCRIPT_FILE);
loadScript(Launcher.CONFIG_SCRIPT_FILE);
isPreLoaded = true;
}
}
@Override
public void init(boolean clientInstance) {
setScriptBindings();
}
}

View file

@ -0,0 +1,20 @@
package pro.gravit.launcher.gui;
import javax.swing.*;
public class NoRuntimeProvider implements RuntimeProvider {
@Override
public void run(String[] args) throws Exception {
JOptionPane.showMessageDialog(null, "GUI часть лаунчера не найдена.\nС 5.1.0 вам необходимо самостоятельно установить модуль, отвечающий за GUI. Рантайм на JS более не поддерживается");
}
@Override
public void preLoad() throws Exception {
}
@Override
public void init(boolean clientInstance) {
}
}