Example #1
0
    void OnInitializeHeroCards(GameObject go, int wrapIndex, int realIndex)
    {
        //Debug.Log("real index : " + realIndex + " wrapIndex : " + wrapIndex);
        List <HeroTypeData> typeData = MyCsvLoad.Instance.GetHeroTypeDatas(hero_Element, hero_Kingdom, hero_Class);

        RemoveSelectedHero(typeData, selectedCardID);

        if (typeData.Count <= 0)
        {
            return;
        }
        if (go == null)
        {
            return;
        }

        int lstIndex = realIndex % typeData.Count;

        if (lstIndex < 0)
        {
            lstIndex = -lstIndex;
        }

        HeroCard card = go.GetComponent <HeroCard>();

        card.Set(Main.Instance.GetHeroPortraitByName(typeData[lstIndex]._portrait),
                 typeData[lstIndex]._name, typeData[lstIndex]._id, typeData[lstIndex]._element, typeData[lstIndex]._hero_class, false);
    }