public static void UpdateABClass() { string ABConfigPath = AssetDatabasex.GetAssetPathStr("AF_ABConfig"); AF_ABConfig abConfig = null; if (!ABConfigPath.IsNotNullAndEmpty()) { abConfig = new AF_ABConfig(); ABConfigPath = "Assets/Scripts/AFData/AF-ConfigPath/AF_ABConfig.asset"; } else { abConfig = AssetDatabase.LoadAssetAtPath <AF_ABConfig>(ABConfigPath); } foreach (ARForProductType aBClass in System.Enum.GetValues(typeof(ARForProductType))) { if (abConfig != null && abConfig.JudgeClassExit(aBClass)) { continue; } AF_ABOneClass aF_ABOneClass = new AF_ABOneClass(); aF_ABOneClass.ABClassType = aBClass.ToString(); abConfig.m_AllClass.Add(aF_ABOneClass); } if (!FileHelper.JudgeFilePathExit(System.Environment.CurrentDirectory + "/" + ABConfigPath)) { AssetDatabase.CreateAsset(abConfig, ABConfigPath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } }
public static void OnPostProcessBuild(BuildTarget target, string path) { if (BuildTarget.iOS != target) { return; } string[] s = AssetDatabasex.GetAssetPathStr("AppInfoConfig").Split('/'); string XcodeSettingPath = PathTool.ProjectPath; for (int i = 0; i < s.Length - 1; i++) { XcodeSettingPath += s[i] + "/"; } XcodeSettingPath += "Editor/XcodeSetting.txt"; if (XcodeSettingPath == "" || !FileHelper.JudgeFilePathExit(XcodeSettingPath)) { return; } XcodeSetting XcodeSetting = SerializeHelper.FromJson <XcodeSetting>(AssetDatabasex.LoadAssetOfType <TextAsset>("XcodeSetting").text); string projPath = PBXProject.GetPBXProjectPath(path); PBXProject pbx = new PBXProject(); pbx.ReadFromString(File.ReadAllText(projPath)); string guid = pbx.TargetGuidByName("Unity-iPhone"); iOSXcodeSet.SetTeamId(pbx, guid, XcodeSetting.TeamID); iOSXcodeSet.SetFrameworks(pbx, guid, XcodeSetting.frameworkToProjectList); iOSXcodeSet.SetLibs(pbx, guid, XcodeSetting.StaticlibraryDic); iOSXcodeSet.SetBuildProperty(pbx, guid, XcodeSetting.buildPropertyDic); //拷贝文件 iOSXcodeSet.CopyFiles(pbx, guid, XcodeSetting.CopyFileDic, path); iOSXcodeSet.CopyFolders(pbx, guid, XcodeSetting.CopyFolderDic, path); iOSXcodeSet.SetFilesCompileFlag(pbx, guid, XcodeSetting.FilesCompileFlagDIC); File.WriteAllText(projPath, pbx.WriteToString()); //修改Info.plist string plistPath = path + "/Info.plist"; iOSInfoPlist pListEditor = new iOSInfoPlist(plistPath); if (XcodeSetting.Version != "") { pListEditor.Update("CFBundleShortVersionString", XcodeSetting.Version); } if (XcodeSetting.build != "") { pListEditor.Update("CFBundleVersion", XcodeSetting.build); } if (XcodeSetting.BundleIdentifier != "" && XcodeSetting.BundleIdentifier.Split('.').Length >= 3) { pListEditor.Update("CFBundleIdentifier", XcodeSetting.BundleIdentifier); } foreach (var entry in XcodeSetting.pListDataDic) { pListEditor.Update(entry.Key, entry.Value, entry.infoType, entry.isAdd); } foreach (var urlScheme in XcodeSetting.urlSchemeDic) { pListEditor.UpdateUrlScheme(urlScheme.Key, urlScheme.Value, urlScheme.isAdd); } foreach (var whiteUrlScheme in XcodeSetting.appQueriesSchemeList) { pListEditor.UpdateLSApplicationQueriesScheme(whiteUrlScheme.Value, whiteUrlScheme.isAdd); } pListEditor.Save(); }