예제 #1
0
        public static List <Set> Read(string filename)
        {
            List <Set> sets = new List <Set>();

            var xmlDocument = new XmlDocument();

            using (var stream = File.OpenRead(filename))
            {
                xmlDocument.Load(stream);
            }

            var nodes = xmlDocument.GetElementsByTagName("set");

            for (int i = 0; i < nodes.Count; i++)
            {
                var node = nodes[i];

                var set = new Set
                {
                    Name = node.Attributes["name"].Value,

                    TileInfos = new TileInfos(node.SelectNodes("tile")),
                    WallInfos = WallInfo.Read(node.SelectNodes("wall")),
                    ItemInfos = ItemInfo.ReadList(node.SelectNodes("item")),
                    NpcInfos  = NpcInfo.Read(node.SelectNodes("Npc"))
                };

                sets.Add(set);
            }

            return(sets);
        }
예제 #2
0
        public static List <WallInfo> Read(XmlNodeList wallNodeList)
        {
            var wallInfoList = new List <WallInfo>();

            for (int i = 0; i < wallNodeList.Count; i++)
            {
                var wallNode = wallNodeList[i];

                int id = 0;

                if (wallNode.Attributes["num"] != null)
                {
                    id = Convert.ToInt32(wallNode.Attributes["num"].Value);
                }

                var wallInfo = new WallInfo
                {
                    Id   = id,
                    Name = wallNode.Attributes["name"].Value
                };

                if (wallNode.Attributes["color"] != null)
                {
                    wallInfo.ColorName  = wallNode.Attributes["color"].Value;
                    wallInfo.ColorValue = TileInfos.ParseColor(wallInfo.ColorName);
                    wallInfo.Color      = (Color)ColorConverter.ConvertFromString(wallInfo.ColorName);
                }
                else
                {
                    wallInfo.Color = MapHelper.GetWallColor((ushort)id);
                }

                if (wallNode.Attributes["blend"] != null)
                {
                    wallInfo.Blend = Convert.ToInt16(wallNodeList[i].Attributes["blend"].Value);
                }
                else
                {
                    wallInfo.Blend = (Int16)id;
                }

                wallInfoList.Add(wallInfo);
            }

            return(wallInfoList);
        }
예제 #3
0
        public static StaticData Read(string filename)
        {
            var staticData = new StaticData();

            var xmlDocument = new XmlDocument();

            using (var stream = File.OpenRead(filename))
            {
                xmlDocument.Load(stream);
            }

            staticData.TileInfos    = TileInfos.Read(xmlDocument);
            staticData.WallInfos    = WallInfo.Read(xmlDocument);
            staticData.GlobalColors = GlobalColors.Read(xmlDocument);
            staticData.ItemPrefixes = ItemPrefix.Read(xmlDocument);
            staticData.ItemInfos    = ItemInfo.Read(xmlDocument);
            staticData.NpcInfoList  = NpcInfo.Read(xmlDocument);

            return(staticData);
        }