Exemplo n.º 1
0
        public static void LoadHairXml(GraphicsDevice gfxd)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("wz\\Misc\\00041656.img.xml");
            XmlNode default_ = doc["xmldump"]["wzimg"].SelectNodes("imgdir[@name='default']")[0];

            foreach (XmlNode component in default_.SelectNodes("canvas"))
            {
                string         componentName = component.Attributes["name"].Value;
                string         imgName       = "default" + "." + componentName;
                short          x             = short.Parse(component["vector"].Attributes["x"].Value);
                short          y             = short.Parse(component["vector"].Attributes["y"].Value);
                ComponentFrame cf            = new ComponentFrame(gfxd, "wz\\Misc\\00041656.atlas.png", new Vector2(x, y), EquipTypes.Misc, "00041656", imgName);
                XmlNodeList    mapNodes      = component.SelectNodes("imgdir[@name='map']");
                if (mapNodes.Count == 1)
                {
                    XmlNodeList brow = mapNodes[0].SelectNodes("vector[@name='brow']");
                    if (brow.Count == 1)
                    {
                        cf.brow = new Vector2(short.Parse(brow[0].Attributes["x"].Value), short.Parse(brow[0].Attributes["y"].Value));
                    }
                }
                StaticSprites[imgName] = cf;
            }
        }
Exemplo n.º 2
0
        public static void LoadHeadXml(GraphicsDevice gfxd)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("wz\\Misc\\head.img.xml");
            XmlNode        front    = doc["xmldump"]["wzimg"].SelectNodes("imgdir[@name='front']")[0]["canvas"];
            string         imgName  = "front.head";
            short          x        = short.Parse(front["vector"].Attributes["x"].Value);
            short          y        = short.Parse(front["vector"].Attributes["y"].Value);
            ComponentFrame cf       = new ComponentFrame(gfxd, "wz\\Misc\\head.atlas.png", new Vector2(x, y), EquipTypes.Misc, "head", imgName);
            XmlNodeList    mapNodes = front.SelectNodes("imgdir[@name='map']");

            if (mapNodes.Count == 1)
            {
                XmlNodeList neck = mapNodes[0].SelectNodes("vector[@name='neck']");
                if (neck.Count == 1)
                {
                    cf.neck = new Vector2(short.Parse(neck[0].Attributes["x"].Value), short.Parse(neck[0].Attributes["y"].Value));
                }
                XmlNodeList brow = mapNodes[0].SelectNodes("vector[@name='brow']");
                if (brow.Count == 1)
                {
                    cf.brow = new Vector2(short.Parse(brow[0].Attributes["x"].Value), short.Parse(brow[0].Attributes["y"].Value));
                }
            }
            StaticSprites[imgName] = cf;
        }
Exemplo n.º 3
0
        private static void LoadAnimation(XmlNode node, GraphicsDevice gfxd, EquipTypes et, string id, string imgNameIn)
        {
            string imgPath;

            imgPath = "wz\\" + et + "\\" + id + ".atlas.png";
            Dictionary <string, Dictionary <int, ComponentFrame> > Books = new Dictionary <string, Dictionary <int, ComponentFrame> >();
            Animations animation = AnimationStrings[node.Attributes["name"].Value];
            List <int> delays    = new List <int>();

            foreach (XmlNode frame in node.ChildNodes)
            {
                string      frameNum      = frame.Attributes["name"].Value;
                XmlNodeList xmlComponents = frame.SelectNodes("canvas");
                Dictionary <string, XmlNode> componentMap = new Dictionary <string, XmlNode>();
                foreach (XmlNode xmlComponent in xmlComponents)
                {
                    componentMap.Add(xmlComponent.Attributes["name"].Value, xmlComponent);
                }
                foreach (XmlNode uol in frame.SelectNodes("uol"))
                {
                    XmlNode target = ResolveXmlPath(uol, uol.Attributes["value"].Value);
                    componentMap.Add(uol.Attributes["name"].Value, target);
                }
                foreach (string componentMapName in componentMap.Keys)
                {
                    XmlNode component     = componentMap[componentMapName];
                    string  componentName = component.Attributes["name"].Value;
                    if (!Books.ContainsKey(componentMapName))
                    {
                        Books.Add(componentMapName, new Dictionary <int, ComponentFrame>());
                    }
                    string imgName     = ResolveInLink(component);
                    string outLink     = ResolveOutLink(component);
                    string origImgPath = imgPath;

                    if (outLink != null)
                    {
                        imgPath = "wz\\" + et + "\\" + outLink.Split('\\')[0].Split(".img")[0] + ".atlas.png";
                        imgName = outLink.Split('\\').Last();
                        id      = outLink.Split('\\').First();
                    }
                    imgName = imgName == null ? imgNameIn + node.Attributes["name"].Value + "." + frameNum + "." + componentName : imgName;
                    short          x  = short.Parse(component["vector"].Attributes["x"].Value);
                    short          y  = short.Parse(component["vector"].Attributes["y"].Value);
                    ComponentFrame cf = new ComponentFrame(gfxd, imgPath, new Vector2(x, y), et, id, imgName);
                    imgPath = origImgPath;
                    XmlNodeList mapNodes = component.SelectNodes("imgdir[@name='map']");
                    if (mapNodes.Count == 1)
                    {
                        XmlNodeList neck = mapNodes[0].SelectNodes("vector[@name='neck']");
                        if (neck.Count == 1)
                        {
                            cf.neck = new Vector2(short.Parse(neck[0].Attributes["x"].Value), short.Parse(neck[0].Attributes["y"].Value));
                        }
                        XmlNodeList navel = mapNodes[0].SelectNodes("vector[@name='navel']");
                        if (navel.Count == 1)
                        {
                            cf.navel = new Vector2(short.Parse(navel[0].Attributes["x"].Value), short.Parse(navel[0].Attributes["y"].Value));
                        }
                        XmlNodeList hand = mapNodes[0].SelectNodes("vector[@name='hand']");
                        if (hand.Count == 1)
                        {
                            cf.hand = new Vector2(short.Parse(hand[0].Attributes["x"].Value), short.Parse(hand[0].Attributes["y"].Value));
                        }
                        XmlNodeList handMove = mapNodes[0].SelectNodes("vector[@name='handMove']");
                        if (handMove.Count == 1)
                        {
                            cf.handMove = new Vector2(short.Parse(handMove[0].Attributes["x"].Value), short.Parse(handMove[0].Attributes["y"].Value));
                        }
                    }
                    Books[componentMapName].Add(Int32.Parse(frameNum), cf);
                }
                if (node.SelectNodes("int[@name='delay']") != null && !Skeleton.Duration.ContainsKey(animation))
                {
                    delays.Add(Int32.Parse(frame.SelectNodes("int[@name='delay']")[0].Attributes["value"].Value));
                }
            }
            foreach (KeyValuePair <string, Dictionary <int, ComponentFrame> > entry in Books)
            {
                Skeleton.AddBook(entry.Key, animation, entry.Value);
            }
            if (!Skeleton.Duration.ContainsKey(animation))
            {
                Skeleton.Duration[animation] = delays;
            }
        }
