void ShowInfoHero(HeroStore _hero)
 {
     if (_hero.id == -1)
     {
         _core._infoPanel.SetActive(false);
         return;
     }
     _core.SetInfo(_hero.hero.name + " เลเวล " + _hero.level
                   + (_hero.hp < _hero.hpMax / 2 ? "<color=#ff0000><เลือด " : "<color=#01b140><เลือด ") + _hero.hp + " </color><color=#01b140>/" + _hero.hpMax + "></color>"
                   + "\n<โจมตี " + _hero.ATK + ">"
                   + "<โจมตีเวทย์ " + _hero.MATK + ">"
                   + "<เกาะ " + _hero.DEF + ">"
                   + "<เกาะเวทย์ " + _hero.MDEF + ">"
                   );
 }
Ejemplo n.º 2
0
        public GameObject LoadHeroIcon(HeroStore hero)
        {
            GameObject slot = Instantiate(_heroIconSlot);

            slot.transform.SetParent(transform.Find("GridView"));
            slot.transform.localScale = new Vector3(1, 1, 1);
            if (getSpriteSet != hero.hero.spriteSet)
            {
                getSpriteSet = hero.hero.spriteSet;
                loadSprite   = Resources.LoadAll <Sprite>("Sprites/Character/Hero/" + getSpriteSet);
            }
            slot.transform.Find("IconImage").GetComponent <Image>().sprite = loadSprite.Single(s => s.name == "Icon_" + hero.hero.spriteName);
            slot.transform.Find("Level").GetComponent <Text>().text        = "เลเวล" + hero.level;
            if (_core == null)
            {
                _core = Camera.main.GetComponent <MainCore>();
            }
            _core.SetSpriteType(slot.transform.Find("TypeImage").GetComponent <Image>(), hero.hero.type);
            return(slot);
        }
Ejemplo n.º 3
0
 public void ChangeHeroInTeam(int slot)
 {
     if (_heroSwapIsSelect == null || _heroSwapIsSelect.id == 0)
     {
         return;
     }
     //Debug.Log("swap 1 "+ _heroSwapIsSelect.id);
     if (_heroSwapIsSelect.id == -1)
     {
         //Debug.Log("swap 2");
         if (slot == 0 && _core._currentTeamIsSelect == 1)
         {
             //Debug.Log("swap 3");
             _core.CallSubMenu(_SubMenu.Alert, "ไม่สามารถปล่อยให้ตำแหน่งหัวหน้าทีมว่างได้!");
             return;
         }
         //Debug.Log("swap 4");
         _teamList[slot]   = _heroSwapIsSelect;
         _heroSwapIsSelect = null;
         LoadTeamIcon();
         RefeshViewHeroInStore();
     }
     else
     {
         //Debug.Log("swap 5");
         if (_teamList[slot].id == -1)
         {
             //Debug.Log("swap 6");
             bool have = false;
             for (int i = 0; i < _teamList.Count; i++)
             {
                 if (_heroSwapIsSelect.id == _teamList[i].id)
                 {
                     if (i == 0)
                     {
                         _core.CallSubMenu(_SubMenu.Alert, "ไม่สามารถปล่อยให้ตำแหน่งหัวหน้าทีมว่างได้!");
                         return;
                     }
                     HeroStore tmp = _teamList[i];
                     _teamList[i]      = _teamList[slot];
                     _teamList[slot]   = tmp;
                     _heroSwapIsSelect = null;
                     LoadTeamIcon();
                     RefeshViewHeroInStore();
                     have = true;
                     break;
                 }
             }
             if (!have)
             {
                 _teamList[slot]   = _heroSwapIsSelect;
                 _heroSwapIsSelect = null;
                 LoadTeamIcon();
                 RefeshViewHeroInStore();
             }
         }
         else
         {
             //Debug.Log("swap 7");
             if (_teamList[slot].id == _heroSwapIsSelect.id)
             {
             }
             else
             {
                 for (int i = 0; i < _teamList.Count; i++)
                 {
                     if (_teamList[i].id == _heroSwapIsSelect.id)
                     {
                         HeroStore tmp = _teamList[i];
                         _teamList[i]    = _teamList[slot];
                         _teamList[slot] = tmp;
                         break;
                     }
                 }
                 _teamList[slot]   = _heroSwapIsSelect;
                 _heroSwapIsSelect = null;
                 LoadTeamIcon();
                 RefeshViewHeroInStore();
             }
         }
     }
 }
Ejemplo n.º 4
0
        void ViewHeroInStore(bool sorting = false)
        {
            Transform trans = _core._teamPanel.transform.Find("TeamStoreMask").Find("GridView");

            if (trans.childCount != 0)
            {
                return;
            }

            if (sorting)
            {
                int count = 0;
                int pos   = 0;
                foreach (HeroStore hero in _teamList)
                {
                    if (hero.id == -1)
                    {
                        count++;
                        continue;
                    }
                    for (int i = 0; i < _heroList.Count; i++)
                    {
                        if (_teamList[count].id == _heroList[i].id)
                        {
                            HeroStore tmp = _heroList[i];
                            _heroList[i]   = _heroList[pos];
                            _heroList[pos] = tmp;
                            break;
                        }
                    }
                    pos++;
                    count++;
                }
            }

            Sprite[] loadSprite   = null;
            string   getSpriteSet = "";

            GameObject ShadowSlot = Instantiate(_shadowSlot);

            ShadowSlot.transform.SetParent(trans);
            ShadowSlot.transform.localScale = new Vector3(1, 1, 1);
            ShadowSlot shadow  = ShadowSlot.GetComponent <ShadowSlot>();
            HeroStore  newhero = new HeroStore();

            newhero.id   = -1;
            shadow._hero = newhero;

            for (int i = 0; i < _heroList.Count; i++)
            {
                GameObject slot = Instantiate(_heroSlot);
                slot.transform.SetParent(trans);
                slot.transform.localScale = new Vector3(1, 1, 1);
                HeroSlot hero = slot.GetComponent <HeroSlot>();
                hero._hero = _heroList[i];

                if (getSpriteSet != _heroList[i].hero.spriteSet)
                {
                    getSpriteSet = _heroList[i].hero.spriteSet;
                    loadSprite   = Resources.LoadAll <Sprite>("Sprites/Character/Hero/" + getSpriteSet);
                }

                slot.transform.Find("Image").GetComponent <Image>().sprite = loadSprite.Single(s => s.name == "Icon_" + _heroList[i].hero.spriteName);
                if (_sortingIsSelect == Sorting.HP)
                {
                    slot.transform.Find("Level").GetComponent <Text>().text = _heroList[i].hp.ToString();
                }
                else
                {
                    slot.transform.Find("Level").GetComponent <Text>().text = "เลเวล" + _heroList[i].level;
                }


                for (int j = 0; j < _teamList.Count; j++)
                {
                    if (_teamList[j].id == -1)
                    {
                        continue;
                    }
                    if (_heroList[i].id == _teamList[j].id)
                    {
                        slot.transform.Find("Select").gameObject.SetActive(true);
                        break;
                    }
                }

                _core.SetSpriteType(slot.transform.Find("Type").GetComponent <Image>(), _heroList[i].hero.type);
                _heroList[i].obj = slot;
                if (_core._cutscene != null)
                {
                    if (_heroList[i].heroId == 9)
                    {
                        _core._cutscene.GetComponent <Cutscene>().TutorialPlay(slot.transform);
                    }
                }
            }
        }