flutter: Fix first tap response slow when piece count changed
Call tree: Game.shared.newGame(); -> Game.shared.start(); Game.shared.position.init(); -> setPosition(rule); -> getNPiecesInHand(); To fix fen string.
This commit is contained in:
parent
be5b877885
commit
8fc4b0038c
|
@ -106,6 +106,14 @@ class _GamePageState extends State<GamePage> with RouteAware {
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// WAR: Fix first tap response slow when piece count changed
|
||||
if (position.phase == Phase.placing &&
|
||||
position.pieceOnBoardCount[PieceColor.black] == 0 &&
|
||||
position.pieceOnBoardCount[PieceColor.white] == 0) {
|
||||
Game.shared.newGame();
|
||||
}
|
||||
|
||||
if (Game.shared.isAiToMove() || Game.shared.aiIsSearching()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue