Beispiel #1
0
    public void ShowWinner(int winner)
    {
        if (winner == 0)
        {
            DatabaseDataAcces.insertGamePlayed(player.id, opponent.id, 1, 0);

            int wonCount     = DatabaseDataAcces.getNumberofWonInRow(player.id);
            int cntNotOpened = DatabaseDataAcces.getNumberOfNotOpenedBoxes(player.id);

            if (wonCount % 3 == 0 && cntNotOpened < 4)
            {
                long now = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;
                DatabaseDataAcces.insertBox(player.id, now);
            }

            winnerText.text = "You won!";
        }
        else
        {
            DatabaseDataAcces.insertGamePlayed(player.id, opponent.id, 2, 0);
            winnerText.text = "You lost!";
        }

        winnerText.gameObject.SetActive(true);
        goToGarage.gameObject.SetActive(true);
        winnerBackground.gameObject.SetActive(true);
    }