Page 1 of 1

Styling elements of a 'stock' collection

Posted: 12 February 2013, 05:26
by BrianHanechak
I'm using a stock collection to show players a set of cards. I want to indicate that some of the cards are not playable.

I've tried to do this by manipulating the opacity values or changing the border color, but the stock collection object already manipulates these values when it does animations or selections, so it overwrites what I set.

I have something that looks great using HTML 5 filter effects, which means they don't conflict with anything set by the stock objects... but only a limited number of browsers support this. (Specifically, I'm setting -webkit-filter: sepia(1) opacity(0.5)... this really makes the unselectable cards fade into the background!)

I could simulate this effect by building a second version of my sprite image that has effects pre-applied, and simply swapping the "src" of the image to the alternate version when I want to apply the filter. Is this the best way to do it?

- Brian

Re: Styling elements of a 'stock' collection

Posted: 12 February 2013, 13:18
by sourisdudesert
Hello Brian,

Actually we don't have actually this type of function for Stock because usually there is not many automatic player assistance feature on BGA games.

However I agree it could be interesting to introduce some kind of "disable items" features in Stock items.

Studying your question I just found that there is a feature of Stock that wasn't documented and that is useful in your case: onItemCreate.

I add it to the documentation:
http://en.doc.boardgamearena.com/Stock# ... _reference
(at the bottom of the page).

As you can see, using onItemCreate you can add custom HTML content inside each Stock item, to display for example the translated name of the card, or any specific element. In your case, what you could do is adding an <div> element with the same size than a stock item. This new element could be transparent by default, but you could change it to whatever-you-need in case you need to have a special rendering of this stock item.

Hope this helps

Re: Styling elements of a 'stock' collection

Posted: 17 February 2013, 04:04
by BrianHanechak
Thanks, that worked nicely.