Exemple #1
0
    /**
     * Set currency received callback
     *
     * @param onCurrencyReceived callback executed when a currency is received
     */
    public static void SetReceivedCurrencyCallback(Action <int> onCurrencyReceived)
    {
        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.OnCurrencyReceivedCallback = onCurrencyReceived;

        InitializeEnhance();
#if UNITY_EDITOR
        FGLEditorInternals.SetCurrencyCallback(FGLEnhance_Callbacks.CallbackObjectName);
#elif UNITY_ANDROID
        FGLAndroidInternals.SetCurrencyCallback(FGLEnhance_Callbacks.CallbackObjectName);
#elif UNITY_IOS
        FGLiOSInternals.SetCurrencyCallback(FGLEnhance_Callbacks.CallbackObjectName);
#endif
    }