private void SetCreatureItem(InfiniteItemBehavior itemBehaver, int dataIndex)
    {
        List <CreatureIcon> ItemElementList = itemBehaver.ItemElementList;
        int iCount = ItemElementList.Count;

        for (int i = 0; i < iCount; ++i)
        {
            int aIdx = ((dataIndex * iCount) + i);

            CreatureIcon ItemElement = ItemElementList[i];
            if (ItemElement == null)
            {
                continue;
            }

            if (_CreatureItemInfoList.Count > aIdx)
            {
                CreatureItemInfo ItemInfo = _CreatureItemInfoList[aIdx];
                if (ItemInfo == null)
                {
                    continue;
                }

                ItemElement.gameObject.SetActive(true);
                ItemElement.SetIcon(ItemInfo, enCreatureIcon_Type.Dispatch);

                ItemElement.SetActiveDispatchSelect(ItemInfo.IsDispatchSelect);
                ItemElement.SetDispatchSelectNumberLabel(ItemInfo.DispatchSelectNumber);
            }
            else
            {
                ItemElement.gameObject.SetActive(false);
            }
        }
    }
Example #2
0
    private void SetDispatchCreature(CreatureIcon CreatureListIcon)
    {
        int iDispatchTeamSlotCount = m_DispatchTeamSlotList.Count - 1;

        if (CreatureListIcon.IsDispatchSelect == false)                    // 크리쳐를 추가할때
        {
            bool bAddCreature = false;
            for (int i = 0; i < iDispatchTeamSlotCount; ++i)
            {
                DispatchTeamSlot slot = m_DispatchTeamSlotList[i];
                if (slot == null)
                {
                    continue;
                }

                if (slot.bSelect == true)
                {
                    if (slot.CreatureIcon != null)
                    {
                        DestroyDispatchTeamCreature(slot);
                    }

                    SetTeamCount(1);

                    CreatureIcon creatureIcon = UIResourceMgr.CreatePrefab <CreatureIcon>(BUNDLELIST.PREFABS_UI_COMMON, slot.SlotObj.transform, "CreatureIcon");
                    creatureIcon.SetIcon(CreatureListIcon.CreatureKey, enCreatureIcon_Type.DispatchDisplay);
                    creatureIcon.AddPanel(m_iPanelDepth);
                    creatureIcon.RemoveBoxCollider();

                    slot.CreatureIcon = creatureIcon;
                    slot.SetActiveSelect(false);

                    CreatureListIcon.SetDispatchSelectNumberLabel(slot.iNum.ToString());
                    CreatureListIcon.SetActiveDispatchSelect(true);

                    bAddCreature = true;
                    break;
                }
            }

            if (bAddCreature == true)
            {
                for (int i = 0; i < iDispatchTeamSlotCount; ++i)                // 다음 선택될 칸을 지정한다.
                {
                    DispatchTeamSlot slot = m_DispatchTeamSlotList[i];
                    if (slot == null)
                    {
                        continue;
                    }

                    if (slot.CreatureIcon == null)
                    {
                        slot.SetActiveSelect(true);
                        break;
                    }
                }
            }
        }
        else if (CreatureListIcon.IsDispatchSelect == true)                // 추가된 크리쳐를 뺄때
        {
            for (int i = 0; i < iDispatchTeamSlotCount; ++i)
            {
                DispatchTeamSlot slot = m_DispatchTeamSlotList[i];
                if (slot == null)
                {
                    continue;
                }

                slot.SetActiveSelect(false);

                if (slot.CreatureIcon != null)
                {
                    if (slot.CreatureIcon.CreatureKey == CreatureListIcon.CreatureKey)
                    {
                        CreatureListIcon.SetActiveDispatchSelect(false);
                        DestroyDispatchTeamCreature(slot);
                        slot.SetActiveSelect(true);
                    }
                }
            }
        }
    }