/// <summary> /// 获取人物艺术等级数据 /// </summary> public LevelInfo GetPeopleArtLevelInfo(int addExp) { //int curLevel=playerPeople.protoData.PropertyData.Level; int beforeExp = playerPeople.protoData.PropertyData.CurArtExp; int beforeLevel = playerPeople.protoData.PropertyData.ArtLevel; int canReachLevel = beforeLevel; int expAfterAllUpgrade = beforeExp + addExp; //int curLevel = 1; if (canReachLevel < DataTable._testNumerialList.Count) { for (int i = canReachLevel; i < DataTable._testNumerialList.Count; i++) { TestNumerialSetting nextSetting = DataTable._testNumerialList[i]; int nextLevelNeed = nextSetting.needExp.ToInt32(); //就在这个等级了 if (expAfterAllUpgrade < nextLevelNeed) { break; } else { canReachLevel++; expAfterAllUpgrade -= nextLevelNeed; } } } LevelInfo info = new LevelInfo(canReachLevel, expAfterAllUpgrade, beforeExp, beforeLevel); return(info); }
public void RefreshShow() { for (int i = 0; i < singlePropertyViewList.Count; i++) { singlePropertyViewList[i].RefreshShow(); } int expLimit = 0; LevelInfo levelInfo = RoleManager.Instance.GetPeopleLevelInfo(0); if (levelInfo.beforeLevel < DataTable._testNumerialList.Count) { TestNumerialSetting setting = DataTable._testNumerialList[levelInfo.beforeLevel]; expLimit = DataTable._testNumerialList[levelInfo.beforeLevel].needExp.ToInt32(); txt_upgradeBar.SetText(levelInfo.beforeExp + "/" + expLimit); img_upgradeBar.fillAmount = levelInfo.beforeExp / (float)expLimit; } else { img_upgradeBar.fillAmount = 1; txt_upgradeBar.SetText("已满级"); } txt_lv.SetText(("LV.") + levelInfo.beforeLevel); LevelInfo physicalLevelInfo = RoleManager.Instance.GetPeoplePhysicalLevelInfo(0); if (physicalLevelInfo.beforeLevel < DataTable._testNumerialList.Count) { TestNumerialSetting setting = DataTable._testNumerialList[levelInfo.beforeLevel]; expLimit = DataTable._testNumerialList[physicalLevelInfo.beforeLevel].needExp.ToInt32(); txt_physicalUpgradeBar.SetText(physicalLevelInfo.beforeExp + "/" + expLimit); img_physicalUpgradeBar.fillAmount = physicalLevelInfo.beforeExp / (float)expLimit; } else { img_physicalUpgradeBar.fillAmount = 1; txt_physicalUpgradeBar.SetText("已满级"); } txt_physicalLv.SetText(("LV.") + physicalLevelInfo.beforeLevel); LevelInfo artLevelInfo = RoleManager.Instance.GetPeopleArtLevelInfo(0); if (artLevelInfo.beforeLevel < DataTable._testNumerialList.Count) { TestNumerialSetting setting = DataTable._testNumerialList[levelInfo.beforeLevel]; expLimit = DataTable._testNumerialList[artLevelInfo.beforeLevel].needExp.ToInt32(); txt_artUpgradeBar.SetText(artLevelInfo.beforeExp + "/" + expLimit); img_artUpgradeBar.fillAmount = artLevelInfo.beforeExp / (float)expLimit; } else { img_artUpgradeBar.fillAmount = 1; txt_artUpgradeBar.SetText("已满级"); } txt_artLv.SetText(("LV.") + artLevelInfo.beforeLevel); }
/// <summary> /// 通过等级获取测试数值 /// </summary> /// <param name="level"></param> /// <returns></returns> public static TestNumerialSetting FindTestNumerialByLevel(int level) { for (int i = 0; i < _testNumerialList.Count; i++) { TestNumerialSetting setting = _testNumerialList[i]; if (setting.level.ToInt32() == level) { return(setting); } } Debug.Log("寻找一个不存在的 TestNumerialSetting,level为" + level); return(null); }
/// <summary> /// 刷新属性升级后需要调用 /// </summary> void RefreshProperty(PropertyData propertyData) { //学习 TestNumerialSetting studySetting = DataTable.FindTestNumerialByLevel(propertyData.Level); List <List <float> > studyProChange = CommonUtil.Split2CfgFloat(studySetting.proChange); InitPropertyChangeWithNumerial(propertyData, studyProChange); //体育 PhysicalUpgradeNumerialSetting physicalSetting = DataTable.FindPhysicalUpgradeNumerialByLevel(propertyData.PhysicalLevel); List <List <float> > physicalProChange = CommonUtil.Split2CfgFloat(physicalSetting.proChange); InitPropertyChangeWithNumerial(propertyData, physicalProChange); //艺术 ArtUpgradeNumerialSetting artSetting = DataTable.FindArtUpgradeNumerialByLevel(propertyData.ArtLevel); List <List <float> > artProChange = CommonUtil.Split2CfgFloat(artSetting.proChange); InitPropertyChangeWithNumerial(propertyData, artProChange); }