public CargoConsoleMenu(CargoConsoleBoundUserInterface owner)
        {
            IoCManager.InjectDependencies(this);
            Owner = owner;

            if (Owner.RequestOnly)
            {
                Title = Loc.GetString("Cargo Request Console");
            }
            else
            {
                Title = Loc.GetString("Cargo Shuttle Console");
            }

            var rows = new VBoxContainer();

            var accountName      = new HBoxContainer();
            var accountNameLabel = new Label {
                Text         = Loc.GetString("Account Name: "),
                StyleClasses = { StyleNano.StyleClassLabelKeyText }
            };

            _accountNameLabel = new Label {
                Text = "None" //Owner.Bank.Account.Name
            };
            accountName.AddChild(accountNameLabel);
            accountName.AddChild(_accountNameLabel);
            rows.AddChild(accountName);

            var points      = new HBoxContainer();
            var pointsLabel = new Label
            {
                Text         = Loc.GetString("Points: "),
                StyleClasses = { StyleNano.StyleClassLabelKeyText }
            };

            _pointsLabel = new Label
            {
                Text = "0" //Owner.Bank.Account.Balance.ToString()
            };
            points.AddChild(pointsLabel);
            points.AddChild(_pointsLabel);
            rows.AddChild(points);

            var shuttleStatus      = new HBoxContainer();
            var shuttleStatusLabel = new Label
            {
                Text         = Loc.GetString("Shuttle Status: "),
                StyleClasses = { StyleNano.StyleClassLabelKeyText }
            };

            _shuttleStatusLabel = new Label
            {
                Text = Loc.GetString("Away") // Shuttle.Status
            };
            shuttleStatus.AddChild(shuttleStatusLabel);
            shuttleStatus.AddChild(_shuttleStatusLabel);
            rows.AddChild(shuttleStatus);

            var shuttleCapacity      = new HBoxContainer();
            var shuttleCapacityLabel = new Label
            {
                Text         = Loc.GetString("Order Capacity: "),
                StyleClasses = { StyleNano.StyleClassLabelKeyText }
            };

            _shuttleCapacityLabel = new Label
            {
                Text = "0/20"
            };
            shuttleCapacity.AddChild(shuttleCapacityLabel);
            shuttleCapacity.AddChild(_shuttleCapacityLabel);
            rows.AddChild(shuttleCapacity);

            var buttons = new HBoxContainer();

            CallShuttleButton = new Button()
            {
                Text                = Loc.GetString("Call Shuttle"),
                TextAlign           = Label.AlignMode.Center,
                SizeFlagsHorizontal = SizeFlags.FillExpand
            };
            PermissionsButton = new Button()
            {
                Text      = Loc.GetString("Permissions"),
                TextAlign = Label.AlignMode.Center
            };
            buttons.AddChild(CallShuttleButton);
            buttons.AddChild(PermissionsButton);
            rows.AddChild(buttons);

            var category = new HBoxContainer();

            _categories = new OptionButton
            {
                Prefix = Loc.GetString("Categories: "),
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1
            };
            _searchBar = new LineEdit
            {
                PlaceHolder           = Loc.GetString("Search"),
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1
            };
            category.AddChild(_categories);
            category.AddChild(_searchBar);
            rows.AddChild(category);

            var products = new ScrollContainer()
            {
                SizeFlagsHorizontal   = SizeFlags.FillExpand,
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 6
            };

            Products = new VBoxContainer()
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
                SizeFlagsVertical   = SizeFlags.FillExpand
            };
            products.AddChild(Products);
            rows.AddChild(products);

            var requestsAndOrders = new PanelContainer
            {
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 6,
                PanelOverride         = new StyleBoxFlat {
                    BackgroundColor = Color.Black
                }
            };
            var orderScrollBox = new ScrollContainer
            {
                SizeFlagsVertical = SizeFlags.FillExpand
            };
            var rAndOVBox     = new VBoxContainer();
            var requestsLabel = new Label {
                Text = Loc.GetString("Requests")
            };

            _requests = new VBoxContainer // replace with scroll box so that approval buttons can be added
            {
                StyleClasses          = { "transparentItemList" },
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
            };
            var ordersLabel = new Label {
                Text = Loc.GetString("Orders")
            };

            _orders = new VBoxContainer
            {
                StyleClasses          = { "transparentItemList" },
                SizeFlagsVertical     = SizeFlags.FillExpand,
                SizeFlagsStretchRatio = 1,
            };
            rAndOVBox.AddChild(requestsLabel);
            rAndOVBox.AddChild(_requests);
            rAndOVBox.AddChild(ordersLabel);
            rAndOVBox.AddChild(_orders);
            orderScrollBox.AddChild(rAndOVBox);
            requestsAndOrders.AddChild(orderScrollBox);
            rows.AddChild(requestsAndOrders);

            rows.AddChild(new TextureButton
            {
                SizeFlagsVertical = SizeFlags.FillExpand,
            });
            Contents.AddChild(rows);

            CallShuttleButton.OnPressed += OnCallShuttleButtonPressed;
            _searchBar.OnTextChanged    += OnSearchBarTextChanged;
            _categories.OnItemSelected  += OnCategoryItemSelected;
        }
示例#2
0
        public SplitScreen(BaseScreenComponent manager) : base(manager)
        {
            Background = new BorderBrush(Color.Gray);                               //Hintergrundfarbe festlegen

            Button backButton = Button.TextButton(manager, "Back");                 //Neuen TextButton erzeugen

            backButton.HorizontalAlignment = HorizontalAlignment.Left;              //Links
            backButton.VerticalAlignment   = VerticalAlignment.Top;                 //Oben
            backButton.LeftMouseClick     += (s, e) => { manager.NavigateBack(); }; //KlickEvent festlegen
            Controls.Add(backButton);                                               //Button zum Screen hinzufügen



            //ScrollContainer
            ScrollContainer scrollContainer = new ScrollContainer(manager)  //Neuen ScrollContainer erzeugen
            {
                VerticalAlignment   = VerticalAlignment.Stretch,            // 100% Höhe
                HorizontalAlignment = HorizontalAlignment.Stretch           //100% Breite
            };

            Controls.Add(scrollContainer);                                  //ScrollContainer zum Root(Screen) hinzufügen



            //Stackpanel - SubControls werden Horizontal oder Vertikal gestackt
            StackPanel panel = new StackPanel(manager);                 //Neues Stackpanel erzeugen

            panel.VerticalAlignment = VerticalAlignment.Stretch;        //100% Höhe
            scrollContainer.Content = panel;                            //Ein Scroll Container kann nur ein Control beherbergen
            panel.ControlSpacing    = 20;

            //Label
            Label label = new Label(manager)
            {
                Text = "Control Showcase"
            };                                                              //Neues Label erzeugen

            panel.Controls.Add(label);                                      //Label zu Panel hinzufügen

            Button tB = Button.TextButton(manager, "TEST");

            tB.Background = new TextureBrush(LoadTexture2DFromFile("./test_texture_round.png", manager.GraphicsDevice), TextureBrushMode.Stretch);
            panel.Controls.Add(tB);

            //Button
            Button button = Button.TextButton(manager, "Dummy Button"); //Neuen TextButton erzeugen

            panel.Controls.Add(button);                                 //Button zu Panel hinzufügen

            //Progressbar
            ProgressBar pr = new ProgressBar(manager)                   //Neue ProgressBar erzeugen
            {
                Value  = 99,                                            //Aktueller Wert
                Height = 20,                                            //Höhe
                Width  = 200                                            //Breite
            };

            panel.Controls.Add(pr);                                     //ProgressBar zu Panel hinzufügen

            //ListBox
            Listbox <string> list = new Listbox <string>(manager);      //Neue ListBox erstellen

            list.TemplateGenerator = (item) =>                          //Template Generator festlegen
            {
                return(new Label(manager)
                {
                    Text = item
                });                                                     //Control (Label) erstellen
            };
            panel.Controls.Add(list);                                   //Liste zu Panel hinzufügen

            list.Items.Add("Hallo");                                    //Items zur Liste hinzufügen
            list.Items.Add("Welt");                                     //...

            //Combobox
            Combobox <string> combobox = new Combobox <string>(manager) //Neue Combobox erstellen
            {
                Height = 20,                                            //Höhe 20
                Width  = 100                                            //Breite 100
            };

            combobox.TemplateGenerator = (item) =>                      //Template Generator festlegen
            {
                return(new Label(manager)
                {
                    Text = item
                });                                                     //Control (Label) erstellen
            };
            panel.Controls.Add(combobox);                               //Combobox zu Panel  hinzufügen

            combobox.Items.Add("Combobox");                             //Items zu Combobox hinzufügen
            combobox.Items.Add("Item");
            combobox.Items.Add("Hallo");


            Button clearCombobox = Button.TextButton(manager, "Clear Combobox");

            clearCombobox.LeftMouseClick += (s, e) => {
                combobox.Items.Clear();
                list.Items.Clear();
            };
            panel.Controls.Add(clearCombobox);

            //Slider Value Label
            Label labelSliderHorizontal = new Label(manager);

            //Horizontaler Slider
            Slider sliderHorizontal = new Slider(manager)
            {
                Width  = 150,
                Height = 20,
            };

            sliderHorizontal.ValueChanged += (value) => { labelSliderHorizontal.Text = "Value: " + value; }; //Event on Value Changed
            panel.Controls.Add(sliderHorizontal);
            labelSliderHorizontal.Text = "Value: " + sliderHorizontal.Value;                                 //Set Text initially
            panel.Controls.Add(labelSliderHorizontal);

            //Slider Value Label
            Label labelSliderVertical = new Label(manager);

            //Vertikaler Slider
            Slider sliderVertical = new Slider(manager)
            {
                Range       = 100,
                Height      = 200,
                Width       = 20,
                Orientation = Orientation.Vertical
            };

            sliderVertical.ValueChanged += (value) => { labelSliderVertical.Text = "Value: " + value; };
            panel.Controls.Add(sliderVertical);
            labelSliderVertical.Text = "Value: " + sliderVertical.Value;
            panel.Controls.Add(labelSliderVertical);

            Checkbox checkbox = new Checkbox(manager);

            panel.Controls.Add(checkbox);


            //Textbox
            textbox = new Textbox(manager)                              //Neue TextBox erzeugen
            {
                Background          = new BorderBrush(Color.LightGray), //Festlegen eines Backgrounds für ein Control
                HorizontalAlignment = HorizontalAlignment.Stretch,      //100% Breite
                Text     = "TEXTBOX!",                                  //Voreingestellter text
                MinWidth = 100                                          //Eine Textbox kann ihre Größe automatisch anpassen
            };

            Button clearTextbox = new Button(manager);

            clearTextbox.LeftMouseClick += (s, e) =>
            {
                textbox.SelectionStart = 0;
                textbox.Text           = "";
            };
            panel.Controls.Add(clearTextbox);
            panel.Controls.Add(textbox);                                //Textbox zu Panel hinzufügen
        }
示例#3
0
            public StorageWindow()
            {
                Title           = "Storage Item";
                RectClipContent = true;

                var containerButton = new ContainerButton
                {
                    SizeFlagsHorizontal = SizeFlags.Fill,
                    SizeFlagsVertical   = SizeFlags.Fill,
                    MouseFilter         = MouseFilterMode.Pass,
                };

                var innerContainerButton = new PanelContainer
                {
                    PanelOverride       = _unHoveredBox,
                    SizeFlagsHorizontal = SizeFlags.Fill,
                    SizeFlagsVertical   = SizeFlags.Fill,
                };


                containerButton.AddChild(innerContainerButton);
                containerButton.OnPressed += args =>
                {
                    var controlledEntity = IoCManager.Resolve <IPlayerManager>().LocalPlayer.ControlledEntity;

                    if (controlledEntity.TryGetComponent(out IHandsComponent hands))
                    {
                        StorageEntity.SendNetworkMessage(new InsertEntityMessage());
                    }
                };

                VSplitContainer = new VBoxContainer()
                {
                    MouseFilter = MouseFilterMode.Ignore,
                };
                containerButton.AddChild(VSplitContainer);
                Information = new Label
                {
                    Text = "Items: 0 Volume: 0/0 Stuff",
                    SizeFlagsVertical = SizeFlags.ShrinkCenter
                };
                VSplitContainer.AddChild(Information);

                var listScrollContainer = new ScrollContainer
                {
                    SizeFlagsVertical   = SizeFlags.FillExpand,
                    SizeFlagsHorizontal = SizeFlags.FillExpand,
                    HScrollEnabled      = true,
                    VScrollEnabled      = true,
                };

                EntityList = new VBoxContainer
                {
                    SizeFlagsHorizontal = SizeFlags.FillExpand
                };
                listScrollContainer.AddChild(EntityList);
                VSplitContainer.AddChild(listScrollContainer);

                Contents.AddChild(containerButton);

                listScrollContainer.OnMouseEntered += args =>
                {
                    innerContainerButton.PanelOverride = _HoveredBox;
                };

                listScrollContainer.OnMouseExited += args =>
                {
                    innerContainerButton.PanelOverride = _unHoveredBox;
                };
            }
示例#4
0
 public override void _Ready()
 {
     MenuRoot         = Game.RuntimeRoot.GetNode("MenuRoot");
     ShadedBackground = MenuRoot.GetNode <Panel>("ShadedBackground");
     Center           = MenuRoot.GetNode <ScrollContainer>("HBox/Center");
 }
示例#5
0
 public TreeContainer()
 {
     Masking      = true;
     CornerRadius = 5;
     Position     = new Vector2(100, 100);
     Size         = new Vector2(width, height);
     AddInternal(new Drawable[]
     {
         new Box
         {
             Colour           = new Color4(30, 30, 30, 240),
             RelativeSizeAxes = Axes.Both,
             Depth            = 0
         },
         new FillFlowContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Direction        = FillDirection.Vertical,
             Children         = new Drawable[]
             {
                 titleBar = new Box //title decoration
                 {
                     Colour           = Color4.DarkBlue,
                     RelativeSizeAxes = Axes.X,
                     Size             = new Vector2(1, 20),
                 },
                 new Container //toolbar
                 {
                     RelativeSizeAxes = Axes.X,
                     Size             = new Vector2(1, 40),
                     Children         = new Drawable[]
                     {
                         new Box
                         {
                             Colour           = new Color4(20, 20, 20, 255),
                             RelativeSizeAxes = Axes.Both,
                         },
                         new FillFlowContainer
                         {
                             RelativeSizeAxes = Axes.Both,
                             Spacing          = new Vector2(1),
                             Children         = new Drawable[]
                             {
                                 new Button
                                 {
                                     BackgroundColour = Color4.DarkGray,
                                     Size             = new Vector2(100, 1),
                                     RelativeSizeAxes = Axes.Y,
                                     Text             = @"Choose Target",
                                     Action           = delegate { ChooseTarget?.Invoke(); }
                                 },
                                 new Button
                                 {
                                     BackgroundColour = Color4.DarkGray,
                                     Size             = new Vector2(100, 1),
                                     RelativeSizeAxes = Axes.Y,
                                     Text             = @"Up one parent",
                                     Action           = delegate { GoUpOneParent?.Invoke(); },
                                 },
                             },
                         },
                     },
                 },
             },
         },
         new Container
         {
             RelativeSizeAxes = Axes.Both,
             Padding          = new MarginPadding {
                 Top = 65
             },
             Children = new[] { scroll = new ScrollContainer {
                                    RelativeSizeAxes = Axes.Both
                                } }
         },
         waitingText = new SpriteText
         {
             Text   = @"Waiting for target selection...",
             Anchor = Anchor.Centre,
             Origin = Anchor.Centre,
         }
     });
 }
示例#6
0
        public InventoryControl(ScreenComponent manager, int columns = COLUMNS) : base(manager)
        {
            ScrollContainer scroll = new ScrollContainer(manager)
            {
                Margin = new Border(0, 0, 0, 0),
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
            };

            Controls.Add(scroll);

            Grid grid = new Grid(manager)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            for (int i = 0; i < columns; i++)
            {
                grid.Columns.Add(new ColumnDefinition()
                {
                    ResizeMode = ResizeMode.Parts, Width = 1
                });
            }
            int rows = (int)System.Math.Ceiling((float)manager.Game.Player.Inventory.Inventory.Count / columns);

            for (int i = 0; i < rows; i++)
            {
                grid.Rows.Add(new RowDefinition()
                {
                    ResizeMode = ResizeMode.Fixed, Height = 50
                });
            }

            int column = 0;
            int row    = 0;

            foreach (var item in manager.Game.Player.Inventory.Inventory)
            {
                Texture2D texture = manager.Game.Assets.LoadTexture(item.Definition.GetType(), item.Definition.Icon);

                var image = new Image(manager)
                {
                    Texture = texture, Width = 42, Height = 42, VerticalAlignment = VerticalAlignment.Center
                };
                image.MouseEnter += (s, e) => { HoveredSlot = item; };
                image.MouseLeave += (s, e) => { HoveredSlot = null; };
                image.StartDrag  += (e) =>
                {
                    e.Handled = true;
                    e.Icon    = texture;
                    e.Content = item;
                    e.Sender  = image;
                };
                var label = new Label(manager)
                {
                    Text = item.Amount.ToString(), HorizontalAlignment = HorizontalAlignment.Right, VerticalTextAlignment = VerticalAlignment.Bottom, Background = new BorderBrush(Color.White)
                };
                grid.AddControl(image, column, row);
                grid.AddControl(label, column, row);

                column++;
                if (column >= columns)
                {
                    row++;
                    column = 0;
                }
            }

            scroll.Content = grid;
        }
        private async void ScrollLater()
        {
            await Task.Delay(150);

            await ScrollContainer.ScrollToAsync(300, 200, false);
        }
示例#8
0
        private void load(OsuGame game, OsuColour colours)
        {
            sections = new OptionsSection[]
            {
                new GeneralSection(),
                new GraphicsSection(),
                new GameplaySection(),
                new AudioSection(),
                new SkinSection(),
                new InputSection(),
                new EditorSection(),
                new OnlineSection(),
                new MaintenanceSection(),
                new DebugSection(),
            };
            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.6f,
                },
                scrollContainer = new ScrollContainer
                {
                    ScrollDraggerVisible = false,
                    RelativeSizeAxes     = Axes.Y,
                    Width  = width,
                    Margin = new MarginPadding {
                        Left = SIDEBAR_WIDTH
                    },
                    Children = new[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Direction        = FillDirection.Vertical,

                            Children = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Text     = "settings",
                                    TextSize = 40,
                                    Margin   = new MarginPadding {
                                        Left = CONTENT_MARGINS, Top = Toolbar.Toolbar.TOOLTIP_HEIGHT
                                    },
                                },
                                new OsuSpriteText
                                {
                                    Colour   = colours.Pink,
                                    Text     = "Change the way osu! behaves",
                                    TextSize = 18,
                                    Margin   = new MarginPadding {
                                        Left = CONTENT_MARGINS, Bottom = 30
                                    },
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes     = Axes.Y,
                                    RelativeSizeAxes = Axes.X,
                                    Direction        = FillDirection.Vertical,
                                    Children         = sections,
                                }
                            }
                        }
                    }
                },
                sidebar = new Sidebar
                {
                    Width    = SIDEBAR_WIDTH,
                    Children = sidebarButtons = sections.Select(section =>
                                                                new SidebarButton
                    {
                        Selected = sections[0] == section,
                        Section  = section,
                        Action   = () => scrollContainer.ScrollIntoView(section),
                    }
                                                                ).ToArray()
                }
            };

            scrollContainer.Padding = new MarginPadding {
                Top = game?.Toolbar.DrawHeight ?? 0
            };
        }
示例#9
0
        /// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
        public PlaySongSelect(BeatmapDatabase database = null)
        {
            this.database = database;

            const float scrollWidth      = 640;
            const float bottomToolHeight = 50;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Size             = Vector2.One,
                    Padding          = new MarginPadding {
                        Right = scrollWidth - 200
                    },
                    Children = new[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Size             = new Vector2(1, 0.5f),
                            Colour           = new Color4(0, 0, 0, 0.5f),
                            Shear            = new Vector2(0.15f, 0),
                        },
                        new Box
                        {
                            RelativeSizeAxes     = Axes.Both,
                            RelativePositionAxes = Axes.Y,
                            Size     = new Vector2(1, -0.5f),
                            Position = new Vector2(0, 1),
                            Colour   = new Color4(0, 0, 0, 0.5f),
                            Shear    = new Vector2(-0.15f, 0),
                        },
                    }
                },
                scrollContainer = new ScrollContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(scrollWidth, 1),
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                    Children         = new Drawable[]
                    {
                        setList = new FlowContainer
                        {
                            Padding = new MarginPadding {
                                Left = 25, Top = 25, Bottom = 25 + bottomToolHeight
                            },
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FlowDirection.VerticalOnly,
                            Spacing          = new Vector2(0, 5),
                        }
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = bottomToolHeight,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Size             = Vector2.One,
                            Colour           = new Color4(0, 0, 0, 0.5f),
                        },
                        new Button
                        {
                            Anchor           = Anchor.CentreRight,
                            Origin           = Anchor.CentreRight,
                            RelativeSizeAxes = Axes.Y,
                            Width            = 100,
                            Text             = "Play",
                            Colour           = new Color4(238, 51, 153, 255),
                            Action           = () => Push(new Player {
                                BeatmapInfo = selectedBeatmapGroup.SelectedPanel.Beatmap,
                                PlayMode    = playMode.Value
                            }),
                        },
                    }
                }
            };
        }
 protected override void OnAppearing()
 {
     base.OnAppearing();
     ScrollContainer.ScrollToAsync(300, 200, true);
 }
示例#11
0
        public OptionsOverlay()
        {
            sections = new OptionsSection[]
            {
                new GeneralSection(),
                new GraphicsSection(),
                new GameplaySection(),
                new AudioSection(),
                new SkinSection(),
                new InputSection(),
                new EditorSection(),
                new OnlineSection(),
                new MaintenanceSection(),
            };

            RelativeSizeAxes = Axes.Y;
            AutoSizeAxes     = Axes.X;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.6f,
                },
                scrollContainer = new ScrollContainer
                {
                    ScrollDraggerVisible = false,
                    RelativeSizeAxes     = Axes.Y,
                    Width  = width,
                    Margin = new MarginPadding {
                        Left = sidebar_width
                    },
                    Children = new[]
                    {
                        new FlowContainer
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Direction        = FlowDirection.VerticalOnly,

                            Children = new Drawable[]
                            {
                                new SpriteText
                                {
                                    Text     = "settings",
                                    TextSize = 40,
                                    Margin   = new MarginPadding {
                                        Left = CONTENT_MARGINS, Top = 30
                                    },
                                },
                                new SpriteText
                                {
                                    Colour   = new Color4(255, 102, 170, 255),
                                    Text     = "Change the way osu! behaves",
                                    TextSize = 18,
                                    Margin   = new MarginPadding {
                                        Left = CONTENT_MARGINS, Bottom = 30
                                    },
                                },
                                new FlowContainer
                                {
                                    AutoSizeAxes     = Axes.Y,
                                    RelativeSizeAxes = Axes.X,
                                    Direction        = FlowDirection.VerticalOnly,
                                    Children         = sections,
                                }
                            }
                        }
                    }
                },
                sidebar = new OptionsSidebar
                {
                    Width    = sidebar_width,
                    Children = sidebarButtons = sections.Select(section =>
                                                                new SidebarButton
                    {
                        Selected = sections[0] == section,
                        Section  = section,
                        Action   = () => scrollContainer.ScrollIntoView(section),
                    }
                                                                ).ToArray()
                }
            };
        }
示例#12
0
        public RoomInspector()
        {
            Width            = 520;
            RelativeSizeAxes = Axes.Y;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"343138"),
                },
                topFlow = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 200,
                            Masking          = true,
                            Children         = new Drawable[]
                            {
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4.Black,
                                        },
                                        coverContainer = new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                        },
                                    },
                                },
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding(20),
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer
                                        {
                                            Anchor         = Anchor.TopRight,
                                            Origin         = Anchor.TopRight,
                                            AutoSizeAxes   = Axes.Both,
                                            Direction      = FillDirection.Horizontal,
                                            LayoutDuration = transition_duration,
                                            Children       = new[]
                                            {
                                                participants = new OsuSpriteText
                                                {
                                                    TextSize = 30,
                                                    Font     = @"Exo2.0-Bold"
                                                },
                                                participantsSlash = new OsuSpriteText
                                                {
                                                    Text     = @"/",
                                                    TextSize = 30,
                                                    Font     = @"Exo2.0-Light"
                                                },
                                                maxParticipants = new OsuSpriteText
                                                {
                                                    TextSize = 30,
                                                    Font     = @"Exo2.0-Light"
                                                },
                                            },
                                        },
                                        name = new OsuSpriteText
                                        {
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft,
                                            TextSize = 30,
                                        },
                                    },
                                },
                            },
                        },
                        statusStrip = new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 5,
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = OsuColour.FromHex(@"28242d"),
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = contentPadding,
                                    Spacing          = new Vector2(0f, 5f),
                                    Children         = new Drawable[]
                                    {
                                        status = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-Bold",
                                        },
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes   = Axes.X,
                                            Height         = 30,
                                            Direction      = FillDirection.Horizontal,
                                            LayoutDuration = transition_duration,
                                            Spacing        = new Vector2(5f, 0f),
                                            Children       = new Drawable[]
                                            {
                                                modeTypeInfo = new ModeTypeInfo(),
                                                new Container
                                                {
                                                    AutoSizeAxes     = Axes.X,
                                                    RelativeSizeAxes = Axes.Y,
                                                    Margin           = new MarginPadding {
                                                        Left = 5
                                                    },
                                                    Children = new[]
                                                    {
                                                        new FillFlowContainer
                                                        {
                                                            AutoSizeAxes = Axes.Both,
                                                            Direction    = FillDirection.Horizontal,
                                                            Children     = new[]
                                                            {
                                                                beatmapTitle = new OsuSpriteText
                                                                {
                                                                    Font = @"Exo2.0-BoldItalic",
                                                                },
                                                                beatmapDash = new OsuSpriteText
                                                                {
                                                                    Font = @"Exo2.0-BoldItalic",
                                                                },
                                                                beatmapArtist = new OsuSpriteText
                                                                {
                                                                    Font = @"Exo2.0-RegularItalic",
                                                                },
                                                            },
                                                        },
                                                        beatmapAuthor = new OsuSpriteText
                                                        {
                                                            Anchor   = Anchor.BottomLeft,
                                                            Origin   = Anchor.BottomLeft,
                                                            TextSize = 14,
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Padding          = contentPadding,
                            Children         = new Drawable[]
                            {
                                participantInfo = new ParticipantInfo(@"Rank Range "),
                            },
                        },
                    },
                },
                participantsScroll = new OsuScrollContainer
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Padding          = new MarginPadding {
                        Top = contentPadding.Top, Left = 38, Right = 37
                    },
                    Children = new[]
                    {
                        participantsFlow = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            LayoutDuration   = transition_duration,
                            Spacing          = new Vector2(5f),
                        },
                    },
                },
            };

            nameBind.ValueChanged            += displayName;
            hostBind.ValueChanged            += displayUser;
            typeBind.ValueChanged            += displayGameType;
            maxParticipantsBind.ValueChanged += displayMaxParticipants;
            participantsBind.ValueChanged    += displayParticipants;
        }
        /// <summary>
        ///     Places a HitObject at a given lane.
        /// </summary>
        /// <param name="inputDevice"></param>
        /// <param name="lane"></param>
        /// <param name="time"></param>
        private void PlaceObject(CompositionInputDevice inputDevice, int lane, double time)
        {
            var am = ActionManager as EditorActionManagerKeys;

            if (HandlePendingLongNoteReleases(lane, time))
            {
                return;
            }

            // Find an existing object in the current lane at the same time, so we can determine if
            // the object should be placed or deleted accordingly.
            HitObjectInfo           existingObject = null;
            DrawableEditorHitObject hoveredObject  = null;

            switch (inputDevice)
            {
            case CompositionInputDevice.Keyboard:
                existingObject = WorkingMap.HitObjects.Find(x => x.StartTime == (int)time && x.Lane == lane);
                break;

            case CompositionInputDevice.Mouse:
                hoveredObject = ScrollContainer.GetHoveredHitObject();

                if (hoveredObject != null)
                {
                    existingObject = hoveredObject.Info;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(inputDevice), inputDevice, null);
            }

            // There's no object currently at this position, so add it.
            if (existingObject == null)
            {
                switch (CompositionTool.Value)
                {
                case EditorCompositionTool.Note:
                    am?.PlaceHitObject(lane, time);
                    break;

                case EditorCompositionTool.LongNote:
                    am?.PlaceLongNote(lane, time);

                    // Makes sure the long note is marked as pending, so any future objects placed in this lane
                    // will be awarded to this LN's end.
                    var workingObject = WorkingMap.HitObjects.Find(x => x.StartTime == (int)time && x.Lane == lane);
                    PendingLongNoteReleases[lane - 1] = workingObject;

                    // Make the long note appear as inactive/dead. Gives a visual effect to the user that
                    // they need to do something with the note.
                    if (!(ScrollContainer.HitObjects.Find(x => x.Info == workingObject) is DrawableEditorHitObjectLong drawable))
                    {
                        return;
                    }

                    drawable.AppearAsInactive();

                    if (!GaveLongNoteGuide)
                    {
                        NotificationManager.Show(NotificationLevel.Info, "Scroll through the timeline and place the end of the long note.");
                        GaveLongNoteGuide = true;
                    }
                    break;

                default:
                    NotificationManager.Show(NotificationLevel.Error, "This tool isn't implemented yet. Choose another!");
                    break;
                }
            }
            // An object exists, so delete it.
            else
            {
                switch (inputDevice)
                {
                case CompositionInputDevice.Keyboard:
                    am?.DeleteHitObject(existingObject);
                    break;

                case CompositionInputDevice.Mouse:
                    // hoveredObject?.AppearAsSelected();
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(inputDevice), inputDevice, null);
                }
            }
        }
        /// <summary>
        ///     Handles the selecting of hitobjects
        /// </summary>
        private void HandleHitObjectSelection()
        {
            if (MouseManager.PreviousState.LeftButton == ButtonState.Released &&
                MouseManager.CurrentState.LeftButton == ButtonState.Pressed)
            {
                MouseInitialClickPosition = MouseManager.CurrentState.Position;
            }

            if (!MouseManager.IsUniqueClick(MouseButton.Left) || View.MenuBar.IsActive)
            {
                return;
            }

            if (CompositionTool.Value == EditorCompositionTool.Select)
            {
                var hoveredObject = ScrollContainer.GetHoveredHitObject();

                // Compare the y positions of the mouse when the user clicked the object initially, vs when they released.
                var relativeY  = ScrollContainer.HitPositionY - (int)ScrollContainer.GetTimeFromY(MouseInitialClickPosition.Y);
                var relativeY2 = ScrollContainer.HitPositionY - (int)ScrollContainer.GetTimeFromY(MouseManager.CurrentState.Y);

                // Give a little bit of leniency for the mouse to move.
                if (Math.Abs(relativeY2 - relativeY) > 2)
                {
                    return;
                }

                // User has clicked on a new object and wants to select it.
                if (hoveredObject != null)
                {
                    // Object isn't hovered, so we need to add it
                    if (!SelectedHitObjects.Contains(hoveredObject))
                    {
                        SelectHitObject(hoveredObject);
                    }

                    if (KeyboardManager.CurrentState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) ||
                        KeyboardManager.CurrentState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl))
                    {
                        return;
                    }

                    // In the event that the user isn't pressing control, deselect all other hitobjects
                    for (var i = SelectedHitObjects.Count - 1; i >= 0; i--)
                    {
                        if (SelectedHitObjects[i] != hoveredObject)
                        {
                            DeselectHitObject(SelectedHitObjects[i]);
                        }
                    }

                    return;
                }
            }

            // Don't deselect if the user is in the hitsound panel.
            if (GraphicsHelper.RectangleContains(View.HitsoundEditor.ScreenRectangle, MouseManager.CurrentState.Position))
            {
                return;
            }

            for (var i = SelectedHitObjects.Count - 1; i >= 0; i--)
            {
                DeselectHitObject(SelectedHitObjects[i]);
            }
        }
        public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, RoundEndMessageEvent.RoundEndPlayerInfo[] info)
        {
            MinSize = SetSize = (520, 580);

            Title = Loc.GetString("round-end-summary-window-title");

            //Round End Window is split into two tabs, one about the round stats
            //and the other is a list of RoundEndPlayerInfo for each player.
            //This tab would be a good place for things like: "x many people died.",
            //"clown slipped the crew x times.", "x shots were fired this round.", etc.
            //Also good for serious info.
            RoundEndSummaryTab = new VBoxContainer()
            {
                Name = Loc.GetString("round-end-summary-window-round-end-summary-tab-title")
            };

            //Tab for listing  unique info per player.
            PlayerManifestoTab = new VBoxContainer()
            {
                Name = Loc.GetString("round-end-summary-window-player-manifesto-tab-title")
            };

            RoundEndWindowTabs = new TabContainer();
            RoundEndWindowTabs.AddChild(RoundEndSummaryTab);
            RoundEndWindowTabs.AddChild(PlayerManifestoTab);

            Contents.AddChild(RoundEndWindowTabs);

            //Gamemode Name
            var gamemodeLabel = new RichTextLabel();

            gamemodeLabel.SetMarkup(Loc.GetString("round-end-summary-window-gamemode-name-label", ("gamemode", gm)));
            RoundEndSummaryTab.AddChild(gamemodeLabel);

            //Round end text
            if (!string.IsNullOrEmpty(roundEnd))
            {
                var roundEndLabel = new RichTextLabel();
                roundEndLabel.SetMarkup(Loc.GetString(roundEnd));
                RoundEndSummaryTab.AddChild(roundEndLabel);
            }

            //Duration
            var roundTimeLabel = new RichTextLabel();

            roundTimeLabel.SetMarkup(Loc.GetString("round-end-summary-window-duration-label",
                                                   ("hours", roundTimeSpan.Hours),
                                                   ("minutes", roundTimeSpan.Minutes),
                                                   ("seconds", roundTimeSpan.Seconds)));
            RoundEndSummaryTab.AddChild(roundTimeLabel);

            //Initialize what will be the list of players display.
            var scrollContainer = new ScrollContainer
            {
                VerticalExpand = true
            };
            var innerScrollContainer = new VBoxContainer();

            //Put observers at the bottom of the list. Put antags on top.
            var manifestSortedList = info.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);

            //Create labels for each player info.
            foreach (var playerInfo in manifestSortedList)
            {
                var playerInfoText = new RichTextLabel();

                if (playerInfo.PlayerICName != null)
                {
                    if (playerInfo.Observer)
                    {
                        playerInfoText.SetMarkup(
                            Loc.GetString("round-end-summary-window-player-info-if-observer-text",
                                          ("playerOOCName", playerInfo.PlayerOOCName),
                                          ("playerICName", playerInfo.PlayerICName)));
                    }
                    else
                    {
                        //TODO: On Hover display a popup detailing more play info.
                        //For example: their antag goals and if they completed them sucessfully.
                        var icNameColor = playerInfo.Antag ? "red" : "white";
                        playerInfoText.SetMarkup(
                            Loc.GetString("round-end-summary-window-player-info-if-not-observer-text",
                                          ("playerOOCName", playerInfo.PlayerOOCName),
                                          ("icNameColor", icNameColor),
                                          ("playerICName", playerInfo.PlayerICName),
                                          ("playerRole", Loc.GetString(playerInfo.Role))));
                    }
                }
                innerScrollContainer.AddChild(playerInfoText);
            }

            scrollContainer.AddChild(innerScrollContainer);
            //Attach the entire ScrollContainer that holds all the playerinfo.
            PlayerManifestoTab.AddChild(scrollContainer);

            //Finally, display the window.
            OpenCentered();
            MoveToFront();
        }
