예제 #1
0
        public virtual XElement GetXml()
        {
            XElement[] elements = new XElement[] {
                new XElement("Name", this.Name),
                new XElement("Rectangle", XmlConverter.FromRectangleF(this.PositionAndSize)),
                new XElement("IsShown", this.IsShown.ToString()),
                new XElement("ZPriority", this.ZPriority.ToString()),
                new XElement("MotherID", this.ParentNode == null ? "" : this.ParentNode.Name),
                new XElement("Group", this.Group),
                new XElement("ForceToHandleMouseEventsFlag", this.ForceToHandleMouseEventsFlag.ToString()),
                new XElement("ForceToNeverBeFoundFlag", this.ForceToNeverBeFoundFlag.ToString())
            };
            XElement widgetElement;

            if (this is SpecialBonusBaseShitWidget)
            {
                widgetElement = new XElement("root", elements);
            }
            else
            {
                widgetElement = new XElement("WidgetList", elements);
                WidgetType widgetType = Widget.WidgetTypes[this.GetType()];
                widgetElement.SetAttributeValue("classname", widgetType.ClassName);
                widgetElement.SetAttributeValue("classid", widgetType.ClassId);
            }
            return(widgetElement);
        }
예제 #2
0
 public XElement[] ToXml()
 {
     return(new XElement[] {
         new XElement("Texture", this.TexturePath),
         new XElement("TextureCoordinates", XmlConverter.FromRectangleF(this.TexturePosAndSize)),
         new XElement("Color", XmlConverter.FromColor(this.RGBA))
     });
 }