Hello.
I was wondering if Stock component had an option to disable some (not all) cards from ... stock
In fact I have my hand created with a stock component but for certain phases of the game not all cards can be played (selected is a must as I already prevent next steps if not playable card is selected).
What I want is to
- remove possibility to "click" on some cards
- pass them to opacity 0.5, or mark them with a red cross (like when discarding cards in Race For The Galaxy)
Do you have any clue/advice to do this ?
I precise that I use stock component as described in the Wiki :
In JS :
In CSS :
I connect and disconnect "this.playerHand" to a method named "onChangeSelection"
That prevent the display of possible card placement for non active player.
Bonus question :
How can we figure out the "undocumented features" like I saw in this (veeeeeeeeeeery old) topic ?
viewtopic.php?p=9255#p9255
NB : my question is the next step of the mentioned topic
NB2 : it is still for the development of Riftforce ^^
Thank you all
I was wondering if Stock component had an option to disable some (not all) cards from ... stock
In fact I have my hand created with a stock component but for certain phases of the game not all cards can be played (selected is a must as I already prevent next steps if not playable card is selected).
What I want is to
- remove possibility to "click" on some cards
- pass them to opacity 0.5, or mark them with a red cross (like when discarding cards in Race For The Galaxy)
Do you have any clue/advice to do this ?
I precise that I use stock component as described in the Wiki :
In JS :
Code: Select all
this.playerHand = new ebg.stock();
this.playerHand.onItemCreate = dojo.hitch(this, function (card_div, card_type_id, card_id) {
dojo.addClass($(card_id),'card-possible-selection');
});
this.playerHand.image_items_per_row = this.nbcolumncards;
this.playerHand.create( this, $('myHand'), this.cardWidth, this.cardHeight );
this.playerHand.setSelectionMode(1);//Only 1 card can be selected at a time
this.playerHand.setSelectionAppearance( 'class' ); //it will use specific Highlighting when selecting a card according to the class .stockitem_selected in CSSCode: Select all
.card-possible-selection {
cursor: pointer;
}
.card-possible-selection:hover {
transform: scale(1.1);
z-index: 100;
}
.stockitem_selected {
border: none ! important;
outline: 3px solid red ! important;
}Code: Select all
this.disconnect(this.playerHand,'onChangeSelection'); //in entering state
dojo.connect( this.playerHand, 'onChangeSelection', this, 'onCardSelectionFromHand' );//only for active player in entering stateBonus question :
How can we figure out the "undocumented features" like I saw in this (veeeeeeeeeeery old) topic ?
viewtopic.php?p=9255#p9255
NB : my question is the next step of the mentioned topic
NB2 : it is still for the development of Riftforce ^^
Thank you all