Exemplo n.º 1
0
        public SceneViewerControl()
        {
            Tabs = new ObservableCollection<SceneTabViewModel>();

            RemoveTab = new RelayCommand((obj) =>
            {
                Tabs.Remove(obj as SceneTabViewModel);
                //MessageBox.Show("New Folder!");
            });

            InitializeComponent();
            AssignPanelEventHandling(xna);

            ScenesControl.ItemsSource = Tabs;

            if (DesignerProperties.GetIsInDesignMode(this))
                return;

            _game = new MyGame(xna.Handle);
            _game.GameWorld.UpdateWorld = false;
            _context = _game.GraphicsContext;

            var gameWorldArg =
                new ConstructorArgument(
                    ApplicationProperties.ISceneViewerGameWorldArgName,
                    _game.GameWorld);
            _controller = DependencyInjectorHelper
                            .MainWindowKernel
                            .Get<ISceneViewerController>(gameWorldArg);
            _controller.Control = this;
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            #region Command Setup
            OpenImageViewer = new RelayCommand(
                (o) =>
                {
                    _imageViewer = new ImageViewerDialog();
                    _imageViewer.Owner = this;
                    _imageViewer.Closed += ImageViewer_Closed;
                    _imageViewer.Show();
                },
                (o) =>
                {
                    return _imageViewer == null;
                }
            );

            SaveScene = new RelayCommand(
                (o) => { SceneViewControl.SaveSelectedScene(); },
                (o) => { return SceneViewControl.SelectedScene != null; }
            );

            SaveAllScenes = new RelayCommand(
                (o) => { },
                (o) => { return true; }
            );

            Undo = new RelayCommand(
                (o) => { SceneViewControl.Undo(); },
                (o) => { return SceneViewControl.CanUndo; }
            );

            Redo = new RelayCommand(
                (o) => { SceneViewControl.Redo(); },
                (o) => { return SceneViewControl.CanRedo; }
            );

            Puppeteer = new RelayCommand(
                (o) =>
                {
                    _puppeteerWindow = new PuppeteerEditorDialog();
                    _puppeteerWindow.Owner = this;
                    _puppeteerWindow.Closed += PuppeteerDialog_Closed;
                    _puppeteerWindow.Show();
                },
                (o) =>
                {
                    return _puppeteerWindow == null;
                }
            );

            ParticleEditor = new RelayCommand(
                (o) =>
                {
                    _particleEditorWindow = new ParticleEditorDialog();
                    _particleEditorWindow.Owner = this;
                    _particleEditorWindow.Closed += ParticleEditor_Closed;
                    _particleEditorWindow.Show();
                },
                (o) =>
                {
                    return _particleEditorWindow == null;
                }
            );

            /*TransformMode = new RelayCommand(
                (o) =>
                {
                    _mode = (WidgetMode)o;
                    _controller.WidgetMode = _mode;
                    //(SceneViewControl.SelectedActor as ITransformableWidget).WidgetMode = _mode.Value;
                },
                (o) =>
                {
                    if (!(o is WidgetMode)) return false;
                    return _controller.HasActorSelected;
                    //return SceneViewControl.SelectedActor != null && SceneViewControl.SelectedActor is ITransformableWidget;
                });*/

            #endregion

            InitializeComponent();

            SceneViewControl.OnActorAdded += OnActorAddedHandler;
            var model =
                DependencyInjectorHelper
                    .MainWindowKernel
                    .Get<TransformModeViewModel>();

            TranslateButton.DataContext = model;
            RotateButton.DataContext = model;
            ScaleButton.DataContext = model;

            ApplicationUtils.SetupApplicationFolders();

            if (DesignerProperties.GetIsInDesignMode(this))
                return;
        }
        public void LoadedHandler(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;

            _skeletonController =
                DependencyInjectorHelper
                    .PuppeteerKernel
                    .Get<ISkeletonViewerController>();

            _skeletonController.SkeletonTreeViewControl = this;
            Clear();

            SwitchEditMode = new RelayCommand(
                (o) =>
                {
                    var bone = (o as BoneViewModel);
                    bone.EditMode = !bone.EditMode;
                },
                (o) =>
                {
                    return (o as BoneViewModel) != null;
                }
            );

            SelectedItemChangedCommand = new RelayCommand(
                (o) =>
                {
                    var bone = (o as BoneViewModel);
                    _skeletonController.SelectBone(bone);
                },
                (o) =>
                {
                    return (o as BoneViewModel) != null;
                }
            );

            if (OnLoaded != null)
                OnLoaded(this);
        }
        public void LoadedHandler(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;

            var controlArg =
                new ConstructorArgument(
                    ApplicationProperties.IGameObjectsControllerArgName,
                    this);
            _controller = DependencyInjectorHelper
                            .MainWindowKernel
                            .Get<IGameObjectsController>(controlArg);

            base.DataContext = _controller.LoadGameObjectsTree();

            #region Initialize Commands
            AddNewSceneCommand =
                new RelayCommand(AddSceneTo);
            AddNewFolderCommand =
                new RelayCommand(
                    (obj) =>
                    {
                        MessageBox.Show("TODO add new folder");
                    });
            ImportSceneCommand =
                new RelayCommand(
                    (obj) =>
                    {
                        MessageBox.Show("TODO import scene");
                    });
            #endregion
        }