//刷新(更新)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 + "%"); }
//接收服务器强化响应 public void RspStrong(GameMsg msg) { int fightPre = PECommon.GetFightProps(GameRoot.instance.playerData); RspStrong rspStrong = msg.rspStrong; GameRoot.instance.SetPlayerDataByStrong(rspStrong); int fightNow = PECommon.GetFightProps(GameRoot.instance.playerData); GameRoot.AddTips("战斗力提升+" + (fightNow - fightPre)); audioSvc.PlayUIAudio(Constants.UIFbitem); strongWind.UpdateUI(); }
//刷新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); } }