public string PrepareStatisticsString(CrossAndNoughtsPlayer playerOne, CrossAndNoughtsPlayer playerTwo)
    {
        string sResults = "";

        sResults += playerOne.sName;
        if (playerOne.bIsThisTypeIsCrosses)
        {
            sResults += " (" + ProjectStrings.GetStringCrosses() + ") ";
        }
        else
        {
            sResults += " (" + ProjectStrings.GetStringNoughts() + ") ";
        }
        sResults += playerOne.LoadAndGetCountOfWinNumber().ToString() + "\n";
        sResults += playerTwo.sName;
        if (playerTwo.bIsThisTypeIsCrosses)
        {
            sResults += " (" + ProjectStrings.GetStringCrosses() + ") ";
        }
        else
        {
            sResults += " (" + ProjectStrings.GetStringNoughts() + ") ";
        }
        sResults += playerTwo.LoadAndGetCountOfWinNumber().ToString();
        return(sResults);
    }
Exemplo n.º 2
0
    void Start()
    {
        buttonPlay.onClick.AddListener(ButtonPlayPressed);
        buttonExit.onClick.AddListener(ButtonExitPressed);
        buttonRestart.onClick.AddListener(ButtonRestartPressed);
        buttonResultsExit.onClick.AddListener(ButtonExitPressed);

        playerOne = new CrossAndNoughtsPlayer("PlayerOne", true);
        playerTwo = new CrossAndNoughtsPlayer("PlayerTwo", false);
        if (!(playerOne is IAbleToSaveAndLoadWinNumber && playerTwo is IAbleToSaveAndLoadWinNumber))
        {
            throw new Exception("player class not implements IAbleToSaveWinNumber");
        }
        CheckInterfaces();

        playingFieldFiller.InitializePlayindFieldFillerAtGameStart(nRowNumber);
        GameInitialization();
    }