Beispiel #1
0
        public override void DrawUI(SpriteBatch sb, LayoutUserInterface ui)
        {
            int sw = Screen.Width;
            int sh = Screen.Height;

            ui.FontSize = 128;
            var size = ui.MeasureString("Raze");

            ui.IMGUI.Label(new Point((sw - size.X) / 2, 40), "Raze", Color.Black, out Rectangle titleBounds);
            ui.FontSize = ui.DefaultFontSize;

            int w = 400;
            int h = 500;

            ui.PanelContext(new Rectangle((sw - w) / 2, Math.Max((sh - h) / 2, titleBounds.Bottom + 10), w, h));
            if (ui.Button("Play"))
            {
                OnHostClicked();
            }
            if (ui.Button("Join Multiplayer"))
            {
                OnConnectClicked();
            }

            var panel  = ui.GetContextInnerBounds();
            int height = ui.IMGUI.ApplyScale(50);

            if (ui.IMGUI.Button(new Rectangle(panel.X, panel.Bottom - height, panel.Width, height), "Quit"))
            {
                OnExitClicked();
            }
            ui.EndContext();
        }
Beispiel #2
0
        private void DrawInputUI(LayoutUserInterface ui)
        {
            int sw = ui.IMGUI.ScreenProvider.GetWidth();
            int sh = ui.IMGUI.ScreenProvider.GetHeight();
            int w  = 350;
            int h  = 350;

            var sb = new Rectangle((sw - w) / 2, (sh - h) / 2, w, h);

            ui.PanelContext(sb, PanelType.Default);
            var panel = ui.GetContextInnerBounds();

            ui.TextBox(ipInput, new Point(panel.Width, 40));
            ui.TextBox(portInput, new Point(panel.Width, 40));
            ui.TextBox(passwordInput, new Point(panel.Width, 40));
            ui.FlatSeparator();
            if (ui.Button("Connect"))
            {
                OnConnectClicked();
            }
            ui.ActiveTint = Color.Red;
            if (ui.IMGUI.Button(new Rectangle(panel.X, panel.Bottom - 32, panel.Width, 32), "Cancel"))
            {
                OnExitClicked();
            }
            ui.ActiveTint = Color.White;

            ui.EndContext();
        }
Beispiel #3
0
        private void DrawConnectingUI(LayoutUserInterface ui)
        {
            int sw = ui.IMGUI.ScreenProvider.GetWidth();
            int sh = ui.IMGUI.ScreenProvider.GetHeight();
            int w  = 450;
            int h  = 250;

            var sb = new Rectangle((sw - w) / 2, (sh - h) / 2, w, h);

            ui.PanelContext(sb);

            ui.Anchor = Anchor.Centered;
            ui.Paragraph(connectionStatus, TextAlignment.Centered, Color.White);
            ui.Anchor = Anchor.Vertical;
            ui.FlatSeparator();
            if (ui.Button("Cancel"))
            {
                OnCancelConnectClicked();
            }

            ui.EndContext();
        }
Beispiel #4
0
        internal void InternalDraw(LayoutUserInterface ui)
        {
            var bounds = ScreenBounds;

            MarginData?margins           = null;
            int        closeButtonHeight = 0;

            if (DrawCloseButton)
            {
                closeButtonHeight = ui.IMGUI.ApplyScale(ui.DefaultFontSize + 3);
                margins           = new MarginData(10, 10, 10, 20 + closeButtonHeight);
            }

            ui.PanelContext(bounds, PanelType, margins);

            if (!string.IsNullOrWhiteSpace(Title))
            {
                ui.Anchor   = Anchor.Centered;
                ui.FontSize = 56;
                ui.Label(Title, Color.LightSkyBlue);
                ui.FontSize = ui.DefaultFontSize;
                ui.Anchor   = Anchor.Vertical;
            }

            Draw(ui);

            if (DrawCloseButton)
            {
                var exteriorBounds = ui.GetContextBounds(); // Should be same as Window.ScreenBounds.
                var mar            = ui.GetContextMargins();
                if (ui.IMGUI.Button(new Rectangle(exteriorBounds.X + mar.Left, exteriorBounds.Bottom - 10 - closeButtonHeight, exteriorBounds.Width - mar.Left - mar.Right, closeButtonHeight), "Close"))
                {
                    Close();
                }
            }

            ui.EndContext();
        }