public ActivityAward Get(int id) { if (id <= 0) { return(null); } ActivityAward activity_award = null; if (_activity_awardMap.TryGetValue(id, out activity_award)) { _refMap[activity_award.Id] = GetCurrentTimeTick(); ReleaseData(false); return(activity_award); } activity_award = DbClassLoader.Instance.QueryData <ActivityAward>(ConfigDataBase.Instance.DbAccessorFactory, id); if (activity_award == null) { #if UNITY_EDITOR Debug.LogWarning("Invalid `id` value in table `activity_award` : " + id); #endif return(null); } _activity_awardMap.Add(id, activity_award); if (_refMap.ContainsKey(activity_award.Id) == false) { _refMap.Add(activity_award.Id, GetCurrentTimeTick()); } ReleaseData(false); return(activity_award); }
public void MemoryUpdate(int key, ActivityAward activity_award) { ActivityAwards.RemoveAll(n => n.Id == key); if (_activity_awardMap.ContainsKey(key)) { _activity_awardMap.Remove(key); if (_refMap.ContainsKey(key)) { _refMap.Remove(key); } } if (activity_award != null) { ActivityAwards.Add(activity_award); _activity_awardMap.Add(key, activity_award); _refMap.Add(key, DateTime.Now.Ticks); } }