protected override void Initialize()
        {
            IoCManager.InjectDependencies(this);

            Visible = false;

            AnchorRight  = 1f;
            AnchorBottom = 0.35f;

            var boxContainer = new VBoxContainer {
                SeparationOverride = 0
            };

            boxContainer.SetAnchorPreset(LayoutPreset.Wide);
            AddChild(boxContainer);
            var styleBox = new StyleBoxFlat
            {
                BackgroundColor = Color.Gray.WithAlpha(0.5f),
            };

            styleBox.SetContentMarginOverride(StyleBox.Margin.All, 3);
            Output = new OutputPanel
            {
                SizeFlagsVertical = SizeFlags.FillExpand,
                StyleBoxOverride  = styleBox
            };
            boxContainer.AddChild(Output);

            CommandBar = new LineEdit {
                PlaceHolder = "Command Here"
            };
            boxContainer.AddChild(CommandBar);
            CommandBar.OnKeyDown     += CommandBarOnOnKeyDown;
            CommandBar.OnTextEntered += CommandEntered;
            CommandBar.OnTextChanged += CommandBarOnOnTextChanged;

            console.AddString    += (_, args) => AddLine(args.Text, args.Channel, args.Color);
            console.AddFormatted += (_, args) => AddFormattedLine(args.Message);
            console.ClearText    += (_, args) => Clear();

            _loadHistoryFromDisk();
        }
Beispiel #2
0
        private void PerformLayout()
        {
            Visible = false;

            AnchorRight  = 1f;
            AnchorBottom = 0.35f;

            var boxContainer = new VBoxContainer {
                SeparationOverride = 0
            };

            boxContainer.SetAnchorPreset(LayoutPreset.Wide);
            AddChild(boxContainer);
            var styleBox = new StyleBoxFlat
            {
                BackgroundColor = Color.FromHex("#25252add"),
            };

            styleBox.SetContentMarginOverride(StyleBox.Margin.All, 3);
            Output = new OutputPanel
            {
                SizeFlagsVertical = SizeFlags.FillExpand,
                StyleBoxOverride  = styleBox
            };
            boxContainer.AddChild(Output);

            CommandBar = new LineEdit {
                PlaceHolder = "Command Here"
            };
            boxContainer.AddChild(CommandBar);
            CommandBar.OnKeyBindDown += CommandBarOnOnKeyBindDown;
            CommandBar.OnTextEntered += CommandEntered;
            CommandBar.OnTextChanged += CommandBarOnOnTextChanged;

            _console.AddString    += (_, args) => AddLine(args.Text, args.Color);
            _console.AddFormatted += (_, args) => AddFormattedLine(args.Message);
            _console.ClearText    += (_, args) => Clear();

            _loadHistoryFromDisk();
        }