public static bool LoadRules(bool _all) { if (!File.Exists(AssetBundleBuilderPanel.BuildRuleConfigPath)) { EditorUtility.DisplayDialog("提示", "打包配置不存在!", "确定"); return(false); } BuildRuleConfig config = AssetDatabase.LoadAssetAtPath <BuildRuleConfig>(AssetBundleBuilderPanel.BuildRuleConfigPath); rules.Clear(); for (int i = 0; i < config.Filters.Count; ++i) { var filter = config.Filters[i]; if (!_all && !filter.select) { continue; } var type = typeof(BuildRule).Assembly.GetType("ResFramework." + filter.type.ToString()); if (type != null) { var rule = Activator.CreateInstance(type) as BuildRule; rule.searchPath = filter.searchPath; rule.searchPattern = filter.searchPattern; rule.searchOption = filter.searchOption; rule.bundleName = filter.bundleName.ToLower(); rules.Add(rule); } } return(true); }
private void _loadConfig() { m_rule_config = AssetDatabase.LoadAssetAtPath <BuildRuleConfig>(BuildRuleConfigPath); if (m_rule_config == null) { m_rule_config = CreateInstance <BuildRuleConfig>(); AssetDatabase.CreateAsset(m_rule_config, BuildRuleConfigPath); } }