Ejemplo n.º 1
0
    IEnumerator WaitDecreaseScore()
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize("3237448", false); // ios id, test mode not enabled

        decreaseScore              = true;
        flashing                   = true;
        scoreCounter.totalScore   += scoreCounter.score;
        CoinScript.totalCoinCount += CoinScript.coinCount;
        retryButton.GetComponent <Button>().enabled     = false;
        menuButton.GetComponent <Button>().enabled      = false;
        continueButton.GetComponent <Button>().enabled  = false;
        startOverButton.GetComponent <Button>().enabled = false;
        yield return(new WaitForSeconds(3)); // wait for flashing to finish

        retryButton.GetComponent <Button>().enabled    = true;
        continueButton.GetComponent <Button>().enabled = true;
        if (!levelPassed)
        {
            CoinScript.totalCoinCount -= CoinScript.coinCount;
            scoreCounter.totalScore   -= scoreCounter.score;
        }
        // show ad every 3 levels
        if (retriesLeft > 0 && Advertisement.IsReady(videoID) && (levelScript.level == 1 || levelScript.level % 3 == 0))
        {
            Advertisement.Show(videoID);
        }
        if (!newHighScoreActive)
        {
            menuButton.GetComponent <Button>().enabled      = true;
            startOverButton.GetComponent <Button>().enabled = true;
        }
    }
Ejemplo n.º 2
0
    public void Start()
    {
        if (winAdsOn)
        {
            if (!Advertisement.isInitialized)
            {
                Advertisement.Initialize(BeginMonetization.AndroidGameId, BeginMonetization.testMode);
            }

            if (!info.noAds)
            {
                if (Advertisement.isSupported)
                {
                    Advertisement.AddListener(this);
                    StartCoroutine(myOnUnityAdsReady());
                }
                else
                {
                    Debug.Log("Данная платформа не поддерживается");
                    Advertisement.RemoveListener(this);
                    StartAnims();
                }
            }
            else
            {
                Advertisement.RemoveListener(this);
                StartAnims();
            }
        }
        else
        {
            Advertisement.RemoveListener(this);
            StartAnims();
        }
    }
Ejemplo n.º 3
0
    AdsManager()
    {
        if (AdsManagerSettings.Instance.IsAdMobEnabled)
        {
            MobileAds.Initialize(initStatus => { });

            if (AdsManagerSettings.Instance.IsLoadingInterstitialEnabled)
            {
                isLoadingInterstitial = true;
                RequestInterstitial(AdsManagerSettings.Instance.LoadingInterstitalId);
            }
            else
            {
                RequestInterstitial(AdsManagerSettings.Instance.InterstitalId);
            }

            if (AdsManagerSettings.Instance.IsBannerEnabled)
            {
                RequestBanner();
            }
        }

        if (AdsManagerSettings.Instance.IsUnityAdsEnabled)
        {
            Advertisement.Initialize(AdsManagerSettings.Instance.UnityAdsId, AdsManagerSettings.Instance.IsTestModeEnabled);
            Advertisement.AddListener(this);
        }
    }
Ejemplo n.º 4
0
        protected override void InternalInit()
        {
#if UNITY_ADS || UNITY_MONETIZATION
            if (!mIsInitialized)
            {
                mIsInitialized = true;
                mAdSettings    = EM_Settings.Advertising.UnityAds;

                // Set GDPR consent (if any).
                var consent = GetApplicableDataPrivacyConsent();
                ApplyDataPrivacyConsent(consent);

#if UNITY_MONETIZATION
                Advertisement.AddListener(new UnityAdsListener(this));
                if (string.IsNullOrEmpty(mAdSettings.AppId.Id))
                {
                    Debug.LogWarning("Attempting to initialize UnityAds with an empty App ID.");
                }
                Advertisement.Initialize(mAdSettings.AppId.Id, mAdSettings.EnableTestMode);
#endif

                Debug.Log("UnityAds client has been initialized.");
            }
#endif
        }
Ejemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize(gameID, testMode);


        // Hook up callback to fire when DDNA SDK has received session config info, including Event Triggered campaigns.
        DDNA.Instance.NotifyOnSessionConfigured(true);
        DDNA.Instance.OnSessionConfigured += (bool cachedConfig) => GetGameConfig(cachedConfig);


        // Allow multiple game parameter actions callbacks from a single event trigger
        DDNA.Instance.Settings.MultipleActionsForEventTriggerEnabled = true;

        //Register default handlers for event triggered campaigns. These will be candidates for handling ANY Event-Triggered Campaigns.
        //Any handlers added to RegisterEvent() calls with the .Add method will be evaluated before these default handlers.
        DDNA.Instance.Settings.DefaultImageMessageHandler =
            new ImageMessageHandler(DDNA.Instance, imageMessage => {
            // do something with the image message
            myImageMessageHandler(imageMessage);
        });
        DDNA.Instance.Settings.DefaultGameParameterHandler = new GameParametersHandler(gameParameters => {
            // do something with the game parameters
            myGameParameterHandler(gameParameters);
        });

        DDNA.Instance.SetLoggingLevel(DeltaDNA.Logger.Level.DEBUG);
        DDNA.Instance.StartSDK();
    }
