Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public int indexOfSerialize; // 현재 씬에서의 구분자

        public UnitSetData(DecType decType, BattleType battleType, int indexOfNode, int indexOfOwnedUnit, int indexOfSerialize)
        {
            this.decType          = decType;
            this.battleType       = battleType;
            this.indexOfNode      = indexOfNode;
            this.indexOfOwnedUnit = indexOfOwnedUnit;
            this.indexOfSerialize = indexOfSerialize;
        }
Ejemplo n.º 3
0
        public void SetDec()
        {
            ClearSlot();

            // dec Setting
            int      maxDec   = (int)DecMax.OwnedMax;
            DataArea db       = Management.MenuGameManager.Instance.DataArea;
            int      decIndex = db.LoginData.Free_DecSlotCount + db.LoginData.Event_DecSlotCount + db.LoginData.Pay_DecSlotCount;

            for (int i = 0; i < maxDec; ++i)
            {
                UI_DecSlotModule newDecSlot = Instantiate(slotPrefab, slotParent.transform).GetComponent <UI_DecSlotModule>();

                newDecSlot.indexOfSlot = i;

                decList.Add(newDecSlot);

                // 소유 가능한 덱보다 작으면 세팅
                if (i >= decIndex)
                {
                    continue;
                }

                Sprite image   = null;
                string decName = "덱을 세팅하세요";
                // slot Setting
                // 세팅된 덱의 데이터 가 있다면 세팅
                if (db.OwnedData.DecData.Count > i)
                {
                    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 = () => { ClickedButton(ownerContainer, openSubContainerModuleIndex, new OpenSubContainerData(openSubContainerModuleIndex, newDecSlot.indexOfSlot)); };
                }
            }
        }
Ejemplo n.º 4
0
 private void SearchDecByIndex(DataArea _db, DecType type, int _index, int _newIndex)
 {
     for (int i = 0; i < _db.OwnedData.DecData.Count; ++i)
     {
         for (int j = 0; j < _db.OwnedData.DecData[i].decList.Count; ++j)
         {
             if (_db.OwnedData.DecData[i].decList[j].type == type && _db.OwnedData.DecData[i].decList[j].ownedIndex == _index)
             {
                 _db.OwnedData.DecData[i].decList[j].ownedIndex = _newIndex;
             }
         }
     }
 }
Ejemplo n.º 5
0
        public void TypeChange()
        {
            if (curType == DecType.Minion)
            {
                curType = DecType.Skill;
            }
            else
            {
                curType = DecType.Minion;
            }

            SetTitle();

            SetSlot(ownerConatiner);
        }
Ejemplo n.º 6
0
 private void DeleteInDecByIndex(DataArea _db, DecType type, int _index)
 {
     for (int i = 0; i < _db.OwnedData.DecData.Count; ++i)
     {
         for (int j = 0; j < _db.OwnedData.DecData[i].decList.Count; ++j)
         {
             if (_db.OwnedData.DecData[i].decList[j].type == type && _db.OwnedData.DecData[i].decList[j].ownedIndex == _index)
             {
                 _db.OwnedData.DecData[i].decList.RemoveAt(j);
                 _db.OwnedData.DecData[i].decCount = _db.OwnedData.DecData[i].decList.Count;
                 if (_db.OwnedData.DecData[i].decCount <= 0)
                 {
                     _db.OwnedData.DecData.RemoveAt(i);
                     --i;
                     break;
                 }
                 --j;
             }
         }
     }
 }
Ejemplo n.º 7
0
        public override void SetModule(object _data = null)
        {
            Debug.LogError("버프 리스트 추가 요망");
            UnitSetData data = (UnitSetData)_data;

            unitCode   = data.indexOfSerialize;
            battleType = data.battleType;
            nodePos    = data.indexOfNode;

            ownedIndex = data.indexOfOwnedUnit;
            decType    = data.decType;

            DataArea db = Management.MenuGameManager.Instance.DataArea;

            if (data.decType == DecType.Minion)
            {
                unitName   = db.DefaultMinionData[db.OwnedData.MinionData[data.indexOfOwnedUnit].IndexOfMinion].MinionName;
                mainStatus = db.DefaultMinionData[db.OwnedData.MinionData[data.indexOfOwnedUnit].IndexOfMinion].BasicStatus + db.OwnedData.MinionData[data.indexOfOwnedUnit].AddStatus;
                curSprite  = Resources.Load <Sprite>(db.DefaultMinionData[db.OwnedData.MinionData[data.indexOfOwnedUnit].IndexOfMinion].MainImagePath);
            }
            else
            {
                unitName   = db.DefaultSkillData[db.OwnedData.SkillData[data.indexOfOwnedUnit].IndexOfType].SkillName;
                mainStatus = db.DefaultSkillData[db.OwnedData.SkillData[data.indexOfOwnedUnit].IndexOfType].BasicStatus + db.OwnedData.SkillData[data.indexOfOwnedUnit].AddStatus;
                curSprite  = Resources.Load <Sprite>(db.DefaultSkillData[db.OwnedData.SkillData[data.indexOfOwnedUnit].IndexOfType].MainImagePath);
            }

            bufStatus = new BasicStatus();

            curHP = mainStatus.Hp + bufStatus.Hp;
            curMP = mainStatus.Mp + bufStatus.Mp;

            moveRoot.Clear();

            bAlive       = true;
            bDetectEnemy = false;
            bEndTurn     = true;
        }
        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("게임시작할때 보낼 데이터를 세팅해줘!!!!!!!!!!!");
            }
        }
Ejemplo n.º 9
0
 public DecInfo(DecType type, int ownedIndex)
 {
     this.type       = type;
     this.ownedIndex = ownedIndex;
 }