コード例 #1
0
    public void ClaimDrawButtonClicked( )
    {
        string condition = null;

        /*
         * technically, there are edge cases where these can overlap. however, the outcome is effectively the same.
         */

        if (Game.PlayerToPlay.CanClaimInsufficientMaterialDraw)
        {
            condition = BoardHandler.GameOverConditions.DRAW_BY_INSUFFICIENT_MATERIAL;
        }
        else if (Game.PlayerToPlay.CanClaimThreeMoveRepetitionDraw)
        {
            condition = BoardHandler.GameOverConditions.DRAW_BY_REPETITION;
        }

        if (condition != null)
        {
            BoardHandler boardHandler = GameObject.Find("Board").GetComponent <BoardHandler>( );
            boardHandler.ClaimDraw(condition);

            Resume( );
        }
        else
        {
            ShowInvalidDrawClaimDialog( );
        }
    }