updating player boards
Posted: 07 May 2025, 03:51
I seem to be stuck and not able to update the player score on the board. I'm using the scoreCtrl but only when I refresh the page do the scores get updated. I'm receiving the notif with all the args but nothing after. Here are the codes I'm using.
serverside:
$newScores = $this->getCollectionFromDb("SELECT player_id, player_score FROM player", true);
$this->notify->all("scoreUpdate", "", array(
"scores" => $newScores
));
-------------------------
client side:
notif_scoreUpdate: async function(args) {
console.log("Received scoreUpdate notification with:", args);
for( var player_id in args.scores )
{
var newScore = args.scores[ player_id ];
this.scoreCtrl[ player_id ].toValue( newScore );
}
},
serverside:
$newScores = $this->getCollectionFromDb("SELECT player_id, player_score FROM player", true);
$this->notify->all("scoreUpdate", "", array(
"scores" => $newScores
));
-------------------------
client side:
notif_scoreUpdate: async function(args) {
console.log("Received scoreUpdate notification with:", args);
for( var player_id in args.scores )
{
var newScore = args.scores[ player_id ];
this.scoreCtrl[ player_id ].toValue( newScore );
}
},
