Esempio n. 1
0
        public GuideChild Get(int id)
        {
            if (id <= 0)
            {
                return(null);
            }
            GuideChild guide_child = null;

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

            guide_child = DbClassLoader.Instance.QueryData <GuideChild>(ConfigDataBase.Instance.DbAccessorFactory, id);
            if (guide_child == null)
            {
#if UNITY_EDITOR
                LoggerManager.Instance.Warn("Invalid `id` value in table `guide_child` : " + id);
#endif
                return(null);
            }

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

            ReleaseData(false);
            return(guide_child);
        }
Esempio n. 2
0
        public void MemoryUpdate(int key, GuideChild guide_child)
        {
            GuideChilds.RemoveAll(n => n.Id == key);
            if (_guide_childMap.ContainsKey(key))
            {
                _guide_childMap.Remove(key);
                if (_refMap.ContainsKey(key))
                {
                    _refMap.Remove(key);
                }
            }

            if (guide_child != null)
            {
                GuideChilds.Add(guide_child);
                _guide_childMap.Add(key, guide_child);
                _refMap.Add(key, DateTime.Now.Ticks);
            }
        }