Exemple #1
0
        public EntityPropertiesEditorViewModel(EntityModel entityModel, IComponentPropertiesEditorViewModelFactory componentPropertiesEditorViewModelFactory)
        {
            _entityModel = entityModel;
            _componentPropertiesEditorViewModelFactory = componentPropertiesEditorViewModelFactory;
            _name = CreateProperty(nameof(Name), _entityModel.Name);

            Components = new ObservableCollection <ComponentPropertiesEditorViewModel>(_entityModel.Components.Select(c =>
                                                                                                                      _componentPropertiesEditorViewModelFactory.Create(c)));

            AddTransform3DComponentCommand       = RelayCommand.Create(AddTransform3DComponent);
            AddEllipseRendererComponentCommand   = RelayCommand.Create(AddEllipseRendererComponent);
            AddRectangleRendererComponentCommand = RelayCommand.Create(AddRectangleRendererComponent);
            AddTextRendererComponentCommand      = RelayCommand.Create(AddTextRendererComponent);
            AddCircleColliderComponentCommand    = RelayCommand.Create(AddCircleColliderComponent);
            AddRectangleColliderComponentCommand = RelayCommand.Create(AddRectangleColliderComponent);

            _name.Subscribe(name => _entityModel.Name = name);

            _entityModel.ComponentAdded += EntityModelOnComponentAdded;
        }
Exemple #2
0
 public EntityPropertiesEditorViewModelFactory(IComponentPropertiesEditorViewModelFactory componentPropertiesEditorViewModelFactory)
 {
     _componentPropertiesEditorViewModelFactory = componentPropertiesEditorViewModelFactory;
 }
 public void SetUp()
 {
     _componentPropertiesEditorViewModelFactory = Substitute.For <IComponentPropertiesEditorViewModelFactory>();
 }