/// <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; } } }
private void OnSpecialButtonDelayEnded(Timer _timer) { #if VOODOO_SAUCE UpdateSpecialButtonInteractivity(specialButtonDelay <= 0 && VoodooSauce.IsRewardedVideoAvailable()); #else UpdateSpecialButtonInteractivity(specialButtonDelay <= 0); #endif }
private void Awake() { showAdButton.onClick.AddListener(ShowAdClick); startGameButton.onClick.AddListener(StartGameClick); endGameButton.onClick.AddListener(EndGameClick); VoodooSauce.SetAdDisplayConditions(60, 3); }
private void OnRVCompleted(bool _completed) { #if VOODOO_SAUCE SetInteractivity(VoodooSauce.IsRewardedVideoAvailable()); #else SetInteractivity(false); #endif }
protected override void OnButtonClicked() { #if VOODOO_SAUCE VoodooSauce.ShowRewardedVideo(OnRewardedVideoCompleted); #elif UNITY_EDITOR OnRewardedVideoCompleted(true); #endif }
private void OnEnable() { #if VOODOO_SAUCE SetInteractivity(VoodooSauce.IsRewardedVideoAvailable()); #elif UNITY_EDITOR SetInteractivity(true); #else SetInteractivity(false); #endif }
protected override void Start() { base.Start(); #if VOODOO_SAUCE VoodooSauce.SubscribeOnRewardedVideoLoaded(OnRewardedVideoLoadComplete); #else OnRewardedVideoLoadComplete(true); #endif }
private void Awake() { GameObject.Instantiate(m_topAdsPrefab); showAdButton.onClick.AddListener(ShowAdClick); startGameButton.onClick.AddListener(StartGameClick); endGameButton.onClick.AddListener(EndGameClick); VoodooSauce.SetAdDisplayConditions(60, 3); }
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 }
/// <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 }
/// <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; } }
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(); } }
/// <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(); }
/** * 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(); } }
public void handleShowAd() { // Async show and wait for privacy popup VoodooSauce.ShowAd(); }
private void StartGameClick() { VoodooSauce.StartGame(); }
private void ShowAdClick() { VoodooSauce.ShowAd("f4280fh0318rf0h2"); }
public void handleEndGame() { // Async show and wait for privacy popup VoodooSauce.EndGame(); }
private void GDPRConsentConfirm() { GDPRPanel.SetActive(false); VoodooSauce.SetGDPRConsent(GDPRConsentToggle.isOn); }
public void GrantConsent() { VoodooSauce.GrantConsent(); InitSceneController.instance.GoToMainScene(); }
private void EndGameClick() { VoodooSauce.EndGame(); }
private void ShowAdClick() { VoodooSauce.ShowAd(); }
public void GoToMainScene() { VoodooSauce.LoadAd(); SceneManager.LoadScene(1); }