Beispiel #1
0
        private void Awake()
        {
            Instance = this;

            _googleAds = new GoogleAds();
            MobileAds.Initialize(initStatus => { });
        }
Beispiel #2
0
    public void InitAdmob()
    {
        if (!isInitGoogleAdmob)
        {
            isInitGoogleAdmob = true;

            googleAds = new GoogleAds();
#if UNITY_ANDROID
            //googleAds.BannerId = AndroidBannerId;
            googleAds.BannerId = RemoteSettingsHandler.remoteSettingsHandler.admob_banner_id;
            //googleAds.InterstitialId = AndroidIntersttitialId;
            googleAds.InterstitialId = RemoteSettingsHandler.remoteSettingsHandler.admob_interstitial_id;
            //googleAds.VideoRewardId = AndroidVideoRewardId;
            //googleAds.NativeAdsId = AndroidNativeAdsId;
#elif UNITY_IOS
            googleAds.BannerId       = IOSBannerId;
            googleAds.InterstitialId = IOSIntersttitialId;
            googleAds.VideoRewardId  = IOSVideoRewardId;
            googleAds.NativeAdsId    = IOSNativeAdsId;
#endif
            // googleAds.VideoRewarded += VideoRewardCompleted;
            googleAds.OnInterstitialClosed  += Interstitial_OnAdClosed;
            googleAds.OnInterstitialOpening += Googleads_OnInterstitialOpening;
            //googleAds.VideoFailedToLoad += Googleads_VideoFailedToLoad;
        }
    }
Beispiel #3
0
    public static GoogleAds GetInstance()
    {
        if (instance == null)
        {
            instance = new GoogleAds();
        }

        return(instance);
    }
Beispiel #4
0
    public static GoogleAds GetInstance()
    {
        if (instance == null)
        {
            instance = new GoogleAds();
        }

        return instance;
    }
Beispiel #5
0
    void Start()
    {
        if(Application.platform == RuntimePlatform.IPhonePlayer) {
            AD_UNIT_ID = "ca-app-pub-3865236618689243/6154612613";
        }

        self = this;

        banner = new BannerView(AD_UNIT_ID, AdSize.Banner, AdPosition.Bottom);
        AdRequest request = new AdRequest.Builder().Build();
        banner.LoadAd(request);
    }
Beispiel #6
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
         SceneManager.sceneLoaded += OnSceneLoaded;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
    public IEnumerator TriggerGameOver()
    {
        yield return(new WaitForEndOfFrame());

        if (ScoreCounter.Life == 0 && !isGameOverTriggered)
        {
            isGameOverTriggered = true;
            _audioClipTap.PlayOneShot(_audioClipDontTap.clip);
            GameOver.showGameOverAnimation = true;
            _enableCollider         = false;
            SpawnTile._disableSpwan = true;
            GoogleAds.ShowInterstitial(2f);
        }
        else if (ScoreCounter.Life != 0)
        {
            ScoreCounter.Life--;
            _audioClipTap.PlayOneShot(_audioClipDontTap.clip);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        ads                        = GetComponent <GoogleAds>();
        ads.AdsClosed             += AdsClosedEvent;
        ads.AdsStarted            += AdsOpenEvent;
        ads.AdsCompleteGiveReward += AdsRewardEvent;

        InterstitialAdsBtn.onClick.AddListener(() => ShowAds(AdsType.Interstitial));
        RewarededAdsBtn.onClick.AddListener(() => ShowAds(AdsType.Rewarded));
        PublishingOrNot.onClick.AddListener(ChangePublishing);

        if (ads.publishing)
        {
            PublishingOrNot.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Real Ads";
        }
        else
        {
            PublishingOrNot.GetComponentInChildren <TMPro.TextMeshProUGUI>().text = "Test Ads";
        }

        UpdateDisplay();
    }
Beispiel #9
0
    public IEnumerator GetConfig(System.Action <bool> callback, System.Action <bool> callback2, System.Action <string> errorCallback)
    {
        HTTPRequest req = new HTTPRequest(new System.Uri("http://one.digitnode.com/config/"));

        req.Send();
        yield return(StartCoroutine(req));

        if (req.Response == null || !req.Response.IsSuccess)
        {
            errorCallback("Get Config Error");
            yield break;
        }

        string data = req.Response.DataAsText;

        config     = JsonConvert.DeserializeObject <AppConfig>(data);
        IsConfiged = true;

        GoogleAds.GetInstance();

        callback(false);
        callback2(true);
        yield return(null);
    }
Beispiel #10
0
 public void RestartLevel()
 {
     GoogleAds.ShowRewardedVideoCurrent();
 }
 // Use this for initialization
 void Start()
 {
     RequestBanner();
     RequestInterstitial();
     Instance = this;
 }
        private void AdView_FailedToReceiveAd(object sender, GoogleAds.AdErrorEventArgs e)
        {

        }
 private void AdView_ReceivedAd(object sender, GoogleAds.AdEventArgs e)
 {
     _ad.ShowAd();
 }
Beispiel #14
0
 private void AdView_FailedToReceiveAd(object sender, GoogleAds.AdErrorEventArgs e)
 {
     Debug.WriteLine("download failed");
     (sender as GoogleAds.AdView).Visibility = Visibility.Collapsed;
 }
Beispiel #15
0
 private void AdView_ReceivedAd(object sender, GoogleAds.AdEventArgs e)
 {
     Debug.WriteLine("download completed");
     (sender as GoogleAds.AdView).Visibility = Visibility.Visible;
 }
Beispiel #16
0
    private string RewardId_IOS       = "ca-app-pub-6562789771066579/5190439315"; //ca-app-pub-6562789771066579/1625484461


    private void Awake()
    {
        _instance = this;
    }
Beispiel #17
0
 // Use this for initialization
 void Start()
 {
     async = SceneManager.LoadSceneAsync(levelToLoad);
     async.allowSceneActivation = false;
     GoogleAds.ShowRewardedVideo();
 }
 private void AdView_FailedToReceiveAd(object sender, GoogleAds.AdErrorEventArgs e)
 {
     MessageBox.Show(e.ErrorCode.ToString(), "Alerta", MessageBoxButton.OK);
 }
 private void OnFailedToReceiveAd(object sender, GoogleAds.AdErrorEventArgs e)
 {
     Debug.WriteLine("Banner: OnFailedToReceiveAd");
 }
 private void OnAdReceived(object sender, GoogleAds.AdEventArgs e)
 {
     Debug.WriteLine("Banner: OnAdReceived");
 }