public override void SetUI(UI_Container _container)
        {
            ownerContainer = _container;
            closeButton.onClick.AddListener(() => { ClickedButton(_container, closeModuleIndex); });

            SetDec();
        }
        private void CloseButtonClick(UI_Container _container, int _moduleIndex)
        {
            StrengthReturnData data;

            if (curType == StrengthSubType.Target)
            {
                if (curSelectedCount <= 0)
                {
                    data = new StrengthReturnData(curViewType, curType, -1, -1);
                }
                else
                {
                    data = new StrengthReturnData(curViewType, curType, selectMatList[0], -1);
                }
            }
            else
            {
                if (curSelectedCount <= 0)
                {
                    data = new StrengthReturnData(curViewType, curType, null, -1);
                }
                else
                {
                    data = new StrengthReturnData(curViewType, curType, new List <int>(selectMatList), -1);
                }
            }
            ClickedButton(_container, _moduleIndex, data);
        }
Esempio n. 3
0
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data = null)
        {
            if (_curContainer.gameObject.activeSelf == false)
            {
                return;
            }
            //여기에 추가할것 넣기
            UI_StrengthenSubSettingModule module = (UI_StrengthenSubSettingModule)_curContainer.PrevContainer.SettingModule;
            StrengthReturnData            data   = (StrengthReturnData)_data;

            if (data.type == StrengthSubType.Target)
            {
                module.GetTargetIndex((int)data.data);
            }
            else if (data.type == StrengthSubType.Material)
            {
                if (data.data != null)
                {
                    module.GetMatList((List <int>)data.data);
                }
                else
                {
                    module.GetMatList(null);
                }
            }
            //
            if (_curContainer.PrevContainer == null)
            {
                return;
            }
            _curContainer.PrevContainer.OpenOtherContainer = false;
            _curContainer.PrevContainer.OpenContainer();
            _curContainer.PrevContainer = null;
            _curContainer.gameObject.SetActive(false);
        }
Esempio n. 4
0
 public void ClickedStrengthenButton(UI_Container _container)
 {
     if (selectTarget && selectMat)
     {
         ButtonClicked(_container, strengthenModuleIndex, new StrengthenData(ViewType.Minion, slot.IndexOfViewType, new List <int>(selectedMatOwnedIndex), addExp, addLv));
     }
 }
Esempio n. 5
0
        public override void SetUI(UI_Container _container)
        {
            addExp       = 0;
            addLv        = 0;
            selectTarget = false;
            selectMat    = false;

            if (selectMatButton.clickedFunc == null)
            {
                selectMatButton.clickedFunc = () => { ButtonClicked(_container, openSelectMatContainerModuleIndex, new StrengthReturnData(ViewType.Minion, StrengthSubType.Material, new List <int>(selectedMatOwnedIndex), slot.IndexOfViewType)); };
            }

            Strengthen();

            if (slot.clickFunc == null)
            {
                slot.clickFunc = () => { ButtonClicked(_container, openSelectMatContainerModuleIndex, new StrengthReturnData(ViewType.Minion, StrengthSubType.Target, new List <int>(selectedMatOwnedIndex), slot.IndexOfViewType)); }
            }
            ;

            //EventTrigger.Entry entry = new EventTrigger.Entry();
            //entry.eventID = EventTriggerType.PointerDown;
            //entry.callback.AddListener((eventData) => { ButtonClicked(_container, openSelectMatContainerModuleIndex, new StrengthReturnData(ViewType.Minion, StrengthSubType.Target, new List<int>(selectedMatOwnedIndex), slot.IndexOfViewType)); });
            //slot.EventTrigger.triggers.Add(entry);

            strenghtenButton.onClick.AddListener(() => { ClickedStrengthenButton(_container); });
        }
Esempio n. 6
0
        public override void SetUI(UI_Container _container)
        {
            ownerConatiner = _container;
            curType        = DecType.Minion;
            SetTitle();

            if (closeButton.triggers.Count <= 0)
            {
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => { ClickedButton(_container, closeModuleIndex); });
                closeButton.triggers.Add(entry);
            }
            if (typeChangeButton.triggers.Count <= 0)
            {
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => { TypeChange(); });
                typeChangeButton.triggers.Add(entry);
            }
            if (saveButton.triggers.Count <= 0)
            {
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerDown;
                entry.callback.AddListener((eventData) => { SaveData(); });
                saveButton.triggers.Add(entry);
            }



            SetSlot(_container);
        }
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data = null)
        {
            StrengthReturnData data = (StrengthReturnData)_data;
            UI_SelectStrengtMatSettingModule module = (UI_SelectStrengtMatSettingModule)_targetContainer.SettingModule;

            module.SetType(data.viewType, data.type, (List <int>)data.data, data.targetIndex);
            _targetContainer.OpenContainer(_curContainer);
        }
Esempio n. 8
0
 private void ButtonClicked(UI_Container _container, int _moduleIndex, object _data = null)
 {
     if (_moduleIndex == openSelectMatContainerModuleIndex && ((StrengthReturnData)_data).type == StrengthSubType.Material && selectTarget == false)
     {
         return;
     }
     _container.CallContents(_moduleIndex, _data);
 }
 public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data)
 {
     OnClickStart();
     if (_targetContainer)
     {
         _targetContainer.OpenContainer(_curContainer);
     }
     _curContainer.gameObject.SetActive(false);
 }
 public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data = null)
 {
     if (_curContainer.PrevContainer == null)
     {
         return;
     }
     ((UI_SettingModuleHaveSubContainerModule)_curContainer.PrevContainer.SettingModule).CloseSubContainer(_data);
     _curContainer.PrevContainer.OpenOtherContainer = false;
     _curContainer.PrevContainer = null;
     _curContainer.gameObject.SetActive(false);
 }
Esempio n. 11
0
        public void CloseButton(UI_Container _container)
        {
            DataArea db = Management.MenuGameManager.Instance.DataArea;

            try
            {
                int resultCurSelectSlot = curSelectSlot >= 0 ? db.OwnedData.ItemData[slotList[curSelectSlot].IndexOfViewType].IndexOfSerializeCode : -1;
                ClickedButton(_container, closeSubContainerModuleIndex, new int[] { curItemSlotIndex, resultCurSelectSlot });
            }
            catch (Exception ex)
            {
                Management.MenuGameManager.Instance.errorText.text = ex.Message;
            }
        }
Esempio n. 12
0
        public override void SetUI(UI_Container _container)
        {
            // background
            backgroundImage.sprite = backgroundSprite;

            // button
            exitButton.onClick.AddListener(() => { OnButtonClicked(_container, closeModuleIndex); });

            minionTypeButton.onClick.AddListener(() => { OnButtonClicked(_container, openSubContainer_type_Minion_ModuleIndex, new OpenSubContainerData(openSubContainer_type_Minion_ModuleIndex, null)); });
            itemTypeButton.onClick.AddListener(() => { OnButtonClicked(_container, openSubContainer_type_Item_ModuleIndex, new OpenSubContainerData(openSubContainer_type_Item_ModuleIndex, null)); });
            skillTypeButton.onClick.AddListener(() => { OnButtonClicked(_container, openSubContainer_type_Skill_ModuleIndex, new OpenSubContainerData(openSubContainer_type_Skill_ModuleIndex, null)); });

            // first subcontainer
            OnButtonClicked(_container, openSubContainer_type_Minion_ModuleIndex, new OpenSubContainerData(openSubContainer_type_Minion_ModuleIndex, null));
        }
Esempio n. 13
0
 public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data)
 {
     if (_curContainer.PrevContainer == null)
     {
         return;
     }
     _curContainer.PrevContainer.OpenOtherContainer = false;
     _curContainer.PrevContainer.OpenContainer();
     _curContainer.PrevContainer = null;
     _curContainer.gameObject.SetActive(false);
     if (deletgateFunc != null)
     {
         deletgateFunc.Invoke();
     }
 }
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data)
        {
            UI_SettingModuleHaveSubContainerModule module = ((UI_SettingModuleHaveSubContainerModule)_curContainer.SettingModule);

            if (_data != null)
            {
                if (module.curSubContainer == ((OpenSubContainerData)_data).SubContainerIndex)
                {
                    return;
                }
                ((UI_SubContainerSettingModule)_targetContainer.SettingModule).SetSubContianer(((OpenSubContainerData)_data).Data);
                module.OpenSubContainer((OpenSubContainerData)_data);
            }

            _targetContainer.OpenContainer(_curContainer);
        }
Esempio n. 15
0
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data)
        {
            if (_curContainer.OpenOtherContainer == true)
            {
                return;
            }
            _curContainer.OpenOtherContainer = true;
            _targetContainer.OpenContainer(_curContainer);
            _curContainer.gameObject.SetActive(false);
            var prevC = _curContainer.PrevContainer;

            while (prevC != null)
            {
                prevC.transform.gameObject.SetActive(false);
                prevC = prevC.PrevContainer;
            }
        }
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data = null)
        {
            UI_Slot_Data data = (UI_Slot_Data)_data;
            UI_ShowUnitViewSettingModule module = ((UI_ShowUnitViewSettingModule)_curContainer.SettingModule);

            if (data.type == ViewType.Minion)
            {
                module.SetMinionInfo(data.index);
            }
            else if (data.type == ViewType.Item)
            {
                module.SetItemInfo(data.index);
            }
            else
            {
                module.SetSkillInfo(data.index);
            }
        }
        public override void SetUI(UI_Container _container)
        {
            if (storyModeButton.clickedFunc == null)
            {
                storyModeButton.clickedFunc = () => { ChangeMode(BattleSelectMode.StoryMode); ClickedButton(_container, indexOfOpenStoryMode); };
            }

            if (multiModeButton.clickedFunc == null)
            {
                multiModeButton.clickedFunc = () => { ChangeMode(BattleSelectMode.MultiMode); ClickedButton(_container, indexOfOpenMultiMode); };
            }

            if (closeButton.clickedFunc == null)
            {
                closeButton.clickedFunc = () => { ClickedButton(_container, indexOfCloseModule); };
            }

            storyModeButton.clickedFunc.Invoke();
        }
        public override void SetUI(UI_Container _container)
        {
            ClearSlot();

            ownerContainer = _container;

            DataArea db           = Management.MenuGameManager.Instance.DataArea;
            int      clearChapter = db.LoginData.ClearChapter;

            // main backgroundImage set
            mainBackgroundImage.sprite = mainBackgroundSprite;

            // chapter slot background set
            chapterSlotBackgroundImage.sprite = chapterSlotBackgroundSprite;
            // chapter slot set
            for (int i = 0; i < db.DefaultChapterData.Length; ++i)
            {
                UI_SelectChapterSlotModule slot = Instantiate(chapterSlotPrefab, chapterSlotParent.transform).GetComponent <UI_SelectChapterSlotModule>();
                slot.SetSlot(i, clearChapter >= i? true : false);
                slot.clickFunc = () => { ClickedChapterSlot(slot.indexOfSlot); };
                chapterSlotList.Add(slot);
            }

            int chapterSize_X = db.DefaultChapterData.Length * 420 + 40;

            if (chapterSize_X < chapterRectT_X_DefaultSize)
            {
                chapterSize_X = chapterRectT_X_DefaultSize;
            }
            Vector2 size = chapterContainViewerRectT.anchoredPosition + Vector2.right * chapterSize_X;

            chapterContainViewerRectT.anchoredPosition = size;


            // stage slot background set
            stageSlotBackgroundImage.sprite = stageSlotBackgroundSprite;
            // stage slot set
            SetStage(clearChapter);
        }
        public override void SetUI(UI_Container _container)
        {
            string basicPath = string.Empty;

#if UNITY_STANDALONE_WIN || UNITY_EDITOR
            basicPath = Application.streamingAssetsPath;
#else
            basicPath = "jar:file://" + Application.dataPath + "!/assets";
#endif
            if (ts)
            {
                ts.text = basicPath + DataPath.defaultPath;
            }
            background.sprite = backgroundImage;

            if (loginButton.triggers.Count <= 0)
            {
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerUp;
                entry.callback.AddListener((eventData) => { _container.CallContents(0); });
                loginButton.triggers.Add(entry);
            }
        }
 private void ClickedButton(UI_Container _container, int _moduleIndex, object _data = null)
 {
     _container.CallContents(_moduleIndex, _data);
 }
