flutter: 解决 score 经常被清空的问题
This commit is contained in:
parent
e9a4d80918
commit
ef06033e16
|
@ -176,7 +176,7 @@ class Position {
|
||||||
}
|
}
|
||||||
|
|
||||||
Position() {
|
Position() {
|
||||||
score[Color.black] = score[Color.white] = score[Color.draw] = nPlayed = 0;
|
//score[Color.black] = score[Color.white] = score[Color.draw] = nPlayed = 0;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,8 +715,6 @@ class Position {
|
||||||
|
|
||||||
setGameOver(Color.opponent(loser), GameOverReason.loseReasonResign);
|
setGameOver(Color.opponent(loser), GameOverReason.loseReasonResign);
|
||||||
|
|
||||||
updateScore();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,6 +727,7 @@ class Position {
|
||||||
gameOverReason = reason;
|
gameOverReason = reason;
|
||||||
winner = w;
|
winner = w;
|
||||||
print("Game over, $w win, becase of $reason");
|
print("Game over, $w win, becase of $reason");
|
||||||
|
updateScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateScore() {
|
void updateScore() {
|
||||||
|
@ -1502,6 +1501,8 @@ class Position {
|
||||||
moves += " ${recorder.moveAt(i).move}";
|
moves += " ${recorder.moveAt(i).move}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print("moves = $moves");
|
||||||
|
|
||||||
return moves.length > 0 ? moves.substring(1) : '';
|
return moves.length > 0 ? moves.substring(1) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue