/// <summary>
        /// Initialize the weightedButtonGroupDatas. Can be done only once per session.
        /// </summary>
        public void Initialize()
        {
            if (!isInitialized)
            {
                weightedButtonGroupDatas = new WeightedRandomizer <ButtonGroupData>();
                foreach (ButtonGroupData _buttonGroupData in buttonGroupDatas)
                {
                    if (_buttonGroupData == null)
                    {
                        continue;
                    }

#if VOODOO_SAUCE
                    if (_buttonGroupData.buttonGroupVisualPrefab != null &&
                        _buttonGroupData.buttonGroupVisualPrefab.specialButton != null)
                    {
                        Voodoo.Sauce.Components.NoAdsButton noAdsButton = _buttonGroupData.buttonGroupVisualPrefab.specialButton.GetComponent <Voodoo.Sauce.Components.NoAdsButton>();
                        if (noAdsButton == null || !VoodooSauce.IsPremium())
                        {
                            weightedButtonGroupDatas.AddElement(_buttonGroupData, _buttonGroupData.weight);
                        }
                    }
                    else
                    {
                        weightedButtonGroupDatas.AddElement(_buttonGroupData, _buttonGroupData.weight);
                    }
#else
                    weightedButtonGroupDatas.AddElement(_buttonGroupData, _buttonGroupData.weight);
#endif
                    isInitialized = true;
                }
            }
        }
예제 #2
0
        private void OnSpecialButtonDelayEnded(Timer _timer)
        {
#if VOODOO_SAUCE
            UpdateSpecialButtonInteractivity(specialButtonDelay <= 0 && VoodooSauce.IsRewardedVideoAvailable());
#else
            UpdateSpecialButtonInteractivity(specialButtonDelay <= 0);
#endif
        }
예제 #3
0
        private void Awake()
        {
            showAdButton.onClick.AddListener(ShowAdClick);
            startGameButton.onClick.AddListener(StartGameClick);
            endGameButton.onClick.AddListener(EndGameClick);

            VoodooSauce.SetAdDisplayConditions(60, 3);
        }
예제 #4
0
        private void OnRVCompleted(bool _completed)
        {
#if VOODOO_SAUCE
            SetInteractivity(VoodooSauce.IsRewardedVideoAvailable());
#else
            SetInteractivity(false);
#endif
        }
예제 #5
0
        protected override void OnButtonClicked()
        {
#if VOODOO_SAUCE
            VoodooSauce.ShowRewardedVideo(OnRewardedVideoCompleted);
#elif UNITY_EDITOR
            OnRewardedVideoCompleted(true);
#endif
        }
예제 #6
0
        private void OnEnable()
        {
#if VOODOO_SAUCE
            SetInteractivity(VoodooSauce.IsRewardedVideoAvailable());
#elif UNITY_EDITOR
            SetInteractivity(true);
#else
            SetInteractivity(false);
#endif
        }
예제 #7
0
        protected override void Start()
        {
            base.Start();

#if VOODOO_SAUCE
            VoodooSauce.SubscribeOnRewardedVideoLoaded(OnRewardedVideoLoadComplete);
#else
            OnRewardedVideoLoadComplete(true);
#endif
        }
예제 #8
0
        private void Awake()
        {
            GameObject.Instantiate(m_topAdsPrefab);

            showAdButton.onClick.AddListener(ShowAdClick);
            startGameButton.onClick.AddListener(StartGameClick);
            endGameButton.onClick.AddListener(EndGameClick);

            VoodooSauce.SetAdDisplayConditions(60, 3);
        }
예제 #9
0
        private void Awake()
        {
            showAdButton.onClick.AddListener(ShowAdClick);
            startGameButton.onClick.AddListener(StartGameClick);
            endGameButton.onClick.AddListener(EndGameClick);

            VoodooSauce.SetAdDisplayConditions(60, 3);

            // Show Android Native Toast if we are on an Android device
            #if UNITY_ANDROID
            _ShowNativeAndroidToast("Hello and Welcome to VoodooSauce demo");
            #endif
        }
예제 #10
0
        /// <summary>
        /// Show the Rewarded Video
        /// </summary>
        public void ShowRewardedVideo()
        {
            if (currencyManager == null)
            {
                currencyManager = CurrencyManager.Instance;
            }

#if VOODOO_SAUCE
            VoodooSauce.ShowRewardedVideo(OnComplete);
#else
            currencyManager.AddToCurrency(RVBonusValue, RVBonusCurrency);
#endif
        }
예제 #11
0
        /// <summary>
        /// Update the interactivity of the button based on the rewarded video availability
        /// </summary>
        public void UpdateInteractivity()
        {
            bool buttonPickerInteractivity;

#if VOODOO_SAUCE
            buttonPickerInteractivity = VoodooSauce.IsRewardedVideoAvailable();
#else
            buttonPickerInteractivity = true;
#endif
            if (buttonPicker)
            {
                buttonPicker.interactable = buttonPickerInteractivity;
            }
        }
