Beispiel #1
0
        private void ReadFrame030(XmlNode node)
        {
            SpriteFrameResource frame = new SpriteFrameResource();

            frame.Bounds   = XmlHelper.ReadAttributeRectangle(node, "rect");
            frame.Offset   = XmlHelper.ReadAttributePoint(node, "offset");
            frame.Filename = XmlHelper.ReadAttributeString(node, "image", string.Empty);

            if (string.IsNullOrEmpty(frame.Filename))
            {
                frame.Filename = mFilename;

                if (mFilename == null)
                {
                    throw new AgateResourceException("Sprite resource " + Name + " does not have a " +
                                                     "default filename, and frame " + mImages.Count.ToString() +
                                                     " does not specify a filename.");
                }
            }

            if (frame.Filename != mFilename)
            {
                mPacked = false;
            }

            mImages.Add(frame);
        }
Beispiel #2
0
        internal void BuildNodes(XmlElement parent, XmlDocument doc, SpriteFrameResource frame)
        {
            XmlElement element = doc.CreateElement("Frame");

            XmlHelper.AppendAttribute(element, doc, "rect", frame.Bounds.ToString());
            XmlHelper.AppendAttribute(element, doc, "offset", frame.Offset.ToString());

            if (Packed == false && frame.Filename != Filename)
            {
                XmlHelper.AppendAttribute(element, doc, "image", frame.Filename);
            }

            parent.AppendChild(element);
        }