diff --git a/Launcher/runtime/dialog/console.fxml b/Launcher/runtime/dialog/console.fxml index 1890848f..524eb03a 100644 --- a/Launcher/runtime/dialog/console.fxml +++ b/Launcher/runtime/dialog/console.fxml @@ -7,7 +7,7 @@ - + diff --git a/Launcher/runtime/dialog/dialog.js b/Launcher/runtime/dialog/dialog.js index a3981c87..44ff75a8 100644 --- a/Launcher/runtime/dialog/dialog.js +++ b/Launcher/runtime/dialog/dialog.js @@ -1,4 +1,4 @@ -var authPane, dimPane, serverPane, bar; +var authPane, dimPane, serverPane, bar, optionsPane; var loginField, passwordField, savePasswordBox; var serverList, serverInfo, serverDescription, serverEntrance, serverLabel, serverStatus; var profilesList = []; @@ -10,12 +10,13 @@ function initLauncher() { initLoginScene(); initMenuScene(); initConsoleScene(); + initOptionsScene(); debug.initOverlay(); processing.initOverlay(); settingsOverlay.initOverlay(); update.initOverlay(); - options.initOverlay(); + //options.initOverlay(); verifyLauncher(); } @@ -41,14 +42,14 @@ function initLoginScene() { authPane = pane; loginField = pane.lookup("#login"); - loginField.setOnMouseMoved(function(event){rootPane.fireEvent(event)}); + 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.setOnMouseMoved(function(event){rootPane.fireEvent(event)}); passwordField.setOnAction(goAuth); if (settings.rsaPassword !== null) { passwordField.getStyleClass().add("hasSaved"); @@ -149,7 +150,7 @@ function initOffline() { function goAuth(event) { if (overlay.current !== null) { return; - } + } var login = loginField.getText(); if (login.isEmpty()) { @@ -176,34 +177,18 @@ function goAuth(event) { /* ======== Console ======== */ function goConsole(event) { - if (overlay.current !== null) { - return; - } + setCurrentScene(consoleScene); } /* ======== Settings ======== */ function goSettings(event) { - // Verify there's no other overlays if (overlay.current !== null) { return; } - // Show settings overlay overlay.show(settingsOverlay.overlay, null); } -/* ======== Options ======== */ -function goOptions(event) { - // Verify there's no other overlays - if (overlay.current !== null) { - return; - } - - // Show options overlay - options.update(); - overlay.show(options.overlay, null); -} - /* ======== Processing functions ======== */ function verifyLauncher(e) { processing.resetOverlay(); @@ -212,7 +197,7 @@ function verifyLauncher(e) { processing.resetOverlay(); // Init offline if set if (settings.offline) { - initOffline(); + initOffline(); } overlay.swap(0, processing.overlay, function(event) makeProfilesRequest(function(result) { settings.lastProfiles = result.profiles; @@ -220,9 +205,9 @@ function verifyLauncher(e) { updateProfilesList(result.profiles); options.load(); overlay.hide(0, function() { - if (cliParams.autoLogin) { - goAuth(null); - } + if (cliParams.autoLogin) { + goAuth(null); + } }); })); })); @@ -245,37 +230,37 @@ function doAuth(login, rsaPassword) { } function doUpdate(profile, pp, accessToken) { -var digest = profile.isUpdateFastCheck(); + var digest = profile.isUpdateFastCheck(); overlay.swap(0, update.overlay, function(event) { - 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.lastHDirs.put(assetDirName, assetHDir.hdir); + 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.lastHDirs.put(assetDirName, 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.lastHDirs.put(clientDirName, clientHDir.hdir); - doLaunchClient(assetDir, assetHDir.hdir, clientDir, clientHDir.hdir, profile, pp, accessToken); - }); + update.resetOverlay("Обновление файлов клиента"); + var clientDirName = profile.getDir(); + var clientDir = settings.updatesDir.resolve(clientDirName); + var clientMatcher = profile.getClientUpdateMatcher(); + makeUpdateRequest(clientDirName, clientDir, clientMatcher, digest, function(clientHDir) { + settings.lastHDirs.put(clientDirName, 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) - ); + launchClient(assetHDir, clientHDir, profile, new ClientLauncherParams(settings.lastDigest, + assetDir, clientDir, pp, accessToken, settings.autoEnter, settings.fullScreen, settings.ram, 0, 0), doDebugClient) +); } function doDebugClient(process) { @@ -317,8 +302,8 @@ function updateProfilesList(profiles) { }); LogHelper.debug("Load selected %d profile",settings.profile); if(profiles.length > 0) { - if(settings.profile >= profiles.length) - settings.profile = profiles.length-1; + if(settings.profile >= profiles.length) + settings.profile = profiles.length-1; serverHolder.set(serverList.getChildren().get(settings.profile)); } } diff --git a/Launcher/runtime/dialog/overlay/debug/debug.fxml b/Launcher/runtime/dialog/overlay/debug/debug.fxml index f8b4e1f2..8411c831 100644 --- a/Launcher/runtime/dialog/overlay/debug/debug.fxml +++ b/Launcher/runtime/dialog/overlay/debug/debug.fxml @@ -3,6 +3,7 @@ + @@ -14,7 +15,10 @@ - - - + + + + + + diff --git a/Launcher/runtime/dialog/overlay/options/options.css b/Launcher/runtime/dialog/overlay/options/options.css index d610c7b0..c21423ba 100644 --- a/Launcher/runtime/dialog/overlay/options/options.css +++ b/Launcher/runtime/dialog/overlay/options/options.css @@ -1,33 +1,61 @@ /*-- DrLeonardo Design --*/ -#holder { +#background { -fx-background-color: #fff; } /* Labels */ -#holder > #settingsTitle { +#background > #settingsTitle { -fx-font-size: 14pt; -fx-alignment: baseline-center; } -#holder > #apply{ +.pressetLight { + -jfx-toggle-color: #61B373; + -jfx-untoggle-color: #FAFAFA; + -jfx-toggle-line-color: rgba(116, 192, 133, 0.79); + -jfx-untoggle-line-color: #999999; + -jfx-size: 10.0; + -jfx-disable-visual-focus: false; +} + +.pressetMedium { + -jfx-toggle-color: #61B373; + -jfx-untoggle-color: #FAFAFA; + -jfx-toggle-line-color: rgba(116, 192, 133, 0.79); + -jfx-untoggle-line-color: #999999; + -jfx-size: 10.0; + -jfx-disable-visual-focus: false; +} + +.pressetHigh { + -jfx-toggle-color: #61B373; + -jfx-untoggle-color: #FAFAFA; + -jfx-toggle-line-color: rgba(116, 192, 133, 0.79); + -jfx-untoggle-line-color: #999999; + -jfx-size: 10.0; + -jfx-disable-visual-focus: false; +} + +#apply{ -fx-background-color: #61B373; -fx-background-radius: 0; -fx-text-fill: white; -fx-background-position: center; -jfx-button-type: FLAT; - -fx-pref-width: 150px; - -fx-pref-height: 25px; + -fx-pref-width: 45px; + -fx-pref-height: 45px; } -#holder > #apply:hover, -#holder > #apply:focused{ +#apply:hover, +#apply:focused{ -fx-background-color: #74C085; } -#holder > #modlist { +#optionsPane > #modlist { -fx-background-color: transparent; } -#holder > #modlist > .viewport { + +#optionsPane > #modlist > .viewport { -fx-background-color: transparent; } @@ -36,6 +64,12 @@ .description-text { -fx-fill: #8c8c8c; -fx-font-size: 12px; } + +.lineHead { + -fx-stroke: #d8d8d8; + -fx-stroke-width: 3; +} + .separator *.line { -fx-border-color: transparent; -fx-border-width: 0 0 10 0; diff --git a/Launcher/runtime/dialog/overlay/options/options.fxml b/Launcher/runtime/dialog/overlay/options/options.fxml index 1b0538cc..c53f1afa 100644 --- a/Launcher/runtime/dialog/overlay/options/options.fxml +++ b/Launcher/runtime/dialog/overlay/options/options.fxml @@ -1,32 +1,45 @@ - + + + - + - - - + + + + + + + - - - - - - - + + + + + + + - - - - + + + + + + + + + + + diff --git a/Launcher/runtime/dialog/overlay/options/options.js b/Launcher/runtime/dialog/overlay/options/options.js index 92979181..b9af9a9c 100644 --- a/Launcher/runtime/dialog/overlay/options/options.js +++ b/Launcher/runtime/dialog/overlay/options/options.js @@ -1,3 +1,38 @@ +var optionsPane; + +/* ======== init Options ======== */ +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("#apply").setOnAction(function(){ + setCurrentScene(menuScene); + }); + pane.lookup("#back").setOnAction(function(){ + setCurrentScene(menuScene); + }); + + var pane = optionsMenu.lookup("#optionsPane"); + optionsPane = pane; + +} + +/* ======== Options ======== */ +function goOptions(event) { + setCurrentScene(optionsScene); +} + var options = { file: DirBridge.dir.resolve("options.bin"), @@ -73,24 +108,19 @@ var options = { }); }, - /* ===================== OVERLAY ===================== */ count: 0, - initOverlay: function() { - options.overlay = loadFXML("dialog/overlay/options/options.fxml"); - var holder = options.overlay.lookup("#holder"); - holder.lookup("#apply").setOnAction(function(event) overlay.hide(0, null)); - }, update: function() { - var holder = options.overlay.lookup("#modlist").getContent(); + + var modlist = pane.lookup("#modlist").getContent(); var nodelist = new java.util.ArrayList; - holder.getChildren().forEach(function(node,i,arr) { + modlist.getChildren().forEach(function(node,i,arr) { if(node instanceof com.jfoenix.controls.JFXCheckBox) nodelist.add(node); }); nodelist.forEach(function(node,i,arr) { - holder.getChildren().remove(node); + modlist.getChildren().remove(node); }); var profile = profilesList[serverHolder.old]; var list = profile.getOptional(); @@ -108,14 +138,14 @@ var options = { LogHelper.debug("optionalMod %s permissions deny",modFile.name); return; } - if(modFile.info != null) //Есть ли описание? + if(modFile.info != null) modDescription = modFile.info; - if(modFile.subTreeLevel != null && modFile.subTreeLevel > 1)//Это суб-модификация? + if(modFile.subTreeLevel != null && modFile.subTreeLevel > 1) subLevel = modFile.subTreeLevel; var testMod = new com.jfoenix.controls.JFXCheckBox(modName); if(subLevel > 1) - for(var i = 1; i < subLevel; i++)//Выделение субмодификаций сдвигом. + for(var i = 1; i < subLevel; i++) testMod.setTranslateX(25*i); testMod.setSelected(modFile.mark); @@ -134,7 +164,7 @@ var options = { options.update(); }); checkBoxList.add(testMod); - if(modDescription != "") { //Добавляем описание? + if(modDescription != "") { textDescr = new javafx.scene.text.Text(modDescription); if(subLevel > 1) { for(var i = 1; i < subLevel; i++){ @@ -153,7 +183,7 @@ var options = { sep.getStyleClass().add("separator"); checkBoxList.add(sep); }); - holder.getChildren().clear(); - holder.getChildren().addAll(checkBoxList); + modlist.getChildren().clear(); + modlist.getChildren().addAll(checkBoxList); } }; diff --git a/Launcher/runtime/dialog/overlay/settings/settings.fxml b/Launcher/runtime/dialog/overlay/settings/settings.fxml index aa2a6430..27fd73da 100644 --- a/Launcher/runtime/dialog/overlay/settings/settings.fxml +++ b/Launcher/runtime/dialog/overlay/settings/settings.fxml @@ -28,7 +28,7 @@ - + @@ -43,7 +43,7 @@ Выделение памяти: - + diff --git a/Launcher/runtime/dialog/styles.css b/Launcher/runtime/dialog/styles.css index 17c10d65..c2e03582 100644 --- a/Launcher/runtime/dialog/styles.css +++ b/Launcher/runtime/dialog/styles.css @@ -254,7 +254,7 @@ .scroll-bar { } .scroll-pane>.corner { - -fx-background-color: black; + -fx-background-color: rgba(0, 0, 0, 0.19); } /* Server buttons */ diff --git a/Launcher/runtime/init.js b/Launcher/runtime/init.js index b073c87c..ea6c51f3 100644 --- a/Launcher/runtime/init.js +++ b/Launcher/runtime/init.js @@ -1,5 +1,5 @@ -var app, stage, scene, loginScene, menuScene, consoleScene; -var rootPane, loginPane, authPane, menuPane, consolePane; +var app, stage, scene, loginScene, menuScene, consoleScene, optionsScene; +var rootPane, loginPane, menuPane, consolePane, optionsMenu; var LauncherApp = Java.extend(JSApplication, { init: function() { @@ -9,7 +9,7 @@ var LauncherApp = Java.extend(JSApplication, { cliParams.applySettings(); }, start: function(primaryStage) { stage = primaryStage; - stage.initStyle(javafx.stage.StageStyle.TRANSPARENT); + stage.initStyle(javafx.stage.StageStyle.TRANSPARENT); stage.setResizable(false); stage.setTitle(config.title); @@ -21,6 +21,7 @@ var LauncherApp = Java.extend(JSApplication, { loginPane = loadFXML("dialog/login.fxml"); menuPane = loadFXML("dialog/mainmenu.fxml"); consolePane = loadFXML("dialog/console.fxml"); + optionsMenu = loadFXML("dialog/overlay/options/options.fxml"); loginScene = new javafx.scene.Scene(loginPane); loginScene.setFill(javafx.scene.paint.Color.TRANSPARENT); @@ -31,6 +32,9 @@ var LauncherApp = Java.extend(JSApplication, { consoleScene = new javafx.scene.Scene(consolePane); consoleScene.setFill(javafx.scene.paint.Color.TRANSPARENT); + optionsScene = new javafx.scene.Scene(optionsMenu); + optionsScene.setFill(javafx.scene.paint.Color.TRANSPARENT); + setCurrentScene(loginScene); initLauncher();