Initial Commit
This commit is contained in:
commit
ddf09fe00c
113 changed files with 187148 additions and 0 deletions
36
app/Game/GameService.php
Normal file
36
app/Game/GameService.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Game;
|
||||
|
||||
class GameService
|
||||
{
|
||||
protected GameSession $session;
|
||||
|
||||
public function __construct(GameSession $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function session() : GameSession
|
||||
{
|
||||
return $this->session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new Game session
|
||||
*/
|
||||
public function newSession(?GameSettings $settings = null) : self
|
||||
{
|
||||
// Generate new cards
|
||||
if (!$settings) {
|
||||
$settings = $this->session()->getSettings();
|
||||
}
|
||||
|
||||
$this->session->getBoard()->regenerate($settings);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in a new issue