public GuiButtonInfo Clone() { GuiButtonInfo btn = new GuiButtonInfo(); btn.Template = this.Template; btn.AnimationFrames = this.AnimationFrames; btn.AnimationTime = this.AnimationTime; btn.ButtonRect = this.ButtonRect; btn.Enabled = this.Enabled; btn.Font = this.Font; btn.ForeColor = this.ForeColor; btn.GuiMenuId = this.GuiMenuId; foreach (KeyValuePair <string, GuiButtonParam> par in this.Params) { btn.Params.Add(par.Key, par.Value.Clone()); } btn.Picture = this.Picture; btn.PictureColor = this.PictureColor; btn.Text = this.Text; btn.TextFormat = this.TextFormat; btn.Tooltip = this.Tooltip; return(btn); }
public virtual void FromXml(XmlNode node, bool loadButtons) { this.id = node.SelectSingleNode("Id").InnerText; this.textureArea = StructXml.RectangleFromXml(node.SelectSingleNode("TextureArea")); this.picture = node.SelectSingleNode("Picture").InnerText; this.location = StructXml.PointFromXml(node.SelectSingleNode("Location")); this.buttons.Clear(); if (loadButtons) { foreach (XmlNode xBtn in node.SelectSingleNode("Buttons")) { string typ = xBtn.Name; if (xBtn.Attributes["Template"] != null) { typ = xBtn.Attributes["Template"].Value; } GuiButtonInfo btn = GameEngine.Instance.GuiButtonTemplates[typ].Clone(); btn.GuiMenuId = this.id; this.buttons.Add(xBtn.Name, btn); } } }
public static GuiButtonInfo InvokeCreate(string typ) { GuiButtonInfo si = StructXml.CreateInstanceFromType(typ) as GuiButtonInfo; if (si == null) { return(new GuiButtonInfo()); } else { return(si); } }