additional parameter for saveUserScore possible?

+2 votes
First, congrats on the service. It's great to use. Love the unity code examples that come with the SDK.

My question. I need to save an extra string with my user score. Is there a way to do this somehow? Even if it is a workaround I'd be grateful.

 

Thank you,

 

Simon
asked Mar 18, 2014 in App42 Cloud API-BaaS by firepunchd (22 points)

1 Answer

0 votes

Thanks for your feedback,

 

For save extra informaction.

Dictionary<string,object> data = new Dictionary<string,object>();
data.Add("key","value");// add your key values here 
scoreService.AddJSONObject("<DB Name>","<Collection Name>",data);
Add these lines just before your saveUserScore.
answered Mar 18, 2014 by sshukla480 (407 points)
Thank you very much.
 am still new to backend communication and this service, so I have some more questions:

this is my code

WriteScoreResponse callBack = new WriteScoreResponse ();
scoreBoardService = sp.BuildScoreBoardService ();
Dictionary<string,object> data = new Dictionary<string,object>();
data.Add("initials","SIC")
scoreBoardService.AddJSONObject("<DB Name>","<Collection Name>",data);
scoreBoardService.SaveUserScore(leaderBoard, GameSave.Instance.userID, currentScore, callBack);   

What do I have to insert for "<DB Name>","<Collection Name>"

Thank you very much,

Simon
A new database and collection is created automatically. You have to uses same database name in further operations because only one database is allowed per app. However you can have multiple collections inside your app database.
sorry to ask again, but the data is then saved in the Storage service, right?
I
How is it connected to my score? I want to add initials for every score saved (even though the username is always the same) How can I retrieve the additional data I write when e.g. retrieving a leaderboard and adding the initials to the scores I saved.?
Thank you very much!
Simon
Add this line just before your "get" method.
scoreService.SetQuery("<DB Name>","<Collecton Name>",null);
for retrieve the additional data find JSONDocList like this.
scoreList[i].GetJsonDocList();
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...