public float GetHeroExpRatio(int uid) { float result = 0f; if (Singleton <PvpManager> .Instance.IsInPvp) { PvpStatisticMgr.HeroData heroData = Singleton <PvpManager> .Instance.StatisticMgr.GetHeroData(uid); if (heroData != null) { int exp2LevelUp = UtilExpData.Instance.GetExp2LevelUp(heroData.CurLv); if (exp2LevelUp == -1) { result = 1f; } else { result = (float)heroData.CurExp / (float)exp2LevelUp; } } } else { ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter; if (expCounter != null) { ExpValue expValue = expCounter.GetValue(uid) as ExpValue; if (expValue != null) { result = expValue.RicherExpRatio; } } } return(result); }
public int GetHerolv(int uid) { int result = 1; if (Singleton <PvpManager> .Instance.IsInPvp) { PvpStatisticMgr.HeroData heroData = Singleton <PvpManager> .Instance.StatisticMgr.GetHeroData(uid); if (heroData != null) { result = heroData.CurLv; } } else { ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter; if (expCounter != null) { ExpValue expValue = expCounter.GetValue(uid) as ExpValue; if (expValue != null) { result = expValue.CurLv; } } } return(result); }
public string ToString(Boolean FullFraction) { if (!FullFraction && Denominator > uint.MaxValue) { return("e^" + ExpValue.ToString()); } Boolean d1 = Denominator == 1; return((d1 ? "" : "(") + Numerator.ToString("n0") + (d1 ? "" : "/" + Denominator.ToString("n0") + ")")); }
/// <summary> /// Добавляет опыт к переданному стату /// </summary> private int AddExp(ref ExpValue stat) { int expToUp = expToLevelUp[stat.Value]; stat.Exp += trainingCost; if (stat.Exp >= expToUp) { stat.Value += 1; stat.Exp -= expToUp; SoundManager.Instance.PlayLevelUp(); } return(trainingCost); }
private void OnLevelBtn(GameObject obj = null) { GameObject gameObject = GameObject.FindGameObjectWithTag("Player"); if (gameObject != null) { Units component = gameObject.GetComponent <Units>(); UtilCounter counter = UtilManager.Instance.GetCounter(UtilType.Exp); ExpValue expValue = counter.GetValue(PlayerControlMgr.Instance.GetPlayer().unique_id) as ExpValue; int lvUpExp = expValue.GetLvUpExp(expValue.CurLv + 1); expValue.AddExp((float)lvUpExp); SendMsgManager.Instance.SendPvpMsgBase <CheatInfo>(PvpCode.C2P_GMCheat, new CheatInfo { cheatMsg = "AddExp " + lvUpExp }); } }
private bool GetDeadExpByUnitId(int inUnitId, int inCurLv, out float outDeadExpVal) { outDeadExpVal = 0f; ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter; if (expCounter == null) { return(false); } ExpValue expValue = expCounter.GetValue(inUnitId) as ExpValue; if (expValue == null) { return(false); } outDeadExpVal = expValue.GetDeadExp(inCurLv); return(true); }
private void OnTestBtn(GameObject go) { if (LevelManager.Instance.CheckSceneIsTest()) { if (LevelManager.Instance.IsServerZyBattleType) { return; } GameObject gameObject = GameObject.FindGameObjectWithTag("Player"); if (gameObject != null) { Units component = gameObject.GetComponent <Units>(); UtilCounter counter = UtilManager.Instance.GetCounter(UtilType.Exp); ExpValue expValue = counter.GetValue(PlayerControlMgr.Instance.GetPlayer().unique_id) as ExpValue; int lvUpExp = expValue.GetLvUpExp(expValue.CurLv + 1); expValue.AddExp((float)lvUpExp); } } }
private void AddExpByUnitId(int inUnitId, float inExpVal) { if (inExpVal < 0.1f) { return; } ExpCounter expCounter = this.GetCounter(UtilType.Exp) as ExpCounter; if (expCounter == null) { return; } ExpValue expValue = expCounter.GetValue(inUnitId) as ExpValue; if (expValue == null) { return; } expValue.AddExp(inExpVal); }
private void OnResetBtn(GameObject go) { if (LevelManager.Instance.CheckSceneIsTest()) { if (LevelManager.Instance.IsServerZyBattleType) { return; } GameObject gameObject = GameObject.FindGameObjectWithTag("Player"); if (gameObject != null) { Units component = gameObject.GetComponent <Units>(); UtilCounter counter = UtilManager.Instance.GetCounter(UtilType.Exp); ExpValue expValue = counter.GetValue(PlayerControlMgr.Instance.GetPlayer().unique_id) as ExpValue; expValue.AddExp(-expValue.CurExp); component.skillManager.SkillPointsLeft = 0; for (int i = 0; i < 4; i++) { List <SkillDataKey> skillsByIndex = component.getSkillsByIndex(i); if (skillsByIndex != null) { for (int j = 0; j < skillsByIndex.Count; j++) { skillsByIndex[j] = new SkillDataKey(skillsByIndex[j].SkillID, 0, skillsByIndex[j].Skin); Skill skillById = component.getSkillById(skillsByIndex[j].SkillID); if (skillById != null) { skillById.SetLevel(0); } } } } SkillCounter skillCounter = UtilManager.Instance.GetCounter(UtilType.Skill) as SkillCounter; skillCounter.OnHeroLevelup(component, 0); component.level = 1; component.UpLevel(); CtrlManager.CloseWindow(WindowID.SkillView); CtrlManager.OpenWindow(WindowID.SkillView, null); } } }
/// <summary> /// 转换为ESQL /// </summary> /// <returns></returns> public string ToESQLString(string TableName) { string FieldName = this.ExpName; if ((this.ConditionList.Count == 0) && (FieldName != null) && (FieldName == "")) { return(""); } string ESQL = ""; if ((FieldName != null) && (FieldName != "")) { //{0} ?? {1} ; ESQL = ConvertOperatorToESQL(); if (FieldName.ToUpper().IndexOf(TableName.ToUpper() + ".") == -1) { //增加表名; FieldName = TableName + "." + FieldName; } if (ExpValue == null || ExpValue == DBNull.Value || ExpValue.ToString().ToLower().Trim() == "null") { // NULL 值处理 = 和 is 不需要处理,linqTOsql会自动处理 = 和 is的; ExpValue = "null"; ESQL = string.Format(ESQL, FieldName, ExpValue); } else if (ExpValue is string) { //字符串 string ValueString = ExpValue.ToString(); if ((ExpOperater != eConditionOperator.In) && (ExpOperater != eConditionOperator.NotIn)) { ValueString = "'" + ValueString + "'"; } else { if (!ValueString.ToLower().Contains("select"))//非子表的查询 { ValueString = "{" + ValueString + "}"; } } ESQL = string.Format(ESQL, FieldName, ValueString); } else if (ExpValue is DateTime) { //日期 string ValueString = "DATETIME'" + ((DateTime)ExpValue).ToString("yyyy-MM-dd HH:mm:ss.fffffff") + "'"; ESQL = string.Format(ESQL, FieldName, ValueString); } else if (ExpValue is ValueType) { //数值 ESQL = string.Format(ESQL, FieldName, ExpValue); } else if (ExpValue is Array) { //对于IN 的,必须采用Array传入对象; //待处理; } else { ESQL = string.Format(ESQL, FieldName, ExpValue); } } if (ESQL != "") { if (ExpLogical == eLogicalOperator.And) { ESQL = " AND " + ESQL; } if (ExpLogical == eLogicalOperator.Or) { ESQL = " OR " + ESQL; } } string ChildESQL = ""; foreach (ConditionExpression ce in this.ConditionList) { ChildESQL = ChildESQL + ce.ToESQLString(TableName); } if (ChildESQL != "") { if (ChildESQL.ToUpper().Trim().StartsWith("AND")) { ChildESQL = ChildESQL.Trim().Remove(0, 3); } if (ChildESQL.ToUpper().Trim().StartsWith("OR")) { ChildESQL = ChildESQL.Trim().Remove(0, 2); } if (ChildESQL != "") { if (ExpLogical == eLogicalOperator.And) { ChildESQL = " AND ( " + ChildESQL + " ) "; } if (ExpLogical == eLogicalOperator.Or) { ChildESQL = " or ( " + ChildESQL + " ) "; } } return(ChildESQL); //return " AND ( " + ChildESQL + " ) "; } ESQL = ESQL + ChildESQL; return(ESQL); }