public static void ChnageDefineState(string file, string tag, bool IsEnabled) { if (FileStaticAPI.IsFileExists(file)) { string content = FileStaticAPI.Read(file); // Debug.Log(file); //Debug.Log(content); int endlineIndex; endlineIndex = content.IndexOf(System.Environment.NewLine); if (endlineIndex == -1) { endlineIndex = content.IndexOf("\n"); } string TagLine = content.Substring(0, endlineIndex); if (IsEnabled) { content = content.Replace(TagLine, "#define " + tag); } else { content = content.Replace(TagLine, "//#define " + tag); } // Debug.Log(content); FileStaticAPI.Write(file, content); } }
private static void ChnageDefineState(string file, string tag, bool IsEnabled) { if (!FileStaticAPI.IsFileExists(file)) { Debug.Log("ChnageDefineState for tag: " + tag + " File not found at path: " + file); return; } string content = FileStaticAPI.Read(file); int endlineIndex; endlineIndex = content.IndexOf(System.Environment.NewLine); if (endlineIndex == -1) { endlineIndex = content.IndexOf("\n"); } string TagLine = content.Substring(0, endlineIndex); if (IsEnabled) { content = content.Replace(TagLine, "#define " + tag); } else { content = content.Replace(TagLine, "//#define " + tag); } FileStaticAPI.Write(file, content); }
public static void UpdatePluginSettings() { AndroidNativeSettingsEditor.UpdatePluginSettings(); string UM_InAppPurchaseManagerContent = FileStaticAPI.Read("Extensions/UltimateMobile/Scripts/InApps/Manage/UM_InAppPurchaseManager.cs"); int endlineIndex; endlineIndex = UM_InAppPurchaseManagerContent.IndexOf(System.Environment.NewLine); if (endlineIndex == -1) { endlineIndex = UM_InAppPurchaseManagerContent.IndexOf("\n"); } string UM_IN_Line = UM_InAppPurchaseManagerContent.Substring(0, endlineIndex); if (AndroidNativeSettings.Instance.EnableATCSupport) { UM_InAppPurchaseManagerContent = UM_InAppPurchaseManagerContent.Replace(UM_IN_Line, "#define ATC_SUPPORT_ENABLED"); } else { UM_InAppPurchaseManagerContent = UM_InAppPurchaseManagerContent.Replace(UM_IN_Line, "//#define ATC_SUPPORT_ENABLED"); } FileStaticAPI.Write("Extensions/UltimateMobile/Scripts/InApps/Manage/UM_InAppPurchaseManager.cs", UM_InAppPurchaseManagerContent); }
private static string GetStringVersionId(string versionFilePath) { if (FileStaticAPI.IsFileExists(versionFilePath)) { return(FileStaticAPI.Read(versionFilePath)); } else { return("0.0"); } }
public static void OnPostProcessBuild(BuildTarget target, string path) { if (target == BuildTarget.Android) { if (!AndroidNativeSettingsEditor.IsInstalled) { EditorUtility.DisplayDialog( "Android Native Resrouces not found", "Looks like Android Native Resurces wasn't imported to your plugins folder. Please hit 'Install' button in plugin settings", "Ok"); } else { string file = PluginsInstalationUtil.ANDROID_DESTANATION_PATH + "AndroidManifest.xml"; string Manifest = FileStaticAPI.Read(file); Manifest = Manifest.Replace("%APP_BUNDLE_ID%", PlayerSettings.bundleIdentifier); //checking for bundle change if (OldBundle != string.Empty) { if (OldBundle != PlayerSettings.bundleIdentifier) { int result = EditorUtility.DisplayDialogComplex("Andrid Native: bundle id change detected", "Project bundle Identifier changed, do you wnat to replase old bundle: " + OldBundle + "with new one: " + PlayerSettings.bundleIdentifier, "Yes", "No", "Later"); switch (result) { case 0: Manifest = Manifest.Replace(QUOTE + OldBundle + QUOTE, QUOTE + PlayerSettings.bundleIdentifier + QUOTE); Manifest = Manifest.Replace(QUOTE + OldBundle + ".fileprovider" + QUOTE, QUOTE + PlayerSettings.bundleIdentifier + ".fileprovider" + QUOTE); OldBundle = PlayerSettings.bundleIdentifier; break; case 1: OldBundle = PlayerSettings.bundleIdentifier; break; } } } else { OldBundle = PlayerSettings.bundleIdentifier; } FileStaticAPI.Write(file, Manifest); Debug.Log("AN Post Process Done"); } } }
private void UpdatePluginSettings() { string IOSNotificationControllerContent = FileStaticAPI.Read("Extensions/IOSNative/Notifications/IOSNotificationController.cs"); string DeviceTokenListenerContent = FileStaticAPI.Read("Extensions/IOSNative/Notifications/DeviceTokenListener.cs"); int endlineIndex; endlineIndex = DeviceTokenListenerContent.IndexOf(System.Environment.NewLine); if (endlineIndex == -1) { endlineIndex = DeviceTokenListenerContent.IndexOf("\n"); } string DTL_Line = DeviceTokenListenerContent.Substring(0, endlineIndex); endlineIndex = IOSNotificationControllerContent.IndexOf(System.Environment.NewLine); if (endlineIndex == -1) { endlineIndex = IOSNotificationControllerContent.IndexOf("\n"); } string INC_Line = IOSNotificationControllerContent.Substring(0, endlineIndex); if (IOSNativeSettings.Instance.EnablePushNotificationsAPI) { IOSNotificationControllerContent = IOSNotificationControllerContent.Replace(INC_Line, "#define PUSH_ENABLED"); DeviceTokenListenerContent = DeviceTokenListenerContent.Replace(DTL_Line, "#define PUSH_ENABLED"); } else { IOSNotificationControllerContent = IOSNotificationControllerContent.Replace(INC_Line, "//#define PUSH_ENABLED"); DeviceTokenListenerContent = DeviceTokenListenerContent.Replace(DTL_Line, "//#define PUSH_ENABLED"); } FileStaticAPI.Write("Extensions/IOSNative/Notifications/IOSNotificationController.cs", IOSNotificationControllerContent); FileStaticAPI.Write("Extensions/IOSNative/Notifications/DeviceTokenListener.cs", DeviceTokenListenerContent); }
private void Actions() { EditorGUILayout.Space(); settings.IsMoreSettingsOpen = EditorGUILayout.Foldout(settings.IsMoreSettingsOpen, "More Settings"); if (settings.IsMoreSettingsOpen) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Android Native Settings ", GUILayout.Width(140))) { Selection.activeObject = AndroidNativeSettings.Instance; } if (GUILayout.Button("IOS Native Settings ", GUILayout.Width(140))) { Selection.activeObject = IOSNativeSettings.Instance; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Analytics Settings ", GUILayout.Width(140))) { Selection.activeObject = GoogleAnalyticsSettings.Instance; } if (GUILayout.Button("Google Ad Settings ", GUILayout.Width(140))) { Selection.activeObject = GoogleMobileAdSettings.Instance; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } settings.IsMoreActionsOpen = EditorGUILayout.Foldout(settings.IsMoreActionsOpen, "More Actions"); if (settings.IsMoreActionsOpen) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Open Manifest ", GUILayout.Width(140))) { UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal("Assets" + AN_ManifestManager.MANIFEST_FILE_PATH, 1); } bool IsIOSGoogleAdEnabled = FileStaticAPI.IsFileExists(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.h"); string buttonTitle = "Disable Google Ad(IOS)"; if (!IsIOSGoogleAdEnabled) { buttonTitle = "Enable Google Ad for IOS"; } if (GUILayout.Button(buttonTitle, GUILayout.Width(140))) { string IOSADBannerContent = FileStaticAPI.Read("Extensions/GoogleMobileAd/Scripts/IOS/IOSADBanner.cs"); string IOSAdMobControllerContent = FileStaticAPI.Read("Extensions/GoogleMobileAd/Scripts/IOS/IOSAdMobController.cs"); string GoogleMobileAdPostProcessContent = FileStaticAPI.Read("Extensions/GoogleMobileAd/Scripts/Editor/GoogleMobileAdPostProcess.cs"); if (IsIOSGoogleAdEnabled) { IOSADBannerContent = IOSADBannerContent.Replace("//#define CODE_DISABLED", "#define CODE_DISABLED"); IOSAdMobControllerContent = IOSAdMobControllerContent.Replace("//#define CODE_DISABLED", "#define CODE_DISABLED"); GoogleMobileAdPostProcessContent = GoogleMobileAdPostProcessContent.Replace("//#define CODE_DISABLED", "#define CODE_DISABLED"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADAdMobExtras.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADAdNetworkExtras.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADAdSize.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADBannerViewDelegate.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADInAppPurchase.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADInAppPurchaseDelegate.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADInterstitialDelegate.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADModules.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADRequest.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GADRequestError.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.mm"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.mm"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "libGoogleAdMobAds.a"); } else { IOSADBannerContent = IOSADBannerContent.Replace("#define CODE_DISABLED", "//#define CODE_DISABLED"); IOSAdMobControllerContent = IOSAdMobControllerContent.Replace("#define CODE_DISABLED", "//#define CODE_DISABLED"); GoogleMobileAdPostProcessContent = GoogleMobileAdPostProcessContent.Replace("#define CODE_DISABLED", "//#define CODE_DISABLED"); PluginsInstalationUtil.IOS_UpdatePlugin(); } FileStaticAPI.Write("Extensions/GoogleMobileAd/Scripts/IOS/IOSADBanner.cs", IOSADBannerContent); FileStaticAPI.Write("Extensions/GoogleMobileAd/Scripts/IOS/IOSAdMobController.cs", IOSAdMobControllerContent); FileStaticAPI.Write("Extensions/GoogleMobileAd/Scripts/Editor/GoogleMobileAdPostProcess.cs", GoogleMobileAdPostProcessContent); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } }
private static int GetVersionCode(string versionFilePath) { string stringVersionId = FileStaticAPI.Read(versionFilePath); return(ParceVersion(stringVersionId)); }
public static void UpdateGoogleAdIOSAPI(bool forseDisable = false) { bool IsEnabled = false; if (!forseDisable) { if (UltimateMobileSettings.Instance.IOSAdEdngine == UM_IOSAdEngineOprions.GoogleMobileAd) { IsEnabled = true; } } string IOSADBannerContent = FileStaticAPI.Read("Extensions/GoogleMobileAd/Scripts/IOS/IOSADBanner.cs"); string IOSAdMobControllerContent = FileStaticAPI.Read("Extensions/GoogleMobileAd/Scripts/IOS/IOSAdMobController.cs"); string GoogleMobileAdPostProcessContent = FileStaticAPI.Read("Extensions/GoogleMobileAd/Scripts/Editor/GoogleMobileAdPostProcess.cs"); if (IsEnabled) { IOSADBannerContent = IOSADBannerContent.Replace("#define CODE_DISABLED", "//#define CODE_DISABLED"); IOSAdMobControllerContent = IOSAdMobControllerContent.Replace("#define CODE_DISABLED", "//#define CODE_DISABLED"); GoogleMobileAdPostProcessContent = GoogleMobileAdPostProcessContent.Replace("#define CODE_DISABLED", "//#define CODE_DISABLED"); } else { IOSADBannerContent = IOSADBannerContent.Replace("//#define CODE_DISABLED", "#define CODE_DISABLED"); IOSAdMobControllerContent = IOSAdMobControllerContent.Replace("//#define CODE_DISABLED", "#define CODE_DISABLED"); GoogleMobileAdPostProcessContent = GoogleMobileAdPostProcessContent.Replace("//#define CODE_DISABLED", "#define CODE_DISABLED"); } FileStaticAPI.Write("Extensions/GoogleMobileAd/Scripts/IOS/IOSADBanner.cs", IOSADBannerContent); FileStaticAPI.Write("Extensions/GoogleMobileAd/Scripts/IOS/IOSAdMobController.cs", IOSAdMobControllerContent); FileStaticAPI.Write("Extensions/GoogleMobileAd/Scripts/Editor/GoogleMobileAdPostProcess.cs", GoogleMobileAdPostProcessContent); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.h.txt"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.mm.txt"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.h.txt"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.mm.txt"); if (IsEnabled) { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.h.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.h"); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.mm"); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.h.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.h"); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.mm"); #else FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.h.txt", PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.h"); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.mm.txt", PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.mm"); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.h.txt", PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.h"); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.mm.txt", PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.mm"); #endif } else { #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdBanner.mm"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_DESTANATION_PATH + "GoogleMobileAdController.mm"); #else FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.h"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdBanner.mm"); FileStaticAPI.DeleteFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "GoogleMobileAdController.mm"); #endif } /* * if(IsEnabled) { * Debug.Log("Google Ad for IOS is enabled"); * } else { * Debug.Log("Google Ad for IOS is disabled"); * } */ }