Merge pull request #319 from LoomeL/dev

[ANY] Js/css pretty print
This commit is contained in:
Zaxar163 2019-08-14 11:56:02 +03:00 committed by GitHub
commit ce37be8247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 383 additions and 318 deletions

View file

@ -291,8 +291,12 @@ function doAuth(login, rsaPassword, auth_type) {
FunctionalBridge.getHWID.join(); FunctionalBridge.getHWID.join();
makeAuthRequest(login, rsaPassword, auth_type, function(result) { makeAuthRequest(login, rsaPassword, auth_type, function(result) {
FunctionalBridge.setAuthParams(result); FunctionalBridge.setAuthParams(result);
loginData = { pp: result.playerProfile , accessToken: result.accessToken, permissions: result.permissions, loginData = {
auth_type: settings.auth}; pp: result.playerProfile,
accessToken: result.accessToken,
permissions: result.permissions,
auth_type: settings.auth
};
overlay.hide(0, function() { overlay.hide(0, function() {
setCurrentScene(menuScene); setCurrentScene(menuScene);
@ -355,10 +359,8 @@ function doUpdate(profile, pp, accessToken) {
function doLaunchClient(assetDir, assetHDir, clientDir, clientHDir, profile, pp, accessToken) { function doLaunchClient(assetDir, assetHDir, clientDir, clientHDir, profile, pp, accessToken) {
processing.resetOverlay(); processing.resetOverlay();
overlay.swap(0, processing.overlay, function(event) overlay.swap(0, processing.overlay, function(event) launchClient(assetHDir, clientHDir, profile, new ClientLauncherParams(settings.lastDigest,
launchClient(assetHDir, clientHDir, profile, new ClientLauncherParams(settings.lastDigest, assetDir, clientDir, pp, accessToken, settings.autoEnter, settings.fullScreen, settings.ram, 0, 0), doDebugClient));
assetDir, clientDir, pp, accessToken, settings.autoEnter, settings.fullScreen, settings.ram, 0, 0), doDebugClient)
);
} }
function doDebugClient(process) { function doDebugClient(process) {

View file

@ -53,4 +53,5 @@ #overlay > #action.kill:focused,
#overlay>#action.kill:pressed { #overlay>#action.kill:pressed {
-fx-background-color: #DB5252; -fx-background-color: #DB5252;
} }
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/

View file

@ -1,5 +1,8 @@
var debug = { var debug = {
overlay: null, output: null, action: null, process: null, overlay: null,
output: null,
action: null,
process: null,
initOverlay: function() { initOverlay: function() {
debug.overlay = loadFXML("dialog/overlay/debug/debug.fxml"); debug.overlay = loadFXML("dialog/overlay/debug/debug.fxml");
@ -47,8 +50,7 @@ var debug = {
append: function(text) { append: function(text) {
//Experimental Feature //Experimental Feature
if(debug.output.getText().length() > 32000 /* Max length */) if (debug.output.getText().length() > 32000 /* Max length */ ) {
{
debug.output.deleteText(0, text.length()); debug.output.deleteText(0, text.length());
} }
debug.output.appendText(text); debug.output.appendText(text);

View file

@ -8,4 +8,5 @@ #overlay > #description {
#overlay>#description.error { #overlay>#description.error {
-fx-text-fill: red; -fx-text-fill: red;
} }
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/

View file

@ -1,6 +1,9 @@
var processing = { var processing = {
overlay: null, spinner: null, description: null, overlay: null,
processingImage: null, errorImage: null, spinner: null,
description: null,
processingImage: null,
errorImage: null,
initOverlay: function() { initOverlay: function() {
processing.overlay = loadFXML("dialog/overlay/processing/processing.fxml"); processing.overlay = loadFXML("dialog/overlay/processing/processing.fxml");
@ -69,6 +72,7 @@ function makeLauncherRequest(callback) {
task.updateMessage("Обновление лаунчера"); task.updateMessage("Обновление лаунчера");
startTask(task); startTask(task);
} }
function makeProfilesRequest(callback) { function makeProfilesRequest(callback) {
var task = newRequestTask(new ProfilesRequest()); var task = newRequestTask(new ProfilesRequest());
@ -83,6 +87,7 @@ function makeProfilesRequest(callback) {
task.updateMessage("Обновление профилей"); task.updateMessage("Обновление профилей");
startTask(task); startTask(task);
} }
function makeAuthAvailabilityRequest(callback) { function makeAuthAvailabilityRequest(callback) {
var task = newRequestTask(new GetAvailabilityAuthRequest()); var task = newRequestTask(new GetAvailabilityAuthRequest());
@ -98,6 +103,7 @@ function makeAuthAvailabilityRequest(callback) {
task.updateMessage("Обновление способов авторизации"); task.updateMessage("Обновление способов авторизации");
startTask(task); startTask(task);
} }
function makeSetProfileRequest(profile, callback) { function makeSetProfileRequest(profile, callback) {
var task = newRequestTask(new SetProfileRequest(profile)); var task = newRequestTask(new SetProfileRequest(profile));

View file

@ -1,13 +1,18 @@
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/
#holder { #holder {
-fx-background-color: #fff; -fx-background-color: #fff;
} }
#holder>#transferDialog { #holder>#transferDialog {
-fx-background-color: rgba(0, 0, 0, 0.5); -fx-background-color: rgba(0, 0, 0, 0.5);
-fx-pref-width: 694px; -fx-pref-width: 694px;
-fx-pref-height: 425px; -fx-pref-height: 425px;
} }
/* Labels */ /* Labels */
#holder>#settingsTitle { #holder>#settingsTitle {
-fx-font-size: 14pt; -fx-font-size: 14pt;
-fx-alignment: baseline-center; -fx-alignment: baseline-center;
@ -19,7 +24,9 @@ #holder #dirChange {
-fx-font-weight: bold; -fx-font-weight: bold;
} }
/* RAM slider */ /* RAM slider */
#holder>#ramSlider>.track { #holder>#ramSlider>.track {
-fx-background-color: #909090; -fx-background-color: #909090;
} }
@ -41,8 +48,11 @@ #holder > #ramSlider > .slider-value {
-fx-stroke: white; -fx-stroke: white;
} }
/* Dir options */ /* Dir options */
#holder > #deleteDir, #cancelTransfer {
#holder>#deleteDir,
#cancelTransfer {
-fx-background-radius: 0; -fx-background-radius: 0;
-fx-text-fill: white; -fx-text-fill: white;
-fx-background-position: center; -fx-background-position: center;
@ -51,8 +61,10 @@ #holder > #deleteDir, #cancelTransfer {
-fx-pref-height: 25px; -fx-pref-height: 25px;
} }
#holder > #deleteDir:hover,#cancelTransfer:hover, #holder>#deleteDir:hover,
#holder > #deleteDir:focused,#cancelTransfer:focused { #cancelTransfer:hover,
#holder>#deleteDir:focused,
#cancelTransfer:focused {
-fx-background-color: #DB5252; -fx-background-color: #DB5252;
} }
@ -67,7 +79,8 @@ #holder > #changeDir:pressed {
-fx-font-weight: bold; -fx-font-weight: bold;
} }
#holder > #apply,#applyTransfer{ #holder>#apply,
#applyTransfer {
-fx-background-color: #5fd97a; -fx-background-color: #5fd97a;
-fx-background-radius: 0; -fx-background-radius: 0;
-fx-text-fill: white; -fx-text-fill: white;
@ -75,8 +88,13 @@ #holder > #apply,#applyTransfer{
-fx-pref-width: 150px; -fx-pref-width: 150px;
-fx-pref-height: 25px; -fx-pref-height: 25px;
} }
#holder > #apply:hover,#applyTransfer:hover,
#holder > #apply:focused,#applyTransfer:focused{ #holder>#apply:hover,
#applyTransfer:hover,
#holder>#apply:focused,
#applyTransfer:focused {
-fx-background-color: #75e18c; -fx-background-color: #75e18c;
} }
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/

View file

@ -1,7 +1,11 @@
var settingsOverlay = { var settingsOverlay = {
/* ===================== OVERLAY ===================== */ /* ===================== OVERLAY ===================== */
overlay: null, ramLabel: null, dirLabel: null, transferDialog: null, overlay: null,
deleteDirPressedAgain: false, count: 0, ramLabel: null,
dirLabel: null,
transferDialog: null,
deleteDirPressedAgain: false,
count: 0,
initOverlay: function() { initOverlay: function() {
settingsOverlay.overlay = loadFXML("dialog/overlay/settings/settings.fxml"); settingsOverlay.overlay = loadFXML("dialog/overlay/settings/settings.fxml");
@ -14,8 +18,7 @@ var settingsOverlay = {
function(o, ov, nv) settings.autoEnter = nv); function(o, ov, nv) settings.autoEnter = nv);
settingsOverlay.dirLabel = holder.lookup("#dirLabel"); settingsOverlay.dirLabel = holder.lookup("#dirLabel");
settingsOverlay.dirLabel.setOnAction(function(event) settingsOverlay.dirLabel.setOnAction(function(event) app.getHostServices().showDocument(settings.updatesDir.toUri()));
app.getHostServices().showDocument(settings.updatesDir.toUri()));
settingsOverlay.updateDirLabel(); settingsOverlay.updateDirLabel();
settingsOverlay.transferDialog = holder.lookup("#transferDialog"); settingsOverlay.transferDialog = holder.lookup("#transferDialog");
@ -93,8 +96,7 @@ var settingsOverlay = {
transferCatalogDialog: function(newDir) { transferCatalogDialog: function(newDir) {
settingsOverlay.transferDialog.setVisible(true); settingsOverlay.transferDialog.setVisible(true);
settingsOverlay.transferDialog.lookup("#cancelTransfer").setOnAction(function(event) settingsOverlay.transferDialog.lookup("#cancelTransfer").setOnAction(function(event) {
{
settings.updatesDir = newDir; settings.updatesDir = newDir;
DirBridge.dirUpdates = settings.updatesDir; DirBridge.dirUpdates = settings.updatesDir;
settingsOverlay.updateDirLabel(); settingsOverlay.updateDirLabel();
@ -148,9 +150,16 @@ LogHelper.debug("Dir: %s", DirBridge.dir);
/* ====================== CLI PARAMS ===================== */ /* ====================== CLI PARAMS ===================== */
var cliParams = { var cliParams = {
login: null, password: null, profile: -1, autoLogin: false, login: null,
updatesDir: null, autoEnter: null, fullScreen: null, ram: -1, password: null,
offline: false, featureStore: null, profile: -1,
autoLogin: false,
updatesDir: null,
autoEnter: null,
fullScreen: null,
ram: -1,
offline: false,
featureStore: null,
init: function(params) { init: function(params) {
var named = params.getNamed(); var named = params.getNamed();
@ -200,8 +209,7 @@ var cliParams = {
if (cliParams.profile >= 0) { if (cliParams.profile >= 0) {
settings.profile = cliParams.profile; settings.profile = cliParams.profile;
} }
if (cliParams.updatesDir !== null) { if (cliParams.updatesDir !== null) {}
}
if (cliParams.autoEnter !== null) { if (cliParams.autoEnter !== null) {
settings.autoLogin = cliParams.autoEnter; settings.autoLogin = cliParams.autoEnter;
} }

View file

@ -50,4 +50,5 @@ .progress-bar > .track {
-fx-background-insets: 0; -fx-background-insets: 0;
-fx-background-radius: 3px; -fx-background-radius: 3px;
} }
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/

View file

@ -1,5 +1,8 @@
var update = { var update = {
overlay: null, title: null, description: null, progress: null, overlay: null,
title: null,
description: null,
progress: null,
initOverlay: function() { initOverlay: function() {
update.overlay = loadFXML("dialog/overlay/update/update.fxml"); update.overlay = loadFXML("dialog/overlay/update/update.fxml");

View file

@ -26,29 +26,23 @@ var options = {
} }
var profilesCount = input.readInt(); var profilesCount = input.readInt();
LogHelper.debug("Load options. ProfilesCount %d", profilesCount); LogHelper.debug("Load options. ProfilesCount %d", profilesCount);
for(var i = 0;i<profilesCount;i++) for (var i = 0; i < profilesCount; i++) {
{
var listSize = input.readInt(); var listSize = input.readInt();
var sortIndex = input.readInt(); var sortIndex = input.readInt();
var profile = null; var profile = null;
settings.lastProfiles.forEach(function(hprofile, i, arr) { settings.lastProfiles.forEach(function(hprofile, i, arr) {
if(hprofile.getSortIndex() == sortIndex) if (hprofile.getSortIndex() == sortIndex) {
{
profile = hprofile; profile = hprofile;
} }
}); });
for(var j = 0; j < listSize; j++) for (var j = 0; j < listSize; j++) {
{
var mark = input.readBoolean(); var mark = input.readBoolean();
var modType = OptionalFile.readType(input); var modType = OptionalFile.readType(input);
var modFile = input.readString(0); var modFile = input.readString(0);
if(mark) if (mark) {
{
profile.markOptional(modFile, modType); profile.markOptional(modFile, modType);
LogHelper.debug("Load options %s marked", modFile); LogHelper.debug("Load options %s marked", modFile);
} } else {
else
{
profile.unmarkOptional(modFile, modType); profile.unmarkOptional(modFile, modType);
LogHelper.debug("Load options %s unmarked", modFile); LogHelper.debug("Load options %s unmarked", modFile);
} }
@ -93,15 +87,15 @@ var options = {
var list = profile.getOptional(); var list = profile.getOptional();
var checkBoxList = new java.util.ArrayList; var checkBoxList = new java.util.ArrayList;
list.forEach(function(modFile) { list.forEach(function(modFile) {
var modName = modFile.name, modDescription = "", subLevel = 1; var modName = modFile.name,
if(!modFile.visible) modDescription = "",
{ subLevel = 1;
if (!modFile.visible) {
LogHelper.debug("optionalMod %s hidden", modFile.name); LogHelper.debug("optionalMod %s hidden", modFile.name);
return; return;
} }
if(modFile.permissions != 0 && ((loginData.permissions.toLong() & modFile.permissions) == 0)) if (modFile.permissions != 0 && ((loginData.permissions.toLong() & modFile.permissions) == 0)) {
{
LogHelper.debug("optionalMod %s permissions deny", modFile.name); LogHelper.debug("optionalMod %s permissions deny", modFile.name);
return; return;
} }
@ -119,13 +113,10 @@ var options = {
testMod.setSelected(modFile.mark); testMod.setSelected(modFile.mark);
testMod.setOnAction(function(event) { testMod.setOnAction(function(event) {
var isSelected = event.getSource().isSelected(); var isSelected = event.getSource().isSelected();
if(isSelected) if (isSelected) {
{
profile.markOptional(modFile); profile.markOptional(modFile);
LogHelper.debug("Selected mod %s", modFile.name); LogHelper.debug("Selected mod %s", modFile.name);
} } else {
else
{
profile.unmarkOptional(modFile); profile.unmarkOptional(modFile);
LogHelper.debug("Unselected mod %s", modFile.name); LogHelper.debug("Unselected mod %s", modFile.name);
} }

View file

@ -1,6 +1,6 @@
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/
/* Server buttons */ /* Server buttons */
.server-button { .server-button {
-fx-font-weight: bold; -fx-font-weight: bold;
-fx-font-size: 16pt; -fx-font-size: 16pt;
@ -19,11 +19,11 @@ .server-button:selected {
-fx-effect: dropshadow(gaussian, rgba(23, 25, 29, 0.3), 15, 0, 0, 3); -fx-effect: dropshadow(gaussian, rgba(23, 25, 29, 0.3), 15, 0, 0, 3);
} }
/** server-button-<your profile name> **/ /** server-button-<your profile name> **/
.server-button-Example { .server-button-Example {
-fx-background-image: url('images/servers/example.png'); -fx-background-image: url('images/servers/example.png');
} }
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/

View file

@ -56,7 +56,10 @@ CheckBox .indeterminate-mark{
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/
Button, CheckBox, ComboBox, RadioButton { Button,
CheckBox,
ComboBox,
RadioButton {
-fx-cursor: hand; -fx-cursor: hand;
} }
@ -69,9 +72,11 @@ #layout {
-fx-pref-height: 450px; -fx-pref-height: 450px;
-fx-background-image: url('images/background.jpg'); -fx-background-image: url('images/background.jpg');
} }
#background { #background {
-fx-background-color: #fff; -fx-background-color: #fff;
} }
/** Labels **/ /** Labels **/
#background>#settingsTitle { #background>#settingsTitle {
-fx-font-size: 14pt; -fx-font-size: 14pt;
@ -110,6 +115,7 @@ #bar {
-fx-pref-width: 46px; -fx-pref-width: 46px;
-fx-pref-height: 450px; -fx-pref-height: 450px;
} }
/** buttons in bar **/ /** buttons in bar **/
#close { #close {
-fx-background-position: center; -fx-background-position: center;
@ -118,7 +124,12 @@ #close {
-fx-pref-width: 46px; -fx-pref-width: 46px;
-fx-pref-height: 45px; -fx-pref-height: 45px;
} }
#hide, #back, #goConsole, #settings, #discord {
#hide,
#back,
#goConsole,
#settings,
#discord {
-fx-background-position: center; -fx-background-position: center;
-fx-background-radius: 0; -fx-background-radius: 0;
-fx-pref-width: 46px; -fx-pref-width: 46px;
@ -134,10 +145,12 @@ #logout{
-fx-background-color: transparent; -fx-background-color: transparent;
-fx-padding: 0; -fx-padding: 0;
} }
#logout:hover, #logout:hover,
#logout:focus { #logout:focus {
-fx-text-fill: #ff6a5e; -fx-text-fill: #ff6a5e;
} }
#logout:pressed { #logout:pressed {
-fx-border-color: #cb4d43; -fx-border-color: #cb4d43;
} }
@ -151,7 +164,9 @@ #send {
-fx-pref-height: 30px; -fx-pref-height: 30px;
} }
#send:pressed { -fx-background-color: #d8d8d8; } #send:pressed {
-fx-background-color: #d8d8d8;
}
/* LoginMenu */ /* LoginMenu */
#authPane { #authPane {
@ -179,9 +194,13 @@ .auth {
-fx-effect: dropshadow(gaussian, rgba(23, 25, 29, 0.3), 15, 0, 0, 3); -fx-effect: dropshadow(gaussian, rgba(23, 25, 29, 0.3), 15, 0, 0, 3);
} }
.auth:hover, .auth:pressed { -fx-background-color: #75e18c; } .auth:hover,
.auth:pressed {
-fx-background-color: #75e18c;
}
#password, #login { #password,
#login {
-fx-background-radius: 0; -fx-background-radius: 0;
-fx-pref-width: 200px; -fx-pref-width: 200px;
-fx-pref-height: 30px; -fx-pref-height: 30px;
@ -208,7 +227,10 @@ #link {
-fx-pref-height: 17px; -fx-pref-height: 17px;
} }
#link:hover, #link:pressed { -fx-opacity: 0.8; } #link:hover,
#link:pressed {
-fx-opacity: 0.8;
}
/** CheckBox & ComboBox**/ /** CheckBox & ComboBox**/
#rememberchb { #rememberchb {
@ -217,12 +239,14 @@ #rememberchb{
-fx-pref-width: 145px; -fx-pref-width: 145px;
-fx-pref-height: 30px; -fx-pref-height: 30px;
} }
#combologin { #combologin {
-fx-text-fill: #909090; -fx-text-fill: #909090;
-fx-prompt-text-fill: #909090; -fx-prompt-text-fill: #909090;
-fx-pref-width: 200px; -fx-pref-width: 200px;
-fx-pref-height: 30px; -fx-pref-height: 30px;
} }
.combologin, .combologin,
.combologin { .combologin {
-fx-font-size: 13px; -fx-font-size: 13px;
@ -253,20 +277,18 @@ .combologin .arrow {
-fx-background-color: #5fd97a; -fx-background-color: #5fd97a;
} }
.combologin-popup .list-view .list-cell .combologin-popup .list-view .list-cell {
{
-fx-background-color: white; -fx-background-color: white;
} }
.combologin-popup .list-view .list-cell:filled:selected, .combologin-popup .list-view .list-cell:filled:selected:hover .combologin-popup .list-view .list-cell:filled:selected,
{ .combologin-popup .list-view .list-cell:filled:selected:hover {
-fx-background: -fx-accent; -fx-background: -fx-accent;
-fx-background-color: -fx-selection-bar; -fx-background-color: -fx-selection-bar;
-fx-text-fill: #909090; -fx-text-fill: #909090;
} }
.combologin-popup .list-view .list-cell:filled:hover .combologin-popup .list-view .list-cell:filled:hover {
{
-fx-background-color: white; -fx-background-color: white;
-fx-text-fill: #909090; -fx-text-fill: #909090;
} }
@ -293,13 +315,17 @@ .clientLaunch{
-fx-background-color: #5fd97a; -fx-background-color: #5fd97a;
-fx-text-fill: #ffffff; -fx-text-fill: #ffffff;
} }
.clientSettings { .clientSettings {
-fx-background-position: center; -fx-background-position: center;
-fx-background-color: #5fd97a; -fx-background-color: #5fd97a;
-fx-background-radius: 0; -fx-background-radius: 0;
} }
.clientLaunch:hover, .clientLaunch:pressed { -fx-background-color: #75e18c; } .clientLaunch:hover,
.clientLaunch:pressed {
-fx-background-color: #75e18c;
}
/* Scrolls */ /* Scrolls */
.scroll-pane { .scroll-pane {
@ -371,6 +397,7 @@ .separator *.line {
#serverlist { #serverlist {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
#serverlist>.viewport { #serverlist>.viewport {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
@ -378,6 +405,7 @@ #serverlist > .viewport {
#serverdesc { #serverdesc {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
#serverdesc>.viewport { #serverdesc>.viewport {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
@ -385,6 +413,7 @@ #serverdesc > .viewport {
#serverinfo { #serverinfo {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
#serverinfo>.viewport { #serverinfo>.viewport {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
@ -402,4 +431,5 @@ .toggle-button:disabled{
.heading { .heading {
-fx-text-fill: #555555; -fx-text-fill: #555555;
} }
/*-- DrLeonardo Design --*/ /*-- DrLeonardo Design --*/

View file

@ -9,7 +9,8 @@ var LauncherApp = Java.extend(JSApplication, {
settings = SettingsManager.settings; settings = SettingsManager.settings;
settingsManager.loadHDirStore(); settingsManager.loadHDirStore();
cliParams.applySettings(); cliParams.applySettings();
}, start: function(primaryStage) { },
start: function(primaryStage) {
stage = primaryStage; stage = primaryStage;
stage.initStyle(javafx.stage.StageStyle.TRANSPARENT); stage.initStyle(javafx.stage.StageStyle.TRANSPARENT);
stage.setResizable(false); stage.setResizable(false);
@ -45,7 +46,8 @@ var LauncherApp = Java.extend(JSApplication, {
setCurrentScene(loginScene); setCurrentScene(loginScene);
initLauncher(); initLauncher();
}, stop: function() { },
stop: function() {
settingsManager.saveConfig(); settingsManager.saveConfig();
settingsManager.saveHDirStore(); settingsManager.saveHDirStore();
options.save(); options.save();