Пример #1
0
    public void SetLevel(string worldTitle, ArcadeLevelsInfo info)
    {
        currentWorld = info.worldID;
        Title.UpdateKey(worldTitle);

        Font font  = null;
        int  index = (int)FontsManager.FontType.Arcade;

        if (FontsManager.Instance.RegularFonts != null && FontsManager.Instance.RegularFonts.Length > index)
        {
            font = FontsManager.Instance.RegularFonts[index];
        }

        for (int i = 0; i != info.levels.Length; ++i)
        {
            string sceneName = info.levels[i].sceneName.Split('-')[0];

            Arcade_ButtonSelect instance = prefab.Spawn <Arcade_ButtonSelect>();
            instance.Setup(font,
                           currentWorld, i, info.levels[i].sceneName, info.levels[i].sectionNames, info.levels[i].picture,
                           info.levels[i].hasTimeAttack, SaveManager.Instance.dataKlaus.GetTime(sceneName), info.levels[i].companyRecordSeconds,
                           CollectablesManager.GetCollectedPieces(sceneName), CollectablesManager.GetTotalPieces(sceneName)
                           );
            Add(instance, false);
        }

        AdjustContainer();
    }
Пример #2
0
    void OnGameLoaded()
    {
        if (!back)
        {
            // Set collectables info
            int currentPieces    = 0;
            int totalPieces      = 0;
            int currentSpeedruns = 0;
            int totalSpeedruns   = 0;

            for (int i = 0; i != info.levels.Length; ++i)
            {
                string sceneName = info.levels[i].sceneName.Split('-')[0];

                currentPieces += CollectablesManager.GetCollectedPieces(sceneName);
                totalPieces   += CollectablesManager.GetTotalPieces(sceneName);

                float currentScore = SaveManager.Instance.dataKlaus.GetTime(sceneName);
                currentSpeedruns += info.levels[i].hasTimeAttack && currentScore > 0 && currentScore < info.levels[i].companyRecordSeconds ? 1 : 0;
                totalSpeedruns   += info.levels[i].hasTimeAttack ? 1 : 0;
            }

            timeAttackValue   = currentSpeedruns + "/" + totalSpeedruns;
            collectablesValue = currentPieces + "/" + totalPieces;
        }
    }
Пример #3
0
    public void SelectLevel(int level)
    {
        audio.Play();
        back.enabled = false;
        menu.ChangeWithGlitch();

        // If this level doesn't have time attack, go to story mode directly
        if (!currentItems[currentLevel].timeAttackAvailable)
        {
            SumitSelectLevel(false);
        }
        // Else, show popup for the user to decide the mode
        else
        {
            currentLevel   = level;
            popup.sections = currentItems[currentLevel].sectionNames;

            string sceneName = currentItems[currentLevel].sceneName.Split('-')[0];

            popup.Setup(
                currentItems[currentLevel].companyRecord,
                SaveManager.Instance.dataKlaus.GetTime(sceneName),
                CollectablesManager.GetCollectedPieces(sceneName),
                CollectablesManager.GetTotalPieces(sceneName));
            popup.Show();
        }
    }
Пример #4
0
    void Start()
    {
        string sceneName = SceneManager.GetActiveScene().name.Split('-')[0];
        int    total     = CollectablesManager.GetTotalPieces(sceneName);

        if (total != 0)
        {
            text.text = CollectablesManager.GetCollectedPieces(sceneName) + "/" + total;
        }

        canvasGroup.alpha = total != 0 ? 1 : 0;

        int worldIndex = Mathf.Clamp((int)char.GetNumericValue(sceneName[1]) - 1, 0, sprites.Length - 1);

        for (int i = 0; i != sprites.Length; ++i)
        {
            sprites[i].SetActive(i == worldIndex);
        }
    }