コード例 #1
0
 public void LoadAlgorithmSettings()
 {
     FloorSettings.Clear();
     TileLayers.Clear();
     TileData.Clear();
     Items.Clear();
     Npcs.Clear();
     Rooms.Clear();
     if (Algorithm > -1)
     {
         FloorAlgorithm settingsGuide = GameData.FloorAlgorithmDex[Algorithm];
         for (int i = 0; i < settingsGuide.FloorSettings.Count; i++)
         {
             FloorSettings.Add(settingsGuide.FloorSettings[i].Item1, 0);
         }
         for (int i = 0; i < settingsGuide.LayerSettings.Count; i++)
         {
             TileLayers.Add(settingsGuide.LayerSettings[i], new List <Maps.TileAnim>());
         }
         for (int i = 0; i < settingsGuide.TileSettings.Count; i++)
         {
             TileData.Add(settingsGuide.TileSettings[i], new List <Maps.TileData>());
         }
         for (int i = 0; i < settingsGuide.ItemGroups.Count; i++)
         {
             Items.Add(settingsGuide.ItemGroups[i], new List <Tuple <ItemPreset, int> >());
         }
         for (int i = 0; i < settingsGuide.NpcGroups.Count; i++)
         {
             Npcs.Add(settingsGuide.NpcGroups[i], new List <Tuple <NpcPreset, int> >());
         }
         for (int i = 0; i < settingsGuide.RoomGroups.Count; i++)
         {
             Rooms.Add(settingsGuide.RoomGroups[i], new List <Tuple <int, int> >());
         }
     }
 }
コード例 #2
0
        public void Load(int algorithmNum)
        {
            Num = algorithmNum;
            using (XmlReader reader = XmlReader.Create(Paths.DataPath + "FloorAlgorithm\\" + algorithmNum + ".xml")) {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                        case "Name": {
                            Name = reader.ReadString();
                            break;
                        }

                        case "FloorSetting": {
                            if (reader.Read())
                            {
                                string settingName = reader.ReadElementString("FloorInt");
                                bool   settingBool = reader.ReadElementString("FloorIntBool").ToBool();
                                FloorSettings.Add(new Tuple <string, bool>(settingName, settingBool));
                            }
                        }
                        break;

                        case "LayerSetting": {
                            LayerSettings.Add(reader.ReadString());
                        }
                        break;

                        case "TileSetting": {
                            TileSettings.Add(reader.ReadString());
                        }
                        break;

                        case "FoliageSetting": {
                            FoliageSettings.Add(reader.ReadString());
                        }
                        break;

                        case "CoverSetting": {
                            CoverSettings.Add(reader.ReadString());
                        }
                        break;

                        case "ItemGroup": {
                            ItemGroups.Add(reader.ReadString());
                        }
                        break;

                        case "NpcGroup": {
                            NpcGroups.Add(reader.ReadString());
                        }
                        break;

                        case "RoomGroup": {
                            RoomGroups.Add(reader.ReadString());
                        }
                        break;
                        }
                    }
                }
            }
        }