예제 #1
0
    public void SetInfo(BattleDataHeroInfo info, int totalDamage, int totalDamageGet, int totalKill, float totalTime)
    {
        _prgDamage.SetValue(1.0f * info.damage / info.totalDamage);
        _prgDamageGet.SetValue(1.0f * info.damageGet / info.totalDamageGet);
        _prgKill.SetValue(1.0f * info.kill / info.totalKill);
        _prgTime.SetValue(info.time / info.totalTime);

        _prgDamage.SetText(info.damage.ToString());
        _prgDamageGet.SetText(info.damageGet.ToString());
        _prgKill.SetText(info.kill.ToString());
        _prgTime.SetText(Utils.GetCountDownString(info.time));
    }
예제 #2
0
    public void SetInfo(long heroID, int addExp)
    {
        HeroInfo info = UserManager.Instance.GetHeroInfo(heroID);

        if (info == null)
        {
            gameObject.SetActive(false);
            return;
        }

        _info   = info;
        _addExp = addExp;

        _heroBg.sprite   = ResourceManager.Instance.GetIconBgByQuality(info.StarLevel);
        _heroIcon.sprite = ResourceManager.Instance.GetHeroIcon(info.ConfigID);
        _heroLevel.text  = "Lv " + info.Level;


        HeroLevelConfig expCfg = HeroLevelConfigLoader.GetConfig(info.Level);

        if (expCfg.ExpRequire == 0)
        {
            _heroExp.SetValue(1);
            if (_heroLevelUp != null)
            {
                _heroLevelUp.gameObject.SetActive(false);
            }
        }
        else
        {
            // 设置初始的进度
            _heroExp._image.fillAmount = 1.0f * info.Exp / expCfg.ExpRequire;
            StartCoroutine(ProcessAnimation());

            if (info.Exp + addExp >= expCfg.ExpRequire)
            {
                if (_heroLevelUp != null)
                {
                    _heroLevelUp.gameObject.SetActive(true);
                }
            }
            else
            {
                if (_heroLevelUp != null)
                {
                    _heroLevel.gameObject.SetActive(false);
                }
            }
        }

        _heroExp.SetText(Str.Get("UI_EXP") + "+" + addExp);
    }