Exemple #1
0
        public Window(Window other)
            : base(other)
        {
            SelectedButtonIndex = new RingIndex();
            SelectedButtonIndex.UpperBound = other.SelectedButtonIndex.UpperBound;
            SelectedButtonIndex.Value = other.SelectedButtonIndex.Value;

            Buttons = new List<Button>();
            foreach (var button in other.Buttons)
            {
                // Add a copy
                Buttons.Add(new Button(button));
            }

            BackgroundTexture = other.BackgroundTexture;
            BackgroundTextureName = other.BackgroundTextureName;
        }
Exemple #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;
        }