CustomDataLoad Stat...
 
Notifications
Clear all

CustomDataLoad Status?

4 Posts
2 Users
0 Reactions
639 Views
(@balazs)
Posts: 2
New Member
Topic starter
 

Hello

Please help me 🙂

I cant understand the inventory manadger, so I currently using custom data, with the demo scripts.
In the demo script, the CustomDataLoad()  haven't status check.

Can I detect, that the CustomDataLoad() is completted without problem? if yes, how?

Because the current sample, have not "succes" or error section as the CustomDataPost() .

(between, I will be happy, if someone make some very simple example how to save and load a public varriable in to the inventory, because the documentation is not very useful with this. wacko I want avoid the array usage and like to use solo public varriables)

C#

public void CustomDataLoad ()
{
status = 1;

CombuDemoUser user = (CombuDemoUser)CombuManager.localUser;

foreach (string key in CombuManager.localUser.customData.Keys)
{

//Save data in to public varriable
if(key == save_key){
currdata_str = string.Format("{1}", key, user.customData[key]);
int.TryParse(currdata_str, out save_value);
}

}
status = 2;
}

 
Posted : 26/08/2015 10:32 pm
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

Sorry but I don't understand what you're trying to do. You are talking about Inventory but your code is searching in the customData of user. Inventory is for inventory items and is managed by the class Inventory, checkout the documentation page.

If instead you are looking for how to create your own User class with custom properties then take a look at this sample code.

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 27/08/2015 1:06 am
(@balazs)
Posts: 2
New Member
Topic starter
 

Thanks, I try to use inventory, but one more question:

// Load the inventory of user ID '123'
Inventory.Load( "123", (Inventory[] items, string error) => {

How can I do this with the current logged in user?

I just need to leave the id ?

Example:
Inventory.Load((Inventory[] items, string error) => {

 

Also on this link: http://skaredcreations.com/api/combu/page_inventory.html

You use UserID at Load and Remove Items, but not use at  Add and Edit.. this is why I cant unserstand you.. when need to use user id, and when not? and how can I got it?

Why need to make dificult the example. It just make it harder to understand. wacko

 
Posted : 27/08/2015 9:13 am
(@skaredcreations)
Posts: 806
Prominent Member Admin
 

UserId is only for Load because in Update it does not pass the UserId to the web service (it assumes that the item is belonging to localUser or has been loaded with Load), to load the inventory of current user just pass CombuManager.localUser.id

FRANCESCO CROCETTI @ SKARED CREATIONS

 
Posted : 27/08/2015 6:37 pm
Share: