Hi, my intention is to include the catalog items as a return for cloudScript execution.
In my cloudscript, I have included this lines of code with Catalog as key and the List of CatalogItems as Value.
var cat = server.GetCatalogItems( CatalogVersion = "Upgrade" ) element["Catalog"] = cat.Catalog; return element;
So the cloudscript returns like this. A Catalog item, including the other initialization I needed.
{ "Catalog": [ { "ItemId": "V1GreenFirePower", "ItemClass": "V1GreenStat", "CatalogVersion": "Upgrade", "DisplayName": "V1Green FirePower", "VirtualCurrencyPrices": { "VC": 10 }, "RealCurrencyPrices": {}, "Tags": [], "CustomData": "{\"Val\":\"[1,1.5,1.8,2.1,2.5]\",\"Prices\":\"[0,20,30,40,60]\"}", "Consumable": {}, "CanBecomeCharacter": false, "IsStackable": true, "IsTradable": false, "IsLimitedEdition": false, "InitialLimitedEditionCount": 0 }, { "ItemId": "V1GreenShield", "ItemClass": "V1GreenStat", "CatalogVersion": "Upgrade", "DisplayName": "V1Green Shield", "VirtualCurrencyPrices": { "VC": 10 }, "RealCurrencyPrices": {}, "Tags": [], "CustomData": "{\"Val\":\"[2,3,4,5,6]\",\"Prices\":\"[0,15,25,35,50]\"}", "Consumable": {}, "CanBecomeCharacter": false, "IsStackable": true, "IsTradable": false, "IsLimitedEdition": false, "InitialLimitedEditionCount": 0 }, { "ItemId": "V1GreenArmor", "ItemClass": "V1GreenStat", "CatalogVersion": "Upgrade", "DisplayName": "V1Green Armor", "VirtualCurrencyPrices": { "VC": 10 }, "RealCurrencyPrices": {}, "Tags": [], "CustomData": "{\"Val\":\"[2,3,4,5,6]\",\"Prices\":\"[0,10,20,30,50]\"}", "Consumable": {}, "CanBecomeCharacter": false, "IsStackable": true, "IsTradable": false, "IsLimitedEdition": false, "InitialLimitedEditionCount": 0 } ], "Ammo": "100", "Gender": "None", "SkinTone": "None", "Skin": "None" }
My question is, how can I cast it in the client side?
I've tried a bunch of approach listed below
var asd = PlayFabSimpleJson.DeserializeObject<List<CatalogItem>>((string)result["Catalog"]);
var asd = (List<CatalogItem>)result["Catalog"];
But I am not getting anywhere.