private void Callback_DownloadCardDatabase_Success(PlayFab.ClientModels.GetCatalogItemsResult result) { foreach (PlayFab.ClientModels.CatalogItem card in result.Catalog) { cardDatabase[card.ItemId] = JsonUtility.FromJson <Card_Data>(card.CustomData); cardDatabase[card.ItemId].ID = card.ItemId; } DownloadAllInventoryCards(); }
private static void GetCatalogItemsCallback_Single(GetCatalogItemsResult result) { callbacks.Add("GetCatalogItemsCallback_Single"); throw new Exception("Non-PlayFab callback error"); }
///// /// /// /// Construct and Render the Catalog based on the Catalog Version /// /// ///// private void ConstructCatalog(GetCatalogItemsResult result){ items = result.Catalog; renderCatalog = true; itemIcons = new Dictionary<string, Texture2D> (); // construct the default gun type PlayFabGameBridge.gunNames = new List<string> (); PlayFabGameBridge.gunTypes = new Dictionary<string,Gun> (); PlayFabGameBridge.currentGunName = "Default"; PlayFabGameBridge.gunNames.Add (PlayFabGameBridge.currentGunName); PlayFabGameBridge.gunTypes.Add (PlayFabGameBridge.currentGunName, new Gun{Frequency=10.0F, ConeAngle=1.5F, DamagePerSecond=20.0F, HitSoundVolume=0.5F, Pitch=1.0F}); // default gun PlayFabGameBridge.currentGun = PlayFabGameBridge.gunTypes [PlayFabGameBridge.currentGunName]; for (int x = 0; x < items.Count; x++) { Dictionary<string,string> customData = JsonReader.Deserialize<Dictionary<string,string>>(items[x].CustomData); itemIcons.Add(items[x].ItemId, icons[customData["Icon"]]); if (items [x].ItemClass.StartsWith("AmmoPack") && !PlayFabGameBridge.gunTypes.ContainsKey(items[x].ItemClass)) { // add a new gun type string newGunName = items[x].ItemClass; // Gun newGun = JsonReader.Deserialize<Gun>(items[x].CustomData); Gun newGun = new Gun{Frequency=float.Parse(customData["Frequency"]), ConeAngle=float.Parse(customData["ConeAngle"]), DamagePerSecond=float.Parse(customData["DamagePerSecond"]), HitSoundVolume=float.Parse(customData["HitSoundVolume"]), Pitch=float.Parse(customData["Pitch"])}; PlayFabGameBridge.gunNames.Add (newGunName); PlayFabGameBridge.gunTypes.Add (newGunName, newGun); } } Time.timeScale = 1; }
private static void GetCatalogItemsCallback_Single(GetCatalogItemsResult result) { callbacks.Add("GetCatalogItemsCallback_Single"); var testContext = (UUnitTestContext)result.CustomData; // NOTE: This depends on the global callbacks happening before the local callback CheckCallbacks(testContext, "GetCatalogItemsCallback_Single", callbacks); CheckCallbacks(testContext, "SuccessCallback_Global", callbacks); testContext.IntEquals(2, callbacks.Count, string.Join(",", callbacks.ToArray())); testContext.EndTest(UUnitFinishState.PASSED, ""); }
/// <summary> /// Callback called when PlayFab request completes. /// </summary> /// <param name="result">Catalog list.</param> void OnCatalogItemsLoaded(GetCatalogItemsResult result) { catalogItems = result.Catalog; GameplayUI.instance.CreateStoreButtons(this.GetCatalog()); }
/// <summary> /// Catalog items loaded. /// </summary> /// <param name="result">Catalog.</param> void OnCatalogItemsLoaded(GetCatalogItemsResult result) { catalogItems = result.Catalog; OnCatalogLoadedCallback(catalogItems); }