//悔棋 private void PreviousActionBtn_Click(object sender, EventArgs e) { if (RoleMgr != null) { PreviousActionCommand previousActionCommand = new PreviousActionCommand("PreviousActionCommand", RoleMgr.IsAnyPlayerAi()); RoleMgr.onCommand(previousActionCommand); } }
private bool onPreviousActionCommand(CommandBase command) { Console.WriteLine("onPreviousActionCommand"); if (command is PreviousActionCommand) { PreviousActionCommand previousActionCommand = command as PreviousActionCommand; if (previousActionCommand.IsEnemyAi) { //judge has my chessType if (Model.GetBoard().Any(x => x.Any(y => y == MyChessType))) { //todo hard code Player.TotalTurn -= 2; Model.PreviousAction(); Model.PreviousAction(); View.RemoveLastChess(); View.RemoveLastChess(); RoleMgr.PreviousPlayerByJudgeContainAI(); } else { Console.WriteLine("Not exit my chess,cant regret"); } } else { Player.TotalTurn--; Model.PreviousAction(); View.RemoveLastChess(); RoleMgr.PreviousPlayerByJudge(); } return(true); } else { Console.WriteLine("command is not PreviousActionCommand"); return(false); } }