Beispiel #1
0
        public ProjectViewModel(
            IAssetService assetService,
            IDialogService dialogService,
            IMonoGameService monoGameService,
            IProjectService projectService,
            ISceneService sceneService,
            Serializer serializer,
            IUndoService undoService)
        {
            this.AssetService     = assetService;
            this._dialogService   = dialogService;
            this._monoGameService = monoGameService;
            this.ProjectService   = projectService;
            this._sceneService    = sceneService;
            this._serializer      = serializer;
            this._undoService     = undoService;

            this.AddAssetCommand     = new RelayCommand(this.AddAsset);
            this._deleteAssetCommand = new RelayCommand(async() => await this.DeleteAsset(), () => this.AssetService.SelectedAsset?.Parent != null);
            this.OpenSceneCommand    = new RelayCommand <Asset>(this.OpenScene, asset => asset.Type == AssetType.Scene);

            this.AssetService.PropertyChanged   += this.AssetService_PropertyChanged;
            this.ProjectService.PropertyChanged += this.ProjectService_PropertyChanged;

            if (this.ProjectService.CurrentProject != null)
            {
                this.ProjectService.CurrentProject.PropertyChanged += this.CurrentProject_PropertyChanged;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextureDocument"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="documentType">The type of the document.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> or <paramref name="documentType"/> is <see langword="null"/>.
        /// </exception>
        internal TextureDocument(IEditorService editor, DocumentType documentType)
            : base(editor, documentType)
        {
            _graphicsService   = editor.Services.GetInstance <IGraphicsService>().ThrowIfMissing();
            _monoGameService   = editor.Services.GetInstance <IMonoGameService>().ThrowIfMissing();
            _propertiesService = editor.Services.GetInstance <IPropertiesService>().WarnIfMissing();

            Editor.ActiveDockTabItemChanged += OnEditorDockTabItemChanged;
        }
Beispiel #3
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="TextureDocument"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="documentType">The type of the document.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> or <paramref name="documentType"/> is <see langword="null"/>.
        /// </exception>
        internal TextureDocument(IEditorService editor, DocumentType documentType)
            : base(editor, documentType)
        {
            _graphicsService = editor.Services.GetInstance<IGraphicsService>().ThrowIfMissing();
            _monoGameService = editor.Services.GetInstance<IMonoGameService>().ThrowIfMissing();
            _propertiesService = editor.Services.GetInstance<IPropertiesService>().WarnIfMissing();

            Editor.ActiveDockTabItemChanged += OnEditorDockTabItemChanged;
        }
        public ComponentHierarchy()
        {
            this._dialogService    = ViewContainer.Resolve <IDialogService>();
            this._monoGameService  = ViewContainer.Resolve <IMonoGameService>();
            this._componentService = ViewContainer.Resolve <IComponentService>();
            this._undoService      = ViewContainer.Resolve <IUndoService>();

            this._componentService.SelectionChanged += this.ComponentService_SelectionChanged;
            this._addComponentCommand    = new RelayCommand(this.AddComponent, () => this.SelectedItem != null);
            this._removeComponentCommand = new RelayCommand(this.RemoveComponent, () => this.SelectedItem != null && this.SelectedItem is ComponentWrapper);
            this.InitializeComponent();
        }
Beispiel #5
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="ModelDocument"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="documentType">The type of the document.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> or <paramref name="documentType"/> is <see langword="null"/>.
        /// </exception>
        internal ModelDocument(IEditorService editor, DocumentType documentType)
            : base(editor, documentType)
        {
            _modelsExtension        = editor.Extensions.OfType <ModelsExtension>().FirstOrDefault().ThrowIfMissing();
            _useDigitalRuneGraphics = _modelsExtension.UseDigitalRuneGraphics;

            var services = Editor.Services;

            _documentService   = services.GetInstance <IDocumentService>().ThrowIfMissing();
            _statusService     = services.GetInstance <IStatusService>().ThrowIfMissing();
            _outputService     = services.GetInstance <IOutputService>().ThrowIfMissing();
            _animationService  = services.GetInstance <IAnimationService>().ThrowIfMissing();
            _monoGameService   = services.GetInstance <IMonoGameService>().ThrowIfMissing();
            _outlineService    = services.GetInstance <IOutlineService>().WarnIfMissing();
            _propertiesService = services.GetInstance <IPropertiesService>().WarnIfMissing();
            _errorService      = services.GetInstance <IErrorService>().WarnIfMissing();

            Editor.ActiveDockTabItemChanged += OnEditorDockTabItemChanged;

            UpdateProperties();
            UpdateOutline();
        }
Beispiel #6
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="ModelDocument"/> class.
        /// </summary>
        /// <param name="editor">The editor.</param>
        /// <param name="documentType">The type of the document.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="editor"/> or <paramref name="documentType"/> is <see langword="null"/>.
        /// </exception>
        internal ModelDocument(IEditorService editor, DocumentType documentType)
          : base(editor, documentType)
        {
            _modelsExtension = editor.Extensions.OfType<ModelsExtension>().FirstOrDefault().ThrowIfMissing();
            _useDigitalRuneGraphics = _modelsExtension.UseDigitalRuneGraphics;

            var services = Editor.Services;
            _documentService = services.GetInstance<IDocumentService>().ThrowIfMissing();
            _statusService = services.GetInstance<IStatusService>().ThrowIfMissing();
            _outputService = services.GetInstance<IOutputService>().ThrowIfMissing();
            _animationService = services.GetInstance<IAnimationService>().ThrowIfMissing();
            _monoGameService = services.GetInstance<IMonoGameService>().ThrowIfMissing();
            _outlineService = services.GetInstance<IOutlineService>().WarnIfMissing();
            _propertiesService = services.GetInstance<IPropertiesService>().WarnIfMissing();
            _errorService = services.GetInstance<IErrorService>().WarnIfMissing();

            Editor.ActiveDockTabItemChanged += OnEditorDockTabItemChanged;

            UpdateProperties();
            UpdateOutline();
        }
Beispiel #7
0
 public SettingsManager(IMonoGameService monoGameService, IProjectService projectService, ISceneService sceneService)
 {
     this._monoGameService = monoGameService;
     this._projectService  = projectService;
     this._sceneService    = sceneService;
 }