public static Hashtable GetHeroDataById(int id, int pos) { Hashtable hero = Johny.HashtablePool.Claim(); hero.Add("id", id); hero.Add("pos", pos); string templateId = string.Empty; if (id < 0)//雇佣兵 { var hireInfo = LTInstanceHireUtil.GetHireInfoByHeroId(id); if (hireInfo != null) { hero.Add("tid", hireInfo.character_id); } } else if (id > 0) { var partnerInfo = LTPartnerDataManager.Instance.GetPartnerByHeroId(id); if (partnerInfo != null) { hero.Add("tid", partnerInfo.StatId.ToString()); } } return(hero); }
public void SetExp(string heroid) { if (int.Parse(heroid) < 0) { var hireInfo = LTInstanceHireUtil.GetHireInfoByHeroId(int.Parse(heroid)); if (hireInfo != null) { m_Level.text = hireInfo.level.ToString(); m_Exp_Progress.gameObject.CustomSetActive(false); m_Exp_Add_Label.gameObject.CustomSetActive(false); } return; } IDictionary expData; int addExp = 0; if (DataLookupsCache.Instance.SearchDataByID <IDictionary>(RewardsPath, out expData)) { addExp = EB.Dot.Integer("quantity", expData, 0); m_Exp_Add_Label.text = string.Format(EB.Localizer.GetString("ID_codefont_in_CamapignVictoryExpDataSet_743"), addExp); } else { m_Exp_Add_Label.text = string.Format(EB.Localizer.GetString("ID_codefont_in_CamapignVictoryExpDataSet_743"), 0); } int endLevel = 0; int endExpSum = 0; DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.stat.level", heroid), out endLevel); DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.stat.xp", heroid), out endExpSum); int endLevelExp = endExpSum - Hotfix_LT.Data.CharacterTemplateManager.Instance.GerHeroPastExpSum(endLevel); float endPercent = (float)endLevelExp / (float)Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelInfo(endLevel).buddy_exp; var partnerData = LTPartnerDataManager.Instance.GetPartnerByHeroId(int.Parse(heroid)); if (partnerData != null) { Hotfix_LT.Data.UpGradeInfoTemplate curTpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetUpGradeInfo(partnerData.UpGradeId, partnerData.HeroInfo.char_type); if (partnerData.Level >= curTpl.level_limit) { LTUIUtil.SetLevelText(m_Level.transform.parent.GetComponent <UISprite>(), m_Level, partnerData); m_Exp_Progress.value = endPercent; return; } } int startExpSum = endExpSum - addExp; int startLevel = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelByExp(startExpSum); int startLevelExp = startExpSum - Hotfix_LT.Data.CharacterTemplateManager.Instance.GerHeroPastExpSum(startLevel); float startPercent = (float)startLevelExp / (float)Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelInfo(startLevel).buddy_exp; EB.Coroutines.Run(PlayExpProgressAni(startPercent, endPercent, endLevel - startLevel, startLevel)); if (m_Exp_Label != null) { LTUIUtil.SetText(m_Exp_Label, endLevelExp + "/" + Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroLevelInfo(endLevel).buddy_exp); } }
public void ShowUI(string heroId, bool isShowHp = false, bool isShowTempHp = false) { ResetStarGrid(); int star = 0; var tpl = new Hotfix_LT.Data.HeroStatTemplate(); var charTpl = new Hotfix_LT.Data.HeroInfoTemplate(); int upGradeId = 0; int awakenLevel = 0; if (int.Parse(heroId) < 0)//hire { var hireInfo = LTInstanceHireUtil.GetHireInfoByHeroId(int.Parse(heroId)); if (hireInfo == null) { EB.Debug.Log("userTeam data heroID <= {0}", heroId); mDMono.gameObject.CustomSetActive(false); return; } int nInfoID = int.Parse(hireInfo.character_id); star = hireInfo.star; tpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroStatByInfoId(nInfoID); charTpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroInfo(nInfoID); upGradeId = hireInfo.upgrade; if (HireObj != null) { HireObj.CustomSetActive(true); } } else { HireObj.CustomSetActive(false); Hashtable heroStatData = null; if (!DataLookupsCache.Instance.SearchDataByID <Hashtable>(SmallPartnerPacketRule.OWN_HERO_STATS + "." + heroId, out heroStatData)) { EB.Debug.LogError("not hero data for heroId ={0}", heroId); mDMono.gameObject.CustomSetActive(false); return; } string hero_templateid = EB.Dot.String("template_id", heroStatData, ""); if (string.IsNullOrEmpty(hero_templateid)) { EB.Debug.LogError("hero_templateid is IsNullOrEmpty"); return; } star = EB.Dot.Integer("star", heroStatData, 0); tpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroStat(hero_templateid); charTpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroInfo(tpl.character_id, EB.Dot.Integer("skin", heroStatData, 0)); upGradeId = EB.Dot.Integer("stat.awake.level", heroStatData, 0); awakenLevel = EB.Dot.Integer("stat.awaken.level", heroStatData, 0); } OnShow(heroId, charTpl, star, upGradeId, awakenLevel, isShowHp, isShowTempHp); }
public void SetHp(string heroId, bool isShowTempHp) { //float fullHp = 0; int level = 0; int peak = 0; float percent = 0; if (int.Parse(heroId) < 0)//是否雇佣 { var hireInfo = LTInstanceHireUtil.GetHireInfoByHeroId(int.Parse(heroId)); if (hireInfo != null) { float fullHp = hireInfo.base_MaxHP; float curHp = 0; if (isShowTempHp) { curHp = LTHotfixManager.GetManager <SceneManager>().GetChallengeTempHp(heroId); } else { curHp = LTChallengeInstanceHpCtrl.GetCombatHp(heroId); } percent = curHp / fullHp; level = hireInfo.level; } } else { if (isShowTempHp) { float curHp = LTHotfixManager.GetManager <SceneManager>().GetChallengeTempHp(heroId); float fullHp = 0; DataLookupsCache.Instance.SearchDataByID <float>(string.Format("userCampaignStatus.challengeChapters.team.{0}.MHP", heroId), out fullHp); percent = curHp / fullHp; } else { percent = LTChallengeInstanceHpCtrl.GetCombatHPPercent(heroId); } DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.stat.level", heroId), out level); DataLookupsCache.Instance.SearchIntByID(string.Format("heroStats.{0}.proficiency.1.1", heroId), out peak); } percent = Mathf.Min(percent, 1); PercentLabel.text = percent.ToString("0%"); HpProgress.value = percent; DeathLabel.gameObject.SetActive(percent <= 0); PercentLabel.gameObject.SetActive(percent > 0); LTUIUtil.SetLevelText(LevelLabel.transform.parent.GetComponent <UISprite>(), LevelLabel, level + peak); }