Esempio n. 1
0
    public void Start()
    {
        var deckDataDic = DeckManager.Instance.DeckDic;

        var deckKeyList = deckDataDic.Keys.ToList();

        deckKeyList.Sort();

        foreach (var key in deckKeyList)
        {
            if (!deckDataDic[key].IsCompleteDeck())
            {
                continue;
            }

            var newDeckSlot = Instantiate(deckSlotPrefab, uiGrid.transform);
            newDeckSlot.Init(key, deckDataDic[key], ClickDeckSlot);
            newDeckSlot.gameObject.SetActive(true);

            deckSlotDic.Add(key, newDeckSlot);
        }

        int index = DeckManager.Instance.CurDeckIndex;

        if (deckSlotDic.ContainsKey(index))
        {
            curSelectedMainSlot = deckSlotDic[index];
            curSelectedMainSlot.ClickSlot();
        }

        centerOnChild.onCenter += MoveToCurrentDeckPos;
    }
Esempio n. 2
0
    public void ActiveMainUI()
    {
        //덱 세팅
        var deckDataDic = DeckManager.Instance.DeckDic;

        for (int i = 0; i < mainSlotUIArray.Length; i++)
        {
            DeckData deckData = null;
            if (deckDataDic.ContainsKey(i))
            {
                deckData = deckDataDic[i];
            }

            //데이터가 없다면 비어있는 덱
            mainSlotUIArray[i].Init(i, deckData, ClickDeckSlot);
        }

        //사용중인 덱 선택
        if (curSelectedMainSlot == null)
        {
            int index = DeckManager.Instance.CurDeckIndex;
            curSelectedMainSlot = mainSlotUIArray.ElementAtOrDefault(index);
        }
        curSelectedMainSlot?.ClickSlot();

        //각 UI 루트 활성화/비활성화
        mainRoot.SetActive(true);
        deckEditRoot.SetActive(false);
        SlotEditRoot.SetActive(false);

        deckEditNameInput.value = string.Empty;
    }