Exemple #1
0
        public Acupoint Get(int id)
        {
            if (id <= 0)
            {
                return(null);
            }
            Acupoint acupoint = null;

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

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

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

            ReleaseData(false);
            return(acupoint);
        }
Exemple #2
0
        public void MemoryUpdate(int key, Acupoint acupoint)
        {
            Acupoints.RemoveAll(n => n.Id == key);
            if (_acupointMap.ContainsKey(key))
            {
                _acupointMap.Remove(key);
                if (_refMap.ContainsKey(key))
                {
                    _refMap.Remove(key);
                }
            }

            if (acupoint != null)
            {
                Acupoints.Add(acupoint);
                _acupointMap.Add(key, acupoint);
                _refMap.Add(key, DateTime.Now.Ticks);
            }
        }