示例#1
0
        private void LoadEntities()
        {
            List <Entity> entities = new List <Entity>();

            if (Map.Instance == null)
            {
                return;
            }

            entities.AddRange(Map.Instance.Children);
            while (entities.Count > 0)
            {
                Entity entity = entities[0];
                entities.RemoveAt(0);

                Map.EditorLayer editorLayer = null;
                if (entity is MapObject)
                {
                    MapObject mapObject = entity as MapObject;
                    editorLayer = mapObject.EditorLayer;
                }

                TreeNode layerNode = TreeViewUtil.FindNodeByTag(rootLayerNode, editorLayer);
                layerNode = layerNode ?? rootNode;
                CreateEntityNode(entity, layerNode, false);
            }
        }
示例#2
0
 public void ClearSelection()
 {
     if (this.treeViewObjects.SelectedNode != null && this.treeViewObjects.SelectedNode.Tag != null)
     {
         this.treeViewObjects.BeginUpdate();
         if (this.treeViewObjects.SelectedNode.Parent != null)
         {
             this.treeViewObjects.SelectedNode = this.treeViewObjects.SelectedNode.Parent;
         }
         else if (this.currentObjectsNode != null)
         {
             this.treeViewObjects.SelectedNode = this.currentObjectsNode;
         }
         else
         {
             this.treeViewObjects.SelectedNode = TreeViewUtil.FindNodeByTag(this.treeViewObjects, null);
         }
         this.treeViewObjects.EndUpdate();
     }
     if (this.treeView3dModel.SelectedNode != null && this.treeView3dModel.SelectedNode.Tag != null)
     {
         this.treeView3dModel.BeginUpdate();
         if (this.treeView3dModel.SelectedNode.Parent != null)
         {
             this.treeView3dModel.SelectedNode = this.treeView3dModel.SelectedNode.Parent;
         }
         else if (this.current3dModelNode != null)
         {
             this.treeView3dModel.SelectedNode = this.current3dModelNode;
         }
         else
         {
             this.treeView3dModel.SelectedNode = TreeViewUtil.FindNodeByTag(this.treeView3dModel, null);
         }
         this.treeView3dModel.EndUpdate();
     }
     OnSelectedItemChange();
 }
示例#3
0
        public void UpdateMapObjectLayer(MapObject target)
        {
            if (target == null)
            {
                return;
            }

            TreeNode objectNode = TreeViewUtil.FindNodeByTag(rootNode, target);

            if (objectNode == null)
            {
                return;
            }

            TreeNode layerNode = target.EditorLayer == null? rootNode : TreeViewUtil.FindNodeByTag(rootNode, target.EditorLayer);

            if (layerNode != null)
            {
                objectNode.Remove();
                layerNode.Nodes.Add(objectNode);
                TreeViewUtil.ExpandTo(objectNode);
            }
        }