Example #1
0
        public Button(Button other)
            : base(other)
        {
            TextureOn = other.TextureOn;
            TextureOnName = other.TextureOnName;
            TextureOff = other.TextureOff;
            TextureOffName = other.TextureOffName;
            EventActivate = other.EventActivate;
            EventActivateData = other.EventActivateData;

            OnOffState = new State();
            OnOffState.Value = other.OnOffState.Value;
        }
Example #2
0
        public static Element Create(Element parent, string name, ConfigSection section)
        {
            var typeName = (string)section["type"];

            Debug.Assert(typeName != "root");

            Element result;

            switch (typeName)
            {
                case "button":
                    result = new Button(parent.Game);
                    break;
                case "window":
                    result = new Window(parent.Game);
                    break;
                default:
                    throw new NotSupportedException(
                        string.Format("Unsupported Element type: {0}",
                                      typeName));
            }

            result.Type = typeName;
            result.Parent = parent;
            result.Name = name;
            result.Initialize(section);

            return result;
        }