mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
Merge remote-tracking branch 'origin/UI' into UI
# Conflicts: # .idea/misc.xml # app/src/main/java/org/toop/app/menu/MainMenu.java # app/src/main/java/org/toop/app/menu/QuitMenu.java
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package org.toop;
|
||||
|
||||
import org.toop.app.App;
|
||||
import org.toop.framework.asset.AssetLoader;
|
||||
import org.toop.framework.asset.AssetManager;
|
||||
import org.toop.framework.audio.SoundManager;
|
||||
import org.toop.framework.networking.NetworkingClientManager;
|
||||
import org.toop.framework.networking.NetworkingInitializationException;
|
||||
|
||||
@@ -11,6 +14,8 @@ public class Main {
|
||||
}
|
||||
|
||||
private static void initSystems() throws NetworkingInitializationException {
|
||||
new NetworkingClientManager();
|
||||
AssetManager.loadAssets(new AssetLoader("app/src/main/resources/assets"));
|
||||
new Thread(NetworkingClientManager::new).start();
|
||||
new Thread(SoundManager::new).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import org.toop.local.AppContext;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import org.toop.framework.asset.AssetManager;
|
||||
import org.toop.framework.asset.resources.CssAsset;
|
||||
import org.toop.framework.asset.resources.ImageAsset;
|
||||
|
||||
public final class MainMenu extends Menu {
|
||||
private Locale currentLocale = AppContext.getLocale();
|
||||
@@ -22,17 +25,27 @@ public final class MainMenu extends Menu {
|
||||
final Button battleship = createButton(resourceBundle.getString("mainMenuSelectBattleship"), () -> {});
|
||||
final Button other = createButton(resourceBundle.getString("mainMenuSelectOther"), () -> {});
|
||||
|
||||
final VBox gamesBox = new VBox(tictactoe, reversi, sudoku, background, other);
|
||||
final VBox gamesBox = new VBox(tictactoe, reversi, sudoku, battleship, other);
|
||||
gamesBox.setAlignment(Pos.TOP_CENTER);
|
||||
|
||||
final Button credits = createButton(resourceBundle.getString("mainMenuSelectCredits"), () -> {});
|
||||
final Button options = createButton(resourceBundle.getString("mainMenuSelectOptions"), () -> {});
|
||||
final Button quit = createButton(resourceBundle.getString("mainMenuSelectQuit"), () -> {});
|
||||
|
||||
final VBox creditsBox = new VBox(10, credits, options, quit);
|
||||
final VBox creditsBox = new VBox(credits, options, quit);
|
||||
creditsBox.setAlignment(Pos.BOTTOM_CENTER);
|
||||
|
||||
VBox grid = new VBox(20, gamesBox, creditsBox);
|
||||
grid.setAlignment(Pos.CENTER);
|
||||
|
||||
ImageAsset backgroundImage = (ImageAsset) AssetManager.getByName("background.jpg").getResource();
|
||||
ImageView background = new ImageView(backgroundImage.getImage());
|
||||
background.setPreserveRatio(false);
|
||||
background.fitWidthProperty().bind(grid.widthProperty());
|
||||
background.fitHeightProperty().bind(grid.heightProperty());
|
||||
|
||||
pane = new StackPane(background, grid);
|
||||
pane.getStylesheets().add(getClass().getResource("/style/main.css").toExternalForm());
|
||||
CssAsset css = (CssAsset) AssetManager.getByName("main.css").getResource();
|
||||
pane.getStylesheets().add(css.getUrl());
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Text;
|
||||
import org.toop.app.App;
|
||||
import org.toop.framework.asset.AssetManager;
|
||||
import org.toop.framework.asset.resources.CssAsset;
|
||||
import org.toop.local.AppContext;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -49,6 +51,7 @@ public final class QuitMenu extends Menu {
|
||||
StackPane.setAlignment(box, Pos.CENTER);
|
||||
|
||||
pane = modalContainer;
|
||||
pane.getStylesheets().add(getClass().getResource("/style/quit.css").toExternalForm());
|
||||
CssAsset css = (CssAsset) AssetManager.getByName("quit.css").getResource();
|
||||
pane.getStylesheets().add(css.getUrl());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user