public GameObjectManagementPanel()
        {
            Title = "Entities";
            GameObjectList = new ListBox<EntityListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            GameObjectList.HideBorder = true;
            GameObjectList.SelectedItemChanged += GameObject_SelectedItemChanged;
            GameObjectList.CompareByReference = true;

            removeSelected = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            removeSelected.Text = "Remove";
            removeSelected.ButtonClicked += RemoveSelected_ButtonClicked;

            moveSelectedUp = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedUp.Text = "Move Up";
            moveSelectedUp.ButtonClicked += MoveSelectedUp_ButtonClicked;

            moveSelectedDown = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            moveSelectedDown.Text = "Move Down";
            moveSelectedDown.ButtonClicked += MoveSelectedDown_ButtonClicked;

            renameLayer = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            renameLayer.Text = "Rename";
            renameLayer.ButtonClicked += RenameEntity_ButtonClicked;

            importGameObject = new Button(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            importGameObject.Text = "Import File";
            importGameObject.ButtonClicked += ImportEntity_ButtonClicked;

            drawGameObjectsCheckbox = new CheckBox(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 1);
            drawGameObjectsCheckbox.IsSelected = true;
            drawGameObjectsCheckbox.Text = "Draw Objects";

            animationListTitle = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, 2);
            animationListTitle.Print(0, 0, "Animations", Settings.Green);

            animationsListBox = new ListBox<AnimationListBoxItem>(SadConsoleEditor.Consoles.ToolPane.PanelWidthControls, 4);
            animationsListBox.SelectedItemChanged += AnimationList_SelectedItemChanged;
            animationsListBox.HideBorder = true;
            animationsListBox.CompareByReference = true;

            playAnimationButton = new Button(Consoles.ToolPane.PanelWidthControls, 1);
            playAnimationButton.Text = "Play Animation";
            playAnimationButton.ButtonClicked += (o, e) => { if (animationsListBox.SelectedItem != null) ((AnimatedTextSurface)animationsListBox.SelectedItem).Restart(); };

            Controls = new ControlBase[] { GameObjectList, removeSelected, moveSelectedUp, moveSelectedDown, renameLayer, importGameObject, null, drawGameObjectsCheckbox, null, animationListTitle,animationsListBox, null, playAnimationButton };

            GameObject_SelectedItemChanged(null, null);
        }
Esempio n. 2
0
        public FilesPanel()
        {
            Title = "File";

            NewButton = new Button(7, 1)
            {
                Text = "New",
                CanUseKeyboard = false,
            };
            NewButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowNewEditorPopup();

            LoadButton = new Button(8, 1)
            {
                Text = "Load",
            };
            LoadButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowLoadEditorPopup();

            SaveButton = new Button(8, 1)
            {
                Text = "Save",
            };
            SaveButton.ButtonClicked += (o, e) => EditorConsoleManager.SaveEditor();

            ResizeButton = new Button(10, 1)
            {
                Text = "Resize",
            };
            ResizeButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowResizeEditorPopup();

            CloseButton = new Button(9, 1)
            {
                Text = "Close",
            };
            CloseButton.ButtonClicked += (o, e) => EditorConsoleManager.ShowCloseConsolePopup();

            DocumentsListbox = new ListBox<EditorListBoxItem>(Consoles.ToolPane.PanelWidthControls, 6);
            DocumentsListbox.HideBorder = true;
            DocumentsListbox.CompareByReference = true;

            DocumentsListbox.SelectedItemChanged += DocumentsListbox_SelectedItemChanged;

            documentsTitle = new DrawingSurface(13, 1);
            documentsTitle.Fill(Settings.Green, Settings.Color_MenuBack, 0, null);
            documentsTitle.Print(0, 0, new ColoredString("Opened Files", Settings.Green, Settings.Color_MenuBack));

            Controls = new ControlBase[] { NewButton, LoadButton, SaveButton, ResizeButton, CloseButton, documentsTitle, DocumentsListbox };
        }
        void RebuildProperties(Zone zone)
        {
            if (zone.Settings.Count == 0)
            {
                propertySurface.IsVisible = false;
            }
            else
            {
                propertySurface.IsVisible = true;
            }

            if (propertySurface.IsVisible)
            {
                var drawing = new DrawingSurface(Consoles.ToolPane.PanelWidthControls, (zone.Settings.Count * 2) + 1);

                previousProperties = new Dictionary<string, string>();
                int y = 1;
                drawing.Print(0, 0, "Zone Settings", Settings.Green);
                foreach (var setting in zone.Settings)
                {
                    drawing.Print(0, y, setting.Key.Length > Consoles.ToolPane.PanelWidthControls ? setting.Key.Substring(0, Consoles.ToolPane.PanelWidthControls) : setting.Key, Settings.Yellow);
                    drawing.Print(1, y + 1, setting.Value.Length > Consoles.ToolPane.PanelWidthControls - 1 ? setting.Value.Substring(0, Consoles.ToolPane.PanelWidthControls - 1) : setting.Value, Settings.Grey);
                    previousProperties[setting.Key] = setting.Value;
                    y += 2;
                }

                propertySurface.TextSurface = drawing.TextSurface;
            }
        }