feat(chinese-chess): 实现中国象棋核心逻辑和基本功能

- 抽象出 ChessCore 类,包含游戏初始化、行棋逻辑、悔棋等功能
- 重构 Player 类,优化行棋和记录逻辑
- 更新 ChessBoard 和 ChessPiece 类,适应新逻辑
- 移除冗余代码,提高代码可读性和可维护性
This commit is contained in:
ZZY
2024-11-07 20:48:08 +08:00
parent 6daf09b300
commit 8ee9732a6f
9 changed files with 225 additions and 121 deletions

View File

@ -55,10 +55,9 @@ public class VirtualBoard {
if (GetPiece(arrayPos) != null) {
return false;
}
OnInsert?.Invoke(this, piece);
SetPiecePos(piece, arrayPos);
SetPiecePos(piece, arrayPos);
return true;
}
@ -74,7 +73,6 @@ public class VirtualBoard {
OnMove?.Invoke(this, new MoveEventArgs { From = from, To = to });
SetPiecePos(SetPiecePos(null, from), to);
return true;
}