Show phase/side/tip and adjust display order in info

This commit is contained in:
Calcitem 2021-08-30 00:13:11 +08:00
parent de3fefc9b5
commit 4bb560c24d
No known key found for this signature in database
GPG Key ID: F2F7C29E054CFB80
4 changed files with 119 additions and 37 deletions

View File

@ -1168,5 +1168,21 @@
"noPoint": "Kein Punkt", "noPoint": "Kein Punkt",
"@close": { "@close": {
"description": "No point" "description": "No point"
},
"placingPhase": "Setzphase",
"@placingPhase": {
"placingPhase": "Placing phase"
},
"movingPhase": "Bewegungsphase",
"@movingPhase": {
"description": "Moving phase"
},
"flyingPhase": "Flugphase",
"@flyingPhase": {
"description": "Flying phase"
},
"sideToMove": "Wer soll umziehen",
"@sideToMove": {
"description": "Side to move"
} }
} }

View File

@ -1150,23 +1150,39 @@
"description": "Close" "description": "Close"
}, },
"whitePiece": "White piece", "whitePiece": "White piece",
"@close": { "@whitePiece": {
"description": "White piece" "description": "White piece"
}, },
"blackPiece": "Black piece", "blackPiece": "Black piece",
"@close": { "@blackPiece": {
"description": "Black piece" "description": "Black piece"
}, },
"banPoint": "Ban point", "banPoint": "Ban point",
"@close": { "@banPoint": {
"description": "Ban point" "description": "Ban point"
}, },
"emptyPoint": "Empty point", "emptyPoint": "Empty point",
"@close": { "@emptyPoint": {
"description": "Empty point" "description": "Empty point"
}, },
"noPoint": "No point", "noPoint": "No point",
"@close": { "@noPoint": {
"description": "No point" "description": "No point"
} },
"placingPhase": "Placing phase",
"@placingPhase": {
"placingPhase": "Placing phase"
},
"movingPhase": "Moving phase",
"@movingPhase": {
"description": "Moving phase"
},
"flyingPhase": "Flying phase",
"@flyingPhase": {
"description": "Flying phase"
},
"sideToMove": "Side to move",
"@sideToMove": {
"description": "Side to move"
}
} }

View File

@ -1150,23 +1150,39 @@
"description": "Close" "description": "Close"
}, },
"whitePiece": "白棋", "whitePiece": "白棋",
"@close": { "@whitePiece": {
"description": "White piece" "description": "White piece"
}, },
"blackPiece": "黑棋", "blackPiece": "黑棋",
"@close": { "@blackPiece": {
"description": "Black piece" "description": "Black piece"
}, },
"banPoint": "被压", "banPoint": "被压",
"@close": { "@banPoint": {
"description": "Ban point" "description": "Ban point"
}, },
"emptyPoint": "空点", "emptyPoint": "空点",
"@close": { "@emptyPoint": {
"description": "Empty point" "description": "Empty point"
}, },
"noPoint": "无点", "noPoint": "无点",
"@close": { "@noPoint": {
"description": "No point" "description": "No point"
},
"placingPhase": "摆子阶段",
"@placingPhase": {
"placingPhase": "Placing phase"
},
"movingPhase": "走子阶段",
"@movingPhase": {
"description": "Moving phase"
},
"flyingPhase": "飞子阶段",
"@flyingPhase": {
"description": "Flying phase"
},
"sideToMove": "轮到",
"@sideToMove": {
"description": "Side to move"
} }
} }

View File

@ -1423,46 +1423,80 @@ class _GamePageState extends State<GamePage>
} }
String getInfoText() { String getInfoText() {
String ret = S.of(context).score + String phase = "";
var pos = Game.instance.position;
switch (pos.phase) {
case Phase.placing:
phase = S.of(context).placingPhase;
break;
case Phase.moving:
phase = S.of(context).movingPhase;
break;
default:
break;
}
String pieceCountInHand = pos.phase == Phase.placing
? S.of(context).player1 +
" " +
S.of(context).inHand +
": " +
pos.pieceInHandCount[PieceColor.white].toString() +
"\n" +
S.of(context).player2 +
" " +
S.of(context).inHand +
": " +
pos.pieceInHandCount[PieceColor.black].toString() +
"\n"
: "";
String sideToMove = "";
if (pos.side == PieceColor.white) {
sideToMove = S.of(context).player1;
} else if (pos.side == PieceColor.black) {
sideToMove = S.of(context).player2;
}
String tip = _tip == null ? "" : _tip!;
String ret = phase +
"\n" + "\n" +
S.of(context).player1 + S.of(context).sideToMove +
": " + sideToMove +
Game.instance.position.score[PieceColor.white].toString() +
"\n" + "\n" +
S.of(context).player2 + tip +
": " +
Game.instance.position.score[PieceColor.black].toString() +
"\n" +
S.of(context).draw +
": " +
Game.instance.position.score[PieceColor.draw].toString() +
"\n\n" + "\n\n" +
S.of(context).pieceCount + S.of(context).pieceCount +
"\n" + "\n" +
S.of(context).player1 + pieceCountInHand +
" " +
S.of(context).inHand +
": " +
Game.instance.position.pieceInHandCount[PieceColor.white].toString() +
"\n" +
S.of(context).player2 +
" " +
S.of(context).inHand +
": " +
Game.instance.position.pieceInHandCount[PieceColor.black].toString() +
"\n" +
S.of(context).player1 + S.of(context).player1 +
" " + " " +
S.of(context).onBoard + S.of(context).onBoard +
": " + ": " +
Game.instance.position.pieceOnBoardCount[PieceColor.white].toString() + pos.pieceOnBoardCount[PieceColor.white].toString() +
"\n" + "\n" +
S.of(context).player2 + S.of(context).player2 +
" " + " " +
S.of(context).onBoard + S.of(context).onBoard +
": " + ": " +
Game.instance.position.pieceOnBoardCount[PieceColor.black].toString() + pos.pieceOnBoardCount[PieceColor.black].toString() +
"\n"; "\n\n" +
S.of(context).score +
"\n" +
S.of(context).player1 +
": " +
pos.score[PieceColor.white].toString() +
"\n" +
S.of(context).player2 +
": " +
pos.score[PieceColor.black].toString() +
"\n" +
S.of(context).draw +
": " +
pos.score[PieceColor.draw].toString();
return ret; return ret;
} }