Пример #1
0
    public void RemoveSlot(string key)
    {
        UIHeroSlotContainer container = heroSlotContainerList.Find(x => x.heroInvenID == key);
        UIHeroSlot          slot      = container.GetComponentInChildren <UIHeroSlot>();

        container.isDestroy = true;

        if (slot != null)
        {
            slot.transform.SetParent(heroSlotStackArea.transform);
        }

        heroSlotContainerList.RemoveAt(heroSlotContainerList.FindIndex(x => x.heroInvenID == key));
        Destroy(container.gameObject);

        SizeControl();
    }
Пример #2
0
    /// <summary> 한계돌파할 같은 영웅 불러오기 </summary>
    public void ShowSameHeroList(string heroID, string id)
    {
        UIHeroInventory.Instance.isLimitBreak = true;

        if (before != null)
        {
            Destroy(before);
        }

        //대상 슬롯 생성 초기화
        GameObject go = Instantiate(heroSlotPrefab, limitBreakPanel.transform);

        before = go;
        go.GetComponent <UIHeroSlot>().SlotDataInit(limitBreakHero.id, HeroSlotState.Default);
        go.GetComponent <UIHeroSlot>().InitImage();

        textLimitBreak.text = "한계돌파 " + limitBreakHero.limitBreak + "단계 → " + limitBreakHero.limitBreak + "단계";


        //훈련포인트 표현 초기화
        int count = 0;

        for (int i = 0; i < limitBreakHero.trainingDataList.Count; i++)
        {
            count += limitBreakHero.trainingDataList[i].training;
        }

        beforePoint = limitBreakHero.limitBreak + 1 - count;

        textBeforeTrainingPoint.text  = beforePoint.ToString();
        textBeforeTrainingPoint.color = noneColor;
        textAfterTrainingPoint.text   = beforePoint.ToString();
        textAfterTrainingPoint.color  = noneColor;

        //무한의 정수 관련 UI 초기화
        textUnlimitedJewelCount.text = MoneyManager.GetMoney(MoneyType.limitBreakTicket).value.ToString();
        unlimitedJeweluse            = 0;
        textUnlimitedJewelUse.text   = unlimitedJeweluse.ToString();


        List <HeroData> list = HeroManager.heroDataList.FindAll(x => x.heroID == heroID);

        int heroNum = 0;

        //같은 영웅만 컨테이너 생성 or 풀링
        for (int i = 0; i < list.Count; i++)
        {
            UIHeroSlotContainer heroContainer = null;

            //자기 자신은 제외
            if (list[i].id == id)
            {
                continue;
            }

            HeroData b = HeroManager.heroDataDic[list[i].id];

            //내정영웅이면
            if (b.heroType == HeroData.HeroType.NonBattle)
            {
                if (!string.IsNullOrEmpty(list[i].placeID))
                {
                    //클릭은 안되지만 생성하여 표시
                    heroContainer       = GetHeroContainerFromPool(list[i]);
                    heroContainer.state = HeroSlotState.Default;
                    heroContainer.GetComponentInChildren <UIHeroSlot>().UpdateSlotContents();
                    containerList.Add(heroContainer);

                    heroNum += 1;
                    continue;
                }
            }
            else//전투영웅이면
            {
                //전투중인지 확인
                if (!string.IsNullOrEmpty(b.battleGroupID))
                {
                    //전투중이면 클릭은 안되지만 생성하여 전투표시
                    heroContainer       = GetHeroContainerFromPool(list[i]);
                    heroContainer.state = HeroSlotState.Default;
                    heroContainer.GetComponentInChildren <UIHeroSlot>().UpdateSlotContents();
                    containerList.Add(heroContainer);

                    heroNum += 1;
                    continue;
                }
            }
            //위 조건에 해당하지 않으면 한계돌파용 슬롯으로 생성
            heroContainer       = GetHeroContainerFromPool(list[i]);
            heroContainer.state = HeroSlotState.LimitBreak;
            containerList.Add(heroContainer);
            heroNum += 1;
        }

        if (heroNum > 0)
        {
            notHeroLimitBreakText.gameObject.SetActive(false);
        }
        else
        {
            notHeroLimitBreakText.gameObject.SetActive(true);
        }

        SortHeroList(HeroSortingType.Name);

        limitBreakCanvas.SetActive(true);

        //표현 패널 켜기
        limitBreakPanel.SetActive(true);

        //한계돌파 버튼 키고 인터렉티브 끄기
        buttonLimitBreak.gameObject.SetActive(true);
        buttonLimitBreak.interactable = false;

        if (limitBreakHero.heroType == HeroData.HeroType.Battle)
        {
            scrollBattleHero.gameObject.SetActive(true);
            scrollterritoryHero.gameObject.SetActive(false);
        }
        else
        {
            scrollBattleHero.gameObject.SetActive(false);
            scrollterritoryHero.gameObject.SetActive(true);
        }


        SizeControl(heroNum);
    }