Ejemplo n.º 1
0
 private void OnParentChanged(object sender, GameObjectParentChangedEventArgs e)
 {
     if (this.ParentChanged != null)
     {
         this.ParentChanged(sender, e);
     }
 }
Ejemplo n.º 2
0
		private void OnParentChanged(object sender, GameObjectParentChangedEventArgs e)
		{
			if (this.ParentChanged != null)
				this.ParentChanged(sender, e);
		}
Ejemplo n.º 3
0
        private void Scene_GameObjectParentChanged(object sender, GameObjectParentChangedEventArgs e)
        {
            // Ignore events during transition
            if (Scene.IsSwitching) return;

            // Find the moved node
            GameObjectNode dragObjNode = this.FindNode(e.Object);
            Node oldParentNode = dragObjNode.Parent;
            Node newParentNode = e.Object.Parent == null ? this.objectModel.Root : this.FindNode(e.Object.Parent);

            // No parent node existing? This must be a new object then.
            if (newParentNode == null)
            {
                // Remove this node and let the parent handle it when it registers.
                oldParentNode.Nodes.Remove(dragObjNode);
                this.UnregisterNodeTree(dragObjNode);
                return;
            }

            // Save old state
            HashSet<object> expandedMap = new HashSet<object>();
            TreeNodeAdv dragObjViewNodeOld = this.objectView.FindNode(this.objectModel.GetPath(dragObjNode));
            bool wasSelected = dragObjViewNodeOld.IsSelected;
            this.objectView.SaveNodesExpanded(dragObjViewNodeOld, expandedMap);

            // Remove node
            oldParentNode.Nodes.Remove(dragObjNode);

            // Re-add node
            this.InsertNodeSorted(dragObjNode, newParentNode);
            TreeNodeAdv dragObjViewNodeNew = this.objectView.FindNode(this.objectModel.GetPath(dragObjNode));
            dragObjViewNodeNew.IsSelected = wasSelected;
            this.objectView.RestoreNodesExpanded(dragObjViewNodeNew, expandedMap);
        }
Ejemplo n.º 4
0
		private void Scene_GameObjectParentChanged(object sender, GameObjectParentChangedEventArgs e)
		{
			// Find the moved node
			GameObjectNode dragObjNode = this.FindNode(e.Object);
			Node parent = dragObjNode.Parent;

			// Remove node
			TreeNodeAdv dragObjViewNode;
			HashSet<object> expandedMap = new HashSet<object>();
			dragObjViewNode = this.objectView.FindNode(this.objectModel.GetPath(dragObjNode));
			bool wasSelected = dragObjViewNode.IsSelected;
			this.objectView.SaveNodesExpanded(dragObjViewNode, expandedMap);
			parent.Nodes.Remove(dragObjNode);

			// Re-add node
			parent = e.Object.Parent == null ? this.objectModel.Root : this.FindNode(e.Object.Parent);
			this.InsertNodeSorted(dragObjNode, parent);
			dragObjViewNode = this.objectView.FindNode(this.objectModel.GetPath(dragObjNode));
			dragObjViewNode.IsSelected = wasSelected;
			this.objectView.RestoreNodesExpanded(dragObjViewNode, expandedMap);
		}
Ejemplo n.º 5
0
 private void OnParentChanged(object sender, GameObjectParentChangedEventArgs e)
 {
     this.ParentChanged?.Invoke(sender, e);
 }