/** * Update the value of a particular SDK key * * @param id ID of sdk to set key for * @param key key to set * @param value new value */ public static void SetSdkValue(string sdkId, string key, string value) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetSdkValue(sdkId, key, value); #elif UNITY_ANDROID FGLAndroidInternals.SetSdkValue(sdkId, key, value); #elif UNITY_IOS FGLiOSInternals.SetSdkValue(sdkId, key, value); #endif }
/** * Show interstitial ad */ public static void ShowInterstitialAd(string placement = INTERSTITIAL_PLACEMENT_DEFAULT) { InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.ShowInterstitialAd(placement); #elif UNITY_ANDROID FGLAndroidInternals.ShowInterstitialAd(placement); #elif UNITY_IOS FGLiOSInternals.ShowInterstitialAd(placement); #endif }
///// PUBLIC ///// /** * Log debug message to the console * * @param tag tag to use * @param message message to log */ public static void LogMessage(string tag, string message) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.LogMessage(tag, message); #elif UNITY_ANDROID FGLAndroidInternals.LogMessage(tag, message); #elif UNITY_IOS FGLiOSInternals.LogMessage(tag, message); #endif }
/** * Disable local notifications */ static public void DisableLocalNotification() { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.DisableLocalNotifications(); #elif UNITY_ANDROID FGLAndroidInternals.DisableLocalNotifications(); #elif UNITY_IOS FGLiOSInternals.DisableLocalNotifications(); #endif }
/** * Enable local notifications * * @param title notification title * @param message notification message * @param delay notification delay in seconds */ public static void EnableLocalNotification(string title, string message, int delay) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.EnableLocalNotifications(title, message, delay); #elif UNITY_ANDROID FGLAndroidInternals.EnableLocalNotifications(title, message, delay); #elif UNITY_IOS FGLiOSInternals.EnableLocalNotifications(title, message, delay); #endif }
/** * Log custom analytics event * * @param eventType event type (for instance 'level_completed') * @param paramKey parameter key (for instance 'level') * @param paramValue parameter value (for instance '3') */ public static void LogEvent(string eventType, string paramKey, string paramValue) { InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.LogEvent(eventType, paramKey, paramValue); #elif UNITY_ANDROID FGLAndroidInternals.LogEvent(eventType, paramKey, paramValue); #elif UNITY_IOS FGLiOSInternals.LogEvent(eventType, paramKey, paramValue); #endif }
private static void _SetSdkConfiguration(string sdkId, string configurationKey, string configurationValue) { Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #elif UNITY_ANDROID FGLAndroidInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #elif UNITY_IOS FGLiOSInternals.SetSdkConfiguration(sdkId, configurationKey, configurationValue); #endif }
private static string _GetDisplayDescription(string sku, string defaultDescription) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(defaultDescription); #elif UNITY_ANDROID return(FGLAndroidInternals.GetDisplayDescription(sku, defaultDescription)); #elif UNITY_IOS return(FGLiOSInternals.GetDisplayDescription(sku, defaultDescription)); #endif }
/** * Check if a banner ad is ready * * @return true if an banner ad is ready, false if not */ public static bool IsBannerAdReady(string placement) { InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsBannerAdReady(placement)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsBannerAdReady(placement)); #elif UNITY_IOS return(FGLiOSInternals.IsBannerAdReady(placement)); #else return(false); #endif }
/** * Check if a rewarded ad is ready * * @return true if a rewarded ad is ready, false if not */ public static bool IsRewardedAdReady(string placement = REWARDED_PLACEMENT_NEUTRAL) { InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsRewardedAdReady(placement)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsRewardedAdReady(placement)); #elif UNITY_IOS return(FGLiOSInternals.IsRewardedAdReady(placement)); #else return(false); #endif }
private static string _GetDisplayPrice(string sku, string defaultPrice) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.GetDisplayPrice(sku, defaultPrice)); #elif UNITY_ANDROID return(FGLAndroidInternals.GetDisplayPrice(sku, defaultPrice)); #elif UNITY_IOS return(FGLiOSInternals.GetDisplayPrice(sku, defaultPrice)); #else return(defaultPrice); #endif }
private static bool _IsItemOwned(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsItemOwned(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsItemOwned(sku)); #elif UNITY_IOS return(FGLiOSInternals.IsItemOwned(sku)); #else return(false); #endif }
///// PUBLIC ///// private static bool _IsSupported() { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsPurchasingSupported()); #elif UNITY_ANDROID return(FGLAndroidInternals.IsPurchasingSupported()); #elif UNITY_IOS return(FGLiOSInternals.IsPurchasingSupported()); #else return(false); #endif }
private static int _GetOwnedItemCount(string sku) { Enhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.GetOwnedItemCount(sku)); #elif UNITY_ANDROID return(FGLAndroidInternals.GetOwnedItemCount(sku)); #elif UNITY_IOS return(FGLiOSInternals.GetOwnedItemCount(sku)); #else return(0); #endif }
public static bool IsRestoringNeeded() { FGLEnhance.InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsRestoringNeeded()); #elif UNITY_ANDROID return(FGLAndroidInternals.IsRestoringNeeded()); #elif UNITY_IOS return(FGLiOSInternals.IsRestoringNeeded()); #else return(false); #endif }
/** * Check if an interstitial ad is ready * * @return true if an interstitial ad is ready, false if not */ public static bool IsInterstitialReady(string placement = INTERSTITIAL_PLACEMENT_DEFAULT) { InitializeEnhance(); #if UNITY_EDITOR return(FGLEditorInternals.IsInterstitialReady(placement)); #elif UNITY_ANDROID return(FGLAndroidInternals.IsInterstitialReady(placement)); #elif UNITY_IOS return(FGLiOSInternals.IsInterstitialReady(placement)); #else return(true); #endif }
///// PRIVATE ///// static void InitializeEnhance() { if (!mInitialized) { mInitialized = true; #if UNITY_EDITOR FGLEditorInternals.Initialize(); #elif UNITY_ANDROID FGLAndroidInternals.Initialize(); #elif UNITY_IOS FGLiOSInternals.Initialize(); #endif } }
/** * Show banner ad * * @param position position (top or bottom) */ public static void ShowBannerAdWithPosition(string placement, Position position) { string strPos = "BOTTOM"; if (position == Position.TOP) { strPos = "TOP"; } InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.ShowBannerAd(placement, strPos); #elif UNITY_ANDROID FGLAndroidInternals.ShowBannerAd(placement, strPos); #elif UNITY_IOS FGLiOSInternals.ShowBannerAd(placement, strPos); #endif }
private static void _ManuallyRestorePurchases(Action onRestoreSuccessCallback, Action onRestoreFailedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnRestorePurchasesSuccessCallback = onRestoreSuccessCallback; FGLEnhance_Callbacks.OnRestorePurchasesFailedCallback = onRestoreFailedCallback; Enhance.InitializeEnhance(); #if UNITY_ANDROID FGLAndroidInternals.ManuallyRestorePurchases(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ManuallyRestorePurchases(FGLEnhance_Callbacks.CallbackObjectName); #endif }
/** * Set event for when an ad is loaded * * @param onReady executed when an ad has loaded */ public static void SetOnLoadingCallback(Action <string, string, string> onLoading) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks> (); } FGLEnhance_Callbacks.OnLoadingCallback = onLoading; InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.SetOnLoadingCallback(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.SetOnLoadingCallback(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.SetOnLoadingCallback(FGLEnhance_Callbacks.CallbackObjectName); #endif }
private static void _AttemptPurchase(string sku, Action onPurchaseSuccessCallback, Action onPurchaseFailedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnPurchaseSuccessCallback = onPurchaseSuccessCallback; FGLEnhance_Callbacks.OnPurchaseFailedCallback = onPurchaseFailedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.AttemptPurchase(sku, FGLEnhance_Callbacks.CallbackObjectName); #endif }
/** * Request permission from the user to show local notifications * * @param onPermissionGrantedCallback executed when the permission is granted * @param onPermissionRefusedCallback executed when the permission is refused */ public static void RequestLocalNotificationPermission(Action onPermissionGrantedCallback, Action onPermissionRefusedCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnLocalNotificationPermissionGrantedCallback = onPermissionGrantedCallback; FGLEnhance_Callbacks.OnLocalNotificationPermissionRefused = onPermissionRefusedCallback; Enhance.InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequestLocalNotificationsPermission(FGLEnhance_Callbacks.CallbackObjectName); #endif }
static public void ShowServiceOptInDialogs(string[] requestedSdks, Action onDialogComplete) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnDialogCompleteCallback = onDialogComplete; #if UNITY_EDITOR Debug.Log("[Enhance] ShowServiceOptInDialogs - runned in Unity Editor, nothing to do"); #elif UNITY_ANDROID FGLAndroidInternals.ShowServiceOptInDialogs(requestedSdks, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ShowServiceOptInDialogs(requestedSdks, FGLEnhance_Callbacks.CallbackObjectName); #endif }
/** * Show rewarded ad * * @param placement placement type for this ad * @param onRewardGrantedCallback callback executed when the ad reward is granted * @param onRewardDeclinedCallback callback executed when the ad reward is declined * @param onRewardUnavailableCallback callback executed when the ad reward is unavailable */ public static void ShowRewardedAd(string placement, Action <RewardType, int> onRewardGrantedCallback, Action onRewardDeclinedCallback, Action onRewardUnavailableCallback) { if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnRewardGrantedCallback = onRewardGrantedCallback; FGLEnhance_Callbacks.OnRewardDeclinedCallback = onRewardDeclinedCallback; FGLEnhance_Callbacks.OnRewardUnavailableCallback = onRewardUnavailableCallback; InitializeEnhance(); #if UNITY_EDITOR FGLEditorInternals.ShowRewardedAd(placement, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_ANDROID FGLAndroidInternals.ShowRewardedAd(placement, FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.ShowRewardedAd(placement, FGLEnhance_Callbacks.CallbackObjectName); #endif }
static public void RequiresDataConsentOptIn(Action onRequired, Action onNotRequired) { Enhance.InitializeEnhance(); if (GameObject.Find(FGLEnhance_Callbacks.CallbackObjectName) == null) { string newName = "__FGLEnhance_Callback_" + UnityEngine.Random.Range(0, int.MaxValue); GameObject callbackObject = new GameObject(newName); callbackObject.AddComponent <FGLEnhance_Callbacks>(); } FGLEnhance_Callbacks.OnOptInRequiredCallback = onRequired; FGLEnhance_Callbacks.OnOptInNotRequiredCallback = onNotRequired; #if UNITY_EDITOR if (onNotRequired != null) { onNotRequired(); } #elif UNITY_ANDROID FGLAndroidInternals.RequiresDataConsentOptIn(FGLEnhance_Callbacks.CallbackObjectName); #elif UNITY_IOS FGLiOSInternals.RequiresDataConsentOptIn(FGLEnhance_Callbacks.CallbackObjectName); #endif }