Hi !
Send each player a private notif with the three cards drawn, then connect with addToStockWithId. Example code:
If you want cards to slide, coming from the deck for example, you can specify the 'from' corresponding to the id of this deck (situation A for adding/removing cards in Stock). Or you can just specify nothing for the 'from' argument just to make the new cards appear in place.
Send each player a private notif with the three cards drawn, then connect with addToStockWithId. Example code:
Code: Select all
/*** In PHP ***/
self::notifyPlayer($player_id, 'newCardsDrawn', _("You draw ${cards}"), array('cards' => /* Your card info goes here */) );
/*** In JS, in the setupNotifications method ***/
dojo.subscribe('newCardsDrawn', this, "notif_newCardsDrawn"); // Tell that the UI must react to this kind of notification, executing the JS function below
/*** In JS, create this method ***/
notif_newCardsDrawn : function(notif) {
var cards = notif.args.cards; // Fetch the cards drawn
for(c in cards) { // This loop for can change depending of the structure you choose for sending cards
var card = cards[c];
this.player_hand.addToStockWithId(card.type, card.id, /* from argument if needed*/)
}
},