コード例 #1
0
        public CInspectorEntityComponentViewModel(IInspectorViewModel viewModel, string name, SEntityComponentId componentId)
            : base(viewModel, name)
        {
            ComponentId = componentId;

            DeleteComponentCommand = new CRelayCommand(arg =>
            {
                EditorEntityUtility.DestroyComponent(ComponentId);

                m_viewModel.QueueEntityInformationUpdate(ComponentId.EntityId, true);
            });
        }
コード例 #2
0
        private void OnKeyDown(object e)
        {
            KeyEventArgs args = (KeyEventArgs)e;

            if (IsActive && args.Key == Key.Delete)
            {
                var outliner = CWorkspace.Instance.GetTool <CWorldOutlinerViewModel>();
                if (outliner.SelectedEntityViewModel != null)
                {
                    EditorEntityUtility.DestroyEntity(outliner.SelectedEntityViewModel.EntityId);
                }
            }
        }
コード例 #3
0
        public CInspectorViewModel()
            : base("Inspector")
        {
            SetIconSourcePath("Resources/Images/Tabs/inspector.png");

            Content = new Inspector();
            m_view  = Content as IInspectorView;

            InitializeEntityMenues();

            RenameEntityCommand             = new CRelayCommand(InternalRenameEntity);
            AddComponentCommand             = new CRelayCommand(InternalAddComponent);
            ToggleAddComponentMenuCommand   = new CRelayCommand((obj) => AddComponentMenuOpen = !AddComponentMenuOpen);
            ToggleEntityCommandsMenuCommand = new CRelayCommand((obj) => EntityCommandsMenuOpen = !EntityCommandsMenuOpen);

            CWorkspace.Instance.OnSelectedEditableObjectChanged += (oldObj, newObj) =>
            {
                m_view?.ClearInspector();
                m_view?.LockInspector(true);

                if (newObj != null)
                {
                    m_view.SetInspectorVisible(true);

                    switch (newObj.Type)
                    {
                    case CEditableObject.EObjectType.Entity:
                        InspectEntity(newObj.EntityId);
                        if (oldObj?.GetTargetEntityId() != newObj?.GetTargetEntityId())
                        {
                            QueueEntityInformationUpdate(newObj.GetTargetEntityId(), true);
                        }

                        EditorEntityUtility.PickRootComponent(newObj.EntityId);
                        break;

                    case CEditableObject.EObjectType.Component:
                        InspectComponent(newObj.ComponentId);
                        break;
                    }
                }
                else
                {
                    m_view?.SetInspectorVisible(false);
                    Reset();
                    EditorEntityUtility.PickComponent(SEntityComponentId.Invalid);
                }
            };
        }
コード例 #4
0
        public CWorldOutlinerViewModel()
            : base("World Outliner")
        {
            SetIconSourcePath("Resources/Images/Tabs/outliner.png");

            Content = new WorldOutliner();
            m_view  = Content as IOutlinerView;

            CWorkspace.Instance.OnSelectedEditableObjectChanged += (oldObj, newObj) =>
            {
                if (newObj != null)
                {
                    switch (newObj.Type)
                    {
                    case CEditableObject.EObjectType.Entity:
                        HighlightEntity(newObj.EntityId);
                        break;

                    case CEditableObject.EObjectType.Component:
                        HighlightEntity(newObj.ComponentId.EntityId);
                        break;
                    }
                }
                else
                {
                    SelectedEntityViewModel?.MarkInOutliner(false);
                }
            };

            KeyDownCommand = new CRelayCommand(param =>
            {
                KeyEventArgs args = (KeyEventArgs)param;
                if (IsActive && args.Key == Key.Delete)
                {
                    if (SelectedEntityViewModel != null)
                    {
                        EditorEntityUtility.DestroyEntity(SelectedEntityViewModel.EntityId);
                    }
                }
            });
        }
コード例 #5
0
 private void OnDeleteCommand(object arg)
 {
     EditorEntityUtility.DestroyEntity(EntityId);
 }
コード例 #6
0
 private void OnDetachCommand(object argument)
 {
     EditorEntityUtility.DetachEntityFromAllParents(EntityId);
 }
コード例 #7
0
        protected virtual void OnMakeRoot(object argument)
        {
            EditorEntityUtility.MakeComponentRoot(ComponentId);

            m_viewModel.QueueEntityInformationUpdate(ComponentId.EntityId, true);
        }
コード例 #8
0
        protected virtual void OnDeleteComponent(object argument)
        {
            EditorEntityUtility.DestroyComponent(ComponentId);

            m_viewModel.QueueEntityInformationUpdate(ComponentId.EntityId, true);
        }