Exemple #1
0
    public void GetStoreItems()
    {
        var request = new GetStoreItemsRequest {
            CatalogVersion = "main", StoreId = "fruits"
        };

        PlayFabClientAPI.GetStoreItems(request, OnGetStoreItemsSuccess, OnGetStoreItemsFailure);
    }
        /// <summary>
        /// Retrieves the set of items defined for the specified store, including all prices defined
        /// </summary>
        public static void GetStoreItems(GetStoreItemsRequest request, Action <GetStoreItemsResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null)
        {
            if (PlayFabSettings.DeveloperSecretKey == null)
            {
                throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
            }

            PlayFabHttp.MakeApiCall("/Admin/GetStoreItems", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData);
        }
Exemple #3
0
    public static void GetActiveEventData()
    {
        // get active events via a special store
        var request = new GetStoreItemsRequest {
            CatalogVersion = "Events", StoreId = "events"
        };

        // DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetActiveEvents); // not needed because called inside GetEventData
        PlayFabClientAPI.GetStoreItems(request, OnGetActiveEventsSuccess, PF_Bridge.PlayFabErrorCallback);
    }
Exemple #4
0
    void GetCatalogStore(string storeName)
    {
        var request = new GetStoreItemsRequest
        {
            CatalogVersion = catalogName,
            StoreId        = storeName
        };

        PlayFabClientAPI.GetStoreItems(request, GetStoreItemsSuccess, GetStoreItemsFailure);
    }
Exemple #5
0
    public void GetStoreItems(string store, System.Action <GetStoreItemsResult> successCallback, System.Action <PlayFabError> failureCallback)
    {
        if (failureCallback == null)
        {
            failureCallback = Callback_Generic_Error;
        }
        var request = new GetStoreItemsRequest {
            StoreId = store
        };

        PlayFabClientAPI.GetStoreItems(request, successCallback, failureCallback);
    }
    public override void Execute()
    {
        if (_args is GetStoreItemsCommandArgs storeArgs)
        {
            var request = new GetStoreItemsRequest
            {
                CatalogVersion = storeArgs.CatalogVersion,
                StoreId        = storeArgs.StoreId
            };

            PlayFabClientAPI.GetStoreItems(request, OnGotCatalog, OnHttpError);
        }
    }
Exemple #7
0
    /// <summary>
    /// ストア情報の取得
    /// </summary>
    public IEnumerator PlayFabGetStore(string storeId, string catalogVersion = "", Action <GetStoreItemsResult> callback = null)
    {
        var getStoreFunction = new CustomPlayFabFunction <GetStoreItemsRequest, GetStoreItemsResult>();
        var request          = new GetStoreItemsRequest {
            StoreId = storeId, CatalogVersion = catalogVersion
        };

        getStoreFunction.SetRequest = request;
        yield return(StartCoroutine(getStoreFunction.ExecuteCoroutine(PlayFabClientAPI.GetStoreItems)));

        Debug.Log("Result:" + JsonUtility.ToJson(getStoreFunction.GetResult));
        if (callback != null)
        {
            callback(getStoreFunction.GetResult);
        }
    }
Exemple #8
0
    /// <summary>
    /// Retrives the store items.
    /// </summary>
    /// <param name="storeName">Store name.</param>
    /// <param name="callback">Callback.</param>
    public static void RetriveStoreItems(string storeName, UnityAction <List <StoreItem> > callback = null)
    {
        DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetStoreItems);
        GetStoreItemsRequest request = new GetStoreItemsRequest();

        request.StoreId        = storeName;
        request.CatalogVersion = "GameItems";
        PlayFabClientAPI.GetStoreItems(request, (GetStoreItemsResult result) =>
        {
            OnRetriveStoreItemsSuccess(result);
            if (callback != null)
            {
                callback(result.Store);
            }
        }, PF_Bridge.PlayFabErrorCallback);
    }
    /// <summary>
    /// Retrieves the store items.
    /// </summary>
    /// <param name="storeName">Store name.</param>
    /// <param name="callback">Callback.</param>
    public static void RetrieveStoreItems(string storeName, Action <GetStoreItemsResult> callback = null)
    {
        DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetStoreItems);
        var request = new GetStoreItemsRequest
        {
            StoreId        = storeName,
            CatalogVersion = GlobalStrings.PrimaryCatalogName,
        };

        PlayFabClientAPI.GetStoreItems(request, result =>
        {
            if (callback != null)
            {
                callback(result);
            }
            PF_Bridge.RaiseCallbackSuccess("Store Retrieved", PlayFabAPIMethods.GetStoreItems, MessageDisplayStyle.none);
        }, PF_Bridge.PlayFabErrorCallback);
    }
