Example #1
0
    /// <summary> 방문 영웅 슬롯 생성 </summary>
    UIVisitedHeroSlot CreateVisitedHeroSlot(VisitedHeroData heroData)
    {
        UIVisitedHeroSlot slot = null;

        for (int i = 0; i < heroSlotPool.Count; i++)
        {
            if (heroSlotPool[i].gameObject.activeSelf == false && heroSlotPool[i].heroID == heroData.heroID)
            {
                slot = heroSlotPool[i];
                break;
            }
            else if (heroSlotPool[i].gameObject.activeSelf == false)
            {
                slot = heroSlotPool[i];
                break;
            }
        }

        if (slot == null)
        {
            GameObject go = Instantiate(visitedHeroSlotPrefab);
            go.transform.SetParent(content.transform, false);
            slot = go.GetComponent <UIVisitedHeroSlot>();
            slot.onClickEmploy += OnClickEmploy;
            heroSlotPool.Add(slot);
        }

        slot.initHeroGuildSlot(heroData);

        return(slot);
    }
Example #2
0
    /// <summary> 방문 영웅 리스트 초기화 </summary>
    void InitVisitedHeroList()
    {
        for (int i = 0; i < heroSlotPool.Count; i++)
        {
            heroSlotPool[i].gameObject.SetActive(false);
        }

        if (HeroGuildManager.Instance == null)
        {
            return;
        }

        for (int i = 0; i < HeroGuildManager.Instance.visitedHeroList.Count; i++)
        {
            // 방문 영웅 slot 생성 & 초기화
            UIVisitedHeroSlot slot = CreateVisitedHeroSlot(HeroGuildManager.Instance.visitedHeroList[i]);
            slot.gameObject.SetActive(true);
        }

        SizeControl(HeroGuildManager.Instance.visitedHeroList.Count);
    }