Hi,
I am still relatively at the start of my development and I have just programmed the draft section where people can choose one by one their cards.
On the active player screen, everything works.
But on the non-active player screen nothing happens. The card the other player choses, is still visible.
I have read you need to do these updates via notifications.
So I tried implementing this and it does give the notification update etc, but nothing happens on the screen of the inactive player.
On php side the function which is performed on the active screen:
This is the notification in JS. I only want to remove the card from the deck called navDeck.
The console log on the notif.args is:
id: "12"
location: "hand"
location_arg: "2363192"
type: "0"
type_arg: "11"
As you can see the card is moved to "hand" instead of "deck". Is this the reason why I can no longer remove the card from the deck on the inactive screen?
What can i do to remove the card also form the other screens (without reloading the screen)?
Thanks Maurice
I am still relatively at the start of my development and I have just programmed the draft section where people can choose one by one their cards.
On the active player screen, everything works.
But on the non-active player screen nothing happens. The card the other player choses, is still visible.
I have read you need to do these updates via notifications.
So I tried implementing this and it does give the notification update etc, but nothing happens on the screen of the inactive player.
On php side the function which is performed on the active screen:
Code: Select all
function playCard($card_id) {
self::checkAction("playCard");
$player_id = self::getActivePlayerId();
$this->navCards->moveCard($card_id, 'hand', $player_id);
$currentCard = $this->navCards->getCard($card_id);
$this->gamestate->nextState('nextPlayer');
self::notifyAllPlayers( "playCard", clienttranslate( '${player_name} takes a card' ), array(
'player_id' => $player_id,
'player_name' => self::getActivePlayerName(),
'card_id' => $this->navCards->getCard($card_id)
) );
}
Code: Select all
setupNotifications: function()
{
console.log( 'notifications subscriptions setup' );
dojo.subscribe( 'playCard', this, "notif_playCard" );
},
notif_playCard: function( notif )
{
console.log(notif.args.card_id);
this.navDeck.removeFromStockById(notif.args.card_id)
this.navDeck.updateDisplay();id: "12"
location: "hand"
location_arg: "2363192"
type: "0"
type_arg: "11"
As you can see the card is moved to "hand" instead of "deck". Is this the reason why I can no longer remove the card from the deck on the inactive screen?
What can i do to remove the card also form the other screens (without reloading the screen)?
Thanks Maurice