-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show info window instead of debug window
- Loading branch information
1 parent
5db8535
commit f7eb530
Showing
6 changed files
with
189 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ice-adapter/src/main/java/com/faforever/iceadapter/debug/InfoWindow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.faforever.iceadapter.debug; | ||
|
||
import javafx.event.Event; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.scene.image.Image; | ||
import javafx.stage.Stage; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import java.io.IOException; | ||
|
||
import static javafx.application.Application.STYLESHEET_MODENA; | ||
import static javafx.application.Application.setUserAgentStylesheet; | ||
|
||
@Slf4j | ||
public class InfoWindow { | ||
|
||
private Stage stage; | ||
private Parent root; | ||
private Scene scene; | ||
private InfoWindowController controller; | ||
|
||
private static final int WIDTH = 533; | ||
private static final int HEIGHT = 330; | ||
|
||
public InfoWindow() { | ||
|
||
} | ||
|
||
public void init() { | ||
stage = new Stage(); | ||
stage.getIcons().add(new Image("https://faforever.com/images/faf-logo.png")); | ||
|
||
try { | ||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/infoWindow.fxml")); | ||
root = loader.load(); | ||
|
||
controller = loader.getController(); | ||
|
||
} catch (IOException e) { | ||
log.error("Could not load debugger window fxml", e); | ||
} | ||
|
||
setUserAgentStylesheet(STYLESHEET_MODENA); | ||
|
||
scene = new Scene(root, WIDTH, HEIGHT); | ||
|
||
stage.setScene(scene); | ||
stage.setTitle("FAF ICE adapter"); | ||
stage.setOnCloseRequest(Event::consume); | ||
stage.show(); | ||
|
||
|
||
log.info("Created info window."); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
ice-adapter/src/main/java/com/faforever/iceadapter/debug/InfoWindowController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.faforever.iceadapter.debug; | ||
|
||
import javafx.event.ActionEvent; | ||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Button; | ||
|
||
public class InfoWindowController { | ||
public Button killAdapterButton; | ||
public Button showDebugWindowButton; | ||
|
||
public void onKillAdapterClicked(ActionEvent actionEvent) { | ||
System.exit(337); | ||
} | ||
|
||
public void onShowDebugWindowClicked(ActionEvent actionEvent) { | ||
Debug.debug.thenAcceptAsync(debugger -> { | ||
if(debugger instanceof DebugWindow) { | ||
((DebugWindow)debugger).showWindow(); | ||
} | ||
}); | ||
} | ||
|
||
@FXML | ||
private void initialize() { | ||
killAdapterButton.setOnAction(this::onKillAdapterClicked); | ||
showDebugWindowButton.setOnAction(this::onShowDebugWindowClicked); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.geometry.*?> | ||
<?import javafx.scene.control.*?> | ||
<?import javafx.scene.image.Image?> | ||
<?import javafx.scene.image.ImageView?> | ||
<?import javafx.scene.layout.*?> | ||
<?import java.net.URL?> | ||
<AnchorPane prefHeight="533.0" prefWidth="330.0" xmlns="http://javafx.com/javafx/8.0.121" | ||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.faforever.iceadapter.debug.InfoWindowController"> | ||
<children> | ||
|
||
<VBox prefHeight="330.0" prefWidth="533.0" alignment="CENTER" spacing="5"> | ||
<padding> | ||
<Insets bottom="5" left="5" right="5" top="5"/> | ||
</padding> | ||
|
||
<ImageView fitHeight="70.0" fitWidth="70.0"> | ||
<image> | ||
<Image url="https://faforever.com/images/faf-logo.png"/> | ||
</image> | ||
</ImageView> | ||
|
||
<HBox> | ||
<padding> | ||
<Insets bottom="2" left="5" right="5" top="2"/> | ||
</padding> | ||
</HBox> | ||
|
||
<Label text="FAForever is currently testing a new connectivity solution to reduce disconnects while in game." | ||
wrapText="true" textAlignment="CENTER"></Label> | ||
|
||
|
||
<HBox> | ||
<padding> | ||
<Insets bottom="5" left="5" right="5" top="5"/> | ||
</padding> | ||
</HBox> | ||
|
||
<Label text="Please keep this window open while the game is in progress." styleClass="bold-text" textAlignment="CENTER"/> | ||
<Label text="To manually stop the ice adapter click here:" textAlignment="CENTER"/> | ||
|
||
<HBox> | ||
<padding> | ||
<Insets bottom="5" left="5" right="5" top="5"/> | ||
</padding> | ||
|
||
</HBox> | ||
|
||
<Button fx:id="killAdapterButton" | ||
text="Clicking here will close the adapter This will disconnect you from the game!" | ||
focusTraversable="false" wrapText="true" textAlignment="CENTER"> | ||
</Button> | ||
|
||
<HBox> | ||
<padding> | ||
<Insets bottom="5" left="5" right="5" top="5"/> | ||
</padding> | ||
|
||
</HBox> | ||
|
||
<Button fx:id="showDebugWindowButton" text="Show debug window"/> | ||
|
||
</VBox> | ||
|
||
</children> | ||
|
||
<stylesheets> | ||
<URL value="@infoWindowStyle.css"/> | ||
</stylesheets> | ||
</AnchorPane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.root { | ||
-fx-base: rgba(60, 63, 65, 255); | ||
|
||
} | ||
|
||
.text-area .content{ | ||
/*-fx-background-color: linear-gradient(from 0px 0px to 0px 4px, derive(rgba(36, 36, 36), -8%), rgba(36, 36, 36));*/ | ||
-fx-background-color: rgba(36, 36, 36, 36); | ||
} | ||
|
||
.text-area { | ||
-fx-text-fill: rgb(154, 154, 154) | ||
} | ||
|
||
.bold-text { | ||
-fx-font-weight: bold; | ||
} |