Example #1
0
    // hacked + game isn't keeping sum of score, sadly
    void SetUpPlayerViewArea(GameObject thisPlayerObj, int pos, ScoreboardInfo.Scoreboard scoreboardInfo)
    {
        thisPlayerObj.SetActive(true);
        LeaderboardPlayerPrefab thisPlayerScript = thisPlayerObj.GetComponent <LeaderboardPlayerPrefab>();

        thisPlayerScript.positionText.text    = "" + (pos + 1) + "+";
        thisPlayerScript.playerNameText.text  = GameSettings.username;
        thisPlayerScript.playerScoreText.text = "<" + scoreboardInfo.scoreboard[scoreboardInfo.scoreboard.Length - 1].score + " " + LanguageText.Translate("score");
        thisPlayerScript.playerScoreText.text = GameSettings.localizationManager.GetTextForKey("COLLOCATION_MULTIPLAYER_LEADERBOARD_POINTS").Replace("{{POINTS}}", scoreboardInfo.scoreboard[scoreboardInfo.scoreboard.Length - 1].score.ToString());
    }
Example #2
0
 public void ClearContent()
 {
     for (int i = 0; i < contentAreaObjects.Count; i++)
     {
         LeaderboardPlayerPrefab newPlayerScript = leaderboardPlayerPrefabsScr[i];
         newPlayerScript.positionImage.color = colorRed;
         newPlayerScript.helperLineObj.SetActive(true);
         contentAreaObjects[i].SetActive(false);
     }
 }
Example #3
0
    public void parseLeaderBoard()
    {
        if (GameSettings.usertype == "guest")
        {
            thisPlayerObj.SetActive(false);
        }
        else
        {
            try {
                thisPlayerObj.SetActive(true);

                LeaderboardPlayerPrefab thisPlayerScript = thisPlayerObj.GetComponent <LeaderboardPlayerPrefab>();
                thisPlayerScript.positionText.text   = "" + LeaderBoardResponseMessage.player.mainPosition.ToString();
                thisPlayerScript.positionImage.color = colorBlue;
                thisPlayerScript.playerNameText.text = "" + GameSettings.username;
                thisPlayerScript.levelText.text      = "" + LeaderBoardResponseMessage.player.maxLevel.ToString();
                //thisPlayerScript.playerScoreText.text = "" + LeaderBoardResponseMessage.player.mainScore.ToString();
                thisPlayerScript.playerScoreText.text = "" + GameSettings.localizationManager.GetTextForKey("SYNONYM_SOLO_SCOREBOARD_POINTS").Replace("{{POINTS}}", LeaderBoardResponseMessage.player.mainScore.ToString());
            }
            catch (Exception except) {
                GameSettings.MyDebug(except.Message);
            }
        }

        int           i = 0;
        RectTransform contentTransform = contentObj.GetComponent <RectTransform>();

        prefabPlayerHeight         = prefabPlayer.GetComponent <RectTransform>().rect.height;
        contentTransform.sizeDelta = new Vector2(0, LeaderBoardResponseMessage.leaderboard.Length * prefabPlayerHeight);

        foreach (BoardPlayer player in LeaderBoardResponseMessage.leaderboard)
        {
            GameObject newPlayerObj = Instantiate(prefabPlayer, new Vector3(0, -i * prefabPlayerHeight, 0), Quaternion.identity);
            newPlayerObj.transform.SetParent(contentTransform, false);
            LeaderboardPlayerPrefab newPlayerScript = newPlayerObj.GetComponent <LeaderboardPlayerPrefab>();
            newPlayerObj.SetActive(true);

            newPlayerScript.positionText.text   = "" + player.rank_position.ToString();
            newPlayerScript.levelText.text      = "" + player.max_level.ToString();
            newPlayerScript.playerNameText.text = player.display_name;
            //newPlayerScript.playerScoreText.text = "" + player.campaign_score.ToString() + " " + LanguageText.Translate("score");
            newPlayerScript.playerScoreText.text = "" + GameSettings.localizationManager.GetTextForKey("SYNONYM_SOLO_SCOREBOARD_POINTS").Replace("{{POINTS}}", player.campaign_score.ToString());

            if (player.display_name == GameSettings.username)
            {
                newPlayerScript.positionImage.color = colorBlue;
            }
            else
            {
                newPlayerScript.positionImage.color = colorRed;
            }

            i++;
        }
    }
