Пример #1
0
        void Run()
        {
            string currentMapFilePath           = string.IsNullOrEmpty(module.StateConfig.Json.CurrentMapFilePath) ? "ReverseDependenceMap.json" : module.StateConfig.Json.CurrentMapFilePath;
            string ReverseDependenceMapSavePath = EditorUtility.SaveFilePanel("Save Reverse Dependence Map", Path.GetDirectoryName(currentMapFilePath), Path.GetFileName(currentMapFilePath), "json");

            if (string.IsNullOrEmpty(ReverseDependenceMapSavePath))
            {
                return;
            }

            try
            {
                EditorUtility.DisplayProgressBar("AssetPolice", "Building...", 0);
                runner.Run();

                //保存映射表
                File.WriteAllText(ReverseDependenceMapSavePath, JsonConvert.SerializeObject(module.ModuleConfig.AllBundles, Formatting.Indented));
                module.StateConfig.Json.CurrentMapFilePath = ReverseDependenceMapSavePath;
                module.StateConfig.Save();

                assetTree.Reload();
                EditorUtility.DisplayDialog("AssetPolice", "Build Dependence Map Finish!", "确定");
            }
            catch (Exception e)
            {
                EditorUtility.DisplayDialog("AssetPolice", "Build Failed: " + e.Message, "确定");
                throw e;
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }