Example #1
0
        public void SetData(UserCardVo vo, int expAdd)
        {
            ProgressBar progressBar = transform.Find("ProgressBar").GetComponent <ProgressBar>();

            progressBar.Progress = (int)(((float)vo.CurrentLevelExp / vo.NeedExp) * 100);

            _cardImage.texture = ResourceManager.Load <Texture>(vo.CardVo.SmallCardPath(vo.UserNeedShowEvoCard()), ModuleConfig.MODULE_BATTLE);
            if (_cardImage.texture == null)
            {
                Debug.LogError(vo.CardVo.SmallCardPath(vo.UseEvo == EvolutionPB.Evo1));
                _cardImage.texture = ResourceManager.Load <Texture>(vo.CardVo.SmallCardPath(), ModuleConfig.MODULE_BATTLE);
            }
            _levelText.text = "Lv." + vo.Level;

            if (vo.Level >= 100)
            {
                transform.Find("ExpAddText").GetComponent <Text>().text = "MAX";
            }
            else
            {
                transform.Find("ExpAddText").GetComponent <Text>().text = "+" + expAdd + " exp";
            }

            for (int i = 1; i < _heartBar.childCount; i++)
            {
//                RawImage star = _heartBar.GetChild(i).GetComponent<RawImage>();
//
//                star.gameObject.SetActive(i < vo.MaxStars);
//
//                if (vo.Star > i)
//                {
//                    star.color = new Color(star.color.r, star.color.g, star.color.b, 1.0f);
//                }
//                else
//                {
//                    star.color = new Color(star.color.r, star.color.g, star.color.b, 0.5f);
//                }
                var heartroot = _heartBar.GetChild(i);
                heartroot.gameObject.SetActive(i - 1 < vo.MaxStars);
                GameObject redheart = heartroot.Find("redHeart").gameObject;
                redheart.SetActive(i - 1 < vo.Star);
            }

            _cardQualityImage.sprite = HeroCardUtil.GetQualityImage(vo.CardVo.Credit);
            //_cardQualityImage.SetNativeSize();
        }
Example #2
0
        public void SetData(VisitBattleUserCardVo battleUserCardVo)
        {
            _battleUserCardVo = battleUserCardVo;
            UserCardVo vo = battleUserCardVo.UserCardVo;

            Texture texture = ResourceManager.Load <Texture>(vo.CardVo.SmallCardPath(vo.UserNeedShowEvoCard()), ModuleConfig.MODULE_VISITBATTLE);

            if (texture == null)
            {
                //Debug.LogError(vo.CardVo.SmallCardPath(vo.UseEvo==EvolutionPB.Evo1));
                texture = ResourceManager.Load <Texture>(vo.CardVo.SmallCardPath(), ModuleConfig.MODULE_VISITBATTLE);
            }

            _cardImage.texture = texture;

            _cardQualityImage.sprite = HeroCardUtil.GetQualityImage(vo.CardVo.Credit);
            //_cardQualityImage.SetNativeSize();

            _nameText.text  = vo.CardVo.CardName;
            _levelText.text = "Lv." + vo.Level;

            for (int i = 1; i < _heartBar.childCount; i++)
            {
//                RawImage heart = _heartBar.GetChild(i).GetComponent<RawImage>();
//                if (vo.Star > i)
//                {
//                    heart.color = new Color(heart.color.r, heart.color.g, heart.color.b, 1.0f);
//                }
//                else
//                {
//                    heart.color = new Color(heart.color.r, heart.color.g, heart.color.b, 0.5f);
//                }
                var heartroot = _heartBar.GetChild(i);
                heartroot.gameObject.SetActive(i - 1 < vo.MaxStars);
                GameObject redheart = heartroot.Find("redHeart").gameObject;
                redheart.SetActive(i - 1 < vo.Star);
            }

            _cg.alpha = battleUserCardVo.IsUsed ? 0.6f : 1.0f;
        }