diff --git a/app/Http/Livewire/Game.php b/app/Http/Livewire/Game.php index f13b34d..78d4fdf 100644 --- a/app/Http/Livewire/Game.php +++ b/app/Http/Livewire/Game.php @@ -4,6 +4,11 @@ namespace App\Http\Livewire; class Game extends GameComponent { + /** + * If we hit the jackpot or not. + */ + public bool $jackpot = true; + /** * Get the game session */ @@ -39,9 +44,14 @@ class Game extends GameComponent /** * Triggered wen a card is pressed. */ - public function toggle($pos) + public function toggle($pos, $jackpot) { - $this->state->toggle($pos); + if ($jackpot) { + $this->state->setAll(); + $this->jackpot = true; + } else { + $this->state->toggle($pos); + } } /** diff --git a/resources/views/game.blade.php b/resources/views/game.blade.php index 2ffd378..dfb917c 100644 --- a/resources/views/game.blade.php +++ b/resources/views/game.blade.php @@ -24,7 +24,7 @@ $card_class = 'absolute backface-hidden flex items-center justify-center border + wire:click="toggle({{ $pos }}, {{ $item->jackpot }})" /> @endforeach @@ -37,7 +37,11 @@ $card_class = 'absolute backface-hidden flex items-center justify-center border @if ($this->board->hasGameEnded()) + @if ($this->jackpot) + 100 {{ __('Parse!') }} + @else {{ __('Game over!') }} + @endif {{ __('Go again?') }} {{ __('New Game') }}