I got stuck on loading and saving scores in the serverside code.
I have playerObjects with 4 properties:
wins
experience
totalScore
played
I'm trying to save totalScore like this:
- Code: Select all
player.GetPlayerObject(delegate(DatabaseObject obj)
{
Console.WriteLine("Retrieved playerobject, properties: "+obj.Properties.Count);
if (obj.Contains("totalScore"))
{
obj.Set("totalScore", obj.GetInt("totalScore") + player.score);
obj.Save();
}
});
but the WriteLine function gives me: Retrieved playerobject, properties: 0;
Registration for SimpleUsers in AS3 finishes like this:
- Code: Select all
client.bigDB.loadMyPlayerObject(function(obj:DatabaseObject):void{
obj.experience = 0;
obj.totalScore = 0;
obj.played = 0;
obj.wins = 0;
obj.save();
});
That worked fine and It creates the objects just fine.
I don't get why the serverside code isn't working. Am I doing something wrong?
I'm testing this in Development server.