mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-27 02:40:51 +01:00
redesign
This commit is contained in:
parent
8c4e02173a
commit
c1188ab228
@ -3,11 +3,13 @@ package gearth.ui.connection;
|
||||
import gearth.misc.Cacher;
|
||||
import gearth.protocol.connection.HState;
|
||||
import gearth.protocol.connection.proxy.ProxyProviderFactory;
|
||||
import gearth.services.Constants;
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.*;
|
||||
import gearth.protocol.HConnection;
|
||||
import gearth.ui.SubForm;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -35,7 +37,27 @@ public class ConnectionController extends SubForm {
|
||||
private final Object lock = new Object();
|
||||
private volatile int fullyInitialized = 0;
|
||||
|
||||
|
||||
public static final String USE_UNITY_CLIENT_CACHE_KEY = "use_unity";
|
||||
public ToggleGroup tgl_clientMode;
|
||||
public RadioButton rd_unity;
|
||||
public RadioButton rd_flash;
|
||||
public GridPane grd_clientSelection;
|
||||
|
||||
public void initialize() {
|
||||
|
||||
Constants.UNITY_PACKETS = rd_unity.isSelected();
|
||||
tgl_clientMode.selectedToggleProperty().addListener(observable -> {
|
||||
changeClientMode();
|
||||
Constants.UNITY_PACKETS = rd_unity.isSelected();
|
||||
});
|
||||
|
||||
if (Cacher.getCacheContents().has(USE_UNITY_CLIENT_CACHE_KEY)) {
|
||||
rd_unity.setSelected(Cacher.getCacheContents().getBoolean(USE_UNITY_CLIENT_CACHE_KEY));
|
||||
rd_flash.setSelected(!Cacher.getCacheContents().getBoolean(USE_UNITY_CLIENT_CACHE_KEY));
|
||||
}
|
||||
|
||||
|
||||
Object object;
|
||||
String hostRemember = null;
|
||||
String portRemember = null;
|
||||
@ -95,6 +117,7 @@ public class ConnectionController extends SubForm {
|
||||
}
|
||||
|
||||
private void updateInputUI() {
|
||||
grd_clientSelection.setDisable(getHConnection().getState() != HState.NOT_CONNECTED);
|
||||
txtfield_hotelversion.setText(getHConnection().getHotelVersion());
|
||||
|
||||
btnConnect.setDisable(getHConnection().getState() == HState.PREPARING || getHConnection().getState() == HState.ABORTING);
|
||||
@ -193,6 +216,7 @@ public class ConnectionController extends SubForm {
|
||||
|
||||
@Override
|
||||
protected void onExit() {
|
||||
Cacher.put(USE_UNITY_CLIENT_CACHE_KEY, rd_unity.isSelected());
|
||||
getHConnection().abort();
|
||||
}
|
||||
|
||||
@ -201,6 +225,6 @@ public class ConnectionController extends SubForm {
|
||||
}
|
||||
|
||||
private boolean useFlash() {
|
||||
return parentController.extraController.rd_flash.isSelected();
|
||||
return rd_flash.isSelected();
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,6 @@ public class ExtraController extends SubForm implements SocksConfiguration {
|
||||
public static final String SOCKS_CACHE_KEY = "socks_config";
|
||||
public static final String GPYTHON_CACHE_KEY = "use_gpython";
|
||||
|
||||
public static final String USE_UNITY_CLIENT_CACHE_KEY = "use_unity";
|
||||
|
||||
public static final String SOCKS_IP = "ip";
|
||||
public static final String SOCKS_PORT = "port";
|
||||
// public static final String IGNORE_ONCE = "ignore_once";
|
||||
@ -56,19 +54,7 @@ public class ExtraController extends SubForm implements SocksConfiguration {
|
||||
public TextField txt_socksPort;
|
||||
public TextField txt_socksIp;
|
||||
|
||||
|
||||
public ToggleGroup tgl_clientMode;
|
||||
public RadioButton rd_unity;
|
||||
public RadioButton rd_flash;
|
||||
public GridPane grd_clientSelection;
|
||||
|
||||
public void initialize() {
|
||||
Constants.UNITY_PACKETS = rd_unity.isSelected();
|
||||
tgl_clientMode.selectedToggleProperty().addListener(observable -> {
|
||||
if (parentController != null) parentController.connectionController.changeClientMode();
|
||||
Constants.UNITY_PACKETS = rd_unity.isSelected();
|
||||
});
|
||||
|
||||
url_troubleshooting.setTooltip(new Tooltip("https://github.com/sirjonasxx/G-Earth/wiki/Troubleshooting"));
|
||||
InfoController.activateHyperlink(url_troubleshooting);
|
||||
|
||||
@ -88,11 +74,6 @@ public class ExtraController extends SubForm implements SocksConfiguration {
|
||||
cbx_gpython.setSelected(Cacher.getCacheContents().getBoolean(GPYTHON_CACHE_KEY));
|
||||
}
|
||||
|
||||
if (Cacher.getCacheContents().has(USE_UNITY_CLIENT_CACHE_KEY)) {
|
||||
rd_unity.setSelected(Cacher.getCacheContents().getBoolean(USE_UNITY_CLIENT_CACHE_KEY));
|
||||
rd_flash.setSelected(!Cacher.getCacheContents().getBoolean(USE_UNITY_CLIENT_CACHE_KEY));
|
||||
}
|
||||
|
||||
cbx_debug.selectedProperty().addListener(observable -> HConnection.DEBUG = cbx_debug.isSelected());
|
||||
cbx_disableDecryption.selectedProperty().addListener(observable -> HConnection.DECRYPTPACKETS = !cbx_disableDecryption.isSelected());
|
||||
|
||||
@ -120,7 +101,6 @@ public class ExtraController extends SubForm implements SocksConfiguration {
|
||||
protected void onExit() {
|
||||
Cacher.put(NOTEPAD_CACHE_KEY, txtarea_notepad.getText());
|
||||
Cacher.put(GPYTHON_CACHE_KEY, cbx_gpython.isSelected());
|
||||
Cacher.put(USE_UNITY_CLIENT_CACHE_KEY, rd_unity.isSelected());
|
||||
saveSocksConfig();
|
||||
}
|
||||
|
||||
@ -133,8 +113,6 @@ public class ExtraController extends SubForm implements SocksConfiguration {
|
||||
}
|
||||
|
||||
private void updateAdvancedUI() {
|
||||
grd_clientSelection.setDisable(getHConnection().getState() != HState.NOT_CONNECTED);
|
||||
|
||||
if (!cbx_advanced.isSelected()) {
|
||||
cbx_debug.setSelected(false);
|
||||
cbx_useSocks.setSelected(false);
|
||||
|
@ -5,13 +5,15 @@
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.ComboBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.control.ToggleGroup?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
<?import javafx.scene.text.Font?>
|
||||
|
||||
<GridPane alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.connection.ConnectionController">
|
||||
<GridPane alignment="CENTER" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.connection.ConnectionController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
@ -104,23 +106,24 @@
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="54.0" minHeight="10.0" prefHeight="39.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="74.0" minHeight="10.0" prefHeight="61.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="14.0" left="20.0" right="15.0" top="17.0" />
|
||||
</GridPane.margin>
|
||||
<children>
|
||||
<GridPane>
|
||||
<GridPane GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="83.0" minHeight="10.0" prefHeight="26.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="86.0" minHeight="10.0" prefHeight="33.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="83.0" minHeight="10.0" prefHeight="19.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="86.0" minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label text="Hotel version:" textFill="#000000cc" />
|
||||
<TextField fx:id="txtfield_hotelversion" editable="false" GridPane.rowIndex="1">
|
||||
<TextField fx:id="txtfield_hotelversion" editable="false" prefHeight="17.0" prefWidth="285.0" GridPane.rowIndex="1">
|
||||
<opaqueInsets>
|
||||
<Insets />
|
||||
</opaqueInsets>
|
||||
@ -130,10 +133,47 @@
|
||||
</TextField>
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="26.0" left="12.0" right="10.0" top="22.0" />
|
||||
<Insets left="12.0" right="10.0" top="5.0" />
|
||||
</GridPane.margin>
|
||||
</GridPane>
|
||||
<GridPane fx:id="grd_clientSelection" prefHeight="26.0" prefWidth="286.0" style="-fx-border-color: #888888; -fx-border-width: 0 0 1 0;">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="149.0" minWidth="10.0" prefWidth="76.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="149.0" minWidth="10.0" prefWidth="25.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="177.0" minWidth="66.0" prefWidth="93.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="133.0" minWidth="8.0" prefWidth="98.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="242.0" minWidth="10.0" prefWidth="32.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="20.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" text="Client type:">
|
||||
<padding>
|
||||
<Insets left="12.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<RadioButton fx:id="rd_unity" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Unity" GridPane.columnIndex="3" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="tgl_clientMode" />
|
||||
</toggleGroup>
|
||||
<GridPane.margin>
|
||||
<Insets />
|
||||
</GridPane.margin>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="rd_flash" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" prefHeight="35.0" prefWidth="111.0" selected="true" text="Flash / Air" toggleGroup="$tgl_clientMode" GridPane.columnIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets />
|
||||
</GridPane.margin></RadioButton>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="8.0" top="8.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</GridPane>
|
||||
<GridPane alignment="CENTER" GridPane.rowIndex="1">
|
||||
|
@ -1,10 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Hyperlink?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.ColumnConstraints?>
|
||||
<?import javafx.scene.layout.GridPane?>
|
||||
<?import javafx.scene.layout.RowConstraints?>
|
||||
|
||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extra.ExtraController">
|
||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" prefHeight="258.0" prefWidth="650.0" xmlns="http://javafx.com/javafx/15.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.extra.ExtraController">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="331.0" minWidth="10.0" prefWidth="318.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="10.0" prefWidth="247.0" />
|
||||
@ -27,24 +34,23 @@
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="7.0" minHeight="7.0" prefHeight="7.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="34.0" minHeight="34.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="28.0" minHeight="28.0" prefHeight="28.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="1.7976931348623157E308" minHeight="10.0" prefHeight="232.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<GridPane fx:id="grd_advanced" disable="true" prefHeight="161.0" prefWidth="299.0" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="4">
|
||||
<GridPane fx:id="grd_advanced" disable="true" prefHeight="161.0" prefWidth="299.0" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="3">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="28.0" minHeight="28.0" prefHeight="28.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="28.0" minHeight="28.0" prefHeight="28.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="28.0" minHeight="28.0" prefHeight="28.0" vgrow="SOMETIMES" />
|
||||
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<GridPane.margin>
|
||||
<Insets bottom="5.0" left="10.0" right="10.0" top="6.0" />
|
||||
<Insets bottom="20.0" left="10.0" right="10.0" top="6.0" />
|
||||
</GridPane.margin>
|
||||
<padding>
|
||||
<Insets left="7.0" top="3.0" />
|
||||
@ -104,7 +110,7 @@
|
||||
</GridPane>
|
||||
</children>
|
||||
</GridPane>
|
||||
<CheckBox fx:id="cbx_advanced" mnemonicParsing="false" text="Advanced" textFill="#000000ba" GridPane.rowIndex="3">
|
||||
<CheckBox fx:id="cbx_advanced" mnemonicParsing="false" text="Advanced" textFill="#000000ba" GridPane.rowIndex="2">
|
||||
<GridPane.margin>
|
||||
<Insets left="10.0" top="2.0" />
|
||||
</GridPane.margin>
|
||||
@ -112,38 +118,11 @@
|
||||
<Insets top="2.0" />
|
||||
</padding>
|
||||
</CheckBox>
|
||||
<CheckBox fx:id="cbx_gpython" mnemonicParsing="false" onAction="#gpythonCbxClick" text="Enable G-Python scripting" textFill="#000000ba" GridPane.rowIndex="2">
|
||||
<CheckBox fx:id="cbx_gpython" mnemonicParsing="false" onAction="#gpythonCbxClick" text="Enable G-Python scripting" textFill="#000000ba" GridPane.rowIndex="1">
|
||||
<GridPane.margin>
|
||||
<Insets left="10.0" top="2.0" />
|
||||
</GridPane.margin>
|
||||
</CheckBox>
|
||||
<GridPane fx:id="grd_clientSelection" prefHeight="26.0" prefWidth="286.0" style="-fx-border-color: #888888; -fx-border-radius: 5px;" GridPane.rowIndex="1">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="149.0" minWidth="10.0" prefWidth="38.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="81.0" minWidth="69.0" prefWidth="75.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="83.0" minWidth="66.0" prefWidth="72.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="82.0" minWidth="61.0" prefWidth="65.0" />
|
||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="242.0" minWidth="10.0" prefWidth="47.0" />
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints minHeight="20.0" prefHeight="34.0" vgrow="SOMETIMES" />
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<RadioButton fx:id="rd_unity" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Unity" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS" GridPane.vgrow="ALWAYS">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="tgl_clientMode" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="rd_flash" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" selected="true" text="Flash" toggleGroup="$tgl_clientMode" GridPane.columnIndex="2" />
|
||||
<RadioButton disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="Anime" GridPane.columnIndex="3" />
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets left="10.0" right="10.0" />
|
||||
</GridPane.margin>
|
||||
<padding>
|
||||
<Insets bottom="8.0" top="8.0" />
|
||||
</padding>
|
||||
</GridPane>
|
||||
</children>
|
||||
<GridPane.margin>
|
||||
<Insets />
|
||||
|
Loading…
Reference in New Issue
Block a user