This commit is contained in:
DrLeonardo 2019-04-08 17:06:07 +03:00
parent 6d69efe258
commit cf89635471
9 changed files with 168 additions and 98 deletions

View file

@ -7,7 +7,7 @@
<!-- DrLeonardo Design -->
<Pane fx:id="layout" prefWidth="740.0" xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1">
<Pane fx:id="background" prefWidth="738.0" xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane fx:id="consolePane" prefHeight="425.0" prefWidth="693.0" styleClass="consolePane">
<children>

View file

@ -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));
}
}

View file

@ -3,6 +3,7 @@
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXTextArea?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.Pane?>
<!-- DrLeonardo Design -->
@ -14,7 +15,10 @@
</stylesheets>
<!-- Debug controls -->
<JFXTextArea fx:id="output" prefHeight="425.0" prefWidth="693.0" />
<JFXButton fx:id="copy" defaultButton="true" layoutX="423.0" layoutY="390.0" prefHeight="30.0" prefWidth="100.0" text="Копировать" />
<JFXButton fx:id="action" layoutX="583.0" layoutY="390.0" prefHeight="25.0" prefWidth="100.0" text="Убить" />
<JFXTextArea fx:id="output" prefHeight="425.0" prefWidth="693.0">
<padding>
<Insets left="10.0" right="10.0" />
</padding></JFXTextArea>
<JFXButton fx:id="copy" defaultButton="true" layoutX="373.0" layoutY="390.0" prefHeight="30.0" prefWidth="100.0" text="Копировать" />
<JFXButton fx:id="action" layoutX="533.0" layoutY="390.0" prefHeight="25.0" prefWidth="150.0" text="Убить" />
</Pane>

View file

@ -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;

View file

@ -1,32 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXScrollPane?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import java.net.URL?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Line?>
<!-- DrLeonardo Design -->
<Pane fx:id="overlay" prefHeight="425.0" prefWidth="693.0" xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1">
<Pane fx:id="background" prefHeight="425.0" prefWidth="738.0" xmlns="http://javafx.com/javafx/8.0.201" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane id="holder" prefHeight="425.0" prefWidth="693.0">
<children>
<JFXScrollPane id="modlist" prefHeight="425.0" prefWidth="694.0">
<Pane id="optionsPane" prefHeight="425.0" prefWidth="693.0" styleClass="optionsPane">
<children>
<JFXToggleButton layoutX="10.0" layoutY="10.0" styleClass="pressetLight" text="Presset 1" />
<JFXToggleButton layoutX="267.0" layoutY="10.0" styleClass="pressetMedium" text="Presset 2" />
<JFXToggleButton layoutX="549.0" layoutY="10.0" prefHeight="58.0" prefWidth="134.0" styleClass="pressetHigh" text="Presset 3" wrapText="true" />
<Line endX="588.0" layoutX="100.0" layoutY="80.0" startX="-100.0" stroke="#5b3636" styleClass="lineHead" />
<ScrollPane id="modlist" layoutY="75.0" prefHeight="351.0" prefWidth="694.0">
<content>
<VBox prefHeight="232.0" prefWidth="689.0">
<children>
</children>
<padding>
<Insets left="10.0" top="8.0" />
</padding>
</VBox>
<VBox prefHeight="349.0" prefWidth="692.0">
<children>
</children>
<padding>
<Insets left="10.0" top="8.0" />
</padding>
</VBox>
</content>
</JFXScrollPane>
<JFXButton fx:id="apply" defaultButton="true" layoutX="532.0" layoutY="390.0" prefHeight="25.0" prefWidth="100.0" text="Применить" />
</children>
</Pane>
</ScrollPane>
</children>
</Pane>
<Pane fx:id="bar" layoutX="693.0" prefHeight="425.0" prefWidth="43.0" styleClass="bar">
<children>
<JFXButton id="hide" alignment="CENTER" contentDisplay="CENTER" layoutY="45.0" text="" textAlignment="CENTER" />
<JFXButton id="close" alignment="CENTER" contentDisplay="CENTER" text="" textAlignment="CENTER" />
<JFXButton id="back" fx:id="back" alignment="CENTER" contentDisplay="CENTER" layoutY="335.0" text="" textAlignment="CENTER" />
<JFXButton fx:id="apply" layoutY="380.0" prefHeight="25.0" prefWidth="45.0" />
</children>
</Pane>
</children>
<stylesheets>
<URL value="@options.css" />

View file

@ -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);
}
};

View file

@ -28,7 +28,7 @@
<TextFlow layoutX="126.0" layoutY="15.0" prefHeight="16.0" prefWidth="112.0">
<Text fx:id="ramLabel" />
</TextFlow>
<Separator layoutY="112.0" prefHeight="3.0" prefWidth="693.0" />
<Separator layoutY="112.0" prefHeight="3.0" prefWidth="694.0" />
<!-- RAM settings -->
<!-- Deldir settings -->
@ -43,7 +43,7 @@
<JFXButton fx:id="apply" defaultButton="true" layoutX="534.0" layoutY="365.0" prefHeight="23.0" prefWidth="100.0" text="Применить" />
<Text layoutX="16.0" layoutY="28.0">Выделение памяти: </Text>
<JFXSlider fx:id="ramSlider" layoutX="14.0" layoutY="76.0" prefHeight="14.0" prefWidth="663.0" />
<Separator layoutY="400.0" prefHeight="3.0" prefWidth="693.0" />
<Separator layoutY="400.0" prefHeight="3.0" prefWidth="694.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">

View file

@ -254,7 +254,7 @@ .scroll-bar {
}
.scroll-pane>.corner {
-fx-background-color: black;
-fx-background-color: rgba(0, 0, 0, 0.19);
}
/* Server buttons */

View file

@ -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();