Beispiel #1
0
        public void UpdateMenuList()
        {
            menuControls.RemoveAll();

            int buttonPosition = 1;

            currentButton = -1;
            buttons.Clear();

            // Continue game button
            if (GameLogic.GameMapScreen != null)
            {
                SadConsole.Controls.Button continueGameButton = new SadConsole.Controls.Button(16);
                continueGameButton.Text     = "Continue Game";
                continueGameButton.Position = new Microsoft.Xna.Framework.Point(2, buttonPosition);
                buttonPosition           += 2;
                continueGameButton.Click += ContinueGameButtonClicked;
                menuControls.Add(continueGameButton);
                buttons.Add(continueGameButton);
            }

            // New game button
            SadConsole.Controls.Button newGameButton = new SadConsole.Controls.Button(16);
            newGameButton.Text     = "New Game";
            newGameButton.Position = new Microsoft.Xna.Framework.Point(2, buttonPosition);
            buttonPosition        += 2;
            newGameButton.Click   += NewGameButtonClicked;
            menuControls.Add(newGameButton);
            buttons.Add(newGameButton);

            // Exit game button
            SadConsole.Controls.Button exitGameButton = new SadConsole.Controls.Button(16);
            exitGameButton.Text     = "Exit";
            exitGameButton.Position = new Microsoft.Xna.Framework.Point(2, buttonPosition);
            buttonPosition         += 2;
            exitGameButton.Click   += ExitGameButtonClicked;
            menuControls.Add(exitGameButton);
            buttons.Add(exitGameButton);
        }
Beispiel #2
0
        public void RedrawPanels()
        {
            int activeRow = 0;

            ToolsConsole.Clear();
            ToolsConsole.RemoveAll();
            _hotSpots.Clear();

            char open   = (char)31;
            char closed = (char)16;

            List <CustomPanel> allPanels = new List <CustomPanel>()
            {
                PanelFiles
            };

            // Custom panels from the selected editor
            if (MainScreen.Instance.ActiveEditor != null)
            {
                if (MainScreen.Instance.ActiveEditor.Panels != null && MainScreen.Instance.ActiveEditor.Panels.Length != 0)
                {
                    allPanels.AddRange(MainScreen.Instance.ActiveEditor.Panels);
                }
            }

            // Custom panels from the selected tool
            //if (SelectedTool.ControlPanels != null && SelectedTool.ControlPanels.Length != 0)
            //    allPanels.AddRange(SelectedTool.ControlPanels);

            // Display all panels needed
            if (allPanels.Count != 0)
            {
                foreach (var pane in allPanels)
                {
                    if (pane.IsVisible)
                    {
                        pane.Loaded();
                        _hotSpots.Add(new Tuple <CustomPanel, int>(pane, activeRow));
                        if (pane.IsCollapsed == false)
                        {
                            ToolsConsole.Print(1, activeRow++, open + " " + pane.Title);
                            ToolsConsole.Print(0, activeRow++, new string((char)196, ToolsConsole.TextSurface.Width));

                            foreach (var control in pane.Controls)
                            {
                                if (control != null)
                                {
                                    if (control.IsVisible)
                                    {
                                        ToolsConsole.Add(control);
                                        control.Position = new Point(1, activeRow);
                                        activeRow       += pane.Redraw(control) + control.Height;
                                    }
                                }
                                else
                                {
                                    activeRow++;
                                }
                            }

                            activeRow += 1;
                        }
                        else
                        {
                            ToolsConsole.Print(1, activeRow++, closed + " " + pane.Title);
                        }
                    }
                }
            }

            int scrollAbility = activeRow + 1 - Settings.Config.WindowHeight;

            if (scrollAbility <= 0)
            {
                ToolsPaneScroller.IsEnabled = false;
                ToolsPaneScroller.Maximum   = 0;
            }
            else
            {
                ToolsPaneScroller.Maximum   = scrollAbility;
                ToolsPaneScroller.IsEnabled = true;
            }
        }