private void TryAddExp(int exp) { if (exp <= 0) { return; } var dt = GameEntry.DataTable.GetDataTable <DRHeroLevel>(); int maxLevel = dt.Count; if (m_PlayerData.Level == maxLevel) { ShowWarning("100005"); return; } DRHeroLevel curLevelData = dt.GetDataRow(m_PlayerData.Level); if (curLevelData == null) { Log.Error("Can no get level{0} data.", m_PlayerData.Level); return; } int maxExp = curLevelData.RequireExp; m_PlayerData.Exp += exp; int offsetExp = m_PlayerData.Exp - maxExp; if (offsetExp > 0) { m_PlayerData.Exp = offsetExp; m_PlayerData.Level++; OnUpgradeLevel(); } int curExp = m_PlayerData.Exp; RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillExp(curExp, maxExp); GameEntry.Event.Fire(this, args); }
public void CalcHeroLevel(Dictionary <PropertyType, int> curData, int level) { DRHeroLevel drHero = GameEntry.DataTable.GetDataTable <DRHeroLevel>().GetDataRow(level); if (drHero == null) { return; } curData[PropertyType.LHP] += drHero.LHP; curData[PropertyType.ATK] += drHero.ATK; curData[PropertyType.DEF] += drHero.DEF; curData[PropertyType.CRI] += drHero.CRI; curData[PropertyType.BUR] += drHero.BUR; curData[PropertyType.LMP] += drHero.LMP; curData[PropertyType.VAM] += drHero.VAM; curData[PropertyType.HIT] += drHero.HIT; curData[PropertyType.DOG] += drHero.DOG; curData[PropertyType.BAF] += drHero.BAF; }