예제 #1
0
 void OnEnable()
 {
     Tapdaq.hasInterstitialsAvailableForOrientation += DisplayInterstitialWhenAvailable;
     Tapdaq.didCloseInterstitial += DidCloseInterstitial;
     hasShowedInterstitial        = false;
     tapdaq = GetComponent <Tapdaq>();
 }
예제 #2
0
 void Start()
 {
     Tapdaq.didCloseInterstitial += Dismiss;
     tdScript = GetComponent <Tapdaq>();
     bgSquare = Resources.Load("tdSquare") as Texture;
     bgRect   = new Rect(0, 0, Screen.width, Screen.height);
 }
예제 #3
0
    void MyListenerMethod_10(string adType, string adSize, string orientation)
    {
        //this example method attempts to fetch and display the first available native ad, regardless of category
        int unit   = int.Parse(adType);
        int size   = int.Parse(adSize);
        int orient = int.Parse(orientation);

        Debug.Log("Ad type: " + ((Tapdaq.TDNativeAdUnit)unit).ToString());
        Debug.Log("adsize: " + ((Tapdaq.TDNativeAdSize)size).ToString());
        Debug.Log("orientation: " + ((Tapdaq.TDOrientation)orient).ToString());
        if (!nativeAdCreated)
        {
            //fetch a native based on the first available type
            nativeAd = Tapdaq.GetNativeAd((Tapdaq.TDNativeAdUnit)unit, (Tapdaq.TDNativeAdSize)size, (Tapdaq.TDOrientation)orient);

            //if not given sufficient loading time, the native ad can return a null object
            if (nativeAd.creativeImage != null)
            {
                nativeCanvas.SetActive(true);
                //Display the image from the nativeAd to a Canvas Image object
                image.sprite = Sprite.Create(nativeAd.creativeImage, new Rect(0, 0, nativeAd.creativeImage.width, nativeAd.creativeImage.height), new Vector2(0.5f, 0.5f));
                Tapdaq.SendNativeImpression(nativeAd);
                nativeAdCreated = true;
            }
        }
    }
예제 #4
0
    void MyListenerMethod_7(string orientation)
    {
        // Example: //Here we use a bool to avoid rapid fire interstitial spam. 'orientation' will either be PORTRAIT or LANDSCAPE
        if (!interstitialShown)
        {
            int orient = int.Parse(orientation);
            Debug.Log(string.Format("An interstitial for {0} orientation is available", (Tapdaq.TDOrientation)orient));
            interstitialShown = true;

            Tapdaq.ShowInterstitial();
            interstitialsAvailable = true;
        }
    }
예제 #5
0
    void DisplayInterstitialWhenAvailable(string orientation)
    {
        if (!hasShowedInterstitial)
        {
            var orientationNumber = int.Parse(orientation);

            if (Screen.width < Screen.height && orientationNumber == 0)
            {
                Tapdaq.ShowInterstitial();
                hasShowedInterstitial = true;
            }
            if (Screen.width > Screen.height && orientationNumber == 1)
            {
                Tapdaq.ShowInterstitial();
                hasShowedInterstitial = true;
            }
        }
    }