示例#16
0
 public override void _Ready()
 {
     popup = GetNode <CustomConfirmationDialog>(PopupPath);
     organelleSpecificContent = GetNode <Container>(OrganelleSpecificContentPath);
     scrollContainer          = GetNode <ScrollContainer>(ScrollContainerPath);
 }
        public override void Initialize(SS14Window window, object obj)
        {
            _entity = (IEntity)obj;

            var scrollContainer = new ScrollContainer();

            //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true);
            window.Contents.AddChild(scrollContainer);
            var vBoxContainer = new BoxContainer
            {
                Orientation = LayoutOrientation.Vertical
            };

            scrollContainer.AddChild(vBoxContainer);

            // Handle top bar displaying type and ToString().
            {
                Control top;
                var     stringified = PrettyPrint.PrintUserFacingWithType(obj, out var typeStringified);
                if (typeStringified != "")
                {
                    //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10);
                    // Custom ToString() implementation.
                    var headBox = new BoxContainer
                    {
                        Orientation        = LayoutOrientation.Vertical,
                        SeparationOverride = 0
                    };
                    headBox.AddChild(new Label {
                        Text = stringified, ClipText = true
                    });
                    headBox.AddChild(new Label
                    {
                        Text = typeStringified,
                        //    FontOverride = smallFont,
                        FontColorOverride = Color.DarkGray,
                        ClipText          = true
                    });
                    top = headBox;
                }
                else
                {
                    top = new Label {
                        Text = stringified
                    };
                }

                if (_entity.TryGetComponent(out ISpriteComponent? sprite))
                {
                    var hBox = new BoxContainer
                    {
                        Orientation = LayoutOrientation.Horizontal
                    };
                    top.HorizontalExpand = true;
                    hBox.AddChild(top);
                    hBox.AddChild(new SpriteView {
                        Sprite = sprite, OverrideDirection = Direction.South
                    });
                    vBoxContainer.AddChild(hBox);
                }
                else
                {
                    vBoxContainer.AddChild(top);
                }
            }

            _tabs = new TabContainer();
            _tabs.OnTabChanged += _tabsOnTabChanged;
            vBoxContainer.AddChild(_tabs);

            var clientVBox = new BoxContainer
            {
                Orientation        = LayoutOrientation.Vertical,
                SeparationOverride = 0
            };

            _tabs.AddChild(clientVBox);
            _tabs.SetTabTitle(TabClientVars, Loc.GetString("view-variable-instance-entity-client-variables-tab-title"));

            var first = true;

            foreach (var group in LocalPropertyList(obj, ViewVariablesManager, _robustSerializer))
            {
                ViewVariablesTraitMembers.CreateMemberGroupHeader(
                    ref first,
                    TypeAbbreviation.Abbreviate(group.Key),
                    clientVBox);

                foreach (var control in group)
                {
                    clientVBox.AddChild(control);
                }
            }

            _clientComponents = new BoxContainer
            {
                Orientation        = LayoutOrientation.Vertical,
                SeparationOverride = 0
            };
            _tabs.AddChild(_clientComponents);
            _tabs.SetTabTitle(TabClientComponents, Loc.GetString("view-variable-instance-entity-client-components-tab-title"));

            PopulateClientComponents();

            if (!_entity.Uid.IsClientSide())
            {
                _serverVariables = new BoxContainer
                {
                    Orientation        = LayoutOrientation.Vertical,
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverVariables);
                _tabs.SetTabTitle(TabServerVars, Loc.GetString("view-variable-instance-entity-server-variables-tab-title"));

                _serverComponents = new BoxContainer
                {
                    Orientation        = LayoutOrientation.Vertical,
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverComponents);
                _tabs.SetTabTitle(TabServerComponents, Loc.GetString("view-variable-instance-entity-server-components-tab-title"));

                PopulateServerComponents(false);
            }
        }
        public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, List <RoundEndPlayerInfo> info)
        {
            MinSize = SetSize = (520, 580);

            Title = Loc.GetString("Round End Summary");

            //Round End Window is split into two tabs, one about the round stats
            //and the other is a list of RoundEndPlayerInfo for each player.
            //This tab would be a good place for things like: "x many people died.",
            //"clown slipped the crew x times.", "x shots were fired this round.", etc.
            //Also good for serious info.
            RoundEndSummaryTab = new VBoxContainer()
            {
                Name = Loc.GetString("Round Information")
            };

            //Tab for listing  unique info per player.
            PlayerManifestoTab = new VBoxContainer()
            {
                Name = Loc.GetString("Player Manifesto")
            };

            RoundEndWindowTabs = new TabContainer();
            RoundEndWindowTabs.AddChild(RoundEndSummaryTab);
            RoundEndWindowTabs.AddChild(PlayerManifestoTab);

            Contents.AddChild(RoundEndWindowTabs);

            //Gamemode Name
            var gamemodeLabel = new RichTextLabel();

            gamemodeLabel.SetMarkup(Loc.GetString("Round of [color=white]{0}[/color] has ended.", gm));
            RoundEndSummaryTab.AddChild(gamemodeLabel);

            //Round end text
            if (!string.IsNullOrEmpty(roundEnd))
            {
                var roundEndLabel = new RichTextLabel();
                roundEndLabel.SetMarkup(Loc.GetString(roundEnd));
                RoundEndSummaryTab.AddChild(roundEndLabel);
            }

            //Duration
            var roundTimeLabel = new RichTextLabel();

            roundTimeLabel.SetMarkup(Loc.GetString("It lasted for [color=yellow]{0} hours, {1} minutes, and {2} seconds.",
                                                   roundTimeSpan.Hours, roundTimeSpan.Minutes, roundTimeSpan.Seconds));
            RoundEndSummaryTab.AddChild(roundTimeLabel);

            //Initialize what will be the list of players display.
            var scrollContainer = new ScrollContainer();

            scrollContainer.VerticalExpand = true;
            var innerScrollContainer = new VBoxContainer();

            //Put observers at the bottom of the list. Put antags on top.
            var manifestSortedList = info.OrderBy(p => p.Observer).ThenBy(p => !p.Antag);

            //Create labels for each player info.
            foreach (var playerInfo in manifestSortedList)
            {
                var playerInfoText = new RichTextLabel();

                if (playerInfo.PlayerICName != null)
                {
                    if (playerInfo.Observer)
                    {
                        playerInfoText.SetMarkup(
                            Loc.GetString("[color=gray]{0}[/color] was [color=lightblue]{1}[/color], an observer.",
                                          playerInfo.PlayerOOCName, playerInfo.PlayerICName));
                    }
                    else
                    {
                        //TODO: On Hover display a popup detailing more play info.
                        //For example: their antag goals and if they completed them sucessfully.
                        var icNameColor = playerInfo.Antag ? "red" : "white";
                        playerInfoText.SetMarkup(
                            Loc.GetString("[color=gray]{0}[/color] was [color={1}]{2}[/color] playing role of [color=orange]{3}[/color].",
                                          playerInfo.PlayerOOCName, icNameColor, playerInfo.PlayerICName, Loc.GetString(playerInfo.Role)));
                    }
                }
                innerScrollContainer.AddChild(playerInfoText);
            }

            scrollContainer.AddChild(innerScrollContainer);
            //Attach the entire ScrollContainer that holds all the playerinfo.
            PlayerManifestoTab.AddChild(scrollContainer);

            //Finally, display the window.
            OpenCentered();
            MoveToFront();
        }
