diff options
Diffstat (limited to 'sw-ui/src')
-rw-r--r-- | sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt | 14 | ||||
-rw-r--r-- | sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt index 373ad0f1..a5ce0357 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt @@ -7,7 +7,7 @@ import kotlinx.html.DIV import org.luxons.sevenwonders.model.* import org.luxons.sevenwonders.model.cards.CardPlayability import org.luxons.sevenwonders.model.cards.HandCard -import org.luxons.sevenwonders.model.resources.PricedResourceTransactions +import org.luxons.sevenwonders.model.resources.ResourceTransactionOptions import org.luxons.sevenwonders.model.wonders.WonderBuildability import org.luxons.sevenwonders.ui.redux.TransactionSelectorState import react.* @@ -120,7 +120,7 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(props) { large = true, intent = Intent.SUCCESS, disabled = !card.playability.isPlayable, - onClick = { prepareMove(handAction.moveType, card, card.playability.cheapestTransactions) }, + onClick = { prepareMove(handAction.moveType, card, card.playability.transactionOptions) }, ) { bpIcon(handAction.icon) if (card.playability.isPlayable && !card.playability.isFree) { @@ -136,7 +136,7 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(props) { large = true, intent = Intent.PRIMARY, disabled = !wonderBuildability.isBuildable, - onClick = { prepareMove(MoveType.UPGRADE_WONDER, card, wonderBuildability.cheapestTransactions) }, + onClick = { prepareMove(MoveType.UPGRADE_WONDER, card, wonderBuildability.transactionsOptions) }, ) { bpIcon("key-shift") if (wonderBuildability.isBuildable && !wonderBuildability.isFree) { @@ -145,10 +145,10 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(props) { } } - private fun prepareMove(moveType: MoveType, card: HandCard, transactions: Set<PricedResourceTransactions>) { - when (transactions.size) { - 1 -> props.prepareMove(PlayerMove(moveType, card.name, transactions.first())) - else -> props.startTransactionsSelection(TransactionSelectorState(moveType, card, transactions)) + private fun prepareMove(moveType: MoveType, card: HandCard, transactionOptions: ResourceTransactionOptions) { + when (transactionOptions.size) { + 1 -> props.prepareMove(PlayerMove(moveType, card.name, transactionOptions.first())) + else -> props.startTransactionsSelection(TransactionSelectorState(moveType, card, transactionOptions)) } } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt index ef1f0362..3de763b4 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt @@ -9,7 +9,7 @@ import org.luxons.sevenwonders.model.api.PlayerDTO import org.luxons.sevenwonders.model.api.State import org.luxons.sevenwonders.model.cards.CardBack import org.luxons.sevenwonders.model.cards.HandCard -import org.luxons.sevenwonders.model.resources.PricedResourceTransactions +import org.luxons.sevenwonders.model.resources.ResourceTransactionOptions import redux.RAction data class SwState( @@ -40,7 +40,7 @@ data class GameState( data class TransactionSelectorState( val moveType: MoveType, val card: HandCard, - val transactionsOptions: Set<PricedResourceTransactions>, + val transactionsOptions: ResourceTransactionOptions, ) fun rootReducer(state: SwState, action: RAction): SwState = state.copy( |