I'm a beginner here and in game development, but I try it anyway...
I uncounter an issue with gamedatas. In fact at the beginning of the game I asked to players to choose a team and a team name. I put these in the modified data base player, and after I want to update player's interfaces by putting these datas and to show some tables.
So I used the code in .js after changing game state :
Code: Select all
var team_name = this.gamedatas.players[ player_id ].team_name;
var team_race = this.gamedatas.players[ player_id ].race;So I used in .php in the previous leaving state
Code: Select all
location.reload(true);Code: Select all
// in .game.php
$update_gamedatas = self::getAllDatas();
self::notifyAllPlayers( "team_chosen", clienttranslate( 'All players have chosen a team' ), array( "gamedatas" => $update_gamedatas));
//in game.js
// in notification
dojo.subscribe( 'team_chosen', this, "notif_team_chosen" );
//and after
notif_team_chosen: function( notif)
{
console.log('notif_team_chosen');
console.log( notif );
this.gamedatas = notif.args.gamedatas;
}
What are your tips to force an gamedata update?
Thanks!