示例#1
0
            internal ConsoleElement(CoreGui coreGui)
            {
                Build(coreGui);
                RootFrame.Visible = false;

                InputService.Service.InputBegan.Event += input =>
                {
                    if (input.InputType == InputType.Keyboard)
                    {
                        if (input.Key == DebugSettings.ToggleConsoleKey)
                        {
                            var visible = !RootFrame.Visible;
                            RootFrame.Visible = visible;

                            if (visible)
                            {
                                TextBox.Focus();
                            }
                            else
                            {
                                TextBox.Unfocus();
                            }
                        }
                    }
                };
            }
示例#2
0
            private void Build(CoreGui coreGui)
            {
                RootFrame = new Frame
                {
                    Name     = "ConsoleRoot",
                    Parent   = coreGui,
                    Position = new UDim2(0, 30, 0, 30),
                    Size     = new UDim2(.5f, 0, 0, 120),
                    BackgroundTransparency = 1
                };

                var title = new TextLabel
                {
                    Name             = "TitleLabel",
                    Parent           = RootFrame,
                    Size             = new UDim2(0, 150, 0, 18),
                    BackgroundColour = Colour.White,
                    BorderThickness  = 0,
                    TextColour       = Colour.Black,
                    Text             = " Console",
                    FontSize         = 15,
                    TextAlignmentX   = AlignmentX.Left,
                    TextAlignmentY   = AlignmentY.Middle
                };

                ContainerFrame = new Frame
                {
                    Name             = "Container",
                    Parent           = RootFrame,
                    Position         = new UDim2(0, 0, 0, 18),
                    Size             = new UDim2(1, 0, 1, -18),
                    BackgroundColour = new Colour(.5f, .5f, .5f, .5f),
                    BorderThickness  = 0
                };

                _lines = new TextLabel[6];

                for (int i = 0; i < _lines.Length; i++)
                {
                    _lines[i] = new TextLabel
                    {
                        Parent           = ContainerFrame,
                        BackgroundColour = Colour.Transparent,
                        Size             = new UDim2(1, 0, 0, 14),
                        Position         = new UDim2(0, 0, 0, 14 * i),
                        FontSize         = 14,
                        TextAlignmentX   = AlignmentX.Left,
                        Text             = ""
                    };
                }

                TextBox = new TextBox
                {
                    Parent   = ContainerFrame,
                    Position = new UDim2(0, 0, 1, -14),
                    Size     = new UDim2(1, 0, 0, 14)
                };
            }