Exemplo n.º 1
0
    public void ShowAd()
    {
        //Get Content for a placement
        PlacementContent placementContent = Monetization.GetPlacementContent(placementName);

        //Convert to ShowAdPlacementContent to show the ad
        //This works for most ad types (Video, Playable, Display, Promo, AR, etc.)
        //IAP Promo does require additional configuration. (See: PromoExample)
        ShowAdPlacementContent showAd = (ShowAdPlacementContent)placementContent;

        //We can check if this is a rewarded placement from the placement content
        if (showAd.rewarded == true)
        {
            ShowAdCallbacks callbacks = new ShowAdCallbacks
            {
                finishCallback = HandleReward
            };
            Debug.Log("Showing Rewarded Ad - Placement: " + placementContent.placementId);
            showAd.Show(callbacks);
        }
        else
        {
            Debug.Log("Showing Non-rewarded Ad - Placement: " + placementContent.placementId);
            showAd.Show();
        }
    }
 public PlacementContentStateChangeEventArgs(string id, PlacementContent placementContent, PlacementContentState preState, PlacementContentState newState)
 {
     this.placementId      = id;
     this.placementContent = placementContent;
     this.previousState    = preState;
     this.newState         = newState;
 }
Exemplo n.º 3
0
 private void ContentReady(object sender, PlacementContentReadyEventArgs e)
 {
     if (e.placementId == ar_ad)
     {
         arContent = e.placementContent;
         Debug.Log("Placement is ready to go");
     }
 }
Exemplo n.º 4
0
 private void ContentReady(object sender, PlacementContentReadyEventArgs e)
 {
     if (e.placementId == placementID_AR)
     {
         arContent = e.placementContent;
         Debug.Log("AR placement is ready to go.");
     }
 }
Exemplo n.º 5
0
    public void ShowPromo()
    {
        if (Monetization.IsReady(placementName) == false)
        {
            Debug.Log("Placement Not Ready: " + placementName);
            return;
        }

        //Get Content for a placement
        PlacementContent placementContent = Monetization.GetPlacementContent(placementName);

        if (placementContent == null)
        {
            Debug.LogError("Placement Content Empty for Placement ID: " + placementContent.placementId);
            return;
        }

        //Convert to ShowAdPlacementContent to show the ad
        //This works for most ad types (Video, Playable, Display, Promo, AR, etc.)
        //IAP Promo requires that the Purcahsing Adapter is set, otherwise placement will never be Ready
        ShowAdPlacementContent showAd = (ShowAdPlacementContent)placementContent;

        if (showAd == null)
        {
            Debug.LogError("Show Ad Placement Content Empty for Placement ID: " + showAd.placementId);
            return;
        }


        //Since this is a Personalized Placement, it can be an Ad or an IAP Promo. And we can check which if needed.
        if (showAd.GetType() == typeof(ShowAdPlacementContent))
        {
            Debug.Log("Showing Ad - Placement: " + showAd.placementId);
        }

        if (showAd.GetType() == typeof(PromoAdPlacementContent))
        {
            Debug.Log("Showing Promo - Placement: " + showAd.placementId);
        }

        //We can check if this is a rewarded placement from the placement content
        if (showAd.rewarded == true)
        {
            ShowAdCallbacks callbacks = new ShowAdCallbacks
            {
                finishCallback = HandleReward
            };
            Debug.Log("Showing Rewarded Ad - Placement: " + placementContent.placementId);
            showAd.Show(callbacks);
        }
        else
        {
            Debug.Log("Showing Non-rewarded Ad - Placement: " + placementContent.placementId);
            showAd.Show();
        }
    }
Exemplo n.º 6
0
    public bool IsReady(string placement)
    {
        PlacementContent placementContent = Monetization.GetPlacementContent(placement);

        if (placementContent == null)
        {
            return(false);
        }
        return(placementContent.ready);
    }
 public PlacementContentReadyEventArgs(string id, PlacementContent placementContent)
 {
     this.placementId      = id;
     this.placementContent = placementContent;
 }