Exemplo n.º 4
0
        public static void LoadFaceXml(GraphicsDevice gfxd)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load("wz\\Face\\00020644.img.xml");
            XmlNode default_ = doc["imgdir"].SelectNodes("imgdir[@name='default']")[0];

            foreach (XmlNode component in default_.SelectNodes("canvas"))
            {
                string         componentName = component.Attributes["name"].Value;
                string         imgName       = "default" + "." + componentName;
                short          x             = short.Parse(component["vector"].Attributes["x"].Value);
                short          y             = short.Parse(component["vector"].Attributes["y"].Value);
                ComponentFrame cf            = new ComponentFrame(gfxd, "wz\\Face\\00020644.atlas.png", new Vector2(x, y), EquipTypes.Face, "00020644", imgName);
                XmlNodeList    mapNodes      = component.SelectNodes("imgdir[@name='map']");
                if (mapNodes.Count == 1)
                {
                    XmlNodeList brow = mapNodes[0].SelectNodes("vector[@name='brow']");
                    if (brow.Count == 1)
                    {
                        cf.brow = new Vector2(short.Parse(brow[0].Attributes["x"].Value), short.Parse(brow[0].Attributes["y"].Value));
                    }
                }
                StaticSprites[imgName] = cf;
            }
            XmlNode blink = doc["imgdir"].SelectNodes("imgdir[@name='blink']")[0];

            foreach (XmlNode frame in blink.ChildNodes)
            {
                string frameNum = frame.Attributes["name"].Value;
                foreach (XmlNode component in frame.SelectNodes("canvas"))
                {
                    string componentName = component.Attributes["name"].Value;
                    string imgName       = ResolveInLink(component);
                    string outLink       = ResolveOutLink(component);
                    string imgPath       = "wz\\Face\\00020644.atlas.png";
                    string id            = "00020644";
                    if (outLink != null)
                    {
                        imgPath = "wz\\Face\\" + outLink.Split('\\')[0].Split(".img")[0] + ".atlas.png";
                        imgName = outLink.Split('\\').Last();
                        id      = outLink.Split('\\').First();
                    }
                    string keyName = blink.Attributes["name"].Value + "." + frameNum + "." + componentName;
                    imgName = imgName == null ? keyName : imgName;
                    short          x        = short.Parse(component["vector"].Attributes["x"].Value);
                    short          y        = short.Parse(component["vector"].Attributes["y"].Value);
                    ComponentFrame cf       = new ComponentFrame(gfxd, imgPath, new Vector2(x, y), EquipTypes.Face, id, imgName);
                    XmlNodeList    mapNodes = component.SelectNodes("imgdir[@name='map']");
                    if (mapNodes.Count == 1)
                    {
                        XmlNodeList brow = mapNodes[0].SelectNodes("vector[@name='brow']");
                        if (brow.Count == 1)
                        {
                            cf.brow = new Vector2(short.Parse(brow[0].Attributes["x"].Value), short.Parse(brow[0].Attributes["y"].Value));
                        }
                    }
                    StaticSprites[keyName] = cf;
                }
            }
        }