Example #4
0
    void SetUpPlayerViewArea(GameObject thisPlayerObj, GameObject thisPlayerOverallObj, ScoreboardInfo.Scoreboard scoreboardInfo)
    {
        GameSettings.MyDebug(scoreboardInfo.user_score.display_name);
        if (scoreboardInfo.user_score.display_name.Equals("") || GameSettings.user == null)
        {
            thisPlayerObj.SetActive(false);
            return;
        }

        thisPlayerObj.SetActive(true);
        LeaderboardPlayerPrefab thisPlayerScript = thisPlayerObj.GetComponent <LeaderboardPlayerPrefab>();

        thisPlayerScript.positionText.text   = "" + scoreboardInfo.user_score.position;
        thisPlayerScript.playerNameText.text = "" + scoreboardInfo.user_score.display_name;
        //thisPlayerScript.playerScoreText.text = "" + scoreboardInfo.user_score.score + " " + LanguageText.Translate("score");
        thisPlayerScript.playerScoreText.text = GameSettings.localizationManager.GetTextForKey("COLLOCATION_MULTIPLAYER_LEADERBOARD_POINTS").Replace("{{POINTS}}", scoreboardInfo.user_score.score.ToString());
    }
Example #5
0
    private IEnumerator StaggeredSpawn(RectTransform contentTransform, int numOfPlayers, GameObject thisPlayerObj, bool global, int maxScore, GameObject thisPlayerOverallObj, ScoreboardInfo.Scoreboard scoreboardInfo)
    {
        int maxPerFrame = 10;
        int loopCounter = 0;

        if (global)
        {
            SetUpPlayerViewArea(thisPlayerObj, thisPlayerOverallObj, scoreboardInfo);
        }

        int  previousScore = -1;
        int  position      = 1;
        int  save          = 0;
        bool hacked        = true;

        for (int i = 0; i < numOfPlayers; i++)
        {
            if (i >= contentAreaObjects.Count)
            {
                CreateObjects(i);
            }
            contentAreaObjects[i].SetActive(true);
            contentAreaObjects[i].transform.SetParent(contentTransform, false);
            LeaderboardPlayerPrefab newPlayerScript = leaderboardPlayerPrefabsScr[i];
            if (global)
            {
                if (scoreboardInfo.scoreboard[i].display_name.Equals(scoreboardInfo.user_score.display_name) && GameSettings.user != null)
                {
                    coloredOne = i;
                    newPlayerScript.positionImage.color = colorBlue;
                }
            }
            else
            {
                if (scoreboardInfo.scoreboard[i].display_name.Equals(GameSettings.username))
                {
                    coloredOne = i;
                    newPlayerScript.positionImage.color = colorBlue;
                    SetUpPlayerViewArea(thisPlayerObj, i, maxScore, scoreboardInfo);
                    hacked = false;
                }
            }
            if (scoreboardInfo.scoreboard[i].score == previousScore)
            {
                position--;
                save++;
            }
            else
            {
                position += save;
                save      = 0;
            }
            newPlayerScript.positionText.text    = "" + (position++);
            newPlayerScript.playerNameText.text  = scoreboardInfo.scoreboard[i].display_name;
            newPlayerScript.playerScoreText.text = "" + scoreboardInfo.scoreboard[i].score + " " + LanguageText.Translate("score");
            newPlayerScript.playerScoreText.text = GameSettings.localizationManager.GetTextForKey("COLLOCATION_MULTIPLAYER_LEADERBOARD_POINTS").Replace("{{POINTS}}", scoreboardInfo.scoreboard[i].score.ToString());

            /*if (!global)
             *  newPlayerScript.playerScoreText.text += "/" + maxScore + " " + LanguageText.Translate("score");
             * else
             *  newPlayerScript.playerScoreText.text += " " + LanguageText.Translate("score");*/


            previousScore = scoreboardInfo.scoreboard[i].score;

            if (i + 1 == numOfPlayers)
            {
                newPlayerScript.helperLineObj.SetActive(false);
            }

            loopCounter++;
            if (loopCounter >= maxPerFrame)
            {
                loopCounter = 0;
                yield return(null);
            }
        }

        if (!global && hacked)
        {
            SetUpPlayerViewArea(thisPlayerObj, position, scoreboardInfo);
        }
    }