Exemplo n.º 1
0
    /// <summary>
    /// 広告配置の取得
    /// </summary>
    /// <param name="gameId">Unity Dashboard で確認</param>
    /// <param name="placementName">Unity Dashboard で確認</param>
    public async void GetAdPlacementsAsync(string gameId, string placementName)
    {
        var request = new GetAdPlacementsRequest {
            AppId = gameId
        };
        var result = await PlayFabClientAPI.GetAdPlacementsAsync(request);

        if (result.Error != null)
        {
            Debug.Log(result.Error.GenerateErrorReport());
        }
        else
        {
            var placement = result.Result.AdPlacements.Find(x => x.PlacementName == placementName);
            PlacementId                = placement.PlacementId;
            RewardId                   = placement.RewardId;
            PlacementViewsRemaining    = placement.PlacementViewsRemaining;
            PlacementViewsResetMinutes = placement.PlacementViewsResetMinutes;

            Debug.Log("GetAdPlacements Success!!");
            Debug.Log("PlacementName:" + placement.PlacementName);
            Debug.Log("RewardName:" + placement.RewardName);
            Debug.Log("PlacementViewsRemaining:" + placement.PlacementViewsRemaining);
            Debug.Log("PlacementViewsResetMinutes:" + placement.PlacementViewsResetMinutes);
        }
    }
Exemplo n.º 2
0
 public static void GetAdPlacements(GetAdPlacementsRequest request, Action <GetAdPlacementsResult> resultCallback, Action <PlayFab.PlayFabError> errorCallback, object customData = null)
 {
     if (!PlayFabHttp.IsClientLoggedIn())
     {
         throw new Exception("Must be logged in to call this method");
     }
     PlayFabHttp.MakeApiCall("/Client/GetAdPlacements", request, AuthType.LoginSession, resultCallback, errorCallback, customData);
 }
Exemplo n.º 3
0
    public static void GetAdPlacements(GetAdPlacementsRequest request, Action <GetAdPlacementsResult> resultCallback, Action <PlayFab.PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
    {
        // var context = (request == null ? null : request.AuthenticationContext) ?? PlayFab.PlayFabSettings.staticPlayer;
        if (!PlayFab.PlayFabClientAPI.IsClientLoggedIn())
        {
            throw new PlayFab.PlayFabException(PlayFab.PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method");
        }

        PlayFabHttp.MakeApiCall("/Client/GetAdPlacements", request, AuthType.LoginSession, resultCallback, errorCallback, customData, extraHeaders);
    }