コード例 #1
0
    /**
     * 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
    }
コード例 #2
0
    /**
     * 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
    }
コード例 #3
0
    /**
     * 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
    }
コード例 #4
0
    /**
     * Set current screen
     *
     * @param name name of the currently displayed screen
     */
    public static void SetCurrentScreen(string name)
    {
        Enhance.InitializeEnhance();

#if UNITY_EDITOR
        FGLEditorInternals.SetCurrentScreen(name);
#elif UNITY_ANDROID
        FGLAndroidInternals.SetCurrentScreen(name);
#elif UNITY_IOS
        FGLiOSInternals.SetCurrentScreen(name);
#endif
    }
コード例 #5
0
    ///// 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
    }
コード例 #6
0
    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
    }
コード例 #7
0
    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
    }
コード例 #8
0
    // Interstitial Ad

    public void OnShowInterstitialAd()
    {
        // Check whether an interstitial ad is ready

        if (!Enhance.IsInterstitialReady())
        {
            return;
        }

        // The ad is ready

        Enhance.ShowInterstitialAd();
    }
コード例 #9
0
    // Offerwall

    public void OnShowOfferwall()
    {
        // Check whether an offerwall is available

        if (!Enhance.IsOfferwallReady())
        {
            return;
        }

        // The offerwall is ready, show it

        Enhance.ShowOfferwall();
    }
コード例 #10
0
    void Awake()
    {
        // Ask for permission to show local notifications
        // It can be done at any point in the application

        if (!_hasLocalNotificationPermission)
        {
            Enhance.RequestLocalNotificationPermission(OnPermissionGranted, OnPermissionRefused);
        }

        // Set currency callback (offerwalls)
        // It is important to do in the beginning of the application's logic
    }
コード例 #11
0
    // Special Offer

    public void OnShowSpecialOffer()
    {
        // Check whether a special offer is available

        if (!Enhance.IsSpecialOfferReady())
        {
            return;
        }

        // The special offer is ready, display it

        Enhance.ShowSpecialOffer();
    }
コード例 #12
0
    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
    }
コード例 #13
0
    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
    }
コード例 #14
0
    // Local Notification

    public void OnEnableLocalNotification()
    {
        // Check if we have permission to schedule notification

        if (!_hasLocalNotificationPermission)
        {
            return;
        }

        // We have permission, enable a local notification
        // It will appear 5 seconds after the app is deactivated

        Enhance.EnableLocalNotification("Enhance", "Local Notification!", 5);
    }
コード例 #15
0
    ///// 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
    }
コード例 #16
0
    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
    }
コード例 #17
0
    private static bool _IsProductStatusPending(string sku)
    {
        Enhance.InitializeEnhance();

#if UNITY_EDITOR
        return(FGLEditorInternals.IsProductStatusPending(sku));
#elif UNITY_ANDROID
        return(FGLAndroidInternals.IsProductStatusPending(sku));
#elif UNITY_IOS
        return(false); //iOS doesn't need pending transations
#else
        return(false);
#endif
    }
コード例 #18
0
    // Special Offer

    public void OnShowSpecialOffer()
    {
        // Check whether a special offer is available

        if (!Enhance.IsSpecialOfferReady())
        {
            writeLog("Special offer is not ready");
            return;
        }

        // The special offer is ready, display it

        Enhance.ShowSpecialOffer();
        writeLog("Showing special offer");
    }
コード例 #19
0
    // Offerwall

    public void OnShowOfferwall()
    {
        // Check whether an offerwall is available

        if (!Enhance.IsOfferwallReady())
        {
            writeLog("Offerwall is not ready");
            return;
        }

        // The offerwall is ready, show it

        Enhance.ShowOfferwall();
        writeLog("Showing offerwall");
    }
コード例 #20
0
    // Interstitial Ad

    public void OnShowInterstitialAd()
    {
        // Check whether an interstitial ad is ready

        if (!Enhance.IsInterstitialReady())
        {
            writeLog("Interstitial ad is not ready");
            return;
        }

        // The ad is ready

        Enhance.ShowInterstitialAd();
        writeLog("Showing interstitial ad");
    }
コード例 #21
0
    // Rewarded Ad

    public void OnShowRewardedAd()
    {
        // Check whether a rewarded ad is ready

        if (!Enhance.IsRewardedAdReady())
        {
            writeLog("Rewarded ad is not ready");
            return;
        }

        // The ad is ready, show it

        Enhance.ShowRewardedAd(OnRewardGranted, OnRewardDeclined, OnRewardUnavailable);
        writeLog("Showing rewarded ad");
    }
コード例 #22
0
        private void EnhanceImage(MagickImage image)
        {
            if (Enhance == WhiteboardEnhancements.None)
            {
                return;
            }

            if (Enhance.HasFlag(WhiteboardEnhancements.Stretch))
            {
                image.ContrastStretch((Percentage)0, (Percentage)0);
            }

            if (Enhance.HasFlag(WhiteboardEnhancements.Whitebalance))
            {
                ApplyWhiteBalance(image);
            }
        }
コード例 #23
0
    void Awake()
    {
        // Ask for permission to show local notifications
        // It can be done at any point in the application

        if (!_hasLocalNotificationPermission)
        {
            Enhance.RequestLocalNotificationPermission(OnPermissionGranted, OnPermissionRefused);
        }

        // Set currency callback (offerwalls)
        // It is important to do in the beginning of the application's logic

        Enhance.SetReceivedCurrencyCallback(onCurrencyReceived);
        UpdateIAPLabel();
        SetIapProductSku("Extra10Gems");
    }
コード例 #24
0
    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
    }
コード例 #25
0
    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
    }
コード例 #26
0
    /**
     * 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
    }
コード例 #27
0
    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
    }
コード例 #28
0
ファイル: FGLEnhance.cs プロジェクト: ch00se/enhance-example
    /**
     * 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 <FGLEnhance.RewardType, int> onRewardGrantedCallback, Action onRewardDeclinedCallback, Action onRewardUnavailableCallback)
    {
        Action <Enhance.RewardType, int> onGrantedAction = delegate(Enhance.RewardType rType, int rValue) {
            FGLEnhance.RewardType fglRewardType = FGLEnhance.RewardType.REWARDTYPE_ITEM;

            if (rType == Enhance.RewardType.COINS)
            {
                fglRewardType = FGLEnhance.RewardType.REWARDTYPE_COINS;
            }

            onRewardGrantedCallback(fglRewardType, rValue);
        };

        Action onDeclinedAction = delegate() {
            onRewardDeclinedCallback();
        };

        Action onUnavailableAction = delegate() {
            onRewardUnavailableCallback();
        };

        Enhance.ShowRewardedAd(placement, onGrantedAction, onDeclinedAction, onUnavailableAction);
    }
コード例 #29
0
    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
    }
コード例 #30
0
 /*
  *  Example code to handle App Tracking Transparency on iOS
  *
  *  Provide both callbacks, even if you do not care about the results. You can resume
  *  your app using the callback functions.
  */
 public void OnRequestAppTrackingTransparencyAuthorization()
 {
     Enhance.RequestAppTrackingTransparencyAuthorization(OnAttApproved, OnAttRejected);
 }