private List <NodeValue> GetSubTreeNode(int currentOpenSubTreeId)
        {
            List <NodeValue> nodeList = new List <NodeValue>();

            NodeValue subTreeNode = BehaviorDataController.Instance.GetNode(currentOpenSubTreeId);

            if (null == subTreeNode)
            {
                return(nodeList);
            }

            if (subTreeNode.subTreeType == (int)SUB_TREE_TYPE.NORMAL)
            {
                List <NodeValue> allNodeList = GetNodeList();
                for (int i = 0; i < allNodeList.Count; ++i)
                {
                    NodeValue nodeValue = allNodeList[i];
                    if (currentOpenSubTreeId >= 0 && nodeValue.parentSubTreeNodeId == currentOpenSubTreeId)
                    {
                        nodeList.Add(nodeValue);
                    }
                }
            }
            else if (subTreeNode.subTreeType == (int)SUB_TREE_TYPE.CONFIG)
            {
                ConfigFileLoad   configFileLoad = new ConfigFileLoad();
                BehaviorTreeData data           = configFileLoad.ReadFile(subTreeNode.subTreeConfig, false);
                if (null != data)
                {
                    nodeList.AddRange(data.nodeList);
                }
            }

            return(nodeList);
        }
Ejemplo n.º 2
0
        private void SelectFile()
        {
            ConfigFileSelect configFileSelect = new ConfigFileSelect();
            string           filePath         = configFileSelect.Select();

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }
            string         fileName       = System.IO.Path.GetFileNameWithoutExtension(filePath);
            ConfigFileLoad configFileLoad = new ConfigFileLoad();

            configFileLoad.LoadFile(fileName);
        }
Ejemplo n.º 3
0
        private BehaviorTreeData LoadConfig(string fileName)
        {
            ConfigFileLoad   configFileLoad   = new ConfigFileLoad();
            BehaviorTreeData behaviorTreeData = configFileLoad.ReadFile(fileName, false);

            behaviorTreeData.nodeDic.Clear();
            for (int i = 0; i < behaviorTreeData.nodeList.Count; ++i)
            {
                NodeValue nodeValue = behaviorTreeData.nodeList[i];
                behaviorTreeData.nodeDic.Add(nodeValue.id, nodeValue);
            }

            return(behaviorTreeData);
        }