public int GetGoldById(int uid) { if (Singleton <PvpManager> .Instance.IsInPvp) { PvpStatisticMgr.HeroData heroData = Singleton <PvpManager> .Instance.StatisticMgr.GetHeroData(uid); if (heroData != null) { return(heroData.CurGold); } return(0); } else { GoldCounter goldCounter = this.GetCounter(UtilType.Gold) as GoldCounter; if (goldCounter == null) { return(0); } GoldValue goldValue = goldCounter.GetValue(uid) as GoldValue; if (goldValue == null) { return(0); } return(goldValue.CurrentGold); } }
private void AddGoldByUnitId(int inUnitId, int inGoldVal) { GoldCounter goldCounter = this.GetCounter(UtilType.Gold) as GoldCounter; if (goldCounter == null) { return; } GoldValue goldValue = goldCounter.GetValue(inUnitId) as GoldValue; if (goldValue == null) { return; } goldValue.ChangeGold(inGoldVal); }
public int ChangeGoldById(int uid, int changeNum) { GoldCounter goldCounter = this.GetCounter(UtilType.Gold) as GoldCounter; if (goldCounter == null) { return(0); } GoldValue goldValue = goldCounter.GetValue(uid) as GoldValue; if (goldValue == null) { ClientLogger.Error("not gold data for this id:" + uid); return(0); } goldValue.ChangeGold(changeNum); return(goldValue.CurrentGold); }