Exemple #10
0
    /// <summary>
    /// Retrieves the store items.
    /// </summary>
    /// <param name="storeName">Store name.</param>
    /// <param name="callback">Callback.</param>
    public static void RetrieveStoreItems(string storeName, UnityAction <List <StoreItem> > callback = null)
    {
        DialogCanvasController.RequestLoadingPrompt(PlayFabAPIMethods.GetStoreItems);
        var request = new GetStoreItemsRequest
        {
            StoreId        = storeName,
            CatalogVersion = GlobalStrings.PrimaryCatalogName,
        };

        PlayFabClientAPI.GetStoreItems(request, result =>
        {
            OnRetrieveStoreItemsSuccess(result);
            if (callback != null)
            {
                callback(result.Store);
            }
        }, PF_Bridge.PlayFabErrorCallback);
    }
Exemple #11
0
        public async Task <List <PlayFabItem> > GetStoreItems()
        {
            var isCacheUpdated = await IsCacheUpdated();

            if (!cache.TryGetValue(CacheKeys.Store, out List <PlayFabItem> items) || !isCacheUpdated)
            {
                var reqGetCatalog = new GetCatalogItemsRequest
                {
                    CatalogVersion = configuration.CatalogName,
                };

                var reqGetStore = new GetStoreItemsRequest
                {
                    CatalogVersion = configuration.CatalogName,
                    StoreId        = configuration.StoreName
                };

                var resultCatalog = await PlayFabAdminAPI.GetCatalogItemsAsync(reqGetCatalog);

                if (resultCatalog.Error != null)
                {
                    throw new Exception(resultCatalog.Error.ErrorMessage);
                }

                var resultStore = await PlayFabAdminAPI.GetStoreItemsAsync(reqGetStore);

                if (resultStore.Error != null)
                {
                    throw new Exception(resultStore.Error.ErrorMessage);
                }

                var catalog = resultCatalog.Result.Catalog;
                var store   = resultStore.Result.Store;

                items = MergeAndGetItemList(catalog, store);
                cache.Set(CacheKeys.Store, items, cacheEntryOptions);
                if (!isCacheUpdated)
                {
                    await UpdateStoreVersionCache();
                }
            }

            return(items);
        }
Exemple #12
0
    private void GetDataFromPlayFab(Action callback)
    {
        var catalogRequest = new GetCatalogItemsRequest()
        {
            CatalogVersion = "ItemCatalog"
        };

        PlayFabClientAPI.GetCatalogItems(catalogRequest, (catResult) =>
        {
//				PlayFabDataStore.Catalog = catResult.Catalog;

            var storeRequest = new GetStoreItemsRequest()
            {
//					CatalogVersion = "ItemCatalog",
                StoreId = "ResizerItems"
            };
            PlayFabClientAPI.GetStoreItems(storeRequest, (storeResult) =>
            {
//						PlayFabDataStore.Store = storeResult.Store;
                callback();

//						GUI_Manager.instance.OnEnableStore();
            }, (error) => {});
        }, (error) => {});

//		CharacterData characterData = GetComponent<CharacterData> ();
        var playerdataRequest = new GetUserDataRequest()
        {
//			PlayFabId = PlayFabId,
            Keys = null
        };

        PlayFabClientAPI.GetUserData(playerdataRequest, (result) =>
        {
            Debug.Log("data" + playerdataRequest.PlayFabId);
        }, (error) => {});

        var playerdatatest = new GetCharacterDataResult();
//		Debug.Log("data111" + playerdatatest.P);
    }
Exemple #13
0
    private void GetDataFromPlayFab(Action callback)
    {
        var catalogRequest = new GetCatalogItemsRequest()
        {
            CatalogVersion = "ItemCatalog"
        };

        PlayFabClientAPI.GetCatalogItems(catalogRequest, (catResult) =>
        {
            PlayFabDataStore.Catalog = catResult.Catalog;

            var storeRequest = new GetStoreItemsRequest()
            {
                CatalogVersion = "ItemCatalog",
                StoreId        = "ResizerItems"
            };
            PlayFabClientAPI.GetStoreItems(storeRequest, (storeResult) =>
            {
                PlayFabDataStore.Store = storeResult.Store;
                callback();
            }, PlayFabErrorHandler.HandlePlayFabError);
        }, PlayFabErrorHandler.HandlePlayFabError);
    }
Exemple #14
0
 public static IEnumerator <GetStoreItemsResult> Do(GetStoreItemsRequest request)
 {
     return(Do <GetStoreItemsRequest, GetStoreItemsResult>(request, PlayFabClientAPI.GetStoreItems));
 }