Example #1
0
    private void Initialize()
    {
        menuManager = GetComponent <AbstractMenuManager>();
        menuManager.ComponentSelected += SkipScoreAnimation;

        // Resize to 0
        scoreContainer.localScale          = Vector3.zero;
        scoreText.rectTransform.localScale = Vector3.zero;

        InitializeWaitForSeconds();

        // Event game name  (Only active if this is an event build)
        ScoreContainer scoreData = DataCollector.instance.getScoreContainer();

        if (DataCollector.instance.eventBuild)
        {
            eventGameName.gameObject.SetActive(true);
            eventGameName.text = string.Format(eventGameName.text, scoreData.getGameName());
        }

        // Init highscore entries
        originalScoreText = scoreText.text.ToString();
        foreach (Transform child in scoreContainer.transform)
        {
            Text textItem                 = child.GetComponent <Text>();
            Text scoreNumberText          = child.GetChild(0).GetComponent <Text>();
            HighscoreIdentifier scoreType = child.GetComponent <HighscoreIdentifier>();

            highscoreEntries.Add(scoreType.ScoreType, new ScoreData(textItem, scoreNumberText));
        }

        // Init player count and levelname
        string splittedLevelName = Regex.Replace(scoreData.getLevelName(), "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");

        playerCountLevelName.text = string.Format(playerCountLevelName.text,
                                                  scoreData.getPlayerCount(),
                                                  scoreData.getLevelName() == "" ? "?" : splittedLevelName.ToUpper());
    }