Example #1
0
		/// <summary>
		/// The user decided to promote a pawn
		/// </summary>
		/// <param name="type">The piece the pawn should promote to</param>
		public void OnPawnPromoted( PawnPromotion type )
		{
			m_Board.OnPawnPromoted( m_PromotedPawn, type );

			m_PromotedPawn = null;
		}
Example #2
0
		/// <summary>
		/// This function is called when a move is completed, and the next step in game should be performed
		/// </summary>
		public void OnMoveOver( Move move, string whiteMsg, string blackMsg )
		{
			m_Timer.OnMoveMade();

			if ( move != null && move.Piece is Pawn && ( move.Piece as Pawn ).ShouldBePromoted )
			{
				// A pawn should be promoted
				m_PromotedPawn = move.Piece as Pawn;

				if ( m_Status == GameStatus.BlackMoving )
				{
					// Black
					m_Status = GameStatus.BlackPromotion;
					SendAllGumps( "Waiting for black to promote their pawn", "Please promote your pawn" );

					m_Black.SendGump( new PawnPromotionGump( m_Black, this ) );
				}
				else
				{
					// White
					m_Status = GameStatus.WhitePromotion;
					SendAllGumps( "Please promote your pawn", "Waiting for white to promote their pawn" );

					m_White.SendGump( new PawnPromotionGump( m_White, this ) );
				}

				return;
			}

			if ( m_Status == GameStatus.BlackMoving || m_Status == GameStatus.BlackPromotion )
			{
				m_BlackTime += ( DateTime.Now.Subtract( m_MoveTime ) );
				m_Status = GameStatus.WhiteToMove;
			}
			else if ( m_Status == GameStatus.WhiteMoving || m_Status == GameStatus.WhitePromotion )
			{
				m_WhiteTime += ( DateTime.Now.Subtract( m_MoveTime ) );
				m_Status = GameStatus.BlackToMove;
			}

			m_MoveTime = DateTime.Now;

			SendAllGumps( null, null );
		}