Beispiel #1
0
    private void RefreshUI()
    {
        PlayerData pd = GameRoot.instance.Playerdata;

        SetText(txtCharactor, pd.name + " LV" + pd.lv);
        SetText(txtExp, pd.exp + "/" + PECommon.GetExpUpValByLv(pd.lv));
        imgExp.fillAmount = (pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv));
        SetText(txtPower, pd.power);
        imgPower.fillAmount = (pd.power * 1.0f / PECommon.GetPowerLimit(pd.lv));
        SetText(txtJob, " 职业  暗夜刺客");
        SetText(txtFight, " 战力  " + PECommon.GetFightByPlayerData(pd));
        SetText(txtHP, " 生命  " + pd.hp);
        SetText(txtDamage, " 伤害  " + (pd.ad + pd.ap));
        SetText(txtDefend, " 防御  " + (pd.addef + pd.apdef));

        //detail
        SetText(hpValue, pd.hp);
        SetText(addValue, pd.ad);
        SetText(apValue, pd.ap);
        SetText(addValue, pd.addef);
        SetText(apdValue, pd.apdef);
        SetText(dodgeValue, pd.dodge);
        SetText(pierceValue, pd.pierce);
        SetText(criticalValue, pd.critical);
    }
Beispiel #2
0
    private void RefreshUI()
    {
        PlayerData pd = GameRoot.Instance.PlayerData;

        SetText(txtInfo, pd.name + " LV." + pd.lv);
        SetText(txtExp, pd.exp + "/" + PECommon.GetExpUpValByLv(pd.lv));
        imgExpPrg.fillAmount = pd.exp * 1.0F / PECommon.GetExpUpValByLv(pd.lv);
        SetText(txtPower, pd.power + "/" + PECommon.GetPowerLimit(pd.lv));
        imgPowerPrg.fillAmount = pd.power * 1.0F / PECommon.GetPowerLimit(pd.lv);

        SetText(txtJob, " 暗夜刺客");
        SetText(txtFight, PECommon.GetFightByProps(pd));
        SetText(txtHP, pd.hp);
        SetText(txtHurt, (pd.ad + pd.ap));
        SetText(txtDef, (pd.addef + pd.apdef));

        // 详细信息
        SetText(txtDHp, pd.hp);
        SetText(txtDAd, pd.ad);
        SetText(txtDAp, pd.ap);
        SetText(txtDAdDef, pd.addef);
        SetText(txtDApDef, pd.apdef);
        SetText(txtDDodge, pd.dodge + "%");
        SetText(txtDPierce, pd.pierce + "%");
        SetText(txtDCritical, pd.critical + "%");
    }
Beispiel #3
0
    private void RefreshUI()
    {
        PlayerData pd = GameRoot.Instance.PlayerData;

        SetText(txtInfo, $"{pd.name} LV.{pd.lv}");
        SetText(txtExp, $"{pd.exp}/{PECommon.GetExpUpValByLv(pd.lv)}");
        imgExpPrg.fillAmount = pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv);
        SetText(txtPower, $"{pd.power}/{PECommon.GetPowerLimit(pd.lv)}");
        imgPowerPrg.fillAmount = pd.power * 1.0f / PECommon.GetPowerLimit(pd.lv);

        SetText(txtJob, $" 职业   暗夜刺客");
        SetText(txtFight, $" 战力   {PECommon.GetFightByProps(pd)}");
        SetText(txtHP, $" 血量   {pd.hp}");
        SetText(txtHurt, $" 伤害   {pd.ad + pd.ap}");
        SetText(txtDef, $" 防御   {pd.addef + pd.apdef}");

        // detail TODO
        SetText(dtxhp, pd.hp);
        SetText(dtxad, pd.ad);
        SetText(dtxap, pd.ap);
        SetText(dtxaddef, pd.addef);
        SetText(dtxapdef, pd.apdef);
        SetText(dtxdodge, pd.dodge + "%");
        SetText(dtxpierce, pd.pierce + "%");
        SetText(dtxcritical, pd.critical + "%");
    }
Beispiel #4
0
    /// <summary>
    /// 升级逻辑
    /// </summary>
    public static void CalExp(PlayerData pd, int addExp)
    {
        int curtLv     = pd.lv;
        int curtExp    = pd.exp;
        int addRestExp = addExp;

        while (true)
        {
            //计算出当前等级升级需要的经验,处理升级与连续升级问题
            int upNeedExp = PECommon.GetExpUpValByLv(curtLv) - curtExp;
            if (addRestExp >= upNeedExp)
            {
                //能升级
                curtLv++;
                curtExp     = 0;
                addRestExp -= upNeedExp;
            }
            else
            {
                //不能升级
                pd.lv  = curtLv;
                pd.exp = curtExp + addRestExp;
                break;
            }
        }
    }
