/// <summary> /// 可升级检测逻辑 /// </summary> /// <param name="hero"></param> /// <returns></returns> private bool CheckUpgradable(ObjectCard hero) { if (hero == null) { return(false); } HeroTemplate _heroItem = hero.GetHeroRow(); IExcelBean _data = null; HeroexpTemplate _heroExp = null; var _dataMap = m_HeroExpTable.getData(); if (_dataMap.TryGetValue(hero.GetHeroData().Level, out _data)) { _heroExp = _data as HeroexpTemplate; } if (_heroExp != null) { return(m_ObjectSelf.ExpFruit * m_ExpCrystalFactor >= _heroExp.getExp()[_heroItem.getExpNum() - 1] && hero.GetHeroData().Level < _heroItem.getMaxLevel()); } else { return(false); } }
public void NeedExp() { HeroTemplate _HeroItem = objc.GetHeroRow(); int expid = _HeroItem.getExpNum() - 1; int level = objc.GetHeroData().Level; if (level != null) { if (level < _HeroItem.getMaxLevel()) { HeroexpTemplate _HeroExp = (HeroexpTemplate)DataTemplate.GetInstance().m_HeroExpTable.getTableData(level); int needxp = _HeroExp.getExp()[expid] - objc.GetHeroData().Exp; mNeedExp.text = needxp.ToString(); } } }
int GetLithCount(ObjectCard card) { HeroTemplate temp = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(card.GetHeroData().TableID); int lithCount = temp.getReturnBack(); int expNum = temp.getExpNum(); int level = card.GetHeroData().Level; int allExp = 0; for (int i = 1; i < level; i++) { HeroexpTemplate heroExpTemp = (HeroexpTemplate)DataTemplate.GetInstance().m_HeroExpTable.getTableData(i); allExp += heroExpTemp.getExp()[expNum - 1]; } lithCount += (int)((allExp + card.GetHeroData().Exp) * DataTemplate.GetInstance().m_GameConfig.getRongling_conversion_rate() / (float)DataTemplate.GetInstance().m_GameConfig.getJingyanjiejing_to_jingyan()); return(lithCount); }
public void ExpCrustal() { int allExpNum = ObjectSelf.GetInstance().ExpFruit; allExpCrystal.text = allExpNum.ToString(); int proportion = DataTemplate.GetInstance().m_GameConfig.getJingyanjiejing_to_jingyan(); HeroTemplate _HeroItem = objc.GetHeroRow(); mLevel.text = objc.GetHeroData().Level.ToString(); int expid = _HeroItem.getExpNum() - 1; int level = int.Parse(mLevel.text); if (level < _HeroItem.getMaxLevel()) { HeroexpTemplate _HeroExp = (HeroexpTemplate)DataTemplate.GetInstance().m_HeroExpTable.getTableData(level); int needxp = _HeroExp.getExp()[expid] - objc.GetHeroData().Exp; oneExpCrustal.text = needxp.ToString(); int tenneedxp = 0; levelSurplus = 0; expSurplus = 0; expCrustalSurplus = 0; //距离当阶最大等级是否为10级 if (level >= (_HeroItem.getMaxLevel() - 10)) { for (int i = level; i < _HeroItem.getMaxLevel(); i++) { HeroexpTemplate ten_HeroExp = (HeroexpTemplate)DataTemplate.GetInstance().m_HeroExpTable.getTableData(i); tenneedxp += ten_HeroExp.getExp()[expid]; } } else { for (int i = level; i < level + 10; i++) { HeroexpTemplate ten_HeroExp = (HeroexpTemplate)DataTemplate.GetInstance().m_HeroExpTable.getTableData(i); if (allExpNum < _HeroExp.getExp()[expid]) { expSurplus = _HeroExp.getExp()[expid]; expCrustalSurplus = allExpNum; levelSurplus = i; } allExpNum -= _HeroExp.getExp()[expid]; tenneedxp += ten_HeroExp.getExp()[expid]; } } tenExpCrustal.text = (tenneedxp - objc.GetHeroData().Exp).ToString(); } mExpProgress.value = (int)(objc.GetHeroData().GetExpPercentage() * 100); //等级到达当阶最大等级时 if (int.Parse(mLevel.text) >= _HeroItem.getMaxLevel()) { mExpProgress.value = 100f; mLevelup1.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); mLevelup10.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); oneExpCrustal.text = "------"; tenExpCrustal.text = "------"; //mExpProOver.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_08"); mExpProgress.value = 99.9f; mNeedDes.text = GameUtils.getString("hero_levelup_content1"); //"已达到当阶最高级" expEffectsMax.SetActive(true); mNeedExp.gameObject.SetActive(false); //sPlay = false; } //升一级经验结晶不足 else if (int.Parse(allExpCrystal.text) == 0 || int.Parse(oneExpCrustal.text) > int.Parse(allExpCrystal.text)) { mLevelup1.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); mLevelup10.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); } //升10级经验结晶不足 else if (int.Parse(allExpCrystal.text) == 0 || int.Parse(tenExpCrustal.text) > int.Parse(allExpCrystal.text)) { mLevelup10.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); } else { isPlay = true; //mExpProOver.overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_HeroInfo_01"); mNeedDes.text = GameUtils.getString("hero_levelup_content2"); //"升级所需经验" mNeedExp.gameObject.SetActive(true); oneExpCrustal.gameObject.SetActive(true); tenExpCrustal.gameObject.SetActive(true); expEffectsMax.SetActive(false); //结晶数为0时 if (int.Parse(allExpCrystal.text) == 0) { mLevelup1.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); mLevelup10.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_07"); } else { mLevelup1.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_04"); mLevelup10.gameObject.GetComponent <Image>().overrideSprite = UIResourceMgr.LoadSprite(common.defaultPath + "UI_Up_04"); } } }