Ejemplo n.º 1
0
 public SceneGraphNodeViewData(SceneGraphNodeViewData parent, EngineNS.GamePlay.SceneGraph.ISceneNode srcNode)
 {
     Parent        = parent;
     mSrcSceneNode = srcNode;
     Name          = srcNode.Name;
     BindingOperations.SetBinding(this, NameProperty, new Binding("Name")
     {
         Source = srcNode, Mode = BindingMode.TwoWay
     });
     BindingOperations.SetBinding(this, VisibleProperty, new Binding("Visible")
     {
         Source = srcNode, Mode = BindingMode.TwoWay
     });
 }
Ejemplo n.º 2
0
        SceneGraphNodeViewData CreateNodeItem(SceneGraphNodeViewData parent, EngineNS.GamePlay.SceneGraph.ISceneNode srcNode)
        {
            var viewData = new SceneGraphNodeViewData(parent, srcNode);

            if (parent != null)
            {
                parent.Children.Add(viewData);
                viewData.Parent = parent;
            }
            mViewDataDic.Add(srcNode, viewData);

            foreach (var childNode in srcNode.ChildrenNode)
            {
                CreateNodeItem(viewData, childNode);
            }
            return(viewData);
        }
Ejemplo n.º 3
0
 private void Viewport_DAddActor(EngineNS.GamePlay.Actor.GActor actor)
 {
     foreach (var comp in actor.Components)
     {
         var sgComp = comp as EngineNS.GamePlay.Component.ISceneGraphComponent;
         if (sgComp != null)
         {
             var node = sgComp.GetSceneNode();
             SceneGraphNodeViewData parentData = null;
             if (node.Parent == null)
             {
                 throw new InvalidOperationException("node.Parent不能为空");
             }
             mViewDataDic.TryGetValue(node.Parent, out parentData);
             CreateNodeItem(parentData, node);
         }
     }
 }
Ejemplo n.º 4
0
 private void Viewport_DRemoveActor(EngineNS.GamePlay.Actor.GActor actor)
 {
     foreach (var comp in actor.Components)
     {
         var sgComp = comp as EngineNS.GamePlay.Component.ISceneGraphComponent;
         if (sgComp != null)
         {
             var node = sgComp.GetSceneNode();
             if (node != null)
             {
                 SceneGraphNodeViewData nodeData = null;
                 mViewDataDic.TryGetValue(node, out nodeData);
                 if (nodeData != null)
                 {
                     var parentData = nodeData.Parent as SceneGraphNodeViewData;
                     parentData.Children.Remove(nodeData);
                     RemoveNodeFromDic(node);
                 }
             }
         }
     }
 }