예제 #1
0
        private void FillCardDataFoMyGames(GameCard gCard, GameData gData)
        {
            //
            gCard.OnPlayClick += PlayGame;

            // game ID
            gCard.Set_GameID(gData);

            // enemy name
            var enemyName =
                (_playerManager.PlayerId == gData.player1_Id)
                                        ? (gData.player2_name) : (gData.player1_name);

            gCard.enemyName.text = enemyName;

            // player score
            gCard.youScoreLabel.text =
                (_playerManager.PlayerId == gData.player1_Id)
                                        ? (gData.player1_score.ToString()) : (gData.player2_score.ToString());

            // enemy score
            gCard.enemyScoreLabel.text =
                (_playerManager.PlayerId == gData.player1_Id)
                                        ? (gData.player2_score.ToString()) : (gData.player1_score.ToString());

            // map name
            string trackIdString = gData.track_id;
            int    trackId       = int.Parse(trackIdString);
            string trackName     = _chooseTrackWindow.trackNames[trackId];

            gCard.Set_MapName(trackName);

            // race date
            int    lastUpdate        = int.Parse(gData.last_update);
            string correctedRaceTime = GetCorrectedRaceTime(lastUpdate);

            gCard.Set_TextRaceDate(correctedRaceTime);



            switch (gData.GameType)
            {
            case GameTypeEnum.MultyRecord:
                if (!_safePlayerPrefs.IsGameId(gData.gameId))
                {
                    gCard.SetRecordView();
                }
                break;

            case GameTypeEnum.MultyReplay:
                gCard.SetReplayView();
                // message smiles
                List <int> idSmiles = gData.smiles;
                if (idSmiles != null)
                {
                    gCard.FillMessageWithSmiles(idSmiles);
                }
                break;
            }
            // continue or not
            int    buttonShow = 1;
            string buttonText = "PLAY";

            if (_safePlayerPrefs.IsGameId(gData.gameId))
            {
                buttonShow = 2;
                buttonText = "CONTINUE";
            }
            gCard.Set_TextButtonPlay(buttonShow, buttonText);
        }