Exemplo n.º 1
0
    public void Init()
    {
        SetCheckBoxSprite(RaidMode.GetComponent <Image>(), PF_GamePlay.UseRaidMode);

        for (var z = 0; z < levelItems.Count; z++)
        {
            Destroy(levelItems[z].gameObject);
        }
        levelItems.Clear();
        if (PF_GameData.Levels.Count == 0)
        {
            return;
        }

        foreach (var levelData in PF_GameData.Levels)
        {
            //TODO show locked levels
            if (levelData.Value.MinEntryLevel != null && levelData.Value.MinEntryLevel.Value > PF_PlayerData.activeCharacter.characterData.CharacterLevel)
            {
                continue; // Hide high level dungeons
            }
            if (PF_GameData.IsEventActive(levelData.Value.RestrictedToEventKey) != PromotionType.Active)
            {
                continue;
            }

            var slot = Instantiate(levelButtonPrefab);
            slot.SetParent(gridView, false);
            var li = slot.GetComponent <LevelItem>();
            li.levelData = levelData.Value;
            li.levelName = levelData.Key;
            li.levelIcon.overrideSprite = GameController.Instance.iconManager.GetIconById(levelData.Value.Icon, IconManager.IconTypes.Misc);
            levelItems.Add(li);
        }

        LevelItemClicked(levelItems[0].levelName);
    }