Exemplo n.º 1
0
    public void RefreshUI()
    {
        PlayerData playerData = GameRoot.Instance.PlayerData;

        //血量
        //int hpLimit = PECommon.GetHpByLv(playerData.lv);
        hpSum = playerData.hp;
        SetSelfHpBar(hpSum);
        SetText(txtName, playerData.name);
        //等级
        SetText(txtLv, playerData.lv);
        //能量
        imgEnergy.fillAmount = playerData.energy * 1.0f / 100;
        //进度条
        int expLimit = PECommon.GetExpLimitByLv(playerData.lv);

        SetText(txtExp, Mathf.Round((playerData.exp * 1.0f / expLimit) * 100.0f).ToString() + "%");
        SetExpProgressBar(playerData.exp);
        AdaptProgressBar();
    }
Exemplo n.º 2
0
    /// <summary>
    /// 设置进度条进度
    /// </summary>
    public void SetExpProgressBar(int exp)
    {
        int expLimit = PECommon.GetExpLimitByLv(GameRoot.Instance.PlayerData.lv);
        int fullItem = exp * 10 / expLimit;

        for (int i = 0; i < expItemListTrans.childCount; i++)
        {
            Image img = expItemListTrans.GetChild(i).GetComponent <Image>();
            if (i < fullItem)
            {
                img.fillAmount = 1;
            }
            else if (i == fullItem)
            {
                img.fillAmount = ((exp * 1.0f) - expLimit * fullItem * 1.0f / 10) / 100;
            }
            else
            {
                img.fillAmount = 0;
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// 更新UI
    /// </summary>
    public void RefreshUI()
    {
        PlayerData playerData = GameRoot.Instance.PlayerData;
        //计算战斗力并更新
        int fight = PECommon.GetFightByProps(playerData);

        SetText(txtFight, fight);
        //更新体力UI
        int staminaLimit = PECommon.GetStaminaLimitByLv(playerData.lv);

        SetText(txtStamina, "体力:" + playerData.stamina + "/" + staminaLimit);
        sliderStamina.fillAmount = playerData.stamina * 1.0f / staminaLimit;
        //更新等级UI
        SetText(txtLevel, playerData.lv);
        //更新名字
        SetText(txtName, playerData.name);
        //更新进度条UI
        int expLimit = PECommon.GetExpLimitByLv(playerData.lv);

        SetText(txtExp, Mathf.Round((playerData.exp * 1.0f / expLimit) * 100.0f).ToString() + "%");
        SetExpProgressBar(playerData.exp);

        AdaptProgressBar();

        #region TaskIconRefresh
        curTaskCfg = resSvc.GetTaskCfg(playerData.taskid);
        if (curTaskCfg != null)
        {
            SetAutoTaskIcon(curTaskCfg.npcID);
        }
        //如果当前没有任务,显示默认图片
        else
        {
            SetAutoTaskIcon(-1);
        }
        #endregion
        //TODO
    }
Exemplo n.º 4
0
    public void RefreshUI()
    {
        PlayerData playerData = GameRoot.Instance.PlayerData;

        SetText(txtNameLv, playerData.name + " LV" + playerData.lv);

        int staminaLimit = PECommon.GetStaminaLimitByLv(playerData.lv);

        SetText(txtStamina, playerData.stamina + "/" + staminaLimit);
        float percentStamina = playerData.stamina * 1.0f / staminaLimit;

        staminaFill.fillAmount = percentStamina;

        int expLimit = PECommon.GetExpLimitByLv(playerData.lv);

        SetText(txtExp, playerData.exp + "/" + expLimit);
        float percentExp = playerData.exp * 1.0f / expLimit;

        expFill.fillAmount = percentExp;

        SetText(txtProfession, "职业      暗夜刺客");

        int fight = PECommon.GetFightByProps(playerData);

        SetText(txtFight, "战力         " + fight);
        SetText(txtHp, "生命        " + playerData.hp);
        SetText(txtHurt, "伤害         " + (playerData.ad + playerData.ap).ToString());
        SetText(txtDefence, "防御         " + (playerData.addef + playerData.apdef).ToString());

        SetText(txthp, playerData.hp);
        SetText(txtad, playerData.ad);
        SetText(txtap, playerData.ap);
        SetText(txtaddef, playerData.addef);
        SetText(txtapdef, playerData.apdef);
        SetText(txtdodge, playerData.dodge + "%");
        SetText(txtpierce, playerData.pierce + "%");
        SetText(txtcritical, playerData.critical + "%");
    }