Exemplo n.º 1
0
 public static void RouteActivityToPlayFab(string placement, string reward)
 {
     PF_Advertising.RewardAdActivity(new RewardAdActivityRequest()
     {
         PlacementId = placement, RewardId = reward
     }, OnReportAdActivitySuccess, PF_Bridge.PlayFabErrorCallback);
 }
Exemplo n.º 2
0
 //Invoked when the video ad finishes playing.
 public void VideoEndEvent()
 {
     Debug.Log("VideoEndEvent");
     PF_Advertising.ReportAdActivity(new ReportAdActivityRequest()
     {
         PlacementId = SupersonicEvents.queuedAd.PlacementId, RewardId = SupersonicEvents.queuedAd.RewardId, Activity = AdActivity.End
     }, null, PF_Bridge.PlayFabErrorCallback);
 }
Exemplo n.º 3
0
    public void CheckForPlayFabPlacement(string placement = null)
    {
        Action <PlayFabError> errorCb = error =>
        {
            if (error.GenerateErrorReport().Contains("AllAdPlacementViewsAlreadyConsumed"))
            {
                //PF_Bridge.RaiseCallbackError(string.Format("No more rewared ads can be viewed at this time. Check back in {0} minutes",  ), PlayFabAPIMethods.Generic, MessageDisplayStyle.error);
                var adpromo = promos.Find((p) => { return(p.linkedAd != null); });

                if (adpromo != null)
                {
                    Debug.Log(string.IsNullOrEmpty(adpromo.assets.PromoId) ? "AdPromo was not null... removing: " + adpromo.assets.PromoId : "Unknown");
                    promos.Remove(adpromo);
                    SetAdSlotCount(promos.Count);
                    SelectBanner();
                    Debug.Log("Promo Count: " + promos.Count);
                }
                else
                {
                    Debug.Log("AdPromo not in rotation.");
                }
            }
            else
            {
                PF_Bridge.RaiseCallbackError(error.GenerateErrorReport(), PlayFabAPIMethods.Generic, MessageDisplayStyle.error);
            }
        };

        // SupersonicEvents.queuedAd = null;

        if (placement != null)
        {
            // PF_Advertising.GetAdPlacements(new GetAdPlacementsRequest { Identifier = new NameIdentifier() { Name = placement }, AppId = SupersonicEvents.appKey }, OnCheckForPlayFabPlacementSuccess, errorCb);
            PF_Advertising.GetAdPlacements(new GetAdPlacementsRequest {
                Identifier = new NameIdentifier()
                {
                    Name = placement
                }, AppId = "0"
            }, OnCheckForPlayFabPlacementSuccess, errorCb);
        }
        else
        {
            // PF_Advertising.GetAdPlacements(new GetAdPlacementsRequest { AppId = SupersonicEvents.appKey }, OnCheckForPlayFabPlacementSuccess, errorCb);
            PF_Advertising.GetAdPlacements(new GetAdPlacementsRequest {
                AppId = "0"
            }, OnCheckForPlayFabPlacementSuccess, errorCb);
        }
    }