Exemple #1
0
        private void editResource(Value value)
        {
            IDocumentPanel editorPanel = null;
            Resource       resource    = value.Getter() as Resource;

            if (value.Type == typeof(Managed.Graphics.Texture.Image))
            {
                /*editorPanel = new ImageEditorPanel() {
                 *  Image = resource as Managed.Graphics.Texture.Image
                 * };*/
            }
            else if (value.Type == typeof(Material))
            {
                editorPanel = new MaterialEditorPanel()
                {
                    Material = resource as Material
                };
            }
            else if (value.Type == typeof(Sound))
            {
                editorPanel = new SoundEditorPanel()
                {
                    Sound = resource as Sound
                };
            }
            else if (value.Type == typeof(Script))
            {
                if (resource == null)
                {
                    resource = Managed.Script.Scripts.MakeEmpty(value.Owner as Entity);
                }
                editorPanel = new ScriptEditorPanel()
                {
                    Script = resource as Script
                };
                value.Setter(resource);
            }
            else
            {
                MessageBox.Show(this, "GhurundEngine is unable to open files of that type.", "Unknown format", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            openPanel(this, editorPanel);

            if (resource.FileName != null)
            {
                Settings.AddRecentFile(resource.FileName);
            }
        }
Exemple #2
0
        private void panelFocused(object sender, PanelActionEventArgs args)
        {
            if (args.Panel.Content is IDocumentPanel || args.Panel.Content is WelcomePage)
            {
                mostRecentDocumentPanel      = args.Panel.Content as IDocumentPanel;
                mostRecentDocumentTabControl = args.TabControl;
            }
            else if (args.Panel.Content is IToolPanel)
            {
                mostRecentToolPanel      = args.Panel.Content as IToolPanel;
                mostRecentToolTabControl = args.TabControl;
            }

            if (args.Panel.Content is ISceneEditor)
            {
                var editor = args.Panel.Content as ISceneEditor;
                SceneExplorer.Scene = editor.Scene;
            }
        }