Esempio n. 1
0
    public void ShowAd()
    {
        if (PlayerPrefs.HasKey("AdCount"))
        {
            if (PlayerPrefs.GetInt("AdCount") == 2)
            {
                if (Monetization.IsReady(video_ad))
                {
                    ShowAdPlacementContent ad = null;
                    ad = Monetization.GetPlacementContent(video_ad) as ShowAdPlacementContent;

                    if (ad != null)
                    {
                        ad.Show();
                    }
                }
                PlayerPrefs.SetInt("AdCount", 0);
            }
            else
            {
                PlayerPrefs.SetInt("AdCount", PlayerPrefs.GetInt("AdCount") + 1);
            }
        }
        else
        {
            PlayerPrefs.SetInt("AdCount", 0);
        }
    }
Esempio n. 2
0
 void Update()
 {
     if (adButton)
     {
         adButton.interactable = Monetization.IsReady("rewardedVideo");
     }
 }
    private void Start()
    {
        if (Monetization.isSupported)
        {
            Monetization.Initialize(ADS_GAMEID, ADS_TESTMODE);
        }
#if UNITY_IOS
        ISN_GKLocalPlayer.Authenticate((SA_Result result) =>
        {
            if (result.IsSucceeded)
            {
                _localPlayer = ISN_GKLocalPlayer.LocalPlayer;
            }
            else
            {
                _localPlayer = null;
            }
        });
#elif UNITY_ANDROID
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.Activate();
        Social.localUser.Authenticate((bool success) =>
        {
            if (success)
            {
                _localPlayer = Social.localUser;
            }
        });
#endif
    }
Esempio n. 4
0
 public void Start()
 {
     if (Monetization.isSupported)
     {
         Monetization.Initialize(gameId, false);
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     if (Monetization.isSupported)
     {
         Monetization.Initialize(gameId, true); //출시전에는 false, 출시 후에는 true
     }
 }
Esempio n. 6
0
 private void Start()
 {
     if (Monetization.isSupported)
     {
         Monetization.Initialize(gameId, testMode);
     }
 }
 public void Update()
 {
     if (adButton)
     {
         adButton.interactable = Monetization.IsReady(placementIdOfRewardVideo);
     }
 }
Esempio n. 8
0
        private static IEnumerator ShowAd(AdType type)
        {
            while (!Monetization.isInitialized)
            {
                yield return(new WaitForSeconds(.2f));
            }
            while (!Monetization.IsReady(type.ToString()))
            {
                yield return(new WaitForSeconds(.2f));
            }

            var ad = Monetization.GetPlacementContent(type.ToString());

            if (ad == null)
            {
                Debug.LogError("Ad retrieved was null.");
                yield break;
            }
            while (!ad.ready)
            {
                yield return(new WaitForSeconds(.2f));
            }
            yield return((ad as ShowAdPlacementContent).Show());


            Debug.LogError("Passed show ad");
            yield return(null);
        }
Esempio n. 9
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButton("Fire1"))
     {
         if (Monetization.IsReady("video"))
         {
             ShowAdPlacementContent ad = null;
             ad = Monetization.GetPlacementContent("video") as ShowAdPlacementContent;
             if (ad != null)
             {
                 ad.Show();
             }
         }
     }
     if (Input.GetKeyDown(KeyCode.S))
     {
         if (Monetization.IsReady("rewardedVideo"))
         {
             ShowAdPlacementContent ad = null;
             ad = Monetization.GetPlacementContent("rewardedVideo") as ShowAdPlacementContent;
             if (ad != null)
             {
                 ad.Show();
             }
         }
     }
 }
Esempio n. 10
0
File: Ads.cs Progetto: gagip/GameDev
 // Start is called before the first frame update
 void Start()
 {
     if (Monetization.isSupported)
     {
         Monetization.Initialize(gameId, true); // <- 테스트 모드. 실제로 출시할 때 false로 하자
     }
 }
Esempio n. 11
0
 private async void WaitForAds()
 {
     SetBtGetMoreInteractable(false);
     while (true)
     {
         //if (this.rewardedAd.IsLoaded() || Monetization.IsReady(placementId)) break;
         if (Monetization.IsReady(placementId))
         {
             break;
         }
         await Task.Delay(100);
     }
     //if (this.rewardedAd.IsLoaded())
     //{
     //    SetBtGetMoreInteractable(true);
     //}
     if (Monetization.IsReady(placementId))
     {
         ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent;
         if (ad != null)
         {
             SetBtGetMoreInteractable(true);
         }
     }
 }
Esempio n. 12
0
 void Start()
 {
     if (Monetization.isSupported)
     {
         Monetization.Initialize(store_id, true);
     }
 }
Esempio n. 13
0
 private void Update()
 {
     if (adButton)
     {
         adButton.interactable = Monetization.IsReady(myPlacementId);
     }
 }
 public void LoadVideoAds()
 {
     if (Monetization.isInitialized == false)
     {
         Monetization.Initialize(unityAdsId, showTestAd);
     }
 }
Esempio n. 15
0
 protected override void Start()
 {
     if (Monetization.isSupported)
     {
         Monetization.Initialize(gameId, true);
     }
 }
    void Start()
    {
        Monetization.Initialize("2943700", true);
        this.rzabkaGiver = GameObject.Find("RzabaSpawner").GetComponent <RzabaSpawner>();
        ZaboPodmieniarka(rzabkaGiver.ProszemDacRzabke(new Vector3(0, 0, 0)));
        this.flowerManager = new FlowerManager();
        this.lootSpawner   = GameObject.Find("LootSpawner").GetComponent <LootSpawner>();
        this.happyFrogs    = new List <GameObject>();
        this.currentFrog   = GameObject.Find("Frog");
        this.modifiers     = new List <FlowerModifier>();
        Screen.orientation = ScreenOrientation.Portrait;
        this.wybuch        = GameObject.Find("Wybuch").transform.Find("Explosion");
        this.wybuch.gameObject.SetActive(false);
        this.dymek = GameObject.Find("Dymek").transform.Find("Smoke");
        this.dymek.gameObject.SetActive(false);
        this.goToCollectionButton = GameObject.Find("GoToCollectionButton");
        this.trzepacz             = GameObject.Find("TrzepaczHajsu").GetComponent <TrzepaczHajsu>();

        this.trzepacz.rewarder = delegate(bool p)
        {
            modifiers.Add(new FlowerModifier(2, 60, p));
        };
        this.playerResourcesScript = GameObject.Find("PlayerResources").GetComponent <PlayerResourcesScript>();
        LoadData();


        GameObject.Find("Shop").GetComponent <ShopScript>().itemDatas.FindAll(x => x.isBought).ForEach(x => {
            modifiers.Add(new FlowerModifier(2, 60, true));
        });
    }
Esempio n. 17
0
    void Start()
    {
        sceneTransition.Play("SceneIntro");
        Monetization.Initialize(gameId, false);

        isGameOver              = false;
        reviveAd                = false;
        disappearCounter        = 0;
        spikeDisappearCounter   = 0;
        bombSpawnCounter        = 0;
        poisonCloudSpawnCounter = 0;
        levelNum                = 1; //used to choose the sub level, chooses each and then randomly after playing all

        bulletRef.speed    = 15f;
        bullet2Ref.speed   = 15f;
        laserBeamRef.speed = 20f;

        coinsValue       = 0;
        scoreValue       = 0;
        min              = 3f;
        max              = 6f;
        coinSpawnCounter = Random.Range(min, max);
        InvokeRepeating("UpdateScore", 0.2f, 0.2f);
        InvokeRepeating("SpawnCoins", coinSpawnCounter, coinSpawnCounter);
    }
Esempio n. 18
0
    IEnumerator WaitForAd(bool rewarded = false)
    {
        string selectPlacementID = rewarded? placementId_Rewarded: placementId_No;

        while (!Monetization.IsReady(selectPlacementID))
        {
            yield return(null);
        }

        ShowAdPlacementContent ad = null;

        ad = Monetization.GetPlacementContent(selectPlacementID) as ShowAdPlacementContent;

        if (ad != null)
        {
            if (rewarded)
            {
                ad.Show(AdFinished);
            }
            else
            {
                ad.Show(AdFinished_No);
            }
        }
    }
Esempio n. 19
0
    private void InitializeAds()
    {
        // IOSとAndroid毎にゲームIDを指定する。
#if UNITY_IOS
        _gameId = appleAppStoreGameId;
#elif UNITY_ANDROID
        _gameId = googlePlayStoreGameId;
#endif

        // UnityAdsが対応していない場合は実行しない
        if (!Advertisement.isSupported)
        {
            return;
        }

        // UnityAdsの初期化(ゲーム起動中に一度だけ実行します)
        Monetization.Initialize(_gameId, testMode);

        // バナーの初期化処理
        unityAdsBanner.InitializeBanner(bannerPplacementId);

        // 動画リワードの初期化処理
        unityAdsVideoRewardResult.InitializeVideoReward(rewardVideoPplacementId);

        // 動画リワードの初期化処理
        unityAdsVideoRewardSkin.InitializeVideoReward(rewardVideoPplacementId2);

        // 動画リワードの初期化処理
        unityAdsVideoRewardTimer.InitializeVideoReward(rewardVideoPplacementId3);

        // インタースティシャルの初期化
        unityAdsInterstitial.InitializeVideoReward(interstitialPplacementId);
    }
Esempio n. 20
0
    // Use this for initialization
    void Start()
    {
        // スコアのテキストオブジェクトを取ってくる
        scoreText = GameObject.FindGameObjectWithTag("Score");

        score = PlayerPrefs.GetInt("maxScore", 0); // セーブされた値、セーブが無い時は0
        // 文字を初期化
        scoreText.GetComponent <Text>().text = " MaxScore:" + score.ToString();

        // コインのテキストを書いてるオブジェクトを取って来る
        coinText = GameObject.FindGameObjectWithTag("Coin");

        coinChange();

        /*
         * dialog = GameObject.FindGameObjectWithTag("Dialog");
         * dialog.SetActive(false);
         */

        //canvas = GameObject.FindGameObjectWithTag("canvas");

        //asobikata_active = false;

        suta = this.gameObject.GetComponent <sutamina>(); // スタミナ処理用

        // エラー処理用
        errorText = errordialog.transform.Find("Text").gameObject.GetComponent <Text>();

        // 広告の設定
        Monetization.Initialize(_gameId, testMode);
    }