Ejemplo n.º 6
0
    void Awake()
    {
        _videoAd = this;

        if (PlayerPrefs.HasKey("RemoveAdsActivated"))
        {
            showAds = false;
        }
        else
        {
            showAds = true;
            PlayerPrefs.SetInt("RemoveAdsActivated", 0);
        }

        if (!showAds)
        {
            return;
        }


        // Initialize the Ads listener and service:
        Advertisement.AddListener(this);
        Advertisement.Initialize(gameId, testMode);
        IsAdReady();
    }
Ejemplo n.º 7
0
 private void OnEnable()
 {
     Advertisement.AddListener(_unityAdsListener);
     _bannerButton.onClick.AddListener(ShowAbsBanner);
     _videButton.onClick.AddListener(ShowAbsVideo);
     _rewardVideButton.onClick.AddListener(ShowAbsRewardedVideo);
 }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     // Initialize the Ads listener and service:
     Advertisement.AddListener(this);
     Advertisement.Initialize(gameId, testMode);
     StartCoroutine(ShowBannerWhenReady());
 }
Ejemplo n.º 9
0
    void Awake()
    {
        //Get Shop Manager
        myShopManager = GetComponent <ShopManager>();

        //Initialize Admob
        MobileAds.Initialize(initStatus => { });

        //Initialize Unity

        rewardedButton = GetRewardedButton("Rewarded-Button");

        if (rewardedButton != null)
        {
            rewardedButton.interactable = Advertisement.IsReady(surfaceReward);
            rewardedButton.onClick.AddListener(ShowRewardedVideo);
        }

        Advertisement.Initialize(unityGameId, testMode);
        Advertisement.AddListener(this);
        InitialzieBanner();
        string adUnitId = "ca-app-pub-3668225440256580/7694322222";

        admobRewarded = new RewardedAd(adUnitId);

        InitializeAdmobRewardedListeners();
    }
Ejemplo n.º 10
0
    // Start is called before the first frame update
    void Start()
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize(GooglePlay_ID, TestMode);

        Instance = this;
    }
Ejemplo n.º 11
0
 void Start()
 {
     isActivated = false;
     levelIndex  = SceneManager.GetActiveScene().buildIndex; //Определяем текущий уровень
     Advertisement.AddListener(this);
     Advertisement.Initialize(gameId, true);
 }
Ejemplo n.º 12
0
    void Start()
    {
        Advertisement.Initialize(gameID, TestMode);
        // showInterstitial.interactable = Advertisement.IsReady(interstitialID);

        Advertisement.AddListener(this);
    }
Ejemplo n.º 13
0
 // Initialize the Ads listener and service:
 private void Start()
 {
     Instance = this;
     DontDestroyOnLoad(this);
     Advertisement.AddListener(this);
     Advertisement.Initialize(gameId, testMode);
 }
Ejemplo n.º 14
0
    void Start()
    {
        levelManager = FindObjectOfType <LevelManager>();

        Advertisement.AddListener(this);
        Advertisement.Initialize("4085763", false);
    }
Ejemplo n.º 15
0
    void Start()
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize(gameId, testMode);

        StartCoroutine(ShowBannerWhenInitialized());
    }
Ejemplo n.º 16
0
    /// <summary>
    /// Unity Ads Stuff
    /// </summary>
    ///

    public void ConfigureUnityAds()
    {
        // Unity Ads Configuration

        Advertisement.AddListener(this);
        Advertisement.Initialize(unityAdsGameId, unityAdsTestMode);
    }
 //Kok Unity Ads gk mau muncul ya?
 // Start is called before the first frame update
 void Start()
 {
     Advertisement.AddListener(this);
     GameId   = Advertiser.Instance.GameId;
     TestMode = Advertiser.Instance.TestMode;
     Advertisement.Initialize(GameId, TestMode);
 }
Ejemplo n.º 18
0
        // Start is called before the first frame update
        void Start()
        {
            Advertisement.AddListener(this);
            Advertisement.Initialize("3921877", true);

            InitiateAdsData();
        }
