상속: CustomPanel
예제 #1
0
        public SceneEditor()
        {
            consoleWrapper = new Console(1, 1);
            consoleWrapper.Renderer = new LayeredTextRenderer();
            consoleWrapper.MouseHandler = ProcessMouse;
            consoleWrapper.CanUseKeyboard = false;

            consoleWrapper.MouseMove += (o, e) => { toolsPanel.SelectedTool?.MouseMoveSurface(e.OriginalMouseInfo, textSurface); };
            consoleWrapper.MouseEnter += (o, e) => { toolsPanel.SelectedTool?.MouseEnterSurface(e.OriginalMouseInfo, textSurface); };
            consoleWrapper.MouseExit += (o, e) => { toolsPanel.SelectedTool?.MouseExitSurface(e.OriginalMouseInfo, textSurface); };

            layerManagementPanel = new LayersPanel() { IsCollapsed = true };
            toolsPanel = new ToolsPanel();

            // Fill tools
            tools = new Dictionary<string, Tools.ITool>();
            tools.Add(Tools.PaintTool.ID, new Tools.PaintTool());
            tools.Add(Tools.LineTool.ID, new Tools.LineTool());
            tools.Add(Tools.CircleTool.ID, new Tools.CircleTool());
            tools.Add(Tools.RecolorTool.ID, new Tools.RecolorTool());
            tools.Add(Tools.FillTool.ID, new Tools.FillTool());
            tools.Add(Tools.BoxTool.ID, new Tools.BoxTool());
            tools.Add(Tools.SelectionTool.ID, new Tools.SelectionTool());
            tools.Add(Tools.SceneObjectMoveResizeTool.ID, new Tools.SceneObjectMoveResizeTool());
            tools.Add(Tools.HotspotTool.ID, new Tools.HotspotTool());

            toolsPanel.ToolsListBox.Items.Add(tools[Tools.SceneObjectMoveResizeTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.HotspotTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.PaintTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.LineTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.CircleTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.RecolorTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.FillTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.BoxTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.SelectionTool.ID]);

            toolsPanel.ToolsListBox.SelectedItemChanged += ToolsListBox_SelectedItemChanged;

            GameObjectPanel = new Panels.GameObjectManagementPanel();
            ZonesPanel = new RegionManagementPanel() { IsCollapsed = true };
            HotspotPanel = new HotspotToolPanel() { IsCollapsed = true };

            LinkedGameObjects = new Dictionary<GameObject, GameObject>();
            Objects = new List<ResizableObject>();
            Zones = new List<ResizableObject<Zone>>();
            Hotspots = new List<Hotspot>();

            panels = new CustomPanel[] { layerManagementPanel, GameObjectPanel, ZonesPanel, HotspotPanel, toolsPanel };
        }
        public LayeredConsoleEditor()
        {
            consoleWrapper = new Console(1, 1);
            consoleWrapper.Renderer = new LayeredTextRenderer();
            consoleWrapper.MouseHandler = ProcessMouse;
            consoleWrapper.CanUseKeyboard = false;

            consoleWrapper.MouseMove += (o, e) => { toolsPanel.SelectedTool?.MouseMoveSurface(e.OriginalMouseInfo, textSurface); };
            consoleWrapper.MouseEnter += (o, e) => { toolsPanel.SelectedTool?.MouseEnterSurface(e.OriginalMouseInfo, textSurface); };
            consoleWrapper.MouseExit += (o, e) => { toolsPanel.SelectedTool?.MouseExitSurface(e.OriginalMouseInfo, textSurface); };

            layerManagementPanel = new LayersPanel() { IsCollapsed = true };
            toolsPanel = new ToolsPanel();

            // Fill tools
            tools = new Dictionary<string, Tools.ITool>();
            tools.Add(Tools.PaintTool.ID, new Tools.PaintTool());
            tools.Add(Tools.LineTool.ID, new Tools.LineTool());
            tools.Add(Tools.TextTool.ID, new Tools.TextTool());
            tools.Add(Tools.CircleTool.ID, new Tools.CircleTool());
            tools.Add(Tools.RecolorTool.ID, new Tools.RecolorTool());
            tools.Add(Tools.FillTool.ID, new Tools.FillTool());
            tools.Add(Tools.BoxTool.ID, new Tools.BoxTool());
            tools.Add(Tools.SelectionTool.ID, new Tools.SelectionTool());

            toolsPanel.ToolsListBox.Items.Add(tools[Tools.PaintTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.LineTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.TextTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.CircleTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.RecolorTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.FillTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.BoxTool.ID]);
            toolsPanel.ToolsListBox.Items.Add(tools[Tools.SelectionTool.ID]);

            toolsPanel.ToolsListBox.SelectedItemChanged += ToolsListBox_SelectedItemChanged;

            panels = new CustomPanel[] { layerManagementPanel, toolsPanel };
        }
예제 #3
0
        public void FinishCreating()
        {
            ProcessMouseWithoutFocus = true;

            textSurface.DefaultBackground = Settings.Color_MenuBack;
            textSurface.DefaultForeground = Settings.Color_TitleText;
            Clear();

            _tools = new Dictionary<string, ITool>();
            _tools.Add(PaintTool.ID, new PaintTool());
            _tools.Add(RecolorTool.ID, new RecolorTool());
            _tools.Add(FillTool.ID, new FillTool());
            _tools.Add(TextTool.ID, new TextTool());
            _tools.Add(LineTool.ID, new LineTool());
            _tools.Add(BoxTool.ID, new BoxTool());
            //_tools.Add(ObjectTool.ID, new ObjectTool());
            _tools.Add(SelectionTool.ID, new SelectionTool());
            _tools.Add(CircleTool.ID, new CircleTool());
            _tools.Add(EntityCenterTool.ID, new EntityCenterTool());
            _tools.Add(SceneEntityMoveTool.ID, new SceneEntityMoveTool());

            FilesPanel = new FilesPanel();
            ToolsPanel = new ToolsPanel();
            LayersPanel = new LayersPanel();

            FilesPanel.IsCollapsed = true;
            LayersPanel.IsCollapsed = true;

            ToolsPanel.ToolsListBox.SelectedItemChanged += (sender, e) =>
            {
                if (selectedTool != null)
                {
                    selectedTool.OnDeselected();
                    if (selectedTool.ControlPanels != null)
                        foreach (var pane in selectedTool.ControlPanels)
                        {
                            foreach (var control in pane.Controls)
                            {
                                Remove(control);
                            }
                        }
                }

                if (e.Item != null)
                {
                    selectedTool = (ITool)e.Item;
                    EditorConsoleManager.Instance.ToolName = selectedTool.Title;

                    EditorConsoleManager.Instance.AllowKeyboardToMoveConsole = true;
                    CommonCharacterPickerPanel.HideCharacter = false;
                    CommonCharacterPickerPanel.HideForeground = false;
                    CommonCharacterPickerPanel.HideBackground = false;

                    selectedTool.OnSelected();
                    CommonCharacterPickerPanel.Reset();
                    RefreshControls();
                }

            };
        }