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); }
private static string GetStringVersionId(string versionFilePath) { if (FileStaticAPI.IsFileExists(versionFilePath)) { return(FileStaticAPI.Read(versionFilePath)); } else { return("0.0"); } }
static AndroidNativeInit() { #if UNITY_ANDROID if (FileStaticAPI.IsFileExists("Extensions/UltimateMobile/Resources/UltimateMobileSettings.asset")) { return; } if (!AndroidNativeSettingsEditor.IsInstalled) { EditorApplication.update += OnEditorLoaded; } else { if (!AndroidNativeSettingsEditor.IsUpToDate) { EditorApplication.update += OnEditorLoaded; } } #endif }
static SocialPlatfromInit() { if (FileStaticAPI.IsFileExists("Extensions/UltimateMobile/Resources/UltimateMobileSettings.asset")) { return; } if (SocialPlatfromSettingsEditor.IsFullVersion) { if (!SocialPlatfromSettingsEditor.IsInstalled) { EditorApplication.update += OnEditorLoaded; } else { if (!SocialPlatfromSettingsEditor.IsUpToDate) { EditorApplication.update += OnEditorLoaded; } } } }
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(); } }
public static void Android_InstallPlugin(bool IsFirstInstall = true) { //Unity 5 upgdare: FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/httpclient-4.3.1.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/signpost-commonshttp4-1.2.1.2.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/signpost-core-1.2.1.2.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/libGoogleAnalyticsServices.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/android-support-v4.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/image-chooser-library-1.3.0.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/twitter4j-core-3.0.5.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "libs/google-play-services.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "social/an_social.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "social/twitter4j-core-3.0.5.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "google_play/an_googleplay.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "google_play/google-play-services.jar"); FileStaticAPI.DeleteFile(ANDROID_SOURCE_PATH + "billing/an_billing.jar"); FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + "libs/android-support-v4.txt", ANDROID_DESTANATION_PATH + "libs/android-support-v4.jar"); FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + "androidnative.txt", ANDROID_DESTANATION_PATH + "androidnative.jar"); FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + "mobilenativepopups.txt", ANDROID_DESTANATION_PATH + "mobilenativepopups.jar"); FileStaticAPI.CopyFolder(ANDROID_SOURCE_PATH + "facebook", ANDROID_DESTANATION_PATH + "facebook"); #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 #else FileStaticAPI.DeleteFolder(ANDROID_SOURCE_PATH + "facebook"); #endif if (IsFirstInstall) { EnableBillingAPI(); EnableGooglePlayAPI(); EnableSocialAPI(); EnableCameraAPI(); EnableAppLicensingAPI(); } string file; file = "AN_Res/res/values/analytics.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } file = "AN_Res/res/values/ids.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } file = "AN_Res/res/xml/file_paths.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } file = "AN_Res/res/values/version.xml"; FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); file = "AN_Res/project.properties"; FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); file = "AN_Res/AndroidManifest.xml"; FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); //First install dependense file = "AndroidManifest.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } AssetDatabase.Refresh(); }
public static void UpdatePluginSettings() { if (!IsInstalled || !IsUpToDate) { return; } ChnageDefineState(IOSNotificationController_Path, "PUSH_ENABLED", IOSNativeSettings.Instance.EnablePushNotificationsAPI); ChnageDefineState(DeviceTokenListener_Path, "PUSH_ENABLED", IOSNativeSettings.Instance.EnablePushNotificationsAPI); ChnageDefineState(GameCenterManager_Path, "GAME_CENTER_ENABLED", IOSNativeSettings.Instance.EnableGameCenterAPI); ChnageDefineState(GameCenter_TBM_Path, "GAME_CENTER_ENABLED", IOSNativeSettings.Instance.EnableGameCenterAPI); ChnageDefineState(GameCenter_RTM_Path, "GAME_CENTER_ENABLED", IOSNativeSettings.Instance.EnableGameCenterAPI); ChnageDefineState(IOSNativeMarketBridge_Path, "INAPP_API_ENABLED", IOSNativeSettings.Instance.EnableInAppsAPI); ChnageDefineState(IOSStoreProductView_Path, "INAPP_API_ENABLED", IOSNativeSettings.Instance.EnableInAppsAPI); ChnageDefineState(ISN_Security_Path, "INAPP_API_ENABLED", IOSNativeSettings.Instance.EnableInAppsAPI); ChnageDefineState(iAdBannerControllerr_Path, "IAD_API", IOSNativeSettings.Instance.EnableiAdAPI); ChnageDefineState(iAdBanner_Path, "IAD_API", IOSNativeSettings.Instance.EnableiAdAPI); ChnageDefineState(IOSSocialManager_Path, "SOCIAL_API", IOSNativeSettings.Instance.EnableSocialSharingAPI); ChnageDefineState(IOSCamera_Path, "CAMERA_API", IOSNativeSettings.Instance.EnableCameraAPI); ChnageDefineState(IOSVideoManager_Path, "VIDEO_API", IOSNativeSettings.Instance.EnableMediaPlayerAPI); ChnageDefineState(ISN_MediaController_Path, "VIDEO_API", IOSNativeSettings.Instance.EnableMediaPlayerAPI); ChnageDefineState(ISN_ReplayKit_Path, "REPLAY_KIT", IOSNativeSettings.Instance.EnableReplayKit); if (!IOSNativeSettings.Instance.EnableGameCenterAPI) { PluginsInstalationUtil.RemoveIOSFile("ISN_GameCenter"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_GameCenter.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_GameCenter.mm"); } if (!IOSNativeSettings.Instance.EnableInAppsAPI) { PluginsInstalationUtil.RemoveIOSFile("ISN_InApp"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_InApp.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_InApp.mm"); } if (!IOSNativeSettings.Instance.EnableiAdAPI) { PluginsInstalationUtil.RemoveIOSFile("ISN_iAd"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_iAd.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_iAd.mm"); } if (!IOSNativeSettings.Instance.EnableCameraAPI) { PluginsInstalationUtil.RemoveIOSFile("ISN_Camera"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_Camera.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_Camera.mm"); } if (!IOSNativeSettings.Instance.EnableSocialSharingAPI) { PluginsInstalationUtil.RemoveIOSFile("ISN_SocialGate"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_SocialGate.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_SocialGate.mm"); } if (!IOSNativeSettings.Instance.EnableMediaPlayerAPI) { PluginsInstalationUtil.RemoveIOSFile("ISN_Media"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_Media.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_Media.mm"); } if (!IOSNativeSettings.Instance.EnableReplayKit) { PluginsInstalationUtil.RemoveIOSFile("ISN_ReplayKit"); } else { FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_ReplayKit.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_ReplayKit.mm"); } if (!IOSNativeSettings.Instance.EnableSoomla) { ChnageDefineState(ISN_Soomla_Path, "SOOMLA", IOSNativeSettings.Instance.EnableSoomla); PluginsInstalationUtil.RemoveIOSFile("ISN_Soomla"); } else { if (FileStaticAPI.IsFileExists("Plugins/IOS/libSoomlaGrowLite.a")) { ChnageDefineState(ISN_Soomla_Path, "SOOMLA", IOSNativeSettings.Instance.EnableSoomla); FileStaticAPI.CopyFile(PluginsInstalationUtil.IOS_SOURCE_PATH + "ISN_Soomla.mm.txt", PluginsInstalationUtil.IOS_DESTANATION_PATH + "ISN_Soomla.mm"); } else { bool res = EditorUtility.DisplayDialog("Soomla Grow not found", "IOS Native wasn't able to find Soomla Grow libraryes in your project. Would you like to donwload and install it?", "Download", "No Thanks"); if (res) { Application.OpenURL(IOSNativeSettings.Instance.SoomlaDownloadLink); } IOSNativeSettings.Instance.EnableSoomla = false; UpdatePluginSettings(); } } }
public static void Android_InstallPlugin(bool IsFirstInstall = true) { FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/android-support-v4.jar", ANDROID_DESTANATION_PATH + "libs/android-support-v4.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/android-support-v4.jar", ANDROID_DESTANATION_PATH + "libs/android-support-v4.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/google-play-services.jar", ANDROID_DESTANATION_PATH + "libs/google-play-services.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/httpclient-4.3.1.jar", ANDROID_DESTANATION_PATH + "libs/httpclient-4.3.1.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/libGoogleAnalyticsServices.jar", ANDROID_DESTANATION_PATH + "libs/libGoogleAnalyticsServices.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/signpost-commonshttp4-1.2.1.2.jar", ANDROID_DESTANATION_PATH + "libs/signpost-commonshttp4-1.2.1.2.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/signpost-core-1.2.1.2.jar", ANDROID_DESTANATION_PATH + "libs/signpost-core-1.2.1.2.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/twitter4j-core-3.0.5.jar", ANDROID_DESTANATION_PATH + "libs/twitter4j-core-3.0.5.jar"); FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + "libs/image-chooser-library-1.3.0.jar", ANDROID_DESTANATION_PATH + "libs/image-chooser-library-1.3.0.jar"); FileStaticAPI.CopyFolder(ANDROID_SOURCE_PATH + "facebook", ANDROID_DESTANATION_PATH + "facebook"); string file; file = "res/values/" + "analytics.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } file = "res/values/" + "ids.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } file = "res/values/" + "version.xml"; FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); file = "androidnative.jar"; FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); //First install dependense file = "AndroidManifest.xml"; if (!FileStaticAPI.IsFileExists(ANDROID_DESTANATION_PATH + file)) { FileStaticAPI.CopyAsset(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); } else { if (IsFirstInstall) { int options = EditorUtility.DisplayDialogComplex( "AndroidManifest.xml detected", "Looks like you already have AndroidManifest.xml in your project, probably it's part of another android plugin. AndroidManifest.xml is reuired for Androud Native plugin. You can merge or replace Manifest, please choose from options bellow.", "Replace", "Learn more", "Do nothing"); switch (options) { case 0: FileStaticAPI.CopyFile(ANDROID_SOURCE_PATH + file, ANDROID_DESTANATION_PATH + file); break; case 1: Application.OpenURL("http://goo.gl/UX30B3"); break; } } } AssetDatabase.Refresh(); }