mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Refactored nextScreen runnable
This commit is contained in:
@@ -9,17 +9,10 @@ import org.toop.framework.resource.ResourceManager;
|
||||
import java.util.List;
|
||||
|
||||
public class Connect4TutorialWidget extends BaseTutorialWidget {
|
||||
public Connect4TutorialWidget(GameInformation information) {
|
||||
public Connect4TutorialWidget(Runnable nextScreen) {
|
||||
super(List.of(
|
||||
new ImmutablePair<>("connect4.1", ResourceManager.get("connect41.png")),
|
||||
new ImmutablePair<>("connect4.2", ResourceManager.get("connect42.png"))
|
||||
), () -> Platform.runLater(() -> new Connect4Game(information)));
|
||||
}
|
||||
|
||||
public Connect4TutorialWidget() {
|
||||
super(List.of(
|
||||
new ImmutablePair<>("connect4.1", ResourceManager.get("connect41.png")),
|
||||
new ImmutablePair<>("connect4.2", ResourceManager.get("connect42.png"))
|
||||
), () -> {});
|
||||
), nextScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
package org.toop.app.widget.tutorial;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import org.apache.maven.surefire.shared.lang3.tuple.ImmutablePair;
|
||||
import org.toop.app.GameInformation;
|
||||
import org.toop.app.game.ReversiGame;
|
||||
import org.toop.framework.resource.ResourceManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReversiTutorialWidget extends BaseTutorialWidget {
|
||||
public ReversiTutorialWidget(GameInformation gameInformation) {
|
||||
super(List.of(
|
||||
new ImmutablePair<>("reversi1", ResourceManager.get("reversi1.png")),
|
||||
new ImmutablePair<>("reversi2", ResourceManager.get("reversi2.png")),
|
||||
new ImmutablePair<>("reversi3", ResourceManager.get("cat.jpg")),
|
||||
new ImmutablePair<>("reversi4", ResourceManager.get("cat.jpg"))
|
||||
), () -> Platform.runLater(() -> new ReversiGame(gameInformation)));
|
||||
}
|
||||
|
||||
public ReversiTutorialWidget() {
|
||||
public ReversiTutorialWidget(Runnable nextScreen) {
|
||||
super(List.of(
|
||||
new ImmutablePair<>("reversi1", ResourceManager.get("reversi1.png")),
|
||||
new ImmutablePair<>("reversi2", ResourceManager.get("reversi2.png")),
|
||||
new ImmutablePair<>("reversi3", ResourceManager.get("cat.jpg")),
|
||||
new ImmutablePair<>("reversi4", ResourceManager.get("cat.jpg"))
|
||||
), () -> {});
|
||||
), nextScreen);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,11 @@ import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class TicTacToeTutorialWidget extends BaseTutorialWidget {
|
||||
|
||||
public TicTacToeTutorialWidget(GameInformation gameInformation) {
|
||||
public TicTacToeTutorialWidget(Runnable nextScreen) {
|
||||
super(List.of(
|
||||
new ImmutablePair<>("tictactoe1", ResourceManager.get("tictactoe1.png")),
|
||||
new ImmutablePair<>("tictactoe2", ResourceManager.get("tictactoe2.png"))
|
||||
), () -> Platform.runLater(() -> new TicTacToeGameThread(gameInformation)));
|
||||
}
|
||||
|
||||
public TicTacToeTutorialWidget() {
|
||||
super(List.of(
|
||||
new ImmutablePair<>("tictactoe1", ResourceManager.get("tictactoe1.png")),
|
||||
new ImmutablePair<>("tictactoe2", ResourceManager.get("tictactoe2.png"))
|
||||
), () -> {});
|
||||
), nextScreen);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ public final class GameView extends ViewWidget {
|
||||
|
||||
switch(gameType) {
|
||||
case "TicTacToe":
|
||||
this.tutorialButton = Primitive.button("tutorialstring", TicTacToeTutorialWidget::new); break;
|
||||
this.tutorialButton = Primitive.button("tutorialstring", () -> new TicTacToeTutorialWidget(() -> {})); break;
|
||||
case "Reversi":
|
||||
this.tutorialButton = Primitive.button("tutorialstring", ReversiTutorialWidget::new); break;
|
||||
this.tutorialButton = Primitive.button("tutorialstring", () -> new ReversiTutorialWidget(() -> {})); break;
|
||||
case "Connect4":
|
||||
this.tutorialButton = Primitive.button("tutorialstring", Connect4TutorialWidget::new); break;
|
||||
this.tutorialButton = Primitive.button("tutorialstring", () -> new Connect4TutorialWidget(() -> {})); break;
|
||||
default:
|
||||
this.tutorialButton = null; break;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LocalMultiplayerView extends ViewWidget {
|
||||
"tutorial",
|
||||
() -> {
|
||||
AppSettings.getSettings().setFirstTTT(false);
|
||||
new TicTacToeTutorialWidget(information);
|
||||
new TicTacToeTutorialWidget(() -> new TicTacToeGameThread(information));
|
||||
},
|
||||
() -> {
|
||||
AppSettings.getSettings().setFirstTTT(false);
|
||||
@@ -67,7 +67,7 @@ public class LocalMultiplayerView extends ViewWidget {
|
||||
"tutorial",
|
||||
() -> {
|
||||
AppSettings.getSettings().setFirstTTT(false);
|
||||
new ReversiTutorialWidget(information);
|
||||
new ReversiTutorialWidget(() -> new ReversiGame(information));
|
||||
},
|
||||
() -> {
|
||||
AppSettings.getSettings().setFirstTTT(false);
|
||||
@@ -93,7 +93,7 @@ public class LocalMultiplayerView extends ViewWidget {
|
||||
"tutorial",
|
||||
() -> {
|
||||
AppSettings.getSettings().setFirstTTT(false);
|
||||
new Connect4TutorialWidget(information);
|
||||
new Connect4TutorialWidget(() -> new Connect4Game(information));
|
||||
},
|
||||
() -> {
|
||||
AppSettings.getSettings().setFirstTTT(false);
|
||||
|
||||
Reference in New Issue
Block a user