/// <summary>
 ///   Builds a region list from the regions specified in the provided frame XML node
 /// </summary>
 /// <param name="frameElement">
 ///   XML node for the frame whose regions wille be processed
 /// </param>
 /// <param name="bitmaps">
 ///   Bitmap lookup table used to associate a region's bitmap id to the real bitmap
 /// </param>
 /// <returns>
 ///   A list of the regions that have been extracted from the frame XML node
 /// </returns>
 public static Frame.Region[] Build(
   XElement frameElement, IDictionary<string, Texture2D> bitmaps
 ) {
   RegionListBuilder builder = new RegionListBuilder();
   builder.retrieveBorderSizes(frameElement);
   return builder.createAndPlaceRegions(frameElement, bitmaps);
 }
 /// <summary>
 ///   Builds a region list from the regions specified in the provided frame XML node
 /// </summary>
 /// <param name="frameNode">
 ///   XML node for the frame whose regions wille be processed
 /// </param>
 /// <param name="bitmaps">
 ///   Bitmap lookup table used to associate a region's bitmap id to the real bitmap
 /// </param>
 /// <returns>
 ///   A list of the regions that have been extracted from the frame XML node
 /// </returns>
 public static Frame.Region[] Build(
   XmlNode frameNode, IDictionary<string, Texture2D> bitmaps
 ) {
   RegionListBuilder builder = new RegionListBuilder(frameNode);
   builder.retrieveBorderSizes();
   return builder.createAndPlaceRegions(bitmaps);
 }
Esempio n. 3
0
            /// <summary>
            ///   Builds a region list from the regions specified in the provided frame XML node
            /// </summary>
            /// <param name="frameElement">
            ///   XML node for the frame whose regions wille be processed
            /// </param>
            /// <param name="bitmaps">
            ///   Bitmap lookup table used to associate a region's bitmap id to the real bitmap
            /// </param>
            /// <returns>
            ///   A list of the regions that have been extracted from the frame XML node
            /// </returns>
            public static Frame.Region[] Build(
                XElement frameElement, IDictionary <string, Texture2D> bitmaps
                )
            {
                RegionListBuilder builder = new RegionListBuilder();

                builder.retrieveBorderSizes(frameElement);
                return(builder.createAndPlaceRegions(frameElement, bitmaps));
            }
            /// <summary>
            ///   Builds a region list from the regions specified in the provided frame XML node
            /// </summary>
            /// <param name="frameNode">
            ///   XML node for the frame whose regions wille be processed
            /// </param>
            /// <param name="bitmaps">
            ///   Bitmap lookup table used to associate a region's bitmap id to the real bitmap
            /// </param>
            /// <returns>
            ///   A list of the regions that have been extracted from the frame XML node
            /// </returns>
            public static Frame.Region[] Build(
                XmlNode frameNode, IDictionary <string, Texture2D> bitmaps
                )
            {
                RegionListBuilder builder = new RegionListBuilder(frameNode);

                builder.retrieveBorderSizes();
                return(builder.createAndPlaceRegions(bitmaps));
            }
Esempio n. 5
0
        /// <summary>Loads the frames contained in a skin document</summary>
        /// <param name="skinDocument">
        ///   XML document containing a skin description whose frames will be loaded
        /// </param>
        private void loadFrames(XDocument skinDocument)
        {
            // Load all the frames specified by the skin
            XElement resources = skinDocument.Element("skin").Element("frames");

            foreach (XElement element in resources.Descendants("frame"))
            {
                string name = element.Attribute("name").Value;

                Frame.Region[] regions = RegionListBuilder.Build(element, this.bitmaps);
                Frame.Text[]   texts   = TextListBuilder.Build(element, this.fonts);
                this.frames.Add(name, new Frame(regions, texts));
            }
        }
        /// <summary>Loads the frames contained in a skin document</summary>
        /// <param name="skinDocument">
        ///   XML document containing a skin description whose frames will be loaded
        /// </param>
        private void loadFrames(XmlDocument skinDocument)
        {
            // Extract all frames from the skin
            XmlNodeList frames = skinDocument.SelectNodes("/skin/frames/frame");

            for (int frameIndex = 0; frameIndex < frames.Count; ++frameIndex)
            {
                // Extract the frame's attributes
                string name = frames[frameIndex].Attributes["name"].Value;

                Frame.Region[] regions = RegionListBuilder.Build(frames[frameIndex], this.bitmaps);
                Frame.Text[]   texts   = TextListBuilder.Build(frames[frameIndex], this.fonts);
                this.frames.Add(name, new Frame(regions, texts));
            }
        }