Artemis.Engine.Graphics.Animation.LoadSheetReader.Parse_Tile C# (CSharp) Метод

Parse_Tile() приватный Метод

private Parse_Tile ( XmlElement element, string groupName ) : void
element System.Xml.XmlElement
groupName string
Результат void
        private void Parse_Tile(XmlElement element, string groupName)
        {
            Rectangle tile = new Rectangle(0, 0, Texture.Width, Texture.Height);

            if (!groupName.Equals(string.Empty))
            {
                groupName += ".";  // Add GroupName sparator if not in global tile group
            }

            if (!GroupTiles.ContainsKey(groupName))
            {
                GroupTiles.Add(groupName, new List<Rectangle>());
            }

            foreach (XmlAttribute attrib in element.Attributes)
            {
                switch (attrib.Name)
                {
                    case TOP_LEFT:
                        Match coords = Regex.Match(attrib.Value, INT_REGEX + SPACE_REGEX + INT_REGEX);
                        tile.X = Convert.ToInt32(coords.Groups[1].Value.Trim());
                        tile.Y = Convert.ToInt32(coords.Groups[5].Value.Trim());
                        break;

                    case DIMENSIONS:
                        Match dimensions = Regex.Match(attrib.Value, INT_REGEX + DIMENSIONS_SPECE_REGEX + INT_REGEX);
                        tile.Width = Convert.ToInt32(dimensions.Groups[1].Value.Trim());
                        tile.Height = Convert.ToInt32(dimensions.Groups[6].Value.Trim());
                        break;

                    default:
                        break;
                }
            }

            GroupTiles[groupName].Add(tile);
        }