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

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

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

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

            ReleaseData(false);
            return(faction_tree_mission);
        }
Exemple #2
0
        public void MemoryUpdate(int key, FactionTreeMission faction_tree_mission)
        {
            FactionTreeMissions.RemoveAll(n => n.Id == key);
            if (_faction_tree_missionMap.ContainsKey(key))
            {
                _faction_tree_missionMap.Remove(key);
                if (_refMap.ContainsKey(key))
                {
                    _refMap.Remove(key);
                }
            }

            if (faction_tree_mission != null)
            {
                FactionTreeMissions.Add(faction_tree_mission);
                _faction_tree_missionMap.Add(key, faction_tree_mission);
                _refMap.Add(key, DateTime.Now.Ticks);
            }
        }