Ejemplo n.º 1
0
    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);
        }
    }
Ejemplo n.º 2
0
    public void SetupLevel()
    {
        ////Get information of current category
        CategoryInfo categoryInfo = GuessManager.Instance.GetCategoryInfo(activeCategoryName);

        levelItemObjectPool.ReturnAllObjectsToPool();

        for (int i = 0; i < categoryInfo.levelInfos.Count; i++)
        {
            LevelListItem.Type type;
            if (i < numbersOfActiveLevel)
            {
                type = LevelListItem.Type.Completed;
            }
            else if (i == numbersOfActiveLevel)
            {
                type = LevelListItem.Type.Normal;
            }
            else
            {
                type = LevelListItem.Type.Locked;
            }
            LevelListItem levelListItem = levelListContainer.GetChild(i).transform.gameObject.GetComponent <LevelListItem>();

            levelListItem.Setup(categoryInfo, i + 1, type, categoryInfo.levelInfos[i].answer, categoryInfo.levelInfos[i].question, categoryInfo.levelInfos[i].sprite, categoryInfo.levelInfos[i].description);
            levelListItem.gameObject.SetActive(true);
        }

        for (int j = 0; j < categoryInfo.levelInfos.Count; j++)
        {
            LevelListItem levelListItem = levelListContainer.GetChild(j).transform.gameObject.GetComponent <LevelListItem>();
            levelListItem.SetupMode(timeMode.Contains(j + 1), lockMode.Contains(j + 1));
        }
    }