public override void OnShowing(object data)
    {
        base.OnShowing(data);

        levelItemObjectPool.ReturnAllObjectsToPool();

        CategoryInfo categoryInfo = GameManager.Instance.GetCategoryInfo((string)data);
        bool         completed    = true;

        for (int i = 0; i < categoryInfo.levelInfos.Count; i++)
        {
            LevelListItem.Type type = completed ? LevelListItem.Type.Completed : LevelListItem.Type.Locked;

            if (completed && !GameManager.Instance.IsLevelCompleted(categoryInfo, i))
            {
                completed = false;
                type      = LevelListItem.Type.Normal;
            }

            LevelListItem levelListItem = levelItemObjectPool.GetObject().GetComponent <LevelListItem>();

            levelListItem.Setup(categoryInfo, i, type);
            levelListItem.gameObject.SetActive(true);
        }
    }
Esempio n. 2
0
    //get the information of level
    public void StartLevel(string answer, string levelQuestion, int levelIndex, LevelListItem.Type type, Sprite sprite, string description, bool isTimeMode, bool isLockMode)
    {
        this.answer = answer;
        //questionField.transform.gameObject.GetComponent<TextMeshProUGUI>().text = levelQuestion;
        this.activeLevelIndex = levelIndex;
        this.type             = type;
        this.sprite           = sprite;
        this.description      = description;

        totalClick = 0;

        if (isTimeMode)
        {
            TimeMode();
        }

        if (isLockMode)
        {
            LockMode();
        }

        CreateAnswerField();
        currentLevelObject.transform.gameObject.GetComponent <TextMeshProUGUI>().text = "LEVEL " + levelIndex.ToString();
        imageField.gameObject.GetComponent <Image>().sprite = sprite;
        coinText.text = CoinNumber.ToString();
        BonusCoinsStart(isTimeMode, isLockMode);
    }