mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
Server scripting.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Client.UserInterface.CustomControls
|
||||
{
|
||||
internal abstract class ScriptConsole : SS14Window
|
||||
{
|
||||
protected OutputPanel OutputPanel { get; }
|
||||
protected HistoryLineEdit InputBar { get; }
|
||||
protected Button RunButton { get; }
|
||||
|
||||
protected ScriptConsole()
|
||||
{
|
||||
Contents.AddChild(new VBoxContainer
|
||||
{
|
||||
Children =
|
||||
{
|
||||
new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = Color.FromHex("#1E1E1E"),
|
||||
ContentMarginLeftOverride = 4
|
||||
},
|
||||
Children =
|
||||
{
|
||||
(OutputPanel = new OutputPanel
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
})
|
||||
},
|
||||
SizeFlagsVertical = SizeFlags.FillExpand
|
||||
},
|
||||
new HBoxContainer
|
||||
{
|
||||
Children =
|
||||
{
|
||||
(InputBar = new HistoryLineEdit
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
PlaceHolder = Loc.GetString("Your C# code here.")
|
||||
}),
|
||||
(RunButton = new Button {Text = Loc.GetString("Run")})
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
InputBar.OnTextEntered += _ => Run();
|
||||
RunButton.OnPressed += _ => Run();
|
||||
CustomMinimumSize = (550, 300);
|
||||
}
|
||||
|
||||
protected abstract void Run();
|
||||
|
||||
protected override void Opened()
|
||||
{
|
||||
InputBar.GrabKeyboardFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user