File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ Members of `Player`:
201201* ` player.username `
202202* ` player.score `
203203* ` player.hasLeftGame `
204+ * ` player.extraFields ` : Dictionary of extra fields defined in your database schema. These will be persisted automatically.
204205
205206Your project must create a ` GameDelegate ` and pass it into ` ostracodMultiplayer.initialize ` . ` GameDelegate ` must have the following members:
206207
Original file line number Diff line number Diff line change @@ -64,10 +64,15 @@ Player.prototype.tick = function() {
6464
6565Player . prototype . persist = function ( done ) {
6666 var self = this ;
67+ var tempFieldSet = { score : self . score } ;
68+ var name ;
69+ for ( name in this . extraFields ) {
70+ tempFieldSet [ name ] = this . extraFields [ name ] ;
71+ }
6772 dbUtils . performTransaction ( function ( callback ) {
6873 accountUtils . updateAccount (
6974 self . accountUid ,
70- { score : self . score } ,
75+ tempFieldSet ,
7176 function ( error , result ) {
7277 if ( error ) {
7378 console . log ( error ) ;
You can’t perform that action at this time.
0 commit comments