예제 #1
0
    public void Set(string id, string name, string nickname, string category, string kingdom, HeroPanel.Hero_Class hero_class,
                    string gender, string tier, string rarity, string portrait, string playable, string hide_card, string disabled, HeroPanel.Hero_Element element)
    {
        _id   = id;
        _name = name;

        _nickname   = nickname;
        _category   = category;
        _kingdom    = kingdom;
        _hero_class = hero_class;
        _gender     = gender;
        _tier       = tier;
        _rarity     = rarity;
        _portrait   = portrait;

        if (playable.Length != 0)
        {
            _playable = int.Parse(playable);
        }
        if (hide_card.Length != 0)
        {
            _hide_card = int.Parse(hide_card);
        }
        if (disabled.Length != 0)
        {
            _disabled = int.Parse(disabled);
        }

        _element = element;
    }
예제 #2
0
 static public string GetSpriteNameByEnum(HeroPanel.Hero_Class hero_class, bool isWhite = false)
 {
     if (isWhite)
     {
         return(string.Format("class_icon_{0}_white", hero_class.ToString()));
     }
     else
     {
         return(string.Format("class_icon_{0}", hero_class.ToString()));
     }
 }
예제 #3
0
    public void LoadHeroTypeDatas()
    {
        CsvReader reader = LoadCSVtoPath("UI/HeroType");

        if (reader == null)
        {
            return;
        }

        string[] headers         = reader.GetFieldHeaders();
        int      index_id        = System.Array.IndexOf(headers, "id");
        int      index_name      = System.Array.IndexOf(headers, "name");
        int      index_nickname  = System.Array.IndexOf(headers, "nickname");
        int      index_category  = System.Array.IndexOf(headers, "category");
        int      index_kingdom   = System.Array.IndexOf(headers, "kingdom");
        int      index_class     = System.Array.IndexOf(headers, "class");
        int      index_gender    = System.Array.IndexOf(headers, "gender");
        int      index_tier      = System.Array.IndexOf(headers, "tier");
        int      index_rarity    = System.Array.IndexOf(headers, "rarity");
        int      index_portrait  = System.Array.IndexOf(headers, "portrait");
        int      index_playable  = System.Array.IndexOf(headers, "playable");
        int      index_hide_card = System.Array.IndexOf(headers, "hide_card");
        int      index_disabled  = System.Array.IndexOf(headers, "disabled");
        int      index_element   = System.Array.IndexOf(headers, "element");

        heroTypeDatas.Clear();

        while (reader.ReadNextRecord())
        {
            HeroTypeData data = new HeroTypeData();

            HeroPanel.Hero_Class   hero_class = GetClassStringToEnum(reader[index_class]);
            HeroPanel.Hero_Element element    = GetElementStringToEnum(reader[index_element]);

            data.Set(reader[index_id],
                     reader[index_name], reader[index_nickname], reader[index_category],
                     reader[index_kingdom],
                     hero_class, reader[index_gender],
                     reader[index_tier], reader[index_rarity],
                     reader[index_portrait], reader[index_playable],
                     reader[index_hide_card], reader[index_disabled],
                     element);

            heroTypeDatas.Add(data);
        }

        // Sort
        heroTypeDatas.Sort(CompareHeroDatas);
    }
예제 #4
0
    public void ClickClassToggle()
    {
        Vector2 size = new Vector2(56, 50);

        if (toggle_class_all.value)
        {
            label_Class.alpha = 1;
            icon_Class.alpha  = 0;
            hero_Class        = HeroPanel.Hero_Class.all;
        }
        else
        {
            ClassIconOn();
        }

        if (toggle_tank.value)
        {
            Utility.ChangeSpriteAspectSnap(icon_Class, "class_icon_tank", size);
            hero_Class = HeroPanel.Hero_Class.tank;
        }
        else if (toggle_rogue.value)
        {
            Utility.ChangeSpriteAspectSnap(icon_Class, "class_icon_rogue", size);
            hero_Class = HeroPanel.Hero_Class.rogue;
        }
        else if (toggle_ranger.value)
        {
            Utility.ChangeSpriteAspectSnap(icon_Class, "class_icon_ranger", size);
            hero_Class = HeroPanel.Hero_Class.ranger;
        }
        else if (toggle_paladin.value)
        {
            Utility.ChangeSpriteAspectSnap(icon_Class, "class_icon_paladin", size);
            hero_Class = HeroPanel.Hero_Class.paladin;
        }
        else if (toggle_wizard.value)
        {
            Utility.ChangeSpriteAspectSnap(icon_Class, "class_icon_wizard", size);
            hero_Class = HeroPanel.Hero_Class.wizard;
        }
        WrapSetting();
        scrollView.ResetPosition();
        SpringPanel.Begin(scrollView.panel.cachedGameObject, scrollView_StartPos, 8);
        OnOffpanel_Class_Filter();
    }