예제 #12
0
    void Init()
    {
        //Instatiate TopAds Prefab
        TopAdsBehaviour topAds = Instantiate(topAdsPrefab);

        DontDestroyOnLoad(topAds.gameObject);

        //Initialize TopAds
        TopAds.InitializeSDK();

        //Set VoodooSauce tracking events
        TopAds.OnAdLoadedEvent += VoodooSauce.OnAdLoaded;
        TopAds.OnAdFailedEvent += VoodooSauce.OnAdLoadingFail;
        TopAds.OnAdShownEvent  += VoodooSauce.OnAdShown;

        //Set ad id list
        VoodooSauce.SetAdUnitIDs(adUnitIDList);

        //Display toast
        _ShowAndroidToastMessage("Hello Voodoo!");

        //Line added to see RGPD PopUp in Editor at every launch
#if UNITY_EDITOR
        PlayerPrefs.DeleteAll();
#endif

        //We check in playerPref if consent is granted or revoked
        //If consent hasn't granted nor revoked we ask for it
        if (!PlayerPrefs.HasKey("consent"))
        {
            Instantiate(GDPRPopUpPrefab);
        }
        else
        {
            if (PlayerPrefs.GetInt("consent") != 0)
            {
                VoodooSauce.GrantConsent();
            }
            else
            {
                VoodooSauce.RevokeConsent();
            }
            GoToMainScene();
        }
    }
예제 #13
0
        /// <summary>
        /// Launch the different countdowns
        /// </summary>
        public void Launch()
        {
            if (defaultButtonDelayGameObjectActivation)
            {
                defaultButtonDelayGameObjectActivation.StartCountdown();
            }

            if (specialButton == null)
            {
                return;
            }

#if VOODOO_SAUCE
            if (specialButton is ButtonRV && !VoodooSauce.IsRewardedVideoAvailable())
            {
                UpdateSpecialButtonInteractivity(false);
                return;
            }
#endif
            StartDelayBarCountdown();
        }
예제 #14
0
    /**
     * Async show GDPR consent and wait for user response
     * We are using UnitySimpleGDPRConsent open source package for faster display
     * @see: https://github.com/yasirkula/UnitySimpleGDPRConsent
     */
    private IEnumerator AskForConsentAndInit()
    {
        // Show a consent dialog with two sections (and wait for the dialog to be closed):
        yield return(SimpleGDPR.WaitForDialog(new GDPRConsentDialog().
                                              AddSectionWithToggle(ADS_PERSONALIZATION_CONSENT, "Ads Personalization", "When enabled, you'll see ads that are more relevant to you. Otherwise, you will still receive ads, but they will no longer be tailored toward you.").
                                              AddPrivacyPolicies("https://policies.google.com/privacy", "https://unity3d.com/legal/privacy-policy", "https://my.policy.url")));

        // Check if user has granted the Ads Personalization permission before closing the dialog
        if (SimpleGDPR.GetConsentState(ADS_PERSONALIZATION_CONSENT) == SimpleGDPR.ConsentState.Yes)
        {
            // User accepted
            VoodooSauce.Initialize("f4280fh0318rf0h2", true);

            VoodooSauce.StartGame();
        }
        else
        {
            // User denied
            VoodooSauce.Initialize("f4280fh0318rf0h2", false);

            VoodooSauce.StartGame();
        }
    }
예제 #15
0
 public void handleShowAd()
 {
     // Async show and wait for privacy popup
     VoodooSauce.ShowAd();
 }
예제 #16
0
 private void StartGameClick()
 {
     VoodooSauce.StartGame();
 }
예제 #17
0
 private void ShowAdClick()
 {
     VoodooSauce.ShowAd("f4280fh0318rf0h2");
 }
예제 #18
0
 public void handleEndGame()
 {
     // Async show and wait for privacy popup
     VoodooSauce.EndGame();
 }
예제 #19
0
 private void GDPRConsentConfirm()
 {
     GDPRPanel.SetActive(false);
     VoodooSauce.SetGDPRConsent(GDPRConsentToggle.isOn);
 }
예제 #20
0
 public void GrantConsent()
 {
     VoodooSauce.GrantConsent();
     InitSceneController.instance.GoToMainScene();
 }
예제 #21
0
 private void EndGameClick()
 {
     VoodooSauce.EndGame();
 }
예제 #22
0
 private void ShowAdClick()
 {
     VoodooSauce.ShowAd();
 }
예제 #23
0
 public void GoToMainScene()
 {
     VoodooSauce.LoadAd();
     SceneManager.LoadScene(1);
 }