Пример #1
0
        public DropDownMenu(GameScreen screen, DisplayLayer drawOrder, int itemNum, MenuItemInfo info)
            : base(screen, drawOrder, itemNum, info)
        {
            // drop-down menu
            dropdown = new VerticalMenu (screen, new WidgetInfo (), DisplayLayer.SubMenu);

            dropdown.ItemForegroundColor = DropDownForegroundColor;
            dropdown.ItemBackgroundColor = DropDownBackgroundColor;
            dropdown.ItemAlignX = HorizontalAlignment.Left;
            dropdown.ItemAlignY = VerticalAlignment.Center;
            dropdown.Border = new Border (new Color (0xb4, 0xff, 0x00), 5, 5, 0, 0);
            dropdown.IsVisible = false;

            // selected value
            MenuItemInfo valueInfo = new MenuItemInfo () {
                Text = "---",
                RelativePosition = () => ValuePosition (0),
                RelativeSize = () => ValueSize (0),
                OnClick = () => info.OnClick (),
            };
            selected = new MenuButton (screen, DisplayLayer.MenuItem, 0, valueInfo);
            selected.Info.ForegroundColor = () => DropDownForegroundColor (selected.ItemState);
            selected.Info.BackgroundColor = () => DropDownBackgroundColor (selected.ItemState);

            // action to open the drop-down menu
            info.OnClick = () => {
                GameScreens.VideoOptionScreen.Collapse (this);
                if (dropdown.IsVisible == true) {
                    dropdown.IsVisible = false;
                }
                else {
                    dropdown.IsVisible = true;
                }
            };
        }
Пример #2
0
 public virtual MenuButton AddButton(MenuItemInfo info)
 {
     int num = Items.Count;
     MenuButton item = new MenuButton (screen, ItemDisplayLayer, num, info);
     assignMenuItemInfo (ref info, num, item);
     Items.Add (item);
     return item;
 }