public void Init(Challenges challenges, int _id, Challenges.PlayerData playerData)
    {
        RemindButton.SetActive(false);
        this.playerData = playerData;
        this.challenges = challenges;
        this.id         = _id;

        if (challenges.type == Challenges.types.MADE)
        {
            InactiveButtons();
            RemindButton.SetActive(true);
        }


        if (playerData.winner != "")
        {
            if (playerData.winner == Data.Instance.userData.facebookID)
            {
                result.text  = "YOU WON";
                result.color = WinColor;
            }
            else
            {
                result.text  = "YOU LOST";
                result.color = lostColor;
            }
            InactiveButtons();
        }
        this.objectID   = playerData.objectID;
        this.facebookID = playerData.facebookID;

        username           = Data.Instance.gameSettings.GetUsername(playerData.playerName);
        usernameLabel.text = username;


        levelId    = playerData.level;
        level.text = "LEVEL " + levelId;

        string score = Data.Instance.levelsData.GetScoreString(playerData.level, playerData.score);

        Levels.LevelData data = Data.Instance.levels.GetData(levelId);

        if (data.Sudden_Death)
        {
            scoreLabel.text = score;
        }
        else
        if (data.totalTime > 0)
        {
            scoreLabel.text = score + " in " + Data.Instance.levelsData.GetTimer(data.totalTime);
        }
        else
        {
            scoreLabel.text = data.totalLaps + "000" + "m in " + score;
        }

        op_score = playerData.score;
        profilePicture.setPicture(facebookID);
        infoLoaded = true;
    }
Пример #2
0
    public void Init(Challenges challenges, int _id, Challenges.PlayerData playerData)
    {
        RemindButton.SetActive(false);
        this.playerData = playerData;
        this.challenges = challenges;
        this.id         = _id;

        if (challenges.type == Challenges.types.MADE)
        {
            InactiveButtons();
            RemindButton.SetActive(true);
        }


        if (playerData.winner != null && playerData.winner.Length > 1)
        {
            if (playerData.winner == SocialManager.Instance.userData.facebookID)
            {
                result.text     = "Gantaste";
                scoreLabel.text = "$" + playerData.score;
                result.color    = WinColor;
            }
            else
            {
                result.text     = "Perdiste!";
                scoreLabel.text = "$" + playerData.score2;
                result.color    = lostColor;
            }
            InactiveButtons();
        }
        else
        {
            op_score        = playerData.score;
            scoreLabel.text = "$" + playerData.score;
        }
        this.objectID   = playerData.objectID;
        this.facebookID = playerData.facebookID;

        username           = Data.Instance.gameSettings.GetUsername(playerData.playerName);
        usernameLabel.text = username;


        profilePicture.setPicture(facebookID);
        infoLoaded = true;
    }
Пример #3
0
    public void Init(Challenges challenges, int _id, Challenges.PlayerData playerData)
    {
        RemindButton.SetActive(false);
        this.playerData = playerData;
        this.challenges = challenges;
        this.id = _id;

        if (challenges.type == Challenges.types.MADE)
        {
            InactiveButtons();
            RemindButton.SetActive(true);
        }

        if (playerData.winner != null && playerData.winner.Length > 1)
        {
            if (playerData.winner == SocialManager.Instance.userData.facebookID)
            {
                result.text = "Gantaste";
                scoreLabel.text = "$" + playerData.score;
                result.color = WinColor;
            }
            else
            {
                result.text = "Perdiste!";
                scoreLabel.text = "$" + playerData.score2;
                result.color = lostColor;
            }
            InactiveButtons();
        }
        else
        {
            op_score = playerData.score;
            scoreLabel.text = "$" + playerData.score;
        }
        this.objectID = playerData.objectID;
        this.facebookID = playerData.facebookID;

        username = Data.Instance.gameSettings.GetUsername(playerData.playerName);
        usernameLabel.text = username;

        profilePicture.setPicture(facebookID);
        infoLoaded = true;
    }