예제 #1
0
 private void OnGameItemClick(object game)
 {
     if (game.GetType() == typeof(GameInfo))
     {
         GameInfo gameInfo = (game as GameInfo);
         gameInfo.PlayersNicknames.Add(PlayerNickName);
         gameInfo.PlayersNow = gameInfo.PlayersNow + 1;
         DataPersistance.SaveCurrentGameId(gameInfo.Id);
         StartCoroutine(NetworkController.PostGameInfo(gameInfo, PostGameInfoResponse));
     }
 }
예제 #2
0
    private void SendCreateGameRequest(int howMany)
    {
        string newGameId = "GAME_" + ((int)(System.DateTime.UtcNow - new System.DateTime(1970, 1, 1))
                                      .TotalSeconds).ToString("X2");

        string creatorNickname = DataPersistance.GetPlayerNickName();

        List <string> playersIds = new List <string>();

        playersIds.Add(creatorNickname);
        //todo creator name
        newGame = new GameInfo(newGameId, true, creatorNickname, howMany, 1, playersIds);

        DataPersistance.SaveCurrentGameId(newGameId);
        StartCoroutine(NetworkController.PostGameInfo(newGame, NewGameCreatedResponse));
    }