/// <summary> /// Builds configuration, i.e. load values from config file and merge them with hard coded values. /// Have to be called before accessing static configuration properties. /// <para /> /// Why not call this via static constructor? /// Because if an error occurs, not even logger is available yet. /// </summary> public static void Build() { int start = Environment.TickCount; ConfigBuilder builder = new ConfigBuilder(); ConfigException ce = null; try { builder.BuildConfig(); } catch (ConfigException e) // log exceptions thrown in Player.Conf.Build only here { logger.Error(ExceptionUtil.Format(e)); ce = e; } Global = builder.GlobalConfig; Scanner = builder.ScannerConfig; Style = builder.StyleConfig; logger.Trace("Build() needed {0}ms", (Environment.TickCount - start)); if (ce != null) // signal error { throw ce; } }
//绘制窗口时调用 void OnGUI() { scroll_pos = EditorGUILayout.BeginScrollView(scroll_pos); //输入框控件 GUILayout.Space(10); setting.appName = EditorGUILayout.TextField("项目名称:", setting.appName); GUILayout.Space(5); keystoreCnf.bundleIdentifier = EditorGUILayout.TextField("项目包名:", keystoreCnf.bundleIdentifier); GUILayout.Space(5); setting.version = EditorGUILayout.TextField("版本号:", setting.version); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(5); GUILayout.Label("keystore", GUILayout.Width(146), GUILayout.Height(18f)); GUILayout.Label(keystoreCnf.keystore, "HelpBox", GUILayout.Height(18f)); if (GUILayout.Button(new GUIContent("浏览", "浏览文件夹"))) { string path = EditorUtility.OpenFilePanel("keystore", keystoreCnf.keystore, "keystore"); keystoreCnf.keystore = path.Replace(System.Environment.CurrentDirectory.Replace("\\", "/"), "."); SaveSetting(); SaveKeystoreSetting(); } GUILayout.EndHorizontal(); GUILayout.Space(5); keystoreCnf.keypass = EditorGUILayout.TextField("keypass:"******"keyaliname:", keystoreCnf.keyaliname); GUILayout.Space(5); keystoreCnf.keyalipass = EditorGUILayout.TextField("keyalipass:"******"转配置")) { ConfigBuilder.BuildConfig(); } if (GUILayout.Button("设置资源信息(AB名、SpriteTag)")) { AssetBundlePacker.SetResInfo(); } if (GUILayout.Button("清理AssetBundle")) { AssetBundlePacker.ClearAssetBundleDirectory(); SaveSetting(); } if (GUILayout.Button("构建AssetBundle(差量更新)")) { AssetBundlePacker.BuildCurrentAssetBundle(); SaveSetting(); } if (GUILayout.Button("重新构建AssetBundle")) { AssetBundlePacker.ClearAssetBundleDirectory(); AssetBundlePacker.BuildCurrentAssetBundle(); SaveSetting(); } if (GUILayout.Button("快速构建")) { SaveSetting(); Build(); } if (GUILayout.Button("切换平台并构建APK")) { AssetBundlePacker.BuildApk(); } EditorGUILayout.EndScrollView(); }