Esempio n. 1
0
 public void PlayInterstitialAds(string reward)
 {
     if (Yodo1U3dAds.InterstitialIsReady())
     {
         Yodo1U3dAds.ShowInterstitial();
     }
 }
Esempio n. 2
0
 public void PlayInterstitialAdsWithLevel(string reward, int level)
 {
     if (Yodo1U3dAds.InterstitialIsReady())
     {
         targetLevel = level;
         Yodo1U3dAds.ShowInterstitial();
     }
 }
Esempio n. 3
0
    void OnGUI()
    {
        int buttonHeight = Screen.height / 13;
        int buttonWidth  = Screen.width / 2;
        int buttonSpace  = buttonHeight / 2;
        int startHeight  = buttonHeight / 2;

        if (GUI.Button(new Rect(Screen.width / 4, startHeight, buttonWidth, buttonHeight), "show banner ad"))
        {
            if (isTimes)
            {
                isTimes = false;
                Yodo1U3dAds.SetBannerAlign(Yodo1U3dConstants.BannerAdAlign.BannerAdAlignBotton | Yodo1U3dConstants.BannerAdAlign.BannerAdAlignHorizontalCenter);
            }
            //Show banner ad
            Yodo1U3dAds.ShowBanner();
        }

        if (GUI.Button(new Rect(Screen.width / 4, startHeight + buttonSpace + buttonHeight, buttonWidth, buttonHeight), "hide banner ad"))
        {
            //Hide banner ad
            Yodo1U3dAds.HideBanner();
        }
        if (GUI.Button(new Rect(Screen.width / 4, startHeight + buttonHeight * 2 + buttonSpace * 2, buttonWidth, buttonHeight), "show interstitial ad"))
        {
            //Show interstitial ad
            if (Yodo1U3dAds.InterstitialIsReady())
            {
                Yodo1U3dAds.ShowInterstitial();
            }
            else
            {
                Debug.Log("[Yodo1 Ads] Interstitial ad has not been cached.");
            }
        }

        if (GUI.Button(new Rect(Screen.width / 4, startHeight + buttonHeight * 3 + buttonSpace * 3, buttonWidth, buttonHeight), "show reward video ad"))
        {
            //Show reward video ad
            if (Yodo1U3dAds.VideoIsReady())
            {
                Yodo1U3dAds.ShowVideo();
            }
            else
            {
                Debug.Log("[Yodo1 Ads] Reward video ad has not been cached.");
            }
        }
    }
Esempio n. 4
0
 public void PlayAds(string reward)
 {
     if (Yodo1U3dAds.VideoIsReady())
     {
         rewardType = reward;
         // if (rewardType == AD_REWARD_TYPE.GET_REWARD_ITEM)
         // {
         //     rewardEffectBackground.SetActive(true);
         // }
         Yodo1U3dAds.ShowVideo();
     }
     else
     {
         if (uiController == null)
         {
             uiController = FindObjectOfType <UIController>();
         }
         else
         {
             uiController.ShowToast("광고를 불러오지 못했어요. 잠시 후에 다시 시도해주세요.");
         }
     }
 }
Esempio n. 5
0
    public static void InitializeSdk()
    {
        if (initialized)
        {
            Debug.LogWarning("[Yodo1 Ads] The SDK has been initialized, please do not initialize the SDK repeatedly.");
            return;
        }

        var type   = typeof(Yodo1U3dSDK);
        var sdkObj = new GameObject("Yodo1U3dSDK", type).GetComponent <Yodo1U3dSDK>(); // Its Awake() method sets Instance.

        if (Yodo1U3dSDK.Instance != sdkObj)
        {
            Debug.LogError("[Yodo1 Ads] It looks like you have the " + type.Name + " on a GameObject in your scene. Please remove the script from your scene.");
            return;
        }

        Yodo1Ads.Yodo1AdSettings settings = Resources.Load("Yodo1Ads/Yodo1AdSettings", typeof(Yodo1Ads.Yodo1AdSettings)) as Yodo1Ads.Yodo1AdSettings;
        if (settings == null)
        {
            Debug.LogError("[Yodo1 Ads] The SDK has not been initialized yet. The Yodo1AdSettings is missing.");
            return;
        }

        string appKey = string.Empty;

#if UNITY_ANDROID
        appKey = settings.androidSettings.AppKey;
#elif UNITY_IOS
        appKey = settings.iOSSettings.AppKey;
#endif
        Debug.Log("[Yodo1 Ads] The SDK has been initialized, the app key is " + appKey);
        Yodo1U3dAds.InitWithAppKey(appKey);

        initialized = true;
    }
Esempio n. 6
0
    void Start()
    {
        isTimes = true;

        Yodo1U3dAds.SetLogEnable(true);

        Yodo1U3dAds.SetUserConsent(true);
        Yodo1U3dAds.SetTagForUnderAgeOfConsent(false);
        Yodo1U3dAds.SetDoNotSell(false);
        Yodo1U3dAds.InitializeSdk();
        Yodo1U3dAdsSDK.setBannerdDelegate((Yodo1U3dAdsConstants.AdEvent adEvent, string error) =>
        {
            Debug.Log("[Yodo1 Ads] BannerdDelegate:" + adEvent + "\n" + error);
            switch (adEvent)
            {
            case Yodo1U3dAdsConstants.AdEvent.AdEventClick:
                Debug.Log("[Yodo1 Ads] Banner advertising has been clicked.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventClose:
                Debug.Log("[Yodo1 Ads] Banner advertising has been closed.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventShowSuccess:
                Debug.Log("[Yodo1 Ads] Banner advertising has been shown.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventShowFail:
                Debug.Log("[Yodo1 Ads] Banner advertising show failed, the error message:" + error);
                break;
            }
        });

        Yodo1U3dAdsSDK.setInterstitialAdDelegate((Yodo1U3dAdsConstants.AdEvent adEvent, string error) =>
        {
            Debug.Log("[Yodo1 Ads] InterstitialAdDelegate:" + adEvent + "\n" + error);
            switch (adEvent)
            {
            case Yodo1U3dAdsConstants.AdEvent.AdEventClick:
                Debug.Log("[Yodo1 Ads] Interstital advertising has been clicked.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventClose:
                Debug.Log("[Yodo1 Ads] Interstital advertising has been closed.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventShowSuccess:
                Debug.Log("[Yodo1 Ads] Interstital advertising has been shown.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventShowFail:
                Debug.Log("[Yodo1 Ads] Interstital advertising show failed, the error message:" + error);
                break;
            }
        });

        Yodo1U3dAdsSDK.setRewardVideoDelegate((Yodo1U3dAdsConstants.AdEvent adEvent, string error) =>
        {
            Debug.Log("[Yodo1 Ads] RewardVideoDelegate:" + adEvent + "\n" + error);
            switch (adEvent)
            {
            case Yodo1U3dAdsConstants.AdEvent.AdEventClick:
                Debug.Log("[Yodo1 Ads] Reward video advertising has been clicked.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventClose:
                Debug.Log("[Yodo1 Ads] Reward video advertising has been closed.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventShowSuccess:
                Debug.Log("[Yodo1 Ads] Reward video advertising has shown successful.");
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventShowFail:
                Debug.Log("[Yodo1 Ads] Reward video advertising show failed, the error message:" + error);
                break;

            case Yodo1U3dAdsConstants.AdEvent.AdEventFinish:
                Debug.Log(
                    "[Yodo1 Ads] Reward video advertising has been played finish, give rewards to the player.");
                break;
            }
        });

        Yodo1U3dAdsSDK.setRewardGameDelegate((string reward, string error) =>
        {
            Debug.Log("[Yodo1 Ads] RewardGameDelegate:" + reward + "\n" + error);
        });
    }
Esempio n. 7
0
    void OnGUI()
    {
        int buttonHeight = Screen.height / 13;
        int buttonWidth  = Screen.width / 2;
        int buttonSpace  = buttonHeight / 2;
        int startHeight  = buttonHeight / 2;

        if (GUI.Button(new Rect(Screen.width / 4, startHeight, buttonWidth, buttonHeight), "show banner ad"))
        {
            if (!Yodo1U3dAds.BannerIsReady())
            {
                Debug.Log("[Yodo1 Ads] Banner ad has not been cached.");
                return;
            }

            if (isTimes)
            {
                isTimes = false;
                Yodo1U3dAds.SetBannerAlign(Yodo1U3dAdsConstants.BannerAdAlign.BannerAdAlignTop |
                                           Yodo1U3dAdsConstants.BannerAdAlign.BannerAdAlignHorizontalCenter);
                if (IsiPhoneX())
                {
                    Yodo1U3dAds.SetBannerOffset(0.0f, 44.0f);
                }
            }

            //Show banner ad
            Yodo1U3dAds.ShowBanner();
        }

        if (GUI.Button(new Rect(Screen.width / 4, startHeight + buttonSpace + buttonHeight, buttonWidth, buttonHeight),
                       "hide banner ad"))
        {
            //Hide banner ad
            Yodo1U3dAds.HideBanner();
        }

        if (GUI.Button(
                new Rect(Screen.width / 4, startHeight + buttonHeight * 2 + buttonSpace * 2, buttonWidth, buttonHeight),
                "show interstitial ad"))
        {
            //Show interstitial ad
            if (Yodo1U3dAds.InterstitialIsReady())
            {
                Yodo1U3dAds.ShowInterstitial();
            }
            else
            {
                Debug.Log("[Yodo1 Ads] Interstitial ad has not been cached.");
            }
        }

        if (GUI.Button(
                new Rect(Screen.width / 4, startHeight + buttonHeight * 3 + buttonSpace * 3, buttonWidth, buttonHeight),
                "show reward video ad"))
        {
            //Show reward video ad
            if (Yodo1U3dAds.VideoIsReady())
            {
                Yodo1U3dAds.ShowVideo();
            }
            else
            {
                Debug.Log("[Yodo1 Ads] Reward video ad has not been cached.");
            }
        }

        if (GUI.Button(
                new Rect(Screen.width / 4, startHeight + buttonHeight * 4 + buttonSpace * 4, buttonWidth, buttonHeight),
                "show lucky wheel"))
        {
            //Show reward game
            if (Yodo1U3dAds.RewardGameIsEnable())
            {
                Yodo1U3dAds.ShowRewardGame();
            }
            else
            {
                Debug.Log("[Yodo1 Ads] Reward game is disabled.");
            }
        }

        if (GUI.Button(
                new Rect(Screen.width / 4, startHeight + buttonHeight * 5 + buttonSpace * 5, buttonWidth, buttonHeight),
                "返回"))
        {
            SceneManager.LoadScene("Yodo1Demo");
        }
    }
Esempio n. 8
0
 public void InitializeAds()
 {
     Yodo1U3dAds.InitializeSdk();
     SetListners();
 }