예제 #6
0
    void Awake()
    {
        if (TDinstance != null)           // Ensuring no clones
        {
            Destroy(gameObject);
            return;
        }
        //Make the plugin available across all scenes
        TDinstance = this;
        GameObject.DontDestroyOnLoad(gameObject);
        settings   = GetComponent <TapdaqSettings>();
        view       = GetComponent <TapdaqView>();
        closeImage = Resources.Load("tdCircle") as Texture;


        //Apply All Settings
        showLogMessages = settings.showLogs;
        _TEST_MODE_     = settings.testMode;

        ios_applicationID     = settings.ios_applicationID;
        ios_clientKey         = settings.ios_clientKey;
        android_applicationID = settings.android_applicationID;
        android_clientKey     = settings.android_clientKey;

        frequency = settings.frequency;
        duration  = settings.duration;

        interstitials = settings.interstitials;
        //interstitialPortrait = settings.interstitialPortrait;
        //interstitialLandscape = settings.interstitialLandscape;


        nativeSquareLarge  = settings.nativeSquareLarge;
        nativeSquareMedium = settings.nativeSquareMedium;
        nativeSquareSmall  = settings.nativeSquareSmall;

        nativeNewsfeedPortraitLarge  = settings.nativeNewsfeedPortraitLarge;
        nativeNewsfeedPortraitMedium = settings.nativeNewsfeedPortraitMedium;
        nativeNewsfeedPortraitSmall  = settings.nativeNewsfeedPortraitSmall;

        nativeNewsfeedLandscapeLarge  = settings.nativeNewsfeedLandscapeLarge;
        nativeNewsfeedLandscapeMedium = settings.nativeNewsfeedLandscapeMedium;
        nativeNewsfeedLandscapeSmall  = settings.nativeNewsfeedLandscapeSmall;

        nativeFullscreenPortraitLarge  = settings.nativeFullscreenPortraitLarge;
        nativeFullscreenPortraitMedium = settings.nativeFullscreenPortraitMedium;
        nativeFullscreenPortraitSmall  = settings.nativeFullscreenPortraitSmall;

        nativeFullscreenLandscapeLarge  = settings.nativeFullscreenLandscapeLarge;
        nativeFullscreenLandscapeMedium = settings.nativeFullscreenLandscapeMedium;
        nativeFullscreenLandscapeSmall  = settings.nativeFullscreenLandscapeSmall;

        nativeStripPortraitLarge  = settings.nativeStripPortraitLarge;
        nativeStripPortraitMedium = settings.nativeStripPortraitMedium;
        nativeStripPortraitSmall  = settings.nativeStripPortraitSmall;

        nativeStripLandscapeLarge  = settings.nativeStripLandscapeLarge;
        nativeStripLandscapeMedium = settings.nativeStripLandscapeMedium;
        nativeStripLandscapeSmall  = settings.nativeStripLandscapeSmall;


        if (showLogMessages)
        {
            Debug.Log("TapdaqSDK/Test Mode Active? -- " + _TEST_MODE_);
#if UNITY_IPHONE
            Debug.Log("TapdaqSDK/Application ID -- " + ios_applicationID);
            Debug.Log("TapdaqSDK/Client Key -- " + ios_clientKey);
#elif UNITY_ANDROID
            Debug.Log("TapdaqSDK/Application ID -- " + android_applicationID);
            Debug.Log("TapdaqSDK/Client Key -- " + android_clientKey);
#endif

            Debug.Log("TapdaqSDK/Ad Frequency -- " + frequency);
            Debug.Log("TapdaqSDK/Ad Duration -- " + duration);

            //if(interstitialPortrait)Debug.Log("TapdaqSDK/Portrait Interstitials enabled");
            //if(interstitialLandscape)Debug.Log("TapdaqSDK/Landscape Interstitials enabled");

            if (interstitials)
            {
                if (Screen.width >= Screen.height)
                {
                    Debug.Log("TapdaqSDK/Landscape Interstitials enabled");
                }
                else
                {
                    Debug.Log("TapdaqSDK/Portrait Interstitials enabled");
                }
            }

            if (nativeSquareLarge)
            {
                Debug.Log("TapdaqSDK/Native Square Large enabled");
            }
            if (nativeSquareMedium)
            {
                Debug.Log("TapdaqSDK/Native Square Medium enabled");
            }
            if (nativeSquareSmall)
            {
                Debug.Log("TapdaqSDK/Native Square Small enabled");
            }

            if (nativeNewsfeedPortraitLarge)
            {
                Debug.Log("TapdaqSDK/Native News Feed Portrait Large enabled");
            }
            if (nativeNewsfeedPortraitMedium)
            {
                Debug.Log("TapdaqSDK/Native News Feed Portrait Medium enabled");
            }
            if (nativeNewsfeedPortraitSmall)
            {
                Debug.Log("TapdaqSDK/Native News Feed Portrait Small enabled");
            }

            if (nativeNewsfeedLandscapeLarge)
            {
                Debug.Log("TapdaqSDK/Native News Feed Landscape Large enabled");
            }
            if (nativeNewsfeedLandscapeMedium)
            {
                Debug.Log("TapdaqSDK/Native News Feed Landscape Medium enabled");
            }
            if (nativeNewsfeedLandscapeSmall)
            {
                Debug.Log("TapdaqSDK/Native News Feed Landscape Small enabled");
            }

            if (nativeFullscreenPortraitLarge)
            {
                Debug.Log("TapdaqSDK/Native Full Screen Portrait Large enabled");
            }
            if (nativeFullscreenPortraitMedium)
            {
                Debug.Log("TapdaqSDK/Native Full Screen Portrait Medium enabled");
            }
            if (nativeFullscreenPortraitSmall)
            {
                Debug.Log("TapdaqSDK/Native Full Screen Portrait Small enabled");
            }

            if (nativeFullscreenLandscapeLarge)
            {
                Debug.Log("TapdaqSDK/Native Full Screen Landscape Large enabled");
            }
            if (nativeFullscreenLandscapeMedium)
            {
                Debug.Log("TapdaqSDK/Native Full Screen Landscape Medium enabled");
            }
            if (nativeFullscreenLandscapeSmall)
            {
                Debug.Log("TapdaqSDK/Native Full Screen Landscape Small enabled");
            }

            if (nativeStripPortraitLarge)
            {
                Debug.Log("TapdaqSDK/Native Strip Portrait Large enabled");
            }
            if (nativeStripPortraitMedium)
            {
                Debug.Log("TapdaqSDK/Native Strip Portrait Medium enabled");
            }
            if (nativeStripPortraitSmall)
            {
                Debug.Log("TapdaqSDK/Native Strip Portrait Small enabled");
            }

            if (nativeStripLandscapeLarge)
            {
                Debug.Log("TapdaqSDK/Native Strip Landscape Large enabled");
            }
            if (nativeStripLandscapeMedium)
            {
                Debug.Log("TapdaqSDK/Native Strip Landscape Medium enabled");
            }
            if (nativeStripLandscapeSmall)
            {
                Debug.Log("TapdaqSDK/Native Strip Landscape Small enabled");
            }
        }

//		group = ns_group;
//		interstitialCanvas = ns_interstitialCanvas;
//		interstitialPortraitImage = ns_interstitialPortraitImage;
//		interstitialLandscapeImage = ns_interstitialLandscapeImage;

        //Initialize tapdaq and commence ad caching
        BuildEnabledAdTypesList();
#if UNITY_IPHONE
        GenerateCallbacks();
        TDinitialize(ios_applicationID, ios_clientKey, frequency, duration, flatList);
#elif UNITY_ANDROID
        TDinitialize(android_applicationID, android_clientKey, frequency, duration, flatList);
#endif

        externalInterstitial = new TapdaqInterstitialAd();
        externalNative       = new TapdaqNativeAd();
    }
예제 #7
0
    void Awake()
    {
        if (TDinstance != null)           // Ensuring no clones
        {
            Destroy(gameObject);
            return;
        }

        //Make the plugin available across all scenes
        TDinstance = this;
        GameObject.DontDestroyOnLoad(gameObject);
        settings = GetComponent <TapdaqSettings>();

        showLogMessages = settings.showLogs;
        testModeEnabled = settings.testMode;

        ios_applicationID     = settings.ios_applicationID;
        ios_clientKey         = settings.ios_clientKey;
        android_applicationID = settings.android_applicationID;
        android_clientKey     = settings.android_clientKey;

        frequencyCap = settings.frequency;
        frequencyCapDurationInDays = settings.duration;

        interstitials = settings.interstitials;

        nativeSquareLarge  = settings.nativeSquareLarge;
        nativeSquareMedium = settings.nativeSquareMedium;
        nativeSquareSmall  = settings.nativeSquareSmall;

        nativeNewsfeedPortraitLarge  = settings.nativeNewsfeedPortraitLarge;
        nativeNewsfeedPortraitMedium = settings.nativeNewsfeedPortraitMedium;
        nativeNewsfeedPortraitSmall  = settings.nativeNewsfeedPortraitSmall;

        nativeNewsfeedLandscapeLarge  = settings.nativeNewsfeedLandscapeLarge;
        nativeNewsfeedLandscapeMedium = settings.nativeNewsfeedLandscapeMedium;
        nativeNewsfeedLandscapeSmall  = settings.nativeNewsfeedLandscapeSmall;

        nativeFullscreenPortraitLarge  = settings.nativeFullscreenPortraitLarge;
        nativeFullscreenPortraitMedium = settings.nativeFullscreenPortraitMedium;
        nativeFullscreenPortraitSmall  = settings.nativeFullscreenPortraitSmall;

        nativeFullscreenLandscapeLarge  = settings.nativeFullscreenLandscapeLarge;
        nativeFullscreenLandscapeMedium = settings.nativeFullscreenLandscapeMedium;
        nativeFullscreenLandscapeSmall  = settings.nativeFullscreenLandscapeSmall;

        nativeStripPortraitLarge  = settings.nativeStripPortraitLarge;
        nativeStripPortraitMedium = settings.nativeStripPortraitMedium;
        nativeStripPortraitSmall  = settings.nativeStripPortraitSmall;

        nativeStripLandscapeLarge  = settings.nativeStripLandscapeLarge;
        nativeStripLandscapeMedium = settings.nativeStripLandscapeMedium;
        nativeStripLandscapeSmall  = settings.nativeStripLandscapeSmall;


        if (showLogMessages)
        {
            logMessage(TDLogSeverity.debug, "TapdaqSDK/Test Mode Active? -- " + testModeEnabled);

#if UNITY_IPHONE
            logMessage(TDLogSeverity.debug, "TapdaqSDK/Application ID -- " + ios_applicationID);
            logMessage(TDLogSeverity.debug, "TapdaqSDK/Client Key -- " + ios_clientKey);
#elif UNITY_ANDROID
            logMessage(TDLogSeverity.debug, "TapdaqSDK/Application ID -- " + android_applicationID);
            logMessage(TDLogSeverity.debug, "TapdaqSDK/Client Key -- " + android_clientKey);
#endif

            logMessage(TDLogSeverity.debug, "TapdaqSDK/Ad Frequency -- " + frequencyCap);
            logMessage(TDLogSeverity.debug, "TapdaqSDK/Ad Duration -- " + frequencyCapDurationInDays);

            if (interstitials)
            {
                logMessage(TDLogSeverity.debug, "Interstitials enabled");
            }

            if (nativeSquareLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Square Large enabled");
            }
            if (nativeSquareMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Square Medium enabled");
            }
            if (nativeSquareSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Square Small enabled");
            }

            if (nativeNewsfeedPortraitLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native News Feed Portrait Large enabled");
            }
            if (nativeNewsfeedPortraitMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native News Feed Portrait Medium enabled");
            }
            if (nativeNewsfeedPortraitSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native News Feed Portrait Small enabled");
            }

            if (nativeNewsfeedLandscapeLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native News Feed Landscape Large enabled");
            }
            if (nativeNewsfeedLandscapeMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native News Feed Landscape Medium enabled");
            }
            if (nativeNewsfeedLandscapeSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native News Feed Landscape Small enabled");
            }

            if (nativeFullscreenPortraitLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Full Screen Portrait Large enabled");
            }
            if (nativeFullscreenPortraitMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Full Screen Portrait Medium enabled");
            }
            if (nativeFullscreenPortraitSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Full Screen Portrait Small enabled");
            }

            if (nativeFullscreenLandscapeLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Full Screen Landscape Large enabled");
            }
            if (nativeFullscreenLandscapeMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Full Screen Landscape Medium enabled");
            }
            if (nativeFullscreenLandscapeSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Full Screen Landscape Small enabled");
            }

            if (nativeStripPortraitLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Strip Portrait Large enabled");
            }
            if (nativeStripPortraitMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Strip Portrait Medium enabled");
            }
            if (nativeStripPortraitSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Strip Portrait Small enabled");
            }

            if (nativeStripLandscapeLarge)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Strip Landscape Large enabled");
            }
            if (nativeStripLandscapeMedium)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Strip Landscape Medium enabled");
            }
            if (nativeStripLandscapeSmall)
            {
                logMessage(TDLogSeverity.debug, "TapdaqSDK/Native Strip Landscape Small enabled");
            }
        }

