Initial Commit
This commit is contained in:
commit
ddf09fe00c
113 changed files with 187148 additions and 0 deletions
62
app/Http/Livewire/Game.php
Normal file
62
app/Http/Livewire/Game.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
class Game extends GameComponent
|
||||
{
|
||||
/**
|
||||
* Get the game session
|
||||
*/
|
||||
public function getSessionProperty()
|
||||
{
|
||||
return $this->service->session();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the game board.
|
||||
*/
|
||||
public function getBoardProperty()
|
||||
{
|
||||
return $this->session->getBoard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the game state.
|
||||
*/
|
||||
public function getStateProperty()
|
||||
{
|
||||
return $this->session->getBoardState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear everything.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->board->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered wen a card is pressed.
|
||||
*/
|
||||
public function toggle($pos)
|
||||
{
|
||||
$this->state->toggle($pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset game session.
|
||||
*/
|
||||
public function restart()
|
||||
{
|
||||
$this->service->newSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the game board.
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view('game');
|
||||
}
|
||||
}
|
||||
Reference in a new issue