示例#19
0
        private void load(OsuGame game, OsuColour colours)
        {
            sections = new OptionsSection[]
            {
                new GeneralSection(),
                new GraphicsSection(),
                new GameplaySection(),
                new AudioSection(),
                new SkinSection(),
                new InputSection(),
                new EditorSection(),
                new OnlineSection(),
                new MaintenanceSection(),
            };
            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour = Color4.Black,
                    Alpha = 0.6f,
                },
                scrollContainer = new ScrollContainer
                {
                    ScrollDraggerVisible = false,
                    RelativeSizeAxes = Axes.Y,
                    Width = width,
                    Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
                    Children = new[]
                    {
                        new FlowContainer
                        {
                            AutoSizeAxes = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                            Direction = FlowDirection.VerticalOnly,

                            Children = new Drawable[]
                            {
                                new SpriteText
                                {
                                    Text = "settings",
                                    TextSize = 40,
                                    Margin = new MarginPadding { Left = CONTENT_MARGINS, Top = 30 },
                                },
                                new SpriteText
                                {
                                    Colour = colours.Pink,
                                    Text = "Change the way osu! behaves",
                                    TextSize = 18,
                                    Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
                                },
                                new FlowContainer
                                {
                                    AutoSizeAxes = Axes.Y,
                                    RelativeSizeAxes = Axes.X,
                                    Direction = FlowDirection.VerticalOnly,
                                    Children = sections,
                                }
                            }
                        }
                    }
                },
                sidebar = new OptionsSidebar
                {
                    Width = SIDEBAR_WIDTH,
                    Children = sidebarButtons = sections.Select(section =>
                        new SidebarButton
                        {
                            Selected = sections[0] == section,
                            Section = section,
                            Action = () => scrollContainer.ScrollIntoView(section),
                        }
                    ).ToArray()
                }
            };
        
            scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
        }
示例#20
0
 public static void Setup()     //Called from Game.cs before this class's _Ready would
 {
     ShadedBackground = Game.RuntimeRoot.GetNode("MenuRoot").GetNode("ShadedBackground") as Panel;
     Center           = Game.RuntimeRoot.GetNode("MenuRoot").GetNode("HBox/Center") as ScrollContainer;
 }
示例#21
0
 public override void _Ready()
 {
     scroll    = GetNode <ScrollContainer>("VMargin/Scroll");
     container = GetNode <BoxContainer>("VMargin/Scroll/HMargin/StoryContainer");
 }
示例#22
0
        public CreditsScreen(ScreenComponent manager) : base(manager)
        {
            Padding = new Border(0, 0, 0, 0);

            Title = Languages.OctoClient.CreditsCrew;

            Image background = new Image(manager);

            background.Texture             = Manager.Content.LoadTexture2DFromFile("./Assets/OctoAwesome.Client/background_notext.png", Manager.GraphicsDevice);
            background.VerticalAlignment   = VerticalAlignment.Stretch;
            background.HorizontalAlignment = HorizontalAlignment.Stretch;
            Controls.Add(background);

            Button backButton = Button.TextButton(manager, Languages.OctoClient.Back);

            backButton.VerticalAlignment   = VerticalAlignment.Top;
            backButton.HorizontalAlignment = HorizontalAlignment.Left;
            backButton.LeftMouseClick     += (s, e) =>
            {
                manager.NavigateBack();
            };
            backButton.Margin = new Border(10, 10, 10, 10);
            Controls.Add(backButton);

            List <CrewMember> crew = CrewMember.getCrew(manager);

            ScrollContainer crewScroll = new ScrollContainer(manager)
            {
                VerticalAlignment = VerticalAlignment.Stretch,
                Margin            = new Border(10, 10, 10, 10),
                CanFocus          = false
            };

            StackPanel crewList = new StackPanel(manager)
            {
                MinWidth          = 700,
                VerticalAlignment = VerticalAlignment.Stretch,
                Orientation       = Orientation.Vertical,
            };

            crewScroll.Content = crewList;

            foreach (CrewMember member in crew)
            {
                Panel memberPanel = new Panel(manager)
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    MinHeight           = 30,
                    Background          = new BorderBrush(Color.White),
                    Margin            = new Border(5, 5, 5, 5),
                    HoveredBackground = new BorderBrush(Color.LightGray)
                };

                memberPanel.LeftMouseClick += (s, e) =>
                {
                    manager.NavigateToScreen(new CrewMemberScreen(manager, member));
                };

                Label name = new Label(manager)
                {
                    Text = member.Username,
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Padding             = new Border(5, 5, 5, 5)
                };

                memberPanel.Controls.Add(name);
                crewList.Controls.Add(memberPanel);
            }


            Controls.Add(crewScroll);
        }
示例#23
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            this.colours = colours;

            ModeTypeInfo  modeTypeInfo;
            OsuSpriteText participants, participantsSlash, maxParticipants, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"343138"),
                },
                topFlow = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 200,
                            Masking          = true,
                            Children         = new Drawable[]
                            {
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4.Black,
                                        },
                                        coverContainer = new Container
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                        },
                                    },
                                },
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding(20),
                                    Children         = new Drawable[]
                                    {
                                        participantNumbersFlow = new FillFlowContainer
                                        {
                                            Anchor         = Anchor.TopRight,
                                            Origin         = Anchor.TopRight,
                                            AutoSizeAxes   = Axes.Both,
                                            Direction      = FillDirection.Horizontal,
                                            LayoutDuration = transition_duration,
                                            Children       = new[]
                                            {
                                                participants = new OsuSpriteText
                                                {
                                                    TextSize = 30,
                                                    Font     = @"Exo2.0-Bold"
                                                },
                                                participantsSlash = new OsuSpriteText
                                                {
                                                    Text     = @"/",
                                                    TextSize = 30,
                                                    Font     = @"Exo2.0-Light"
                                                },
                                                maxParticipants = new OsuSpriteText
                                                {
                                                    TextSize = 30,
                                                    Font     = @"Exo2.0-Light"
                                                },
                                            },
                                        },
                                        name = new OsuSpriteText
                                        {
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft,
                                            TextSize = 30,
                                        },
                                    },
                                },
                            },
                        },
                        statusStrip = new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 5,
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = OsuColour.FromHex(@"28242d"),
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    LayoutDuration   = transition_duration,
                                    Padding          = contentPadding,
                                    Spacing          = new Vector2(0f, 5f),
                                    Children         = new Drawable[]
                                    {
                                        status = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-Bold",
                                        },
                                        infoPanelFlow = new FillFlowContainer
                                        {
                                            AutoSizeAxes   = Axes.X,
                                            Height         = 30,
                                            Direction      = FillDirection.Horizontal,
                                            LayoutDuration = transition_duration,
                                            Spacing        = new Vector2(5f, 0f),
                                            Children       = new Drawable[]
                                            {
                                                modeTypeInfo = new ModeTypeInfo(),
                                                new Container
                                                {
                                                    AutoSizeAxes     = Axes.X,
                                                    RelativeSizeAxes = Axes.Y,
                                                    Margin           = new MarginPadding {
                                                        Left = 5
                                                    },
                                                    Children = new[]
                                                    {
                                                        new FillFlowContainer
                                                        {
                                                            AutoSizeAxes = Axes.Both,
                                                            Direction    = FillDirection.Horizontal,
                                                            Children     = new[]
                                                            {
                                                                beatmapTitle = new OsuSpriteText
                                                                {
                                                                    Font = @"Exo2.0-BoldItalic",
                                                                },
                                                                beatmapDash = new OsuSpriteText
                                                                {
                                                                    Font = @"Exo2.0-BoldItalic",
                                                                },
                                                                beatmapArtist = new OsuSpriteText
                                                                {
                                                                    Font = @"Exo2.0-RegularItalic",
                                                                },
                                                            },
                                                        },
                                                        beatmapAuthor = new OsuSpriteText
                                                        {
                                                            Anchor   = Anchor.BottomLeft,
                                                            Origin   = Anchor.BottomLeft,
                                                            TextSize = 14,
                                                            Colour   = colours.Gray9,
                                                        },
                                                    },
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Padding          = contentPadding,
                            Children         = new Drawable[]
                            {
                                participantInfo = new ParticipantInfo(@"Rank Range "),
                            },
                        },
                    },
                },
                participantsScroll = new OsuScrollContainer
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Padding          = new MarginPadding {
                        Top = contentPadding.Top, Left = 38, Right = 37
                    },
                    Children = new[]
                    {
                        participantsFlow = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            LayoutDuration   = transition_duration,
                            Spacing          = new Vector2(5f),
                        },
                    },
                },
            };

            nameBind.ValueChanged   += n => name.Text = n;
            hostBind.ValueChanged   += h => participantInfo.Host = h;
            typeBind.ValueChanged   += t => modeTypeInfo.Type = t;
            statusBind.ValueChanged += displayStatus;

            beatmapBind.ValueChanged += b =>
            {
                modeTypeInfo.Beatmap = b;

                if (b != null)
                {
                    coverContainer.FadeIn(transition_duration);

                    LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        FillMode         = FillMode.Fill,
                        OnLoadComplete   = d => d.FadeInFromZero(400, Easing.Out),
                    }, coverContainer.Add);

                    beatmapTitle.Current  = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title);
                    beatmapDash.Text      = @" - ";
                    beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist);
                    beatmapAuthor.Text    = $"mapped by {b.Metadata.Author}";
                }
                else
                {
                    coverContainer.FadeOut(transition_duration);

                    beatmapTitle.Current  = null;
                    beatmapArtist.Current = null;

                    beatmapTitle.Text = "Changing map";
                    beatmapDash.Text  = beatmapArtist.Text = beatmapAuthor.Text = string.Empty;
                }
            };

            maxParticipantsBind.ValueChanged += m =>
            {
                if (m == null)
                {
                    participantsSlash.FadeOut(transition_duration);
                    maxParticipants.FadeOut(transition_duration);
                }
                else
                {
                    participantsSlash.FadeIn(transition_duration);
                    maxParticipants.FadeIn(transition_duration);
                    maxParticipants.Text = m.ToString();
                }
            };

            participantsBind.ValueChanged += p =>
            {
                participants.Text                   = p.Length.ToString();
                participantInfo.Participants        = p;
                participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u));
            };

            updateState();
        }
 public void ScrollTo(int item)
 => ScrollContainer.ScrollTo(this.ChildrenOfType <BasicRearrangeableListItem <int> >().First(i => i.Model == item), false);
示例#25
0
 public override void _Ready()
 {
     textContainer   = GetNode("ScrollContainer/TextContainer") as VBoxContainer;
     scrollContainer = GetNode("ScrollContainer") as ScrollContainer;
 }
示例#26
0
        private void load(OsuColour colours)
        {
            this.colours = colours;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"343138"),
                },
                topFlow = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 200,
                            Masking          = true,
                            Children         = new Drawable[]
                            {
                                cover = new UpdateableBeatmapSetCover
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding(20),
                                    Children         = new Drawable[]
                                    {
                                        participantCount = new ParticipantCount
                                        {
                                            Anchor = Anchor.TopRight,
                                            Origin = Anchor.TopRight,
                                        },
                                        name = new OsuSpriteText
                                        {
                                            Anchor   = Anchor.BottomLeft,
                                            Origin   = Anchor.BottomLeft,
                                            TextSize = 30,
                                        },
                                    },
                                },
                            },
                        },
                        statusStrip = new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 5,
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = OsuColour.FromHex(@"28242d"),
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    LayoutDuration   = transition_duration,
                                    Padding          = contentPadding,
                                    Spacing          = new Vector2(0f, 5f),
                                    Children         = new Drawable[]
                                    {
                                        status = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-Bold",
                                        },
                                        beatmapTypeInfo = new BeatmapTypeInfo(),
                                    },
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Padding          = contentPadding,
                            Children         = new Drawable[]
                            {
                                participantInfo = new ParticipantInfo(@"Rank Range "),
                            },
                        },
                    },
                },
                participantsScroll = new OsuScrollContainer
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Padding          = new MarginPadding {
                        Top = contentPadding.Top, Left = 38, Right = 37
                    },
                    Children = new[]
                    {
                        participantsFlow = new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            LayoutDuration   = transition_duration,
                            Spacing          = new Vector2(5f),
                        },
                    },
                },
            };

            nameBind.ValueChanged            += n => name.Text = n;
            hostBind.ValueChanged            += h => participantInfo.Host = h;
            typeBind.ValueChanged            += t => beatmapTypeInfo.Type = t;
            maxParticipantsBind.ValueChanged += m => participantCount.Max = m;
            statusBind.ValueChanged          += displayStatus;

            beatmapBind.ValueChanged += b =>
            {
                cover.BeatmapSet        = b?.BeatmapSet;
                beatmapTypeInfo.Beatmap = b;
            };

            participantsBind.ValueChanged += p =>
            {
                participantCount.Count              = p.Count();
                participantInfo.Participants        = p;
                participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u));
            };

            updateState();
        }
        public override void Initialize(SS14Window window, object obj)
        {
            _entity = (IEntity)obj;

            var type = obj.GetType();

            var scrollContainer = new ScrollContainer();

            //scrollContainer.SetAnchorPreset(Control.LayoutPreset.Wide, true);
            window.Contents.AddChild(scrollContainer);
            var vBoxContainer = new VBoxContainer
            {
                SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
                SizeFlagsVertical   = Control.SizeFlags.FillExpand,
            };

            scrollContainer.AddChild(vBoxContainer);

            // Handle top bar displaying type and ToString().
            {
                Control top;
                var     stringified = obj.ToString();
                if (type.FullName != stringified)
                {
                    //var smallFont = new VectorFont(_resourceCache.GetResource<FontResource>("/Fonts/CALIBRI.TTF"), 10);
                    // Custom ToString() implementation.
                    var headBox = new VBoxContainer {
                        SeparationOverride = 0
                    };
                    headBox.AddChild(new Label {
                        Text = stringified, ClipText = true
                    });
                    headBox.AddChild(new Label
                    {
                        Text = type.FullName,
                        //    FontOverride = smallFont,
                        FontColorOverride = Color.DarkGray,
                        ClipText          = true
                    });
                    top = headBox;
                }
                else
                {
                    top = new Label {
                        Text = stringified
                    };
                }

                if (_entity.TryGetComponent(out ISpriteComponent sprite))
                {
                    var hBox = new HBoxContainer();
                    top.SizeFlagsHorizontal = Control.SizeFlags.FillExpand;
                    hBox.AddChild(top);
                    hBox.AddChild(new SpriteView {
                        Sprite = sprite
                    });
                    vBoxContainer.AddChild(hBox);
                }
                else
                {
                    vBoxContainer.AddChild(top);
                }
            }

            _tabs = new TabContainer();
            _tabs.OnTabChanged += _tabsOnTabChanged;
            vBoxContainer.AddChild(_tabs);

            var clientVBox = new VBoxContainer {
                SeparationOverride = 0
            };

            _tabs.AddChild(clientVBox);
            _tabs.SetTabTitle(TabClientVars, "Client Variables");

            foreach (var control in LocalPropertyList(obj, ViewVariablesManager, _resourceCache))
            {
                clientVBox.AddChild(control);
            }

            var clientComponents = new VBoxContainer {
                SeparationOverride = 0
            };

            _tabs.AddChild(clientComponents);
            _tabs.SetTabTitle(TabClientComponents, "Client Components");

            // See engine#636 for why the Distinct() call.
            var componentList = _entity.GetAllComponents().OrderBy(c => c.GetType().ToString());

            foreach (var component in componentList)
            {
                var button = new Button {
                    Text = TypeAbbreviation.Abbreviate(component.GetType().ToString()), TextAlign = Button.AlignMode.Left
                };
                button.OnPressed += args => { ViewVariablesManager.OpenVV(component); };
                clientComponents.AddChild(button);
            }

            if (!_entity.Uid.IsClientSide())
            {
                _serverVariables = new VBoxContainer {
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverVariables);
                _tabs.SetTabTitle(TabServerVars, "Server Variables");

                _serverComponents = new VBoxContainer {
                    SeparationOverride = 0
                };
                _tabs.AddChild(_serverComponents);
                _tabs.SetTabTitle(TabServerComponents, "Server Components");
            }
        }
