/// <summary> /// Create the window with all character UIs and bind it to a keypress /// </summary> public override void Initialize() { base.Initialize(); //Use all the character ui interfaced components to create the character window var UIcomponents = Owner.GetAllComponents <ICharacterUI>(); _window = new CharacterWindow(UIcomponents); _window.AddToScreen(); //Toggle window visible/invisible on keypress _openMenuCmdHandler = InputCmdHandler.FromDelegate(session => { if (_window.Visible) { _window.Close(); } else { _window.Open(); } }); //Set keybind to open character menu var inputMgr = IoCManager.Resolve <IInputManager>(); inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, _openMenuCmdHandler); }
public bool Execute(IDebugConsole console, params string[] args) { var window = new SS14Window("UITest"); window.AddToScreen(); var scroll = new ScrollContainer(); window.Contents.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); return(false); }
protected override void Open() { base.Open(); _window = new ApcWindow(); _window.OnClose += Close; _breakerButton = _window.Contents.GetChild <BaseButton>("Rows/Breaker/Breaker"); _breakerButton.OnPressed += _ => SendMessage(new ApcToggleMainBreakerMessage()); _externalPowerStateLabel = _window.Contents.GetChild <Label>("Rows/ExternalStatus/Status"); _chargeBar = _window.Contents.GetChild <ProgressBar>("Rows/Charge/Charge"); _window.AddToScreen(); }
public bool Execute(IDebugConsole console, params string[] args) { var window = new SS14Window("UITest"); window.AddToScreen(); var scroll = new ScrollContainer(); window.Contents.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); return(false); }
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null) { base.HandleMessage(message, netChannel, component); switch (message) { case OpenDataWindowMsg msg: var window = new SS14Window { Title = "Power Debug Tool" }; window.Contents.AddChild(new Label() { Text = msg.Data }); window.AddToScreen(); window.Open(); break; } }
public bool Execute(IDebugConsole console, params string[] args) { var window = new SS14Window("UITest"); window.AddToScreen(); var scroll = new ScrollContainer(); window.Contents.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); return(false); }
private void _openTutorialWindow() { var window = new SS14Window { Title = "Tutorial" }; var scrollContainer = new ScrollContainer(); window.Contents.AddChild(scrollContainer); var label = new RichTextLabel(); scrollContainer.AddChild(label); var message = new FormattedMessage(); message.AddText(TutorialContents); label.SetMessage(message); window.AddToScreen(); }
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null) { base.HandleMessage(message, netChannel, component); switch (message) { case OpenDataWindowMsg msg: if (LastWindow != null && !LastWindow.Disposed) { LastWindow.Dispose(); } LastWindow = new SS14Window(IoCManager.Resolve <IDisplayManager>()) { Title = "Power Debug Tool", }; LastWindow.Contents.AddChild(new Label() { Text = msg.Data }); LastWindow.AddToScreen(); LastWindow.Open(); break; } }
public bool Execute(IDebugConsole console, params string[] args) { var window = new SS14Window("UITest"); window.AddToScreen(); 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}" });