示例#1
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var dpiScale = Platform.DpiScale;
            var settings = CreateWindowSettings.Default;

            settings.Title         = "Flax Editor";
            settings.Size          = new Vector2(1300 * dpiScale, 900 * dpiScale);
            settings.StartPosition = WindowStartPosition.CenterScreen;

            if (!Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
            {
                settings.HasBorder      = false;
                settings.HasSizingFrame = false;
            }

            MainWindow = Window.Create(settings);

            if (MainWindow == null)
            {
                // Error
                Editor.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.Closing += MainWindow_OnClosing;
            MainWindow.Closed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin         = new ContentWindow(Editor);
            EditWin            = new EditGameWindow(Editor);
            GameWin            = new GameWindow(Editor);
            PropertiesWin      = new PropertiesWindow(Editor);
            SceneWin           = new SceneTreeWindow(Editor);
            DebugLogWin        = new DebugLogWindow(Editor);
            OutputLogWin       = new OutputLogWindow(Editor);
            ToolboxWin         = new ToolboxWindow(Editor);
            GraphicsQualityWin = new GraphicsQualityWindow(Editor);
            GameCookerWin      = new GameCookerWindow(Editor);
            ProfilerWin        = new ProfilerWindow(Editor);
            EditorOptionsWin   = new EditorOptionsWindow(Editor);
            PluginsWin         = new PluginsWindow(Editor);

            // Bind events
            SceneManager.SceneSaveError     += OnSceneSaveError;
            SceneManager.SceneLoaded        += OnSceneLoaded;
            SceneManager.SceneLoadError     += OnSceneLoadError;
            SceneManager.SceneLoading       += OnSceneLoading;
            SceneManager.SceneSaved         += OnSceneSaved;
            SceneManager.SceneSaving        += OnSceneSaving;
            SceneManager.SceneUnloaded      += OnSceneUnloaded;
            SceneManager.SceneUnloading     += OnSceneUnloading;
            ScriptsBuilder.ScriptsReloadEnd += OnScriptsReloadEnd;
        }
示例#2
0
 public void EditGame()
 {
     if (EditGameWindow.ShowDialog(Config.MainWindow, this))
     {
         Entry?.Update();
         Config.Modified = true;
         Config.SaveConfig();
     }
 }
示例#3
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var settings = CreateWindowSettings.Default;

            settings.Title         = "Flax Editor";
            settings.Size          = new Vector2(1300, 900);
            settings.StartPosition = WindowStartPosition.CenterScreen;
            MainWindow             = Window.Create(settings);
            if (MainWindow == null)
            {
                // Error
                Debug.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.OnClosing += MainWindow_OnClosing;
            MainWindow.OnClosed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin         = new ContentWindow(Editor);
            EditWin            = new EditGameWindow(Editor);
            GameWin            = new GameWindow(Editor);
            PropertiesWin      = new PropertiesWindow(Editor);
            SceneWin           = new SceneTreeWindow(Editor);
            DebugWin           = new DebugLogWindow(Editor);
            ToolboxWin         = new ToolboxWindow(Editor);
            GraphicsQualityWin = new GraphicsQualityWindow(Editor);
            GameCookerWin      = new GameCookerWindow(Editor);
            ProfilerWin        = new ProfilerWindow(Editor);
            EditorOptionsWin   = new EditorOptionsWindow(Editor);

            // Bind events
            SceneManager.SceneSaveError += OnSceneSaveError;
            SceneManager.SceneLoaded    += OnSceneLoaded;
            SceneManager.SceneLoadError += OnSceneLoadError;
            SceneManager.SceneLoading   += OnSceneLoading;
            SceneManager.SceneSaved     += OnSceneSaved;
            SceneManager.SceneSaving    += OnSceneSaving;
            SceneManager.SceneUnloaded  += OnSceneUnloaded;
            SceneManager.SceneUnloading += OnSceneUnloading;
        }
示例#4
0
        private void OnEdit(object sender, RoutedEventArgs e)
        {
            TreeViewItem item = treeView.SelectedItem as TreeViewItem;

            if (item != null && item != treeView.Items[0])
            {
                if (item.Tag is SetupFolder)
                {
                    if (EditFolderWindow.ShowDialog(Window.GetWindow(this), item.Tag as SetupFolder))
                    {
                        UpdateItem(item);
                        Modified = true;
                    }
                }
                else if (item.Tag is Game)
                {
                    if (EditGameWindow.ShowDialog(Window.GetWindow(this), item.Tag as Game))
                    {
                        UpdateItem(item);
                        Modified = true;
                    }
                }
                else if (item.Tag is Server)
                {
                    if (EditServerWindow.ShowDialog(Window.GetWindow(this), item.Tag as Server))
                    {
                        UpdateItem(item);
                        Modified = true;
                    }
                }
                else if (item.Tag is Tool)
                {
                    if (EditToolWindow.ShowDialog(Window.GetWindow(this), item.Tag as Tool))
                    {
                        UpdateItem(item);
                        Modified = true;
                    }
                }
                item.IsSelected = true;
                item.Focus();
            }
        }
示例#5
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var dpiScale = Platform.DpiScale;
            var settings = CreateWindowSettings.Default;

            settings.Title               = "Flax Editor";
            settings.Size                = Platform.DesktopSize;
            settings.StartPosition       = WindowStartPosition.CenterScreen;
            settings.ShowAfterFirstPaint = true;

#if PLATFORM_WINDOWS
            if (!Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
#endif
            {
                settings.HasBorder = false;
#if PLATFORM_WINDOWS
                // Skip OS sizing frame and implement it using LeftButtonHit
                settings.HasSizingFrame = false;
#endif
            }

            MainWindow = Platform.CreateWindow(ref settings);

            if (MainWindow == null)
            {
                // Error
                Editor.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.Closing += MainWindow_OnClosing;
            MainWindow.Closed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin              = new ContentWindow(Editor);
            EditWin                 = new EditGameWindow(Editor);
            GameWin                 = new GameWindow(Editor);
            PropertiesWin           = new PropertiesWindow(Editor);
            SceneWin                = new SceneTreeWindow(Editor);
            DebugLogWin             = new DebugLogWindow(Editor);
            OutputLogWin            = new OutputLogWindow(Editor);
            ToolboxWin              = new ToolboxWindow(Editor);
            GraphicsQualityWin      = new GraphicsQualityWindow(Editor);
            GameCookerWin           = new GameCookerWindow(Editor);
            ProfilerWin             = new ProfilerWindow(Editor);
            EditorOptionsWin        = new EditorOptionsWindow(Editor);
            PluginsWin              = new PluginsWindow(Editor);
            VisualScriptDebuggerWin = new VisualScriptDebuggerWindow(Editor);

            // Bind events
            Level.SceneSaveError             += OnSceneSaveError;
            Level.SceneLoaded                += OnSceneLoaded;
            Level.SceneLoadError             += OnSceneLoadError;
            Level.SceneLoading               += OnSceneLoading;
            Level.SceneSaved                 += OnSceneSaved;
            Level.SceneSaving                += OnSceneSaving;
            Level.SceneUnloaded              += OnSceneUnloaded;
            Level.SceneUnloading             += OnSceneUnloading;
            ScriptsBuilder.ScriptsReloadEnd  += OnScriptsReloadEnd;
            Editor.StateMachine.StateChanged += OnEditorStateChanged;
        }