示例#28
0
        public bool Execute(IDebugConsole console, params string[] args)
        {
            var window       = new SS14Window();
            var tabContainer = new TabContainer();

            window.Contents.AddChild(tabContainer);
            var scroll = new ScrollContainer();

            tabContainer.AddChild(scroll);
            //scroll.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide);
            var vBox = new VBoxContainer();

            scroll.AddChild(vBox);

            var progressBar = new ProgressBar {
                MaxValue = 10, Value = 5
            };

            vBox.AddChild(progressBar);

            var optionButton = new OptionButton();

            optionButton.AddItem("Honk");
            optionButton.AddItem("Foo");
            optionButton.AddItem("Bar");
            optionButton.AddItem("Baz");
            optionButton.OnItemSelected += eventArgs => optionButton.SelectId(eventArgs.Id);
            vBox.AddChild(optionButton);

            var tree = new Tree {
                SizeFlagsVertical = Control.SizeFlags.FillExpand
            };
            var root = tree.CreateItem();

            root.Text = "Honk!";
            var child = tree.CreateItem();

            child.Text = "Foo";
            for (var i = 0; i < 20; i++)
            {
                child      = tree.CreateItem();
                child.Text = $"Bar {i}";
            }

            vBox.AddChild(tree);

            var rich    = new RichTextLabel();
            var message = new FormattedMessage();

            message.AddText("Foo\n");
            message.PushColor(Color.Red);
            message.AddText("Bar");
            message.Pop();
            rich.SetMessage(message);
            vBox.AddChild(rich);

            var itemList = new ItemList();

            tabContainer.AddChild(itemList);
            for (var i = 0; i < 10; i++)
            {
                itemList.AddItem(i.ToString());
            }

            var grid = new GridContainer {
                Columns = 3
            };

            tabContainer.AddChild(grid);
            for (var y = 0; y < 3; y++)
            {
                for (var x = 0; x < 3; x++)
                {
                    grid.AddChild(new Button
                    {
                        CustomMinimumSize = (50, 50),
                        Text = $"{x}, {y}"
                    });
        public BodyScannerDisplay(BodyScannerBoundUserInterface owner)
        {
            IoCManager.InjectDependencies(this);
            Owner = owner;
            Title = _loc.GetString("Body Scanner");

            var hSplit = new HBoxContainer();

            Contents.AddChild(hSplit);

            //Left half
            var scrollBox = new ScrollContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
            };

            hSplit.AddChild(scrollBox);
            BodyPartList = new ItemList {
            };
            scrollBox.AddChild(BodyPartList);
            BodyPartList.OnItemSelected += BodyPartOnItemSelected;

            //Right half
            var vSplit = new VBoxContainer
            {
                SizeFlagsHorizontal = SizeFlags.FillExpand,
            };

            hSplit.AddChild(vSplit);

            //Top half of the right half
            var limbBox = new VBoxContainer
            {
                SizeFlagsVertical = SizeFlags.FillExpand
            };

            vSplit.AddChild(limbBox);
            BodyPartLabel = new Label();
            limbBox.AddChild(BodyPartLabel);
            var limbHealthHBox = new HBoxContainer();

            limbBox.AddChild(limbHealthHBox);
            var healthLabel = new Label
            {
                Text = "Health: "
            };

            limbHealthHBox.AddChild(healthLabel);
            BodyPartHealth = new Label();
            limbHealthHBox.AddChild(BodyPartHealth);
            var limbScroll = new ScrollContainer
            {
                SizeFlagsVertical = SizeFlags.FillExpand
            };

            limbBox.AddChild(limbScroll);
            MechanismList = new ItemList();
            limbScroll.AddChild(MechanismList);
            MechanismList.OnItemSelected += MechanismOnItemSelected;

            //Bottom half of the right half
            MechanismInfoLabel = new RichTextLabel
            {
                SizeFlagsVertical = SizeFlags.FillExpand
            };
            vSplit.AddChild(MechanismInfoLabel);
        }
        public TutorialWindow()
        {
            Title = "The Tutorial!";

            //Get section header font
            var  cache        = IoCManager.Resolve <IResourceCache>();
            var  inputManager = IoCManager.Resolve <IInputManager>();
            Font headerFont   = new VectorFont(cache.GetResource <FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"), _headerFontSize);

            var scrollContainer = new ScrollContainer();

            scrollContainer.AddChild(VBox = new VBoxContainer());
            Contents.AddChild(scrollContainer);

            //Intro
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "Intro"
            });
            AddFormattedText(IntroContents);

            string Key(BoundKeyFunction func)
            {
                return(FormattedMessage.EscapeText(inputManager.GetKeyFunctionButtonString(func)));
            }

            //Controls
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "\nControls"
            });

            // Moved this down here so that Rider shows which args correspond to which format spot.
            AddFormattedText(Loc.GetString(@"Movement: [color=#a4885c]{0} {1} {2} {3}[/color]
Switch hands: [color=#a4885c]{4}[/color]
Use held item: [color=#a4885c]{5}[/color]
Drop held item: [color=#a4885c]{6}[/color]
Smart equip from backpack: [color=#a4885c]{24}[/color]
Smart equip from belt: [color=#a4885c]{25}[/color]
Open inventory: [color=#a4885c]{7}[/color]
Open character window: [color=#a4885c]{8}[/color]
Open crafting window: [color=#a4885c]{9}[/color]
Focus chat: [color=#a4885c]{10}[/color]
Focus OOC: [color=#a4885c]{26}[/color]
Focus Admin Chat: [color=#a4885c]{27}[/color]
Use hand/object in hand: [color=#a4885c]{22}[/color]
Do wide attack: [color=#a4885c]{23}[/color]
Use targeted entity: [color=#a4885c]{11}[/color]
Throw held item: [color=#a4885c]{12}[/color]
Pull entity: [color=#a4885c]{30}[/color]
Move pulled entity: [color=#a4885c]{29}[/color]
Stop pulling: [color=#a4885c]{32}[/color]
Examine entity: [color=#a4885c]{13}[/color]
Point somewhere: [color=#a4885c]{28}[/color]
Open entity context menu: [color=#a4885c]{14}[/color]
Toggle combat mode: [color=#a4885c]{15}[/color]
Toggle console: [color=#a4885c]{16}[/color]
Toggle UI: [color=#a4885c]{17}[/color]
Toggle debug overlay: [color=#a4885c]{18}[/color]
Toggle entity spawner: [color=#a4885c]{19}[/color]
Toggle tile spawner: [color=#a4885c]{20}[/color]
Toggle sandbox window: [color=#a4885c]{21}[/color]
Toggle admin menu [color=#a4885c]{31}[/color]",
                                           Key(MoveUp), Key(MoveLeft), Key(MoveDown), Key(MoveRight),
                                           Key(SwapHands),
                                           Key(ActivateItemInHand),
                                           Key(Drop),
                                           Key(OpenInventoryMenu),
                                           Key(OpenCharacterMenu),
                                           Key(OpenCraftingMenu),
                                           Key(FocusChat),
                                           Key(ActivateItemInWorld),
                                           Key(ThrowItemInHand),
                                           Key(ExamineEntity),
                                           Key(OpenContextMenu),
                                           Key(ToggleCombatMode),
                                           Key(ShowDebugConsole),
                                           Key(HideUI),
                                           Key(ShowDebugMonitors),
                                           Key(OpenEntitySpawnWindow),
                                           Key(OpenTileSpawnWindow),
                                           Key(OpenSandboxWindow),
                                           Key(Use),
                                           Key(WideAttack),
                                           Key(SmartEquipBackpack),
                                           Key(SmartEquipBelt),
                                           Key(FocusOOC),
                                           Key(FocusAdminChat),
                                           Key(Point),
                                           Key(TryPullObject),
                                           Key(MovePulledObject),
                                           Key(OpenAdminMenu),
                                           Key(ReleasePulledObject)));

            //Gameplay
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "\nGameplay"
            });
            AddFormattedText(GameplayContents);

            //Gameplay
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = Loc.GetString("\nSandbox spawner", Key(OpenSandboxWindow))
            });
            AddFormattedText(SandboxSpawnerContents);

            //Feedback
            VBox.AddChild(new Label {
                FontOverride = headerFont, Text = "\nFeedback"
            });
            AddFormattedText(FeedbackContents);
        }
示例#31
0
 public static void Setup()     //Called from Game.cs before this class's _Ready would
 {
     MenuRoot         = Game.RuntimeRoot.GetNode("MenuRoot");
     ShadedBackground = MenuRoot.GetNode <Panel>("ShadedBackground");
     Center           = MenuRoot.GetNode <ScrollContainer>("HBox/Center");
 }