Esempio n. 21
0
 void Update()
 {
     if (Monetization.IsReady(RewardedVideo))
     {
         adNotLoaded.SetActive(false);
     }
 }
Esempio n. 22
0
        public IEnumerator WaitAndDisplayRewardedAd()
        {
            yield return(new WaitUntil(() => Monetization.IsReady(placementID_Rewarded)));

            ShowAdPlacementContent adContent = Monetization.GetPlacementContent(placementID_Rewarded) as ShowAdPlacementContent;

            adContent.gamerSid = "[CALLBACK SERVER ID HERE]";

            ShowAdCallbacks callbackOptions = new ShowAdCallbacks();

            callbackOptions.finishCallback += RewardCallback;

            if (adContent != null)
            {
                adContent.Show(callbackOptions);
            }
            else
            {
                Debug.LogWarning("Placement content returned null.");
            }
            customEventParams.Add("ar_content", false);
            AnalyticsResult eventResult = AnalyticsEvent.adStart(true, null, placementID_Rewarded, customEventParams);

            Debug.LogFormat("Event result", eventResult);
        }
Esempio n. 23
0
    public void ShowAd()
    {
        ShowAdPlacementContent ad;

        ad = Monetization.GetPlacementContent(__placement_id) as ShowAdPlacementContent;
        ad.Show();
    }
 // Start is called before the first frame update
 void Start()
 {
     Monetization.Initialize(googleID, testMode);
     Monetization.Initialize(appleID, testMode);
     supportUsMenu.SetActive(false);
     supportOptionsMenu.SetActive(false);
     donateMenu.SetActive(false);
 }
Esempio n. 25
0
    void Start()
    {
        StartCoroutine(CallAd());



        Monetization.Initialize(store_id, false);
    }
Esempio n. 26
0
 // Start is called before the first frame update
 void Start()
 {
     Application.runInBackground = false;
     if (Monetization.isSupported)
     {
         Monetization.Initialize("3205205", false);
     }
 }
Esempio n. 27
0
 private void Awake()
 {
     Monetization.Initialize(gameId, isTestMode);
     if (!showAdButton)
     {
         Debug.LogError("UI Not Configured");
     }
 }
Esempio n. 28
0
	private void Start()
	{
		UnityEngine.Debug.Log("No of retrys=  " + Global.noOfTries);
		try
		{
			Monetization.Initialize(stroreId, testMode: false);
			Invoke("UnityAdIsReady", 5f);
			IronSourceEvents.onInterstitialAdClosedEvent += OnIronInterstitialAdClosed;
			IronSource.Agent.loadInterstitial();
		}
		catch (Exception)
		{
		}
		rewardLoaded = false;
		gm = UnityEngine.Object.FindObjectOfType<GameManager>();
		try
		{
			if (Global.currentLevel >= Global.bannerLevel)
			{
				showBannerAd();
			}
		}
		catch (Exception)
		{
		}
		hasShownAdOneTime = false;
		hasShownReplayAd = false;
		string appId = "ca-app-pub-3411062052281263/5993459298";
		try
		{
			MobileAds.Initialize(appId);
		}
		catch (Exception)
		{
		}
		if (!Application.isEditor)
		{
			LoadInterstitial();
		}
		try
		{
			if (rewardBasedVideo == null || !rewardBasedVideo.IsLoaded())
			{
				rewardBasedVideo = RewardBasedVideoAd.Instance;
				rewardBasedVideo.OnAdLoaded += HandleRewardBasedVideoLoaded;
				rewardBasedVideo.OnAdFailedToLoad += HandleRewardBasedVideoFailedToLoad;
				rewardBasedVideo.OnAdOpening += HandleRewardBasedVideoOpened;
				rewardBasedVideo.OnAdStarted += HandleRewardBasedVideoStarted;
				rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
				rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
				rewardBasedVideo.OnAdLeavingApplication += HandleRewardBasedVideoLeftApplication;
				RequestRewardBasedVideo();
			}
		}
		catch (Exception)
		{
		}
	}
Esempio n. 29
0
    public override void Start()
    {
        Pool.Instance.AddSystemListener(typeof(AdComponent), this);

        Monetization.Initialize(this._gameId, this._testMode);
        Advertisement.Initialize(this._gameId, this._testMode);
        //Advertisement.Banner.SetPosition(BannerPosition.BOTTOM_CENTER); // default
        Advertisement.Banner.Hide();
    }
Esempio n. 30
0
    void ShowAd()
    {
        ShowAdCallbacks options = new ShowAdCallbacks();

        options.finishCallback = HandleShowResult;
        ShowAdPlacementContent ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent;

        ad.Show(options);
    }