Example #1
0
    void OnGameOver(int result, DefinitionsGround.ResultType type)
    {
        gameOver = true;
        SetVisibilityUIElements(false, notationInputSmall, clocks, showBoardButton.gameObject);
        SetVisibilityUIElements(true, reviewGameButton);

        string resultString = "Game over";

        if (result == -1)
        {
            resultStringShorthand = "0-1";
            resultString          = "Black wins";
        }
        else if (result == 1)
        {
            resultStringShorthand = "1-0";
            resultString          = "White wins";
        }
        if (result != 0)           // someone has won
        {
            if (type == DefinitionsGround.ResultType.Checkmate)
            {
                resultString += " by checkmate";
            }
            else if (type == DefinitionsGround.ResultType.Resignation)
            {
                resultString += " by resignation";
            }
            else if (type == DefinitionsGround.ResultType.Timeout)
            {
                resultString += " on time";
            }
        }
        else             // draw
        {
            resultStringShorthand = "1/2-1/2";
            resultString          = "Game drawn";

            if (type == DefinitionsGround.ResultType.Repetition)
            {
                resultString += " by repetition";
            }
            else if (type == DefinitionsGround.ResultType.InsufficientMaterial)
            {
                resultString += "; insufficient mating material";
            }
            else if (type == DefinitionsGround.ResultType.FiftyMoveRule)
            {
                resultString += "; 50 move rule";
            }
            else if (type == DefinitionsGround.ResultType.Stalemate)
            {
                resultString += " by stalemate";
            }
        }


        SetMessage(resultString, 10, false);
    }
 void GameOver(int result, DefinitionsGround.ResultType resultType = DefinitionsGround.ResultType.NA)
 {
     if (!gameOver)
     {
         gameOver = true;
         if (OnGameOver != null)
         {
             OnGameOver(result, resultType);
         }
         whitePlayer.Deactivate();
         blackPlayer.Deactivate();
     }
 }
Example #3
0
 void HandleOnGameOver(int result, DefinitionsGround.ResultType type)
 {
     active = false;
 }