/// <summary> /// 吃经验. /// </summary> /// <param name="Num">Number.</param> private void AddItemUseNum(int Num) { m_parent.SetItemNum(); m_iHaveAddNum = m_iHaveAddNum + Num; if (!MyHead.LblNumUsed.gameObject.activeInHierarchy) { MyHead.LblNumUsed.gameObject.SetActive(true); } MyHead.LblNumUsed.text = "X" + m_iHaveAddNum.ToString(); int MaxLvl = UserM.GetUserMaxHeroLevel(UserDC.GetLevel()); Info.EXP += int.Parse(m_ItemInfo.m_args); int MaxExp = SoldierM.GetSoldierTotalExpAtLevel(MaxLvl); int LevExp = SoldierM.GetSoldierExp(Info.Level); if (Info.EXP >= LevExp && Info.Level < MaxLvl) { int exp = SoldierM.GetSoldierExp(Info.Level); CalUplevelNum(exp, MaxLvl); } int Exp = SoldierM.GetSoldierExp(Info.Level); float pre = (Info.EXP * 1.0f) / (Exp * 1.0f); AddLeveAndExp(Info.Level, pre, true); }
/// <summary> /// 炮弹兵是否能增加经验 0:可以增加,1:已经满级不能增加 /// </summary> /// <returns><c>true</c>, if can add exp was checked, <c>false</c> otherwise.</returns> /// <param name="SoldireTypeID">炮弹兵ID.</param> /// <param name="AddExpNum">炮弹兵增加的经验值</param> public static int CheckCanAddExp(int SoldireTypeID, int AddExpNum) { SoldierInfo info = SoldierDC.GetSoldiers(SoldireTypeID); if (info == null) { return(0); } s_soldier_experienceInfo expInfo = GetSoldierExpData(info.Level); if (expInfo.exp == 0) { return(1); } int MaxLvl = UserM.GetUserMaxHeroLevel(info.Level); int MaxExp = GetSoldierTotalExpAtLevel(MaxLvl); if (info.EXP >= MaxExp) { return(1); } else if (info.EXP + AddExpNum < MaxExp) { return(0); } else if (info.EXP + AddExpNum > MaxExp && info.EXP < MaxExp) { return(0); } return(0); }
public bool ShowCaptionUpWnd() { CombatScene combat = SceneM.GetCurIScene() as CombatScene; if (combat != null) { UserInfo old = combat.m_oldUserInfo; if (old.Level < UserDC.GetLevel()) { CaptionUpgradeWnd cuw = WndManager.GetDialog <CaptionUpgradeWnd>(); int oldMaxPhysical = UserM.GetMaxPhysical(old.Level); int newMaxPhysical = UserM.GetMaxPhysical(UserDC.GetLevel()); int oldMaxherolevel = UserM.GetUserMaxHeroLevel(old.Level); int newMaxherolevel = UserM.GetUserMaxHeroLevel(UserDC.GetLevel()); cuw.SetData(old.Level, UserDC.GetLevel(), StageDC.GetStageResult().win ? old.Physical - StageDC.GetCounterPartInfo().win_physical : old.Physical - StageDC.GetCounterPartInfo().lose_physical, UserDC.GetPhysical(), oldMaxPhysical, newMaxPhysical, oldMaxherolevel, newMaxherolevel); cuw.MyHead.BtnBg.OnClickEventHandler += BackMainScence; cuw.MyHead.BtnClose.OnClickEventHandler += BackMainScence; return(true); } } return(false); }
/// <summary> /// 炮弹兵是否能增加经验 0:可以增加,1:已经满级不能增加,2:吃完了. /// </summary> /// <returns><c>true</c>, if can add exp was checked, <c>false</c> otherwise.</returns> /// <param name="SoldireTypeID">炮弹兵ID.</param> /// <param name="AddExpNum">炮弹兵增加的经验值</param> /// private int CheckCanAdd() { if (m_parent.GetItemNum() <= 0) { return(2); } sdata.s_soldier_experienceInfo expInfo = SoldierM.GetSoldierExpData(Info.Level); if (expInfo.exp == 0) { return(1); } int MaxLvl = UserM.GetUserMaxHeroLevel(UserDC.GetLevel()); int MaxExp = SoldierM.GetSoldierExp(MaxLvl); if (Info.EXP >= MaxExp && Info.Level >= MaxLvl) { return(1); } return(0); }