Beispiel #5
0
    private void Refresh()
    {
        PlayerData pd = GameRoot.Instance.PlayerData;

        SetText(txtInfo, pd.name + " LV." + pd.lv);
        SetText(txtExp, pd.exp + "/" + PECommon.GetExpUpValByLv(pd.lv));
        imgExpPrg.fillAmount = pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv);
        SetText(txtPower, pd.power + "/" + PECommon.GetPowerLimit(pd.lv));
        imgPowerPrg.fillAmount = pd.power * 1.0f / PECommon.GetPowerLimit(pd.lv);

        SetText(txtJob, " 职业   暗夜刺客");
        SetText(txtFight, " 战力   " + PECommon.GetFightByProps(pd));
        SetText(txtHP, " 血量   " + pd.hp);
        SetText(txtHurt, " 伤害   " + (pd.ad + pd.ap));
        SetText(txtDef, " 防御   " + (pd.addef + pd.apdef));

        //detail TODO
        SetText(dtxhp, pd.hp);
        SetText(dtxad, pd.ad);
        SetText(dtxap, pd.ap);
        SetText(dtxaddef, pd.addef);
        SetText(dtxapdef, pd.apdef);
        SetText(dtxdodge, pd.dodge + "%");
        SetText(dtxpierce, pd.pierce + "%");
        SetText(dtxcritical, pd.critical + "%");
    }
Beispiel #6
0
    //刷新(更新)UI信息
    private void RefreshUI()
    {
        PlayerData playerData = GameRoot.instance.playerData;

        SetText(txtInfo, playerData.name + "LV." + playerData.lv);
        SetText(txtExp, playerData.exp + "/" + PECommon.GetExpUpValByLv(playerData.lv));
        imgExpPrg.fillAmount = playerData.exp * 1.0f / PECommon.GetExpUpValByLv(playerData.lv);
        SetText(txtPower, playerData.power + "/" + PECommon.GetPowerLimit(playerData.lv));
        imgPowerPrg.fillAmount = playerData.power * 1.0f / PECommon.GetPowerLimit(playerData.lv);
        SetText(txtJob, "职业      暗夜刺客");
        SetText(txtFight, "战力    " + PECommon.GetFightProps(playerData));
        SetText(txtHP, "血量    " + playerData.hp);
        SetText(txtHurt, "伤害    " + playerData.ad + playerData.ap);
        SetText(txtDefense, "防御    " + playerData.addef + playerData.apdef);

        //详细信息面板
        SetText(txtDtHP, playerData.hp);
        SetText(txtDtAd, playerData.ad);
        SetText(txtDtAp, playerData.ap);
        SetText(txtDtAdDef, playerData.addef);
        SetText(txtDtApDef, playerData.apdef);
        SetText(txtDtDodge, playerData.dodge + "%");
        SetText(txtDtPierce, playerData.pierce + "%");
        SetText(txtDtCritical, playerData.critical + "%");
    }
    private void RefreshUI()
    {
        PlayerData pd = PECommon.PlayerData;

        SetText(txtInfo, pd.Name + " LV." + pd.Lv);
        SetText(txtExp, pd.Exp + "/" + PECommon.GetExpUpValByLv(pd.Lv));
        imgExpPrg.fillAmount = pd.Exp * 1.0F / PECommon.GetExpUpValByLv(pd.Lv);
        SetText(txtPower, pd.Power + "/" + PECommon.GetPowerLimit(pd.Lv));
        imgPowerPrg.fillAmount = pd.Power * 1.0F / PECommon.GetPowerLimit(pd.Lv);

        SetText(txtJob, " 职业   暗夜刺客");
        SetText(txtFight, " 战力   " + PECommon.GetFightByProps(pd));
        SetText(txtHP, " 血量   " + pd.Hp);
        SetText(txtHurt, " 伤害   " + (pd.Ad + pd.Ap));
        SetText(txtDef, " 防御   " + (pd.Addef + pd.Apdef));

        //detail TODO
        SetText(dtxhp, pd.Hp);
        SetText(dtxad, pd.Ad);
        SetText(dtxap, pd.Ap);
        SetText(dtxaddef, pd.Addef);
        SetText(dtxapdef, pd.Apdef);
        SetText(dtxdodge, pd.Dodge + "%");
        SetText(dtxpierce, pd.Pierce + "%");
        SetText(dtxcritical, pd.Critical + "%");
    }
    public void RefreshUI(object sender, GameEventArgs e)
    {
        OnRefreshUIFormEventArgs ne = e as OnRefreshUIFormEventArgs;

        if ((System.Object)sender != this && ne.formId != UIFormId.MainCityForm)
        {
            return;
        }
        PlayerData pd = PECommon.PlayerData;

        SetText(txtFight, PECommon.GetFightByProps(pd));
        SetText(txtPower, "体力:" + pd.Power + "/" + PECommon.GetPowerLimit(pd.Lv));
        imgPowerPrg.fillAmount = pd.Power * 1.0f / PECommon.GetPowerLimit(pd.Lv);
        SetText(txtLevel, pd.Lv);
        SetText(txtName, pd.Name);


        #region Expprg
        int expPrgVal = (int)(pd.Exp * 1.0f / PECommon.GetExpUpValByLv(pd.Lv) * 100);
        SetText(txtExpPrg, expPrgVal + "%");
        int index = expPrgVal / 10;

        GridLayoutGroup grid = expPrgTrans.GetComponent <GridLayoutGroup>();

        float globalRate  = 1.0F * Constants.ScreenStandardHeight / Screen.height;
        float screenWidth = Screen.width * globalRate;
        float width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);

        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                img.fillAmount = 1;
            }
            else if (i == index)
            {
                img.fillAmount = expPrgVal % 10 * 1.0f / 10;
            }
            else
            {
                img.fillAmount = 0;
            }
        }
        #endregion

        //设置自动任务图标
        curtTaskData = GameEntry.Res.GetAutoGuideCfg(pd.Guideid);
        if (curtTaskData != null)
        {
            SetGuideBtnIcon(curtTaskData.npcID);
        }
        else
        {
            SetGuideBtnIcon(-1);
        }
    }