Esempio n. 21
0
 public abstract void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data = null);
        public override void SetUI(UI_Container _container)
        {
            ClearSlot();

            DataArea db = Management.MenuGameManager.Instance.DataArea;

            // set background image
            backgroundImage.sprite = backgroundSprite;

            // set scroll background image
            scrollBackgroundImage.sprite = scrollBackgroundSprite;

            // set dec slot
            int curDecIndex = 0;
            int decIndex    = db.LoginData.Free_DecSlotCount + db.LoginData.Event_DecSlotCount + db.LoginData.Pay_DecSlotCount;

            for (int i = 0; i < decIndex; ++i)
            {
                if (db.OwnedData.DecData.Count <= i)
                {
                    break;
                }
                UI_DecSlotModule newDecSlot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_DecSlotModule>();

                newDecSlot.indexOfSlot = i;

                decList.Add(newDecSlot);

                Sprite image   = null;
                string decName = "덱을 세팅하세요";
                // slot Setting
                // 세팅된 덱의 데이터 가 있다면 세팅
                newDecSlot.indexOfType = i;
                int     unitIndex = db.OwnedData.DecData[i].decList[0].ownedIndex;
                DecType type      = db.OwnedData.DecData[i].decList[0].type;
                string  path      = "";
                if (type == DecType.Minion)
                {
                    path = db.DefaultMinionData[db.OwnedData.MinionData[unitIndex].IndexOfMinion].MainImagePath;
                }
                else
                {
                    path = db.DefaultSkillData[db.OwnedData.SkillData[unitIndex].IndexOfType].MainImagePath;
                }
                image   = Resources.Load <Sprite>(path);
                decName = db.OwnedData.DecData[i].decName;
                newDecSlot.decCountText.text = db.OwnedData.DecData[i].decCount + "/" + (int)DecMax.UnitMax;

                newDecSlot.decNameText.text = decName;
                newDecSlot.slotImage.sprite = image;

                // trigger set
                if (newDecSlot.clickFunc == null)
                {
                    newDecSlot.clickFunc = () => { SelectDecSlot(newDecSlot.indexOfSlot); };
                }
            }

            // set buttons function
            if (closeButton.clickedFunc == null)
            {
                closeButton.clickedFunc = () => { ClickedButton(_container, indexOfCloseModule); }
            }
            ;
            if (startBattleButton.clickedFunc == null)
            {
                startBattleButton.clickedFunc = () => { ClickedButton(_container, indexOfStartBattleButton); };
                Debug.LogError("게임시작할때 보낼 데이터를 세팅해줘!!!!!!!!!!!");
            }
        }
 public void ClickedButton(UI_Container _contianer, int _moduleIndex, object _data = null)
 {
     Debug.LogError("Click Button!");
     _contianer.CallContents(_moduleIndex, _data);
 }
