corda: GameView change opponentColor to myColor
This commit is contained in:
parent
b34335cefc
commit
5f23c4c766
@ -68,11 +68,11 @@ public abstract class GameState implements ContractState {
|
||||
throw new NotInvolved(playerName, this.getClass(), gameUuid);
|
||||
}
|
||||
|
||||
public Stone.Color getOpponentColor(MemberX500Name playerName) throws NotInvolved {
|
||||
public Stone.Color getPlayerColor(MemberX500Name playerName) throws NotInvolved {
|
||||
if (playerName.compareTo(whitePlayer) == 0)
|
||||
return Stone.Color.BLACK;
|
||||
if (playerName.compareTo(blackPlayer) == 0)
|
||||
return Stone.Color.WHITE;
|
||||
if (playerName.compareTo(blackPlayer) == 0)
|
||||
return Stone.Color.BLACK;
|
||||
throw new NotInvolved(playerName, this.getClass(), gameUuid);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ public class View {
|
||||
}
|
||||
public final Status status;
|
||||
|
||||
public final Stone.Color myColor;
|
||||
public final String opponentName;
|
||||
public final Stone.Color opponentColor;
|
||||
|
||||
public final Map<Integer, Stone> board;
|
||||
public final Integer moveNumber;
|
||||
@ -44,7 +44,7 @@ public class View {
|
||||
public View() {
|
||||
this.status = null;
|
||||
this.opponentName = null;
|
||||
this.opponentColor = null;
|
||||
this.myColor = null;
|
||||
this.board = null;
|
||||
this.moveNumber = null;
|
||||
this.previousMove = null;
|
||||
@ -55,7 +55,7 @@ public class View {
|
||||
public View(View.Status status, MemberX500Name myName, GameProposalState gameProposal) {
|
||||
this.status = status;
|
||||
this.opponentName = gameProposal.getOpponentName(myName).getCommonName();
|
||||
this.opponentColor = gameProposal.getOpponentColor(myName);
|
||||
this.myColor = gameProposal.getPlayerColor(myName);
|
||||
this.board = gameProposal.getBoard();
|
||||
this.previousMove = null;
|
||||
this.moveNumber = 0;
|
||||
@ -66,7 +66,7 @@ public class View {
|
||||
public View(View.Status status, MemberX500Name myName, GameBoardState gameBoard, List<Integer> previousMove) {
|
||||
this.status = status;
|
||||
this.opponentName = gameBoard.getOpponentName(myName).getCommonName();
|
||||
this.opponentColor = gameBoard.getOpponentColor(myName);
|
||||
this.myColor = gameBoard.getPlayerColor(myName);
|
||||
this.board = gameBoard.getBoard();
|
||||
this.previousMove = previousMove;
|
||||
this.moveNumber = gameBoard.getMoveNumber();
|
||||
@ -77,7 +77,7 @@ public class View {
|
||||
public View(View.Status status, MemberX500Name myName, GameResultState gameResult) {
|
||||
this.status = status;
|
||||
this.opponentName = gameResult.getOpponentName(myName).getCommonName();
|
||||
this.opponentColor = gameResult.getOpponentColor(myName);
|
||||
this.myColor = gameResult.getPlayerColor(myName);
|
||||
this.board = null;
|
||||
this.previousMove = null;
|
||||
this.moveNumber = gameResult.getTotalMoves();
|
||||
|
Loading…
Reference in New Issue
Block a user