Пример #1
0
 /// <summary>
 /// 执行下棋操作. 没有参数, 交给 AI 完成.
 /// </summary>
 private void MovePiece()
 {
     changeWaitingState(WaitingState.WaitingMovePieceConfirmed);
     reversiGame.SetPieceMoveArgs(reversiAI.GetNextpiece(), MovePiece_Confirmed, MovePiece_Completed);
     if (movePieceThread != null && movePieceThread.IsAlive)
     {
         movePieceThread.Abort();
     }
     movePieceThread = new Thread(new ThreadStart(reversiGame.PieceMoves));
     movePieceThread.Start();
 }
Пример #2
0
 protected async void MovePiece(ReversiPiecePosition position)
 {
     isMovingPiece = true;
     pieces[reversiGame.LastPosition.X, reversiGame.LastPosition.Y].IsLastPiece = false;
     pieces[position.X, position.Y].IsLastPiece = true;
     reversiGame.SetPieceMoveArgs(position, MovePiece_Confirmed, MovePiece_Completed);
     if (movePieceTask != null && !movePieceTask.IsCompleted)
     {
         movePieceTask.Wait();
     }
     movePieceTask = new Task(() => reversiGame.PieceMoves());
     movePieceTask.Start();
 }