From dd164595a0db78a8a2fb8afad14107dcd615307d Mon Sep 17 00:00:00 2001 From: CalciteM Team Date: Sat, 29 Jun 2019 11:21:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=91=86=E6=A3=8B=E9=98=B6=E6=AE=B5=E5=AF=B9?= =?UTF-8?q?=E6=9C=80=E8=BF=91=E7=A7=BB=E9=99=A4=E7=9A=84=E6=A3=8B=E5=AD=90?= =?UTF-8?q?=E7=BD=AE=E4=B8=BA=E9=80=89=E6=8B=A9=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NineChess/src/gamecontroller.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NineChess/src/gamecontroller.cpp b/NineChess/src/gamecontroller.cpp index 07adfdee..d789b29e 100644 --- a/NineChess/src/gamecontroller.cpp +++ b/NineChess/src/gamecontroller.cpp @@ -867,10 +867,13 @@ bool GameController::updateScence(NineChess &chess) // 棋子就位 PieceItem *piece = nullptr; + PieceItem *deletedPiece = nullptr; for (int i = 0; i < nTotalPieces; i++) { piece = pieceList.at(i); + piece->setSelected(false); + // 将pieceList的下标转换为chess的棋子代号 key = (i % 2) ? (i / 2 + 0x21) : (i / 2 + 0x11); @@ -912,6 +915,9 @@ bool GameController::updateScence(NineChess &chess) } if (piece->pos() != pos) { + // 为了对最近移除的棋子置为选择状态作准备 + deletedPiece = piece; + #ifdef GAME_PLACING_SHOW_CAPTURED_PIECES if (chess.getStage() == NineChess::GAME_MOVING) { #endif @@ -968,6 +974,11 @@ bool GameController::updateScence(NineChess &chess) } } + // 对最近移除的棋子置为选择状态 + if (deletedPiece) { + deletedPiece->setSelected(true); + } + animationGroup->start(QAbstractAnimation::DeleteWhenStopped); return true;