jkomoros / boardgame

An in-progress framework in golang to easily build boardgame Progressive Web Apps
Apache License 2.0
31 stars 4 forks source link

Allow a way to set defaults per deckName in stack #419

Closed jkomoros closed 7 years ago

jkomoros commented 7 years ago

For example:

Theoretically the information is encoded in the stack's object in state to key off of deckName.

Related to #418

jkomoros commented 7 years ago
jkomoros commented 7 years ago

Actually, I think this is as simple as boardgame-card-stack stamping each card with card-type= "card-{{deckName}})". (Verify that it works OK if the given card-type given doesn't point to a legitimate dom-module)

The problem is that the card that's stamped doesn't know the stack's metadata.

Another option is that stacks themselves just stamp cards and you tell us if they should propose-move or rotate (instead of adding those on the stacks themselves), and then we can set the card-type ourselves because we stamp and you don't, and we know the stack deckName at stamping time.

... nah, that won't work because in some cases the index needs to be passed as a propose-move arg.

The best option is simply to have _expandStack in state-manager just copy the deckName from the stack to each of the items as well.

jkomoros commented 7 years ago
jkomoros commented 7 years ago