Ejemplo n.º 19
0
 void Start()
 {
     // Initialize the Ads listener and service:
     Advertisement.AddListener(this);
     Advertisement.Initialize(gameId, true);
     StartCoroutine(TimerVideo());
 }
Ejemplo n.º 20
0
 void Start()
 {
     confirmReviveObj.SetActive(false);
     adAudio = GetComponent <AudioSource>();
     Advertisement.AddListener(this);
     Advertisement.Initialize(gameID, true);
 }
Ejemplo n.º 21
0
    public IEnumerator InitializeCoprotuine(string gameId, bool testMode = true)
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize(gameId, testMode);

        yield return(null);
    }
Ejemplo n.º 22
0
    IEnumerator Start()
    {
        Advertisement.AddListener(this);
        Advertisement.Initialize("3815483", true);

        while (!Advertisement.IsReady(placement))
        {
            yield return(null);
        }

        if (hasRemoveAdsBeenBought == false)
        {
            GameObject.Find("AdButton").SetActive(true);
        }

        if (numberOfRestarts == 3 && hasRemoveAdsBeenBought == false)
        {
            Advertisement.Show();
            numberOfRestarts = 0;
        }

        if (hasRemoveAdsBeenBought == true)
        {
            moneyEarned    = PlayerPrefs.GetInt("MoneyEarned");
            normalCurrency = PlayerPrefs.GetInt("NormalCurrency");
            GameObject.Find("MoneyEarnedText").GetComponent <Text>().text = "〄" + PlayerPrefs.GetInt("MoneyEarned") * 2 + "";
            PlayerPrefs.SetInt("NormalCurrency", normalCurrency + moneyEarned);
        }
    }
Ejemplo n.º 23
0
    private void Start()
    {
        Advertisement.Initialize(googleID, false); // 廣告初始化
        Advertisement.AddListener(this);

        player = FindObjectOfType <Player>();
    }
Ejemplo n.º 24
0
    /**
     * Advertisementクラスを使って初期化する
     */
    private void InitUnityAds()
    {
        // 動画広告をサポートしていないプラットフォームだったらreturn
        if (Advertisement.isSupported == false)
        {
            return;
        }

        // すでに初期化していたらreturn
        if (Advertisement.isInitialized)
        {
            return;
        }

#if UNITY_ANDROID
        _gameId = googlePlayGameId;
#elif UNITY_IOS
        _gameId = appStoreGameId;
#endif

        // 初期化
        Advertisement.Initialize(_gameId, testMode);

        // リスナーをセットする
        Advertisement.AddListener(this);
    }
Ejemplo n.º 25
0
    private void Start()
    {
        gameId = androidGameID;

        Advertisement.AddListener(this);
        Advertisement.Initialize(gameId, testMode);
    }
Ejemplo n.º 26
0
 void Start()
 {
     Player = GameObject.Find("Player");
     mp     = Player.GetComponent <PlayerController>();
     Advertisement.AddListener(this);
     Advertisement.Initialize(gameId, false);
 }
Ejemplo n.º 27
0
 void Start()
 {
     Advertisement.Initialize(gameID, TestMode);
     showInterstitial.interactable = Advertisement.IsReady(interstitialID);
     watchRewardAd.interactable    = Advertisement.IsReady(rewardedVideoID);
     Advertisement.AddListener(this);
 }
    private void OnEnable()
    {
        if (_button == null)
        {
            _button = GetComponent <Button>();
        }

        bool adsIsReady = Advertisement.IsReady(AdsManager.Instance.rewardedVideoPlacementID);

        // Set interactivity to be dependent on the Placement’s status:
        _button.interactable = adsIsReady;

        if (_animator == null)
        {
            _animator = GetComponent <Animator>();
        }

        if (_animator != null)
        {
            _animator.SetBool(_animatorParameterName, adsIsReady);
        }


        // Map the ShowRewardedVideo function to the button’s click listener:
        if (_button)
        {
            _button.onClick.AddListener(ShowRewardedVideo);
        }

        // Initialize the Ads listener and service:
        Advertisement.AddListener(this);
        Advertisement.Initialize(AdsManager.Instance.playStoreGameID, AdsManager.Instance.testMode);
    }
Ejemplo n.º 29
0
 void Start()
 {
     Advertisement.AddListener(this);
     InitiaizeAdvertizement();
     soundManager = GameObject.FindGameObjectWithTag("soundManager").GetComponent <SoundManager>();
     //    notreadytxt = GameObject.FindGameObjectWithTag("failedtxt");
 }
Ejemplo n.º 30
0
 private AdsManager(string gameId, IUnityAdsListener listener)
 {
     mGameId   = gameId;
     mListener = listener;
     Advertisement.AddListener(mListener);
     Advertisement.Initialize(mGameId, testMode);
 }