Inheritance: PlayFabRequestCommon
Exemplo n.º 1
0
 void GetStore()
 {
     Debug.Log("GetStore");
     PlayFab.ClientModels.GetStoreItemsRequest request = new PlayFab.ClientModels.GetStoreItemsRequest();
     request.CatalogVersion = m_CatalogVersion;
     request.StoreId        = m_StoreId;
     PlayFabClientAPI.GetStoreItems(request, resultCallback, ErroCallBAck);
 }
Exemplo n.º 2
0
		/// <summary>
		/// Retrieves the set of items defined for the specified store, including all prices defined
		/// </summary>
		public static void GetStoreItems(GetStoreItemsRequest request, GetStoreItemsCallback resultCallback, ErrorCallback errorCallback)
		{
			if (AuthKey == null) throw new Exception ("Must be logged in to call this method");

			string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings);
			Action<string,string> callback = delegate(string responseStr, string errorStr)
			{
				GetStoreItemsResult result = null;
				PlayFabError error = null;
				ResultContainer<GetStoreItemsResult>.HandleResults(responseStr, errorStr, out result, out error);
				if(error != null && errorCallback != null)
				{
					errorCallback(error);
				}
				if(result != null)
				{
					
					if(resultCallback != null)
					{
						resultCallback(result);
					}
				}
			};
			PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Client/GetStoreItems", serializedJSON, "X-Authorization", AuthKey, callback);
		}
    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);

        
    }
        /// <summary>
        /// Retrieves the set of items defined for the specified store, including all prices defined
        /// </summary>
        public static void GetStoreItems(GetStoreItemsRequest request, ProcessApiCallback<GetStoreItemsResult> resultCallback, ErrorCallback errorCallback, object customData = null)
        {
            if (_authKey == null) throw new Exception("Must be logged in to call this method");

            string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy);
            Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer)
            {
                ResultContainer<GetStoreItemsResult>.HandleResults(requestContainer, resultCallback, errorCallback, null);
            };
            PlayFabHTTP.Post("/Client/GetStoreItems", serializedJson, "X-Authorization", _authKey, callback, request, customData);
        }
Exemplo n.º 5
0
		/// <summary>
		/// Retrieves the set of items defined for the specified store, including all prices defined
		/// </summary>
        public static async Task<PlayFabResult<GetStoreItemsResult>> GetStoreItemsAsync(GetStoreItemsRequest request)
        {
            if (AuthKey == null) throw new Exception ("Must be logged in to call this method");

            object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/GetStoreItems", request, "X-Authorization", AuthKey);
            if(httpResult is PlayFabError)
            {
                PlayFabError error = (PlayFabError)httpResult;
                if (PlayFabSettings.GlobalErrorHandler != null)
                    PlayFabSettings.GlobalErrorHandler(error);
                return new PlayFabResult<GetStoreItemsResult>
                {
                    Error = error,
                };
            }
            string resultRawJson = (string)httpResult;

            var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings);
            var resultData = serializer.Deserialize<PlayFabJsonSuccess<GetStoreItemsResult>>(new JsonTextReader(new StringReader(resultRawJson)));
			
			GetStoreItemsResult result = resultData.data;
			
			
            return new PlayFabResult<GetStoreItemsResult>
                {
                    Result = result
                };
        }