public static void UpdateGameInfo() { string fileBody = GPGSUtil.ReadFully(GameInfoTemplatePath); var appId = GPGSProjectSettings.Instance.Get("proj.AppId", null); if (appId != null) { fileBody = fileBody.Replace("__APPID__", appId); } var clientId = GPGSProjectSettings.Instance.Get("ios.ClientId", null); if (clientId != null) { fileBody = fileBody.Replace("__CLIENTID__", clientId); } var bundleId = GPGSProjectSettings.Instance.Get("ios.BundleId", null); if (bundleId != null) { fileBody = fileBody.Replace("__BUNDLEID__", bundleId); } GPGSUtil.WriteFile(GameInfoPath, fileBody); }
public static void UpdateGameInfo() { string fileBody = GPGSUtil.ReadFully(GameInfoTemplatePath); var appId = GPGSProjectSettings.Instance.Get(APPIDKEY, null); if (appId != null) { fileBody = fileBody.Replace(APPIDPLACEHOLDER, appId); } var nearbyServiceId = GPGSProjectSettings.Instance.Get(SERVICEIDKEY, null); if (nearbyServiceId != null) { fileBody = fileBody.Replace(SERVICEIDPLACEHOLDER, appId); } var clientId = GPGSProjectSettings.Instance.Get(IOSCLIENTIDKEY, null); if (clientId != null) { fileBody = fileBody.Replace(IOSCLIENTIDPLACEHOLDER, clientId); } var bundleId = GPGSProjectSettings.Instance.Get(IOSBUNDLEIDKEY, null); if (bundleId != null) { fileBody = fileBody.Replace(IOSBUNDLEIDPLACEHOLDER, bundleId); } GPGSUtil.WriteFile(GameInfoPath, fileBody); }
private void FillInAppData(string sourcePath, string outputPath) { string fileBody = GPGSUtil.ReadFully(sourcePath); fileBody = fileBody.Replace("__CLIENTID__", mClientId); fileBody = fileBody.Replace("__BUNDLEID__", mBundleId); GPGSUtil.WriteFile(outputPath, fileBody); }
/// <summary> /// Helper function to do search and replace of the client and bundle ids. /// </summary> /// <param name="sourcePath">Source path.</param> /// <param name="outputPath">Output path.</param> /// <param name="clientId">Client identifier.</param> /// <param name="bundleId">Bundle identifier.</param> private static void FillInAppData(string sourcePath, string outputPath, string clientId) { string fileBody = GPGSUtil.ReadFully(sourcePath); fileBody = fileBody.Replace(GPGSUtil.ANDROIDCLIENTIDPLACEHOLDER, clientId); GPGSUtil.WriteFile(outputPath, fileBody); }
/// <summary> /// Updates the generated pbxproj to reduce manual work required by developers. Currently /// this just adds the '-fobjc-arc' flag for the Play Games ObjC source files. /// </summary> /// <param name="pbxprojPath">Pbxproj path.</param> private static void UpdateGeneratedPbxproj(string pbxprojPath) { // We're looking for lines in the form: // ... = {isa = PBXBuildFile; fileRef = DEADBEEF /* GPGSFileName.mm */; }; // And we want to append "settings = {COMPILER_FLAGS = "-fobjc-arc"};" to the content in // between the braces. This is done with a regex replace. // The expression is structured as follows: // - Begin a capturing group. // - Find any line that begins with "<anything>{isa = PBXBuildFile" followed by a // reference to a file beginning with "GPGS" and ending with ".m" (e.g. "GPGSFile.m") // - Close the capture group - leaving a trailing "};" // - Replace that line with the captured group with // "settings = {COMPILER_FLAGS = "-fobjc-arc";};};" appended. The trailing "};" is needed // because we omitted the "};" from the group. var withFlagAdded = Regex.Replace( GPGSUtil.ReadFully(pbxprojPath), @"(.*\{isa\s*=\s*PBXBuildFile.*GPGS\w*\.m.*)\}\;", @"$1settings = {COMPILER_FLAGS = ""-fobjc-arc""; }; };"); // Overwrite the pbxproj with the updated value. GPGSUtil.WriteFile(pbxprojPath, withFlagAdded); }