Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorNavigationViewModel"/> class.
        /// </summary>
        /// <param name="editor"></param>
        /// <param name="serviceProvider">The service provider for this view model.</param>
        /// <param name="controller">The controller object for the related editor game.</param>
        public EditorNavigationViewModel([NotNull] IViewModelServiceProvider serviceProvider, [NotNull] IEditorGameController controller, [NotNull] EntityHierarchyEditorViewModel editor)
            : base(serviceProvider)
        {
            if (controller == null)
            {
                throw new ArgumentNullException(nameof(controller));
            }
            this.editor     = editor;
            this.controller = controller;

            ToggleAllGroupsCommand = new AnonymousCommand <bool>(ServiceProvider, value => Visuals.ForEach(x => x.IsVisible = value));

            gameSettingsAsset = editor.Session.AllAssets.FirstOrDefault(x => x.AssetType == typeof(GameSettingsAsset));
            if (gameSettingsAsset != null)
            {
                gameSettingsAsset.PropertyGraph.ItemChanged += GameSettingsPropertyGraphOnItemChanged;
                gameSettingsAsset.PropertyGraph.Changed     += GameSettingsPropertyGraphOnChanged;
                UpdateNavigationMeshLayers();
            }

            editor.Dispatcher.InvokeTask(async() =>
            {
                await controller.GameContentLoaded;
                service = controller.GetService <EditorGameNavigationMeshService>();
                UpdateNavigationMeshLayers();
            });
        }
Exemplo n.º 2
0
 private void UpdateSnap()
 {
     controller.GetService <IEditorGameTransformViewModelService>().UpdateSnap(transformation, Value, IsActive);
 }