onPlayerHandSelectionChanged issue

Game development with Board Game Arena Studio
Post Reply
User avatar
tchobello
Posts: 525
Joined: 18 March 2012, 13:19

onPlayerHandSelectionChanged issue

Post by tchobello »

Howdy

I have an issue with the onPlayerHandSelectionChanged() function.

i've added a if (this.checkAction('giveCards')) there where cards are directly moved on the table when the player clicks on them during 'giveCards' state.

later, on another state, when the player clicks on a card to select it, a warning 'This move is not authorized now' appears.
He is able to validate the choice but how can I get rid of it ?
The warning does not appear if I delete all the if (this.checkAction('giveCards')) bracket...
User avatar
RicardoRix
Posts: 2107
Joined: 29 April 2012, 23:43

Re: onPlayerHandSelectionChanged issue

Post by RicardoRix »

there is a 2nd default parameter of false, which can be used to show/hide the red message, Try:

if( !this.checkAction( 'giveCards', true ) )


-- you could instead change the event handler with dojo.connect / disconnect.

onUpdateActionButtons:

if (this.playerHand_connect != null)
dojo.disconnect(this.playerHand_connect);

switch( stateName )
{
case 'giveCards' :
{
this.playerHand_connect = dojo.connect( this.playerHand, 'onChangeSelection', this, 'onGiveCards' );
.....

case 'somethingElse' :
{
this.playerHand_connect = dojo.connect( this.playerHand, 'onChangeSelection', this, 'onSomethingElse );
.....
User avatar
tchobello
Posts: 525
Joined: 18 March 2012, 13:19

Re: onPlayerHandSelectionChanged issue

Post by tchobello »

thanks a lot.

the 'true' parameter works fine.

I might do the nicer one later..
Post Reply

Return to “Developers”