//		group = ns_group;
//		interstitialCanvas = ns_interstitialCanvas;
//		interstitialPortraitImage = ns_interstitialPortraitImage;
//		interstitialLandscapeImage = ns_interstitialLandscapeImage;

        //Initialize tapdaq and commence ad caching
        string enabledAdTypes = BuildEnabledAdTypesList();

#if UNITY_IPHONE
        GenerateCallbacks();
        TDinitialize(ios_applicationID, ios_clientKey, frequencyCap, frequencyCapDurationInDays, enabledAdTypes);
#elif UNITY_ANDROID
        TDinitialize(android_applicationID, android_clientKey, frequencyCap, frequencyCapDurationInDays, enabledAdTypes);
#endif

        externalNative = new TapdaqNativeAd();
    }
예제 #8
0
    //	void Update()
    //	{
    //		Instance.timerText = String.Format("{0:D2}:{1:D2}", videoWait/60, videoWait%60);
    //	}

    void Play()
    {
        Tapdaq.ShowInterstitial();
        Application.LoadLevelAsync(1);
    }
예제 #9
0
 public void SendNativeClick()
 {
     print("Native Ad clicked");
     Tapdaq.SendNativeClick(nativeAd);
 }
예제 #10
0
 public void ShowInterstitial()
 {
     Tapdaq.ShowInterstitial();
 }