예제 #5
0
    public void Set(Sprite sprite, string name, string id, HeroPanel.Hero_Element element, HeroPanel.Hero_Class hero_class, bool isHeroPanel = true)
    {
        if (sprite)
        {
            _sprite_hero.sprite2D = sprite;
        }

        label_name.text = name;
        _element        = element;
        _hero_class     = hero_class;
        _id             = id;

        Utility.ChangeSpriteAspectSnap(icon_Element, Utility.GetSpriteNameByEnum(element), raw_ClassIconSize);
        Utility.ChangeSpriteAspectSnap(icon_Class, Utility.GetSpriteNameByEnum(hero_class), raw_ClassIconSize);

        _isHeroPanel = isHeroPanel;
        //icon_Element.spriteName = ;
        //icon_Class.spriteName = string.Format("{0}{1}", "class_icon_", hero_class);
    }
예제 #6
0
    public void Set(HeroPanel.Hero_Element element, HeroPanel.Hero_Class hero_class, string name)
    {
        if (panel_front)
        {
            panel_front.depth = panel.depth + 5;
        }
        if (panel_scrollView)
        {
            panel_scrollView.depth = panel.depth + 6;
        }

        Utility.ChangeSpriteAspectSnap(_element, Utility.GetSpriteNameByEnum(element), raw_element_size);
        Utility.ChangeSpriteAspectSnap(_hero_class, Utility.GetSpriteNameByEnum(hero_class, true), raw_class_size);
        _name.text = name;

        // dummy
        _power.text = Random.Range(0, 10000).ToString();

        //
        GameObject go = Main.Instance.MakeObjectToTarget("Unit/tkc-ha_hu_don", target, Vector3.one, Vector3.one * 130);

        Utility.SetSpriteSortingOrderRecursive(go, 1);
    }
예제 #7
0
    public List <HeroTypeData> GetHeroTypeDatas(HeroPanel.Hero_Element element, HeroPanel.Hero_Kingdom kingdom, HeroPanel.Hero_Class hero_class)
    {
        bool chk_kingdom = false;
        bool chk_element = false;

        List <HeroTypeData> findHeroDatas = new List <HeroTypeData>();

        for (int i = 0; i < heroTypeDatas.Count; i++)
        {
            if (element == HeroPanel.Hero_Element.all && kingdom == HeroPanel.Hero_Kingdom.all && hero_class == HeroPanel.Hero_Class.all)
            {
                findHeroDatas.Add(heroTypeDatas[i]);
                continue;
            }

            // check conditions
            // Kingdom check
            chk_kingdom = false;
            chk_element = false;

            if (kingdom != HeroPanel.Hero_Kingdom.all)
            {
                chk_kingdom = CheckHaveKingdom(heroTypeDatas[i], kingdom.ToString());
            }
            else
            {
                chk_kingdom = true;
            }

            if (chk_kingdom)
            {
                // element check
                if (element != HeroPanel.Hero_Element.all)
                {
                    if (heroTypeDatas[i]._element == element)
                    {
                        chk_element = true;
                    }
                    else
                    {
                        chk_element = false;
                        continue;
                    }
                }
                else
                {
                    chk_element = true;
                }
                //class check
                if (chk_element)
                {
                    if (hero_class != HeroPanel.Hero_Class.all)
                    {
                        if (heroTypeDatas[i]._hero_class == hero_class)
                        {
                            findHeroDatas.Add(heroTypeDatas[i]);
                        }
                    }
                    else
                    {
                        findHeroDatas.Add(heroTypeDatas[i]);
                    }
                }
            }
        }

        findHeroDatas = findHeroDatas.Where(x => x._category == "hero" && x._playable == 1 && x._disabled != 1).ToList();

        findHeroDatas.Sort(CompareHeroDatas);
        return(findHeroDatas);
    }