예제 #1
0
        private static void UpdateAllFile(string filePath)
        {
            //TableRead.Instance.Init();
            //string csvPath = string.Format("{0}/StreamingAssets/CSVAssets/", Application.dataPath); // Extend.GameUtils.CombinePath(Application.dataPath, "StreamingAssets", "CSV"); //string.Format("{0}/StreamingAssets/CSV/", Application.dataPath);
            //TableRead.Instance.ReadCustomPath(csvPath);


            DirectoryInfo dInfo = new DirectoryInfo(filePath);

            FileInfo[] fileInfoArr = dInfo.GetFiles("*.bytes", SearchOption.TopDirectoryOnly);
            for (int i = 0; i < fileInfoArr.Length; ++i)
            {
                string            fullName  = fileInfoArr[i].FullName;
                BehaviorReadWrite readWrite = new BehaviorReadWrite();
                BehaviorTreeData  treeData  = readWrite.ReadJson(fullName);

                if (null != BehaviorManager.behaviorStandardID)
                {
                    treeData = BehaviorManager.behaviorStandardID(treeData);
                }

                CheckChildID(treeData, treeData.rootNodeId);

                treeData = UpdateData(treeData);

                string jsonFilePath = System.IO.Path.GetDirectoryName(filePath) + "/Json/" + System.IO.Path.GetFileName(fullName);
                bool   value        = readWrite.WriteJson(treeData, jsonFilePath);
                if (!value)
                {
                    Debug.LogError("WriteError:" + jsonFilePath);
                }
            }
        }