protected override void Initialize() { base.Initialize(); HideOnClose = true; Title = "Options"; configManager = IoCManager.Resolve <IConfigurationManager>(); var vBox = new VBoxContainer(); Contents.AddChild(vBox); vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); VSyncCheckBox = new CheckBox { Text = "VSync" }; vBox.AddChild(VSyncCheckBox); VSyncCheckBox.OnToggled += OnCheckBoxToggled; FullscreenCheckBox = new CheckBox { Text = "Fullscreen" }; vBox.AddChild(FullscreenCheckBox); FullscreenCheckBox.OnToggled += OnCheckBoxToggled; HighResLightsCheckBox = new CheckBox { Text = "High-Res Lights" }; vBox.AddChild(HighResLightsCheckBox); HighResLightsCheckBox.OnToggled += OnCheckBoxToggled; ApplyButton = new Button { Text = "Apply", TextAlign = Button.AlignMode.Center, SizeFlagsVertical = SizeFlags.ShrinkCenter }; vBox.AddChild(ApplyButton); ApplyButton.OnPressed += OnApplyButtonPressed; VSyncCheckBox.Pressed = configManager.GetCVar <bool>("display.vsync"); HighResLightsCheckBox.Pressed = configManager.GetCVar <bool>("display.highreslights"); FullscreenCheckBox.Pressed = ConfigIsFullscreen; }
public OptionsMenu(IConfigurationManager configMan) { configManager = configMan; Title = "Options"; var vBox = new VBoxContainer(); Contents.AddChild(vBox); vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); VSyncCheckBox = new CheckBox { Text = "VSync" }; vBox.AddChild(VSyncCheckBox); VSyncCheckBox.OnToggled += OnCheckBoxToggled; FullscreenCheckBox = new CheckBox { Text = "Fullscreen" }; vBox.AddChild(FullscreenCheckBox); FullscreenCheckBox.OnToggled += OnCheckBoxToggled; HighResLightsCheckBox = new CheckBox { Text = "High-Res Lights" }; vBox.AddChild(HighResLightsCheckBox); HighResLightsCheckBox.OnToggled += OnCheckBoxToggled; ApplyButton = new Button { Text = "Apply", TextAlign = Button.AlignMode.Center, SizeFlagsVertical = SizeFlags.ShrinkCenter }; vBox.AddChild(ApplyButton); ApplyButton.OnPressed += OnApplyButtonPressed; VSyncCheckBox.Pressed = configManager.GetCVar <bool>("display.vsync"); HighResLightsCheckBox.Pressed = configManager.GetCVar <bool>("display.highreslights"); FullscreenCheckBox.Pressed = ConfigIsFullscreen; }
public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache) { var panelTex = resourceCache.GetTexture("/Nano/button.svg.96dpi.png"); var back = new StyleBoxTexture { Texture = panelTex, Modulate = new Color(37, 37, 42), }; back.SetPatchMargin(StyleBox.Margin.All, 10); var panel = new Panel { PanelOverride = back }; AddChild(panel); panel.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer { SeparationOverride = 0 }; vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); vBox.MarginTop = 40; AddChild(vBox); AddChild(new Label { Text = localization.GetString("Lobby"), StyleClasses = { NanoStyle.StyleClassLabelHeadingBigger }, MarginBottom = 40, MarginLeft = 8, VAlign = Label.VAlignMode.Center }); AddChild(ServerName = new Label { StyleClasses = { NanoStyle.StyleClassLabelHeadingBigger }, MarginBottom = 40, GrowHorizontal = GrowDirection.Both, VAlign = Label.VAlignMode.Center }); ServerName.SetAnchorAndMarginPreset(LayoutPreset.CenterTop); AddChild(LeaveButton = new Button { SizeFlagsHorizontal = SizeFlags.ShrinkEnd, Text = localization.GetString("Leave"), StyleClasses = { NanoStyle.StyleClassButtonBig }, GrowHorizontal = GrowDirection.Begin }); LeaveButton.SetAnchorAndMarginPreset(LayoutPreset.TopRight); vBox.AddChild(new Panel { PanelOverride = new StyleBoxFlat { BackgroundColor = NanoStyle.NanoGold, ContentMarginTopOverride = 2 }, }); var hBox = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 0 }; vBox.AddChild(hBox); hBox.AddChild(new VBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SeparationOverride = 0, Children = { new Placeholder(resourceCache) { SizeFlagsVertical = SizeFlags.FillExpand, PlaceholderText = localization.GetString("Character UI\nPlaceholder") }, new StripeBack { Children = { new MarginContainer { MarginRightOverride = 3, MarginLeftOverride = 3, MarginTopOverride = 3, MarginBottomOverride = 3, Children = { new HBoxContainer { SeparationOverride = 6, Children = { (ObserveButton = new Button { Text = localization.GetString("Observe"), StyleClasses = { NanoStyle.StyleClassButtonBig } }), (StartTime = new Label { SizeFlagsHorizontal = SizeFlags.FillExpand, Align = Label.AlignMode.Right, FontColorOverride = Color.DarkGray, StyleClasses = { NanoStyle.StyleClassLabelBig } }), (ReadyButton = new Button { ToggleMode = true, Text = localization.GetString("Ready Up"), StyleClasses = { NanoStyle.StyleClassButtonBig } }), } } } } } }, new MarginContainer { MarginRightOverride = 3, MarginLeftOverride = 3, MarginTopOverride = 3, MarginBottomOverride = 3, SizeFlagsVertical = SizeFlags.FillExpand, Children = { (Chat = new ChatBox { Input = { PlaceHolder = localization.GetString("Say something!")} }) } }, } }); hBox.AddChild(new Panel { PanelOverride = new StyleBoxFlat { BackgroundColor = NanoStyle.NanoGold }, CustomMinimumSize = (2, 0) });
public LatheQueueMenu() { Title = "Lathe Queue"; var margin = new MarginContainer() { MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, }; margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer(); vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var descMargin = new MarginContainer() { MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; var hBox = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, }; Icon = new TextureRect() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; var vBoxInfo = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, }; NameLabel = new Label() { RectClipContent = true, SizeFlagsHorizontal = SizeFlags.Fill, }; Description = new Label() { RectClipContent = true, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.Fill, }; QueueList = new ItemList() { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, SelectMode = ItemList.ItemListSelectMode.None }; vBoxInfo.AddChild(NameLabel); vBoxInfo.AddChild(Description); hBox.AddChild(Icon); hBox.AddChild(vBoxInfo); descMargin.AddChild(hBox); vBox.AddChild(descMargin); vBox.AddChild(QueueList); margin.AddChild(vBox); Contents.AddChild(margin); ClearInfo(); }
public InstrumentMenu(InstrumentBoundUserInterface owner) { IoCManager.InjectDependencies(this); Title = "Instrument"; _owner = owner; _owner.Instrument.OnMidiPlaybackEnded += InstrumentOnMidiPlaybackEnded; var margin = new MarginContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, }; margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var hBoxTopButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Align = BoxContainer.AlignMode.Center }; midiInputButton = new Button() { Text = "MIDI Input", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, ToggleMode = true, Pressed = _owner.Instrument.IsInputOpen, }; midiInputButton.OnToggled += MidiInputButtonOnOnToggled; var topSpacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; var midiFileButton = new Button() { Text = "Open File", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; midiFileButton.OnPressed += MidiFileButtonOnOnPressed; var hBoxBottomButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Align = BoxContainer.AlignMode.Center }; midiLoopButton = new Button() { Text = "Loop", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, ToggleMode = true, Disabled = !_owner.Instrument.IsMidiOpen, Pressed = _owner.Instrument.LoopMidi, }; midiLoopButton.OnToggled += MidiLoopButtonOnOnToggled; var bottomSpacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; midiStopButton = new Button() { Text = "Stop", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Disabled = !_owner.Instrument.IsMidiOpen, }; midiStopButton.OnPressed += MidiStopButtonOnPressed; hBoxBottomButtons.AddChild(midiLoopButton); hBoxBottomButtons.AddChild(bottomSpacer); hBoxBottomButtons.AddChild(midiStopButton); hBoxTopButtons.AddChild(midiInputButton); hBoxTopButtons.AddChild(topSpacer); hBoxTopButtons.AddChild(midiFileButton); vBox.AddChild(hBoxTopButtons); vBox.AddChild(hBoxBottomButtons); margin.AddChild(vBox); Contents.AddChild(margin); }
protected override void Initialize() { base.Initialize(); IoCManager.InjectDependencies(this); HideOnClose = true; Title = "Lathe Menu"; Visible = false; var margin = new MarginContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, }; margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vbox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var hboxButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; QueueButton = new Button() { Text = "Queue", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; var spacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, }; spacer.SetAnchorAndMarginPreset(LayoutPreset.Wide); var hboxFilter = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 }; SearchBar = new LineEdit() { PlaceHolder = "Search Designs", SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; SearchBar.OnTextChanged += Populate; var filterButton = new Button() { Text = "Filter", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, Disabled = true, }; Items = new ItemList() { SizeFlagsStretchRatio = 8, SizeFlagsVertical = SizeFlags.FillExpand, }; Items.OnItemSelected += ItemSelected; AmountLineEdit = new LineEdit() { PlaceHolder = "Amount", Text = "1", SizeFlagsHorizontal = SizeFlags.FillExpand, }; AmountLineEdit.OnTextChanged += PopulateDisabled; Materials = new ItemList() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; hboxButtons.AddChild(spacer); hboxButtons.AddChild(QueueButton); hboxFilter.AddChild(SearchBar); hboxFilter.AddChild(filterButton); vbox.AddChild(hboxButtons); vbox.AddChild(hboxFilter); vbox.AddChild(Items); vbox.AddChild(AmountLineEdit); vbox.AddChild(Materials); margin.AddChild(vbox); Contents.AddChild(margin); }
public LatheMenu(LatheBoundUserInterface owner = null) { IoCManager.InjectDependencies(this); Owner = owner; Title = "Lathe Menu"; var margin = new MarginContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand, MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, }; margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vBox = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SeparationOverride = 5, }; vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var hBoxButtons = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1, }; QueueButton = new Button() { Text = "Queue", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, }; ServerConnectButton = new Button() { Text = "Server list", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, }; ServerSyncButton = new Button() { Text = "Sync", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, }; var spacer = new Control() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, }; spacer.SetAnchorAndMarginPreset(LayoutPreset.Wide); var hBoxFilter = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 1 }; SearchBar = new LineEdit() { PlaceHolder = "Search Designs", SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; SearchBar.OnTextChanged += Populate; var filterButton = new Button() { Text = "Filter", TextAlign = Button.AlignMode.Center, SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsStretchRatio = 1, Disabled = true, }; Items = new ItemList() { SizeFlagsStretchRatio = 8, SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.Button, }; Items.OnItemSelected += ItemSelected; AmountLineEdit = new LineEdit() { PlaceHolder = "Amount", Text = "1", SizeFlagsHorizontal = SizeFlags.FillExpand, }; AmountLineEdit.OnTextChanged += PopulateDisabled; Materials = new ItemList() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3 }; hBoxButtons.AddChild(spacer); if (Owner?.Database is ProtolatheDatabaseComponent database) { hBoxButtons.AddChild(ServerConnectButton); hBoxButtons.AddChild(ServerSyncButton); database.OnDatabaseUpdated += Populate; } hBoxButtons.AddChild(QueueButton); hBoxFilter.AddChild(SearchBar); hBoxFilter.AddChild(filterButton); vBox.AddChild(hBoxButtons); vBox.AddChild(hBoxFilter); vBox.AddChild(Items); vBox.AddChild(AmountLineEdit); vBox.AddChild(Materials); margin.AddChild(vBox); Contents.AddChild(margin); }
protected override void Initialize() { base.Initialize(); HideOnClose = true; Title = "Lathe Queue"; Visible = false; var margin = new MarginContainer() { MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, }; margin.SetAnchorAndMarginPreset(LayoutPreset.Wide); var vbox = new VBoxContainer(); vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide); var descMargin = new MarginContainer() { MarginTop = 5f, MarginLeft = 5f, MarginRight = -5f, MarginBottom = -5f, SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; var hbox = new HBoxContainer() { SizeFlagsHorizontal = SizeFlags.FillExpand, }; Icon = new TextureRect() { SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsStretchRatio = 2, }; var vboxInfo = new VBoxContainer() { SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, }; NameLabel = new Label() { RectClipContent = true, SizeFlagsHorizontal = SizeFlags.Fill, }; Description = new Label() { RectClipContent = true, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.Fill, }; QueueList = new ItemList() { SizeFlagsHorizontal = SizeFlags.Fill, SizeFlagsVertical = SizeFlags.FillExpand, SizeFlagsStretchRatio = 3, SelectMode = ItemList.ItemListSelectMode.None }; vboxInfo.AddChild(NameLabel); vboxInfo.AddChild(Description); hbox.AddChild(Icon); hbox.AddChild(vboxInfo); descMargin.AddChild(hbox); vbox.AddChild(descMargin); vbox.AddChild(QueueList); margin.AddChild(vbox); Contents.AddChild(margin); ClearInfo(); }