Example #1
0
        public UiPannel Get(string id)
        {
            UiPannel ui_pannel = null;

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

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

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

            ReleaseData(false);
            return(ui_pannel);
        }
Example #2
0
        public void MemoryUpdate(string key, UiPannel ui_pannel)
        {
            UiPannels.RemoveAll(n => n.Id == key);
            if (_ui_pannelMap.ContainsKey(key))
            {
                _ui_pannelMap.Remove(key);
                if (_refMap.ContainsKey(key))
                {
                    _refMap.Remove(key);
                }
            }

            if (ui_pannel != null)
            {
                UiPannels.Add(ui_pannel);
                _ui_pannelMap.Add(key, ui_pannel);
                _refMap.Add(key, DateTime.Now.Ticks);
            }
        }