Hello
I'm working on a 4 player card game and I need some help.
At the beginning, each player give an hidden card to the others and after that, they look at the cards given, accept them and they're added to their hand.
It works well when played live but something doesn't work if I need to refresh after accepting the cards.
It's multiplayer mode and when a player has accepted the cards, the div playertables displaying the 3 cards disappear.
I've added this to the setup in JS file.
It's supposed to remove the div when a player is NonMultiactive.
The problem is :
the div disappear for the next player and not the one whose index is -1 !
Can someone explain me what's wrong ? Thanks
I'm working on a 4 player card game and I need some help.
At the beginning, each player give an hidden card to the others and after that, they look at the cards given, accept them and they're added to their hand.
It works well when played live but something doesn't work if I need to refresh after accepting the cards.
It's multiplayer mode and when a player has accepted the cards, the div playertables displaying the 3 cards disappear.
I've added this to the setup in JS file.
It's supposed to remove the div when a player is NonMultiactive.
The problem is :
the div disappear for the next player and not the one whose index is -1 !
Can someone explain me what's wrong ? Thanks
Code: Select all
if(gamedatas.gamestate.action=='stShowPassedCards')
{
for (var pl in gamedatas.playerorder)
{
if (gamedatas.gamestate.multiactive.indexOf(gamedatas.playerorder[pl].toString())==-1)
{
dojo.style( 'playertables', 'display', 'none' );
}
else
{
dojo.style( 'playertables', 'display', 'inline-block' );
for( var i in gamedatas.passedcards )
{
var card = gamedatas.passedcards[i];
if ( card.card_location_arg == this.player_id )
{
var color = card.card_type;
var value = card.card_type_arg;
var player_passed_from = card.card_passed_from;
var x = this.cardwidth * (value - 1);
var y = this.cardheight * (color - 1);
dojo.place(
this.format_block('jstpl_cardontable', {
x: x,
y: y,
player_id: card.card_location_arg,
card_id: card.card_id
}), 'receiveplayertable_' + player_passed_from
);
}
}
}
}
}