Esempio n. 1
0
    void OnGameOver(int result, Definitions.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 == Definitions.ResultType.Checkmate)
            {
                resultString += " by checkmate";
            }
            else if (type == Definitions.ResultType.Resignation)
            {
                resultString += " by resignation";
            }
            else if (type == Definitions.ResultType.Timeout)
            {
                resultString += " on time";
            }
        }
        else             // draw
        {
            resultStringShorthand = "1/2-1/2";
            resultString          = "Game drawn";

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


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