コード例 #1
0
ファイル: Translate.cs プロジェクト: elexis-eu/word-games
 // Use this for initialization
 void Awake()
 {
     for (int i = 0; i < objectsToTranslate.Length; i++)
     {
         LanguageText.Translate(objectsToTranslate[i], translateToString[i]);
     }
 }
コード例 #2
0
    void UpdateUI()
    {
        canvasObj.SetActive(true);

        int score = 0;

        string previewWord  = GameInfoSynonym.info.words[GameInfoSynonym.currentRound].word;
        int    wordPosition = GameInfoSynonym.info.words[GameInfoSynonym.currentRound].position;

        sumPointsText.text = "" + GameInfoSynonym.score;
        objProgressCircle.SetActive(false);
        sumPointsObj.SetActive(true);
        for (int i = 0; i < 3; i++)
        {
            string writeWord = GameInfoSynonym.rec.data[0].scores[i].word;
            if (writeWord.Length == 0)
            {
                writeWord = "/";
            }

            //chosenWordsText[i].text = wordPosition == 1 ? previewWord + " " + writeWord : writeWord + " " + previewWord;

            chosenWordsText[i].text = GameInfoSynonym.rec.data[0].scores[i].word;

            chosenWordsScoreText[i].text = "" + GameInfoSynonym.rec.data[0].scores[i].score + " " + LanguageText.Translate("score");
            score += GameInfoSynonym.rec.data[0].scores[i].score;

            if (chosenWordsText[i].text.Length == 0)
            {
                chosenWordsText[i].text = "/";
            }

            //int pos = Array.IndexOf(GameInfoSynonym.info.scoring, GameInfoSynonym.rec.data[0].scores[i].score);
            //if (pos == 4)
            //    pos = 5;

            int pos = 0;

            if (GameInfoSynonym.rec.data[0].scores[i].score > 80)
            {
                pos = 5;
            }

            if (GameInfoSynonym.rec.data[0].scores[i].score >= 60 && GameInfoSynonym.rec.data[0].scores[i].score < 80)
            {
                pos = 4;
            }

            if (GameInfoSynonym.rec.data[0].scores[i].score >= 40 && GameInfoSynonym.rec.data[0].scores[i].score < 60)
            {
                pos = 3;
            }

            if (GameInfoSynonym.rec.data[0].scores[i].score >= 20 && GameInfoSynonym.rec.data[0].scores[i].score < 40)
            {
                pos = 2;
            }

            if (GameInfoSynonym.rec.data[0].scores[i].score > 0 && GameInfoSynonym.rec.data[0].scores[i].score < 20)
            {
                pos = 1;
            }

            starsScripts[i].EnableStarsObjects(5, pos);
        }

        //sumPointsText.text = score + "/" + GameInfoSynonym.info.max_round_score + " " + LanguageText.Translate("score");
        sumPointsText.text = score + " " + LanguageText.Translate("score");
    }
コード例 #3
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);
        }
    }
コード例 #4
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());
    }