Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        public Element(Element other)
        {
            Debug.Assert(Type != "root");

            Game = other.Game;
            Type = other.Type;
            Name = other.Name;
            Position = other.Position;
            Dimensions = other.Dimensions;
            Parent = other.Parent;
        }