Esempio n. 24
0
 public abstract void SetUI(UI_Container _container);
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data = null)
        {
            StrengthenData data = (StrengthenData)_data;

            ((UI_StrengthenSubSettingModule)_curContainer.SettingModule).Strengthen();

            DataArea db = Management.MenuGameManager.Instance.DataArea;

            switch (data.type)
            {
            case ViewType.Minion:
                SettingMinionData target = db.OwnedData.MinionData[data.ownedTargetIndex];
                target.Lv     += data.addLv;
                target.CurExp += data.addExp;
                BasicStatus addStatus = target.AddStatus + db.DefaultMinionData[db.OwnedData.MinionData[data.ownedTargetIndex].IndexOfMinion].AddStatusByLv * (data.addLv);
                target.AddStatus = addStatus;
                target.NeedExp   = db.DefaultExpManager.UnitExpChart.NeedExp[target.Lv];

                List <SettingMinionData> newList = new List <SettingMinionData>(db.OwnedData.MinionData);
                int listCount = 0;
                for (int i = 0; i < db.OwnedData.MinionData.Count; ++i)
                {
                    if (data.ownedMaterialIndex.Contains(i))
                    {
                        for (int j = 0; j < db.OwnedData.MinionData[i].IndexOfSerializeCodeOwnedItem.Length; ++j)
                        {
                            var ownedItem = db.OwnedData.ItemData.Find(x => x.IndexOfSerializeCode == db.OwnedData.MinionData[i].IndexOfSerializeCodeOwnedItem[j]);
                            if (ownedItem != null)
                            {
                                ownedItem.UseItem = false;
                                ownedItem.OwnerMinionIndexOfSerializeCode = -1;
                            }
                        }
                        // dec에서 삭제
                        DeleteInDecByIndex(db, DecType.Minion, i);
                        // 리스트에서 삭제
                        newList.RemoveAt(listCount);
                    }
                    else
                    {
                        // dec에서 현재 타입이 같고 index가 i와 같은 녀석을 찾아서, listCount로 고쳐준다
                        SearchDecByIndex(db, DecType.Minion, i, listCount);

                        ++listCount;
                    }
                }
                db.OwnedData.MinionData = newList;

                for (int i = 0; i < db.OwnedData.MinionData.Count; ++i)
                {
                    for (int j = 0; j < db.OwnedData.MinionData[i].IndexOfSerializeCodeOwnedItem.Length; ++j)
                    {
                        var curItem = db.OwnedData.ItemData.Find(x => x.IndexOfSerializeCode == db.OwnedData.MinionData[i].IndexOfSerializeCodeOwnedItem[j]);
                        if (curItem != null)
                        {
                            curItem.OwnerMinionIndexOfSerializeCode = db.OwnedData.MinionData[i].IndexOfSerializeCode;
                        }
                    }
                }

                break;

            case ViewType.Item:
                SettingItemData targetItem = db.OwnedData.ItemData[data.ownedTargetIndex];
                targetItem.Lv     += data.addLv;
                targetItem.CurExp += data.addExp;
                BasicStatus addStatusItem = targetItem.AddStatus + db.DefaultItemData[db.OwnedData.ItemData[data.ownedTargetIndex].IndexOfType].AddStatusByLv * (data.addLv);

                // 소유 미니언의 추가스텟 보정
                if (targetItem.OwnerMinionIndexOfSerializeCode >= 0)
                {
                    var owner = db.OwnedData.MinionData.Find(x => x.IndexOfSerializeCode == targetItem.OwnerMinionIndexOfSerializeCode);
                    if (owner != null)
                    {
                        owner.AddStatus     -= targetItem.AddStatus;
                        targetItem.AddStatus = addStatusItem;
                        owner.AddStatus     += targetItem.AddStatus;
                    }
                }
                targetItem.NeedExp = db.DefaultExpManager.UnitExpChart.NeedExp[targetItem.Lv];

                List <SettingItemData> newListItem = new List <SettingItemData>(db.OwnedData.ItemData);
                for (int i = 0; i < data.ownedMaterialIndex.Count; ++i)
                {
                    newListItem.Remove(db.OwnedData.ItemData[data.ownedMaterialIndex[i]]);
                }
                db.OwnedData.ItemData = newListItem;

                break;

            case ViewType.Skill:
                SettingSkillData targetSkill = db.OwnedData.SkillData[data.ownedTargetIndex];
                targetSkill.Lv     += data.addLv;
                targetSkill.CurExp += data.addExp;
                BasicStatus addStatusSkill = targetSkill.AddStatus + db.DefaultSkillData[db.OwnedData.SkillData[data.ownedTargetIndex].IndexOfType].AddStatusByLv * (data.addLv);

                targetSkill.NeedExp = db.DefaultExpManager.UnitExpChart.NeedExp[targetSkill.Lv];

                List <SettingSkillData> newListSkill = new List <SettingSkillData>(db.OwnedData.SkillData);
                //for (int i = 0; i < data.ownedMaterialIndex.Count; ++i)
                //{
                //    DeleteInDecByIndex(db,DecType.Skill, data.ownedMaterialIndex[i]);
                //    newListSkill.Remove(db.OwnedData.SkillData[data.ownedMaterialIndex[i]]);
                //}
                int listCountSkill = 0;
                for (int i = 0; i < db.OwnedData.SkillData.Count; ++i)
                {
                    if (data.ownedMaterialIndex.Contains(i))
                    {
                        // dec에서 삭제
                        DeleteInDecByIndex(db, DecType.Skill, i);
                        // 리스트에서 삭제
                        newListSkill.Remove(db.OwnedData.SkillData[i]);
                    }
                    else
                    {
                        // dec에서 현재 타입이 같고 index가 i와 같은 녀석을 찾아서, listCount로 고쳐준다
                        SearchDecByIndex(db, DecType.Skill, i, listCountSkill);

                        ++listCountSkill;
                    }
                }
                db.OwnedData.SkillData = newListSkill;
                break;
            }

            //Management.MenuGameManager.Instance.SaveData();
        }
Esempio n. 26
0
        public override void SetUI(UI_Container _container)
        {
            curSelectSlot = -1;

            DataArea db             = Management.MenuGameManager.Instance.DataArea;
            int      ownedItemCount = db.OwnedData.ItemData.Count;
            int      curSlotIndex   = 0;

            for (int i = 0; i < ownedItemCount; ++i)
            {
                if (db.OwnedData.ItemData[i].UseItem && db.OwnedData.ItemData[i].OwnerMinionIndexOfSerializeCode != db.OwnedData.MinionData[curOwnerMinionIndex].IndexOfSerializeCode)
                {
                    continue;
                }


                var slot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_SlotModule>();

                slot.IndexOfSlot      = curSlotIndex;
                slot.IndexOfViewType  = i;
                slot.nameText.text    = db.DefaultItemData[db.OwnedData.ItemData[i].IndexOfType].ItemName;
                slot.lvText.text      = db.OwnedData.ItemData[i].Lv.ToString();
                slot.SlotImage.sprite = Resources.Load <Sprite>(db.DefaultItemData[db.OwnedData.ItemData[i].IndexOfType].IconPath);


                if (slot.clickFunc == null)
                {
                    slot.clickFunc = () => { SelectSlot(slot.IndexOfSlot); }
                }
                ;

                //EventTrigger.Entry entry = new EventTrigger.Entry();
                //entry.eventID = EventTriggerType.PointerDown;
                //entry.callback.AddListener((eventData)=> { SelectSlot(slot.IndexOfSlot); });
                //slot.EventTrigger.triggers.Add(entry);

                slotList.Add(slot);
                if (db.OwnedData.ItemData[i].UseItem && db.OwnedData.ItemData[i].OwnerMinionIndexOfSerializeCode == db.OwnedData.MinionData[curOwnerMinionIndex].IndexOfSerializeCode)
                {
                    SelectSlot(curSlotIndex);
                }
                ++curSlotIndex;
            }

            if (closeButton.clickedFunc == null)
            {
                closeButton.clickedFunc = () => { CloseButton(_container); }
            }
            ;
        }

        void ClearList()
        {
            while (slotList.Count > 0)
            {
                UI_SlotModule slot = slotList[0];
                DestroyImmediate(slot.gameObject);
                slotList.RemoveAt(0);
            }
            slotList.Clear();
        }
Esempio n. 27
0
 public override void SetUI(UI_Container _container)
 {
 }
        public override void SetUI(UI_Container _container)
        {
            curSelectedCount = selectMatList.Count;
            DataArea db        = Management.MenuGameManager.Instance.DataArea;
            int      slotIndex = 0;
            int      count     = 0;

            switch (curViewType)
            {
            case ViewType.Minion:
                count = db.OwnedData.MinionData.Count;
                break;

            case ViewType.Item:
                count = db.OwnedData.ItemData.Count;
                break;

            case ViewType.Skill:
                count = db.OwnedData.SkillData.Count;
                break;
            }
            for (int i = 0; i < count; ++i)
            {
                if (curType == StrengthSubType.Material && i == targetIndex)
                {
                    continue;
                }

                if (curType == StrengthSubType.Target && prevSelectMatList.Contains(i))
                {
                    continue;
                }
                UI_SlotModule newSlot = null;
                switch (curViewType)
                {
                case ViewType.Minion:
                    newSlot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_SlotModule>();
                    newSlot.nameText.text    = db.DefaultMinionData[db.OwnedData.MinionData[i].IndexOfMinion].MinionName;
                    newSlot.lvText.text      = db.OwnedData.MinionData[i].Lv.ToString();
                    newSlot.SlotImage.sprite = Resources.Load <Sprite>(db.DefaultMinionData[db.OwnedData.MinionData[i].IndexOfMinion].MainImagePath);

                    break;

                case ViewType.Item:
                    if (curType == StrengthSubType.Material && db.OwnedData.ItemData[i].UseItem)
                    {
                        continue;
                    }
                    newSlot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_SlotModule>();
                    newSlot.nameText.text    = db.DefaultItemData[db.OwnedData.ItemData[i].IndexOfType].ItemName;
                    newSlot.lvText.text      = db.OwnedData.ItemData[i].Lv.ToString();
                    newSlot.SlotImage.sprite = Resources.Load <Sprite>(db.DefaultItemData[db.OwnedData.ItemData[i].IndexOfType].IconPath);

                    break;

                case ViewType.Skill:
                    newSlot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_SlotModule>();
                    newSlot.nameText.text    = db.DefaultSkillData[db.OwnedData.SkillData[i].IndexOfType].SkillName;
                    newSlot.lvText.text      = db.OwnedData.SkillData[i].Lv.ToString();
                    newSlot.SlotImage.sprite = Resources.Load <Sprite>(db.DefaultSkillData[db.OwnedData.SkillData[i].IndexOfType].MainImagePath);

                    break;
                }
                newSlot.IndexOfSlot     = slotIndex++;
                newSlot.IndexOfViewType = i;
                //EventTrigger.Entry entry = new EventTrigger.Entry();
                //entry.eventID = EventTriggerType.PointerDown;
                //entry.callback.AddListener((eventData)=> { SelectMat(newSlot.IndexOfSlot, newSlot.IndexOfViewType); });
                //newSlot.EventTrigger.triggers.Add(entry);
                if (newSlot.clickFunc == null)
                {
                    newSlot.clickFunc = () => { SelectMat(newSlot.IndexOfSlot, newSlot.IndexOfViewType); }
                }
                ;


                if (curType == StrengthSubType.Target && targetIndex == i)
                {
                    newSlot.selectedImage.SetActive(true);
                    ++curSelectedCount;
                    selectMatList.Add(i);
                }
                if (prevSelectMatList != null && prevSelectMatList.Contains(newSlot.IndexOfViewType))
                {
                    newSlot.selectedImage.SetActive(true);
                }

                slotList.Add(newSlot);
            }

            if (closeButton.triggers.Count <= 0)
            {
                EventTrigger.Entry entry = new EventTrigger.Entry();
                entry.eventID = EventTriggerType.PointerUp;
                entry.callback.AddListener((eventData) => { CloseButtonClick(_container, closeModuleIndex); });

                closeButton.triggers.Add(entry);
            }
        }
        public override void ToAction(UI_Container _curContainer, UI_Container _targetContainer, object _data)
        {
            ViewType viewType = (ViewType)_data;

            ((UI_ShowUnitViewSettingModule)_curContainer.SettingModule).SetSlots(_curContainer, viewType);
        }
Esempio n. 30
0
        private void SetSlot(UI_Container _container)
        {
            ClearSlot();

            DataArea db = Management.MenuGameManager.Instance.DataArea;

            // 덱이없다면 생성한다.(저장은 하지않는다.)
            if (db.OwnedData.DecData.Count <= curOwnedDecIndex)
            {
                decData = new SettingDecData(0, "새로운 덱 " + curOwnedDecIndex, new List <DecInfo>());
            }
            else
            {
                decData = new SettingDecData(db.OwnedData.DecData[curOwnedDecIndex]);
            }

            // 현재 뷰 타입에 맞게 슬롯을 생성
            int countMax = 0;

            if (curType == DecType.Minion)
            {
                countMax = db.OwnedData.MinionData.Count;
            }
            else
            {
                countMax = db.OwnedData.SkillData.Count;
            }

            for (int i = 0; i < countMax; ++i)
            {
                UI_SlotModule newSlot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_SlotModule>();

                int    curDefaultIndex = -1;
                string imagePath       = string.Empty;
                string name            = string.Empty;
                string lv = string.Empty;
                if (curType == DecType.Minion)
                {
                    curDefaultIndex = db.OwnedData.MinionData[i].IndexOfMinion;
                    imagePath       = db.DefaultMinionData[curDefaultIndex].MainImagePath;
                    name            = db.DefaultMinionData[curDefaultIndex].MinionName;
                    lv = db.OwnedData.MinionData[i].Lv.ToString();
                }
                else
                {
                    curDefaultIndex = db.OwnedData.SkillData[i].IndexOfType;
                    imagePath       = db.DefaultSkillData[curDefaultIndex].MainImagePath;
                    name            = db.DefaultSkillData[curDefaultIndex].SkillName;
                    lv = db.OwnedData.SkillData[i].Lv.ToString();
                }

                newSlot.IndexOfViewType  = i;
                newSlot.IndexOfSlot      = i;
                newSlot.SlotImage.sprite = Resources.Load <Sprite>(imagePath);
                newSlot.nameText.text    = name;
                newSlot.lvText.text      = lv;

                if (SearchSame(i) != null)
                {
                    newSlot.selectedImage.SetActive(true);
                }


                if (newSlot.clickFunc == null)
                {
                    newSlot.clickFunc = () => { SelectSlot(newSlot.IndexOfViewType); }
                }
                ;

                //EventTrigger.Entry entry = new EventTrigger.Entry();
                //entry.eventID = EventTriggerType.PointerDown;
                //entry.callback.AddListener((eventData)=> { SelectSlot(newSlot.IndexOfViewType); });
                //newSlot.EventTrigger.triggers.Add(entry);

                slotList.Add(newSlot);
            }
        }