public static OCScenesConfig GetScenesConfig()
        {
            OCScenesConfig ret = new OCScenesConfig();

            try
            {
                var filePath = "Assets/template/OCScenesConfig.json";

                if (!File.Exists(filePath))
                {
                    var otherFilePath = "Assets/Assets/CoreRes/template/OCScenesConfig.json";
                    if (!File.Exists(otherFilePath))
                    {
                        Debug.LogErrorFormat("Can not found config file: \"OCScenesConfig.json\" from path {0} or {1}", filePath, otherFilePath);
                        return(ret);
                    }

                    filePath = otherFilePath;
                }

                string templateContent = Util.LoadJson(filePath);

                ret = JsonUtility.FromJson <OCScenesConfig>(templateContent);
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }

            return(ret);
        }
        public static void WriteJsonConfig(string sceneName, bool IsStream, int screenWidth, int screenHeight, float maxPlayAreaHeight, float minPlayAreaHeight, float cellSize,
                                           bool IsFrameBake, int frameCellCount, bool IsMergeCell, float cellMergeWeight, bool IsMergeObjectID, float mergeDistance, float mergeObjectSize,
                                           List <Index> indices, string path = "D:/OCTemp", bool useCacheCell = true, bool useComputeShader = true)
        {
            var config = GetSceneConfig(sceneName);

            config.MapName             = sceneName;
            config.ScreenWidth         = screenWidth;
            config.ScreenHeight        = screenHeight;
            config.MaxPlayerHeight     = maxPlayAreaHeight;
            config.MinPlayerHeight     = minPlayAreaHeight;
            config.CellSize            = cellSize;
            config.ComputePerframe     = IsFrameBake;
            config.PerframeExecCount   = frameCellCount;
            config.MergeCell           = IsMergeCell;
            config.MergeCellWeight     = cellMergeWeight;
            config.MergeObjectID       = IsMergeObjectID;
            config.MergeObjectDistance = mergeDistance;
            config.MergeObjectSize     = mergeObjectSize;
            config.IsStreamScene       = IsStream;
            config.UseComputeShader    = useComputeShader;
            config.UseVisbileCache     = useCacheCell;
            config.TemporaryContainer  = path;

            config.indices = indices;

            OCScenesConfig scenesConfig = GetScenesConfig();

            for (int i = 0; i < scenesConfig.scenesConfig.Count; i++)
            {
                if (scenesConfig.scenesConfig[i].SceneNamePattern == config.SceneNamePattern)
                {
                    scenesConfig.scenesConfig[i] = config;
                    break;
                }
            }


            //write
            string jsonString = JsonUtility.ToJson(scenesConfig, true);

            File.WriteAllText("Assets/Assets/CoreRes/template/OCScenesConfig.json", jsonString);
        }
        public static void TestCreateScensJson()
        {
            var sceneList = new List <OCSceneConfig>();

            sceneList.Add(CreateSceneConfig("S001", "Assets/Maps/maps/S001/Scenes"));
            sceneList.Add(CreateSceneConfig("S002", "Assets/Maps/maps/S002/Scenes"));
            sceneList.Add(CreateSceneConfig("S003", "Assets/Maps/maps/S003/Scenes"));
            sceneList.Add(CreateSceneConfig("M001", "Assets/Maps/maps/M001/Scenes"));
            sceneList.Add(CreateSceneConfig("M002", "Assets/Maps/maps/M002/Scenes"));
            sceneList.Add(CreateSceneConfig("M003", "Assets/Maps/maps/M003/Scenes"));
            sceneList.Add(CreateSceneConfig("M004", "Assets/Maps/maps/M004/Scenes"));
            sceneList.Add(CreateSceneConfig("M006", "Assets/Maps/maps/M006/Scenes"));

            var config = CreateSceneConfig("002", "Assets/Maps/maps/0001/Scenes", true, true, "002 {0}x{1}", 256, false);

            config.indices.Clear();
            config.indices.Add(new Index(2, 1));
            config.indices.Add(new Index(2, 2));
            config.indices.Add(new Index(2, 5));
            config.indices.Add(new Index(3, 1));
            config.indices.Add(new Index(3, 2));
            config.indices.Add(new Index(3, 3));
            config.indices.Add(new Index(4, 3));
            config.indices.Add(new Index(4, 5));
            config.indices.Add(new Index(4, 6));
            config.indices.Add(new Index(5, 4));
            config.indices.Add(new Index(5, 5));
            config.indices.Add(new Index(5, 7));
            sceneList.Add(config);



            OCScenesConfig scenesConfig = new OCScenesConfig();

            scenesConfig.scenesConfig = sceneList;

            string jsonString = JsonUtility.ToJson(scenesConfig, true);

            File.WriteAllText("Assets/Assets/CoreRes/template/OCScenesConfig.json", jsonString);
        }