mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
fixed setgamelabels
This commit is contained in:
@@ -85,6 +85,7 @@ public class Connect4Game {
|
|||||||
|
|
||||||
if (onForfeit == null || onExit == null) {
|
if (onForfeit == null || onExit == null) {
|
||||||
new Thread(this::localGameThread).start();
|
new Thread(this::localGameThread).start();
|
||||||
|
setGameLabels(information.players[0].isHuman);
|
||||||
} else {
|
} else {
|
||||||
new EventFlow()
|
new EventFlow()
|
||||||
.listen(NetworkEvents.GameMoveResponse.class, this::onMoveResponse)
|
.listen(NetworkEvents.GameMoveResponse.class, this::onMoveResponse)
|
||||||
@@ -102,7 +103,13 @@ public class Connect4Game {
|
|||||||
private void localGameThread() {
|
private void localGameThread() {
|
||||||
while (isRunning.get()) {
|
while (isRunning.get()) {
|
||||||
final int currentTurn = game.getCurrentTurn();
|
final int currentTurn = game.getCurrentTurn();
|
||||||
setGameLabels(information.players[currentTurn].isHuman);
|
final String currentValue = currentTurn == 0? "RED" : "BLUE";
|
||||||
|
final int nextTurn = (currentTurn + 1) % GameInformation.Type.playerCount(information.type);
|
||||||
|
|
||||||
|
view.nextPlayer(information.players[currentTurn].isHuman,
|
||||||
|
information.players[currentTurn].name,
|
||||||
|
currentValue,
|
||||||
|
information.players[nextTurn].name);
|
||||||
|
|
||||||
Game.Move move = null;
|
Game.Move move = null;
|
||||||
|
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public final class ReversiGame {
|
|||||||
|
|
||||||
if (onForfeit == null || onExit == null) {
|
if (onForfeit == null || onExit == null) {
|
||||||
new Thread(this::localGameThread).start();
|
new Thread(this::localGameThread).start();
|
||||||
|
setGameLabels(information.players[0].isHuman);
|
||||||
} else {
|
} else {
|
||||||
new EventFlow()
|
new EventFlow()
|
||||||
.listen(NetworkEvents.GameMoveResponse.class, this::onMoveResponse)
|
.listen(NetworkEvents.GameMoveResponse.class, this::onMoveResponse)
|
||||||
@@ -116,7 +117,13 @@ public final class ReversiGame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final int currentTurn = game.getCurrentTurn();
|
final int currentTurn = game.getCurrentTurn();
|
||||||
setGameLabels(information.players[currentTurn].isHuman);
|
final String currentValue = currentTurn == 0? "BLACK" : "WHITE";
|
||||||
|
final int nextTurn = (currentTurn + 1) % GameInformation.Type.playerCount(information.type);
|
||||||
|
|
||||||
|
view.nextPlayer(information.players[currentTurn].isHuman,
|
||||||
|
information.players[currentTurn].name,
|
||||||
|
currentValue,
|
||||||
|
information.players[nextTurn].name);
|
||||||
|
|
||||||
Game.Move move = null;
|
Game.Move move = null;
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,13 @@ public final class TicTacToeGame {
|
|||||||
private void localGameThread() {
|
private void localGameThread() {
|
||||||
while (isRunning.get()) {
|
while (isRunning.get()) {
|
||||||
final int currentTurn = game.getCurrentTurn();
|
final int currentTurn = game.getCurrentTurn();
|
||||||
setGameLabels(information.players[currentTurn].isHuman);
|
final String currentValue = currentTurn == 0? "X" : "O";
|
||||||
|
final int nextTurn = (currentTurn + 1) % GameInformation.Type.playerCount(information.type);
|
||||||
|
|
||||||
|
view.nextPlayer(information.players[currentTurn].isHuman,
|
||||||
|
information.players[currentTurn].name,
|
||||||
|
currentValue,
|
||||||
|
information.players[nextTurn].name);
|
||||||
|
|
||||||
Game.Move move = null;
|
Game.Move move = null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user