Exemple #1
0
    public void ClickHeroCard(HeroCard card)
    {
        scrollView_SelectedPos = scrollView.transform.localPosition;

        List <HeroTypeData> typeData = MyCsvLoad.Instance.GetHeroTypeDatas(hero_Element, hero_Kingdom, hero_Class);
        bool existed = FindHeroByID(typeData, selectedCardID);
        bool removed = false;

        selectedCardID = card._id;
        if (!existed)
        {
            removed = RemoveSelectedHero(typeData, selectedCardID);
        }

        if (removed)
        {
            GameObject activeObj = GetLastActiveObject();

            if (activeObj != null)
            {
                activeObj.SetActive(false);
            }

            wrap.maxIndex--;
        }

        label_Hero_Name.text = card.GetHeroName();

        Transform trans = target.transform;

        if (trans.childCount > 0)
        {
            trans.DestroyChildren();
        }

        hero_info.SetActive(true);
        hero_info.transform.position = target.transform.position;

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

        Utility.SetSpriteSortingOrderRecursive(go, 1);

        wrap.WrapContent(true);
        Transform wrap_trans = wrap.transform;

        SpringPanel.Begin(scrollView.panel.cachedGameObject, scrollView_SelectedPos, 8);
    }