示例#1
0
 public void InitDB()
 {
     if (_DBLoader == null)
     {
         _DBLoader = new DBLoader <Monster>("bestiary.db");
     }
 }
示例#2
0
        public static void LoadFeats()
        {
            List <Feat> set = XmlListLoader <Feat> .Load("Feats.xml");

            featMap    = new Dictionary <string, Feat>();
            altFeatMap = new Dictionary <string, string>();
            types      = new SortedDictionary <String, String>();

            foreach (Feat feat in set)
            {
                bool   changed;
                string commaName = CMStringUtilities.DecommaText(feat.Name, out changed);

                if (changed)
                {
                    feat.AltName = feat.Name;
                    feat.Name    = commaName;
                    altFeatMap.Add(feat.AltName, feat.Name);
                }

                featMap[feat.Name] = feat;



                //add to types list
                foreach (string type in feat.Types)
                {
                    types[type] = type;
                }

                if (feat.Types.Count == 0)
                {
                    Debug.WriteLine(feat.Name);
                }

                feats = new ObservableCollection <Feat>();
                foreach (Feat f in Feat.FeatMap.Values)
                {
                    feats.Add(f);
                }
            }
            if (DBSettings.UseDB)
            {
                _FeatsDB = new DBLoader <Feat>("feats.db");

                foreach (Feat f in _FeatsDB.Items)
                {
                    feats.Add(f);

                    if (!FeatMap.ContainsKey(f.Name))
                    {
                        FeatMap[f.Name] = f;
                    }
                }
            }

            _FeatsLoaded = true;
        }
示例#3
0
 public void Dispose()
 {
     _DBLoader.Dispose();
     _DBLoader = null;
 }