コード例 #1
0
        public LeagueBoss Get(int id)
        {
            if (id <= 0)
            {
                return(null);
            }
            LeagueBoss league_boss = null;

            if (_league_bossMap.TryGetValue(id, out league_boss))
            {
                _refMap[league_boss.Id] = GetCurrentTimeTick();
                ReleaseData(false);
                return(league_boss);
            }

            league_boss = DbClassLoader.Instance.QueryData <LeagueBoss>(ConfigDataBase.Instance.DbAccessorFactory, id);
            if (league_boss == null)
            {
#if UNITY_EDITOR
                Debug.LogWarning("Invalid `id` value in table `league_boss` : " + id);
#endif
                return(null);
            }

            _league_bossMap.Add(id, league_boss);
            if (_refMap.ContainsKey(league_boss.Id) == false)
            {
                _refMap.Add(league_boss.Id, GetCurrentTimeTick());
            }

            ReleaseData(false);
            return(league_boss);
        }
コード例 #2
0
        public void MemoryUpdate(int key, LeagueBoss league_boss)
        {
            LeagueBosss.RemoveAll(n => n.Id == key);
            if (_league_bossMap.ContainsKey(key))
            {
                _league_bossMap.Remove(key);
                if (_refMap.ContainsKey(key))
                {
                    _refMap.Remove(key);
                }
            }

            if (league_boss != null)
            {
                LeagueBosss.Add(league_boss);
                _league_bossMap.Add(key, league_boss);
                _refMap.Add(key, DateTime.Now.Ticks);
            }
        }