Beispiel #9
0
    public void RefreshUI()
    {
        PlayerData pd = GameRoot.Instance.PlayerData;

        SetText(txtFight, PECommon.GetFightByProps(pd));
        SetText(txtPower, "体力:" + pd.power + "/" + PECommon.GetPowerLimit(pd.lv));
        imgPowerPrg.fillAmount = pd.power * 1.0f / PECommon.GetPowerLimit(pd.lv);
        SetText(txtLevel, pd.lv);
        SetText(txtName, pd.name);


        #region Expprg
        int expPrgVal = (int)(pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv) * 100);
        SetText(txtExpPrg, expPrgVal + "%");
        int index = expPrgVal / 10;

        GridLayoutGroup grid = expPrgTrans.GetComponent <GridLayoutGroup>();

        float globalRate  = 1.0F * Constants.ScreenStandardHeight / Screen.height;
        float screenWidth = Screen.width * globalRate;
        float width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);

        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                img.fillAmount = 1;
            }
            else if (i == index)
            {
                img.fillAmount = expPrgVal % 10 * 1.0f / 10;
            }
            else
            {
                img.fillAmount = 0;
            }
        }
        #endregion

        //设置自动任务图标
        curtTaskData = resSvc.GetAutoGuideCfg(pd.guideid);
        if (curtTaskData != null)
        {
            SetGuideBtnIcon(curtTaskData.npcID);
        }
        else
        {
            SetGuideBtnIcon(-1);
        }
    }
Beispiel #10
0
    public void RefreshUI()
    {
        PlayerData pd = GameRoot.instance.Playerdata;

        SetText(txtFight, PECommon.GetFightByPlayerData(pd));
        SetText(txtLV, pd.lv);
        SetText(txtPower, "体力:" + pd.power + "/" + PECommon.GetPowerLimit(pd.lv));
        //需要限制不要超出范围吗?
        imgPowerPrg.fillAmount = pd.power * 1.0f / PECommon.GetPowerLimit(pd.lv);
        SetText(txtName, pd.name);

        #region ExpProgress
        int expValPercent = (int)(pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv) * 100);
        SetText(txtExpPrg, expValPercent + "%");
        int             index = expValPercent / 10;
        GridLayoutGroup grid  = expProgramTrans.GetComponent <GridLayoutGroup>();
        //得到 标准高度和当前高度的比例,然后乘以当前宽度得到真实宽度,然后减掉间隙计算经验条宽度
        float screenRate  = 1.0f * Constants.screenStandardHeight / Screen.height;
        float screenWidth = Screen.width * screenRate;
        float width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);

        for (int i = 0; i < expProgramTrans.childCount; i++)
        {
            Image expImageValue = expProgramTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                expImageValue.fillAmount = 1;
            }
            else if (i == index)
            {
                expImageValue.fillAmount = expValPercent * 1.0f % 10 / 10;
            }
            else
            {
                expImageValue.fillAmount = 0;
            }
        }
        #endregion

        //设置自动任务图标
        currentTaskData = resSvc.GetGuideCfgData(pd.guideid);
        if (currentTaskData != null)
        {
            SetGuideBtnIcon(currentTaskData.npcID);
        }
        else
        {//没任务就显示默认图标
            SetGuideBtnIcon(-1);
        }
    }
Beispiel #11
0
    public void RefreshUI()
    {
        if (GetWindowState() == false)
        {
            return;
        }

        PlayerData playerData = GameRoot.instance.playerData;

        SetText(txtLevel, playerData.lv);
        SetText(txtName, playerData.name);

        #region ExpPrg

        //经验值条自适应
        GridLayoutGroup grid        = expPrgTrans.GetComponent <GridLayoutGroup>();
        float           globalScale = 1.0f * Constants.ScreenStandardHeight / Screen.height;
        float           screenWidth = Screen.width * globalScale;
        float           width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);

        //计算经验值百分比
        int expProVal = (int)(playerData.exp * 1.0f / PECommon.GetExpUpValByLv(playerData.lv) * 100);
        SetText(txtExpPrg, expProVal + "%");

        //填充经验值进度条
        int index = expProVal / 10;
        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                img.fillAmount = 1;
            }
            else if (i == index)
            {
                img.fillAmount = expProVal % 10 * 1.0f / 10;
            }
            else
            {
                img.fillAmount = 0;
            }
        }

        #endregion
    }
    private void RefreshUI()
    {
        PlayerData playerData = GameRoot.Instance.PlayerData;

        SetText(txtFight, PECommon.GetFightByProps(playerData));
        int powerLimit = PECommon.GetPowerLimit(playerData.lv);

        SetText(txtPower, "体力:" + playerData.power + "/" + powerLimit);
        imgPowerPrg.fillAmount = playerData.power * 1.0f / powerLimit;
        SetText(txtLevel, playerData.lv);
        SetText(txtName, playerData.name);

        //经验条自适应
        int expPrgVal = (int)(playerData.exp * 1.0f / PECommon.GetExpUpValByLv(playerData.lv) * 100);

        SetText(txtExpPrg, expPrgVal + "%");
        int index = expPrgVal / 10;

        GridLayoutGroup grid        = expPrgTrans.GetComponent <GridLayoutGroup>();
        float           globalRate  = 1.0f * Constants.ScreenStandardHeight / Screen.height;
        float           screenWidth = Screen.width * globalRate;
        float           width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);
        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                img.fillAmount = 1;
            }
            else if (i == index)
            {
                img.fillAmount = expPrgVal % 10 * 1.0f / 10;
            }
            else
            {
                img.fillAmount = 0;
            }
        }
    }
Beispiel #13
0
    public void RefreshUI()
    {
        PlayerData pd = GameRoot.Instance.PlayerData;

        SetText(txtLevel, pd.lv);
        SetText(txtName, pd.name);

        #region 经验条适配
        int expPrgVal = (int)(pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv) * 100);
        SetText(txtExpPrg, expPrgVal + "%");
        int index = expPrgVal / 10;

        GridLayoutGroup grid = expPrgTrans.GetComponent <GridLayoutGroup>();

        float globalRate  = 1.0F * Constants.ScreenStandardHeight / Screen.height;
        float screenWidth = Screen.width * globalRate;
        float width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);

        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                img.fillAmount = 1;
            }
            else if (i == index)
            {
                img.fillAmount = expPrgVal % 10 * 1.0f / 10;
            }
            else
            {
                img.fillAmount = 0;
            }
        }
        #endregion
    }
Beispiel #14
0
        private void calcExp(PlayerData pd, int addExp)
        {
            int curtLv     = pd.lv;
            int curtExp    = pd.exp;
            int addRestExp = addExp;

            while (true)
            {
                int upNeedExp = PECommon.GetExpUpValByLv(curtLv) - curtExp;
                if (addRestExp >= upNeedExp)
                {
                    curtLv     += 1;
                    curtExp     = 0;
                    addRestExp -= upNeedExp;
                }
                else
                {
                    pd.lv  = curtLv;
                    pd.exp = curtExp + addRestExp;
                    break;
                }
            }
        }
Beispiel #15
0
    private void CalculateExp(PlayerData pd, int addExp)
    {
        //升级之后当前等级经验是清零的
        //int currentExp = pd.exp; ;
        //int lv=pd.lv;
        int upNeedExp;

        upNeedExp = PECommon.GetExpUpValByLv(pd.lv) - pd.exp;
        while (true)
        {
            if (addExp >= upNeedExp)
            {
                addExp -= upNeedExp;
                pd.lv++;
                pd.exp = 0;
            }
            else
            {
                pd.exp += addExp;
                break;
            }
        }
    }
Beispiel #16
0
    public const int PowerAddCount = 2; //分钟



    /// <summary>
    /// 计算经验值
    /// </summary>
    /// <param name="pd"></param>
    /// <param name="addExp"></param>
    public static void CalcExp(PlayerData pd, int addExp)
    {
        int curtLv     = pd.lv;
        int curtExp    = pd.exp;
        int addRestExp = addExp;//增加的经验值可能升多级

        while (true)
        {
            int upNeedExp = PECommon.GetExpUpValByLv(curtLv) - curtExp;
            if (addRestExp >= upNeedExp)
            {
                curtLv     += 1;
                curtExp     = 0;
                addRestExp -= upNeedExp;
            }
            else
            {
                pd.lv  = curtLv;
                pd.exp = curtExp + addRestExp;
                break;
            }
        }
    }
Beispiel #17
0
    /// <summary>
    /// 分段经验条屏幕适配和显示
    /// </summary>
    private void ExpPrg(PlayerData pd)
    {
        // 分段经验条屏幕适配
        GridLayoutGroup grid = expPrgTrans.GetComponent <GridLayoutGroup>();
        // 当前屏幕的缩放比例,因为是使用高度进行缩放的,所以,此处要使用高度进行计算
        float globalRate = 1.0f * Constants.ScreenStandardHeight / Screen.height;
        // 当前屏幕宽度
        float screenWidth = Screen.width * globalRate;
        // 当前经验块的宽度
        float width = (screenWidth - 177) / 10;

        grid.cellSize = new Vector2(width, 11);

        // 经验值
        int expPrgVal = (int)(pd.exp * 1.0f / PECommon.GetExpUpValByLv(pd.lv) * 100);

        SetText(txtExpPrg, expPrgVal + "%"); // 文本数值
        int index = expPrgVal / 10;          // 经验条索引

        // 根据当前拥有的经验值,填充经验条
        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)   // 前面都填充满
            {
                img.fillAmount = 1;
            }
            else if (i == index)   // 数值位于这个经验块之间
            {
                img.fillAmount = expPrgVal % 10 * 1.0f / 10;
            }
            else   // 后面都没满
            {
                img.fillAmount = 0;
            }
        }
    }
Beispiel #18
0
    //刷新UI信息
    public void RefreshUI()
    {
        if (GetWindowState() == false)
        {
            return;
        }

        PlayerData playerData = GameRoot.instance.playerData;
        int        fight      = PECommon.GetFightProps(playerData);
        int        power      = PECommon.GetPowerLimit(playerData.lv);

        //为UI赋值
        SetText(txtFight, fight);
        SetText(txtPower, new StringBuilder("体力:").Append(playerData.power).Append("/").Append(power).ToString());
        imgPowerPrg.fillAmount = playerData.power * 1.0f / power;
        SetText(txtLevel, playerData.lv);
        SetText(txtName, playerData.name);

        #region ExpPrg

        //经验值条自适应
        GridLayoutGroup grid        = expPrgTrans.GetComponent <GridLayoutGroup>();
        float           globalScale = 1.0f * Constants.ScreenStandardHeight / Screen.height;
        float           screenWidth = Screen.width * globalScale;
        float           width       = (screenWidth - 180) / 10;

        grid.cellSize = new Vector2(width, 7);

        //计算经验值百分比
        int expProVal = (int)(playerData.exp * 1.0f / PECommon.GetExpUpValByLv(playerData.lv) * 100);
        SetText(txtExpPrg, expProVal + "%");

        //填充经验值进度条
        int index = expProVal / 10;
        for (int i = 0; i < expPrgTrans.childCount; i++)
        {
            Image img = expPrgTrans.GetChild(i).GetComponent <Image>();
            if (i < index)
            {
                img.fillAmount = 1;
            }
            else if (i == index)
            {
                img.fillAmount = expProVal % 10 * 1.0f / 10;
            }
            else
            {
                img.fillAmount = 0;
            }
        }

        #endregion

        m_curTaskData = resSvc.GetGuideCfgData(playerData.guideId);
        if (m_curTaskData != null)
        {
            SetGuideBtnIcon(m_curTaskData.npcID);
        }
        else
        {
            SetGuideBtnIcon(-1);
        }
    }