|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Stu\Module\Ship\Lib\Ui; |
|
6
|
|
|
|
|
7
|
|
|
use Stu\Component\Map\EncodedMapInterface; |
|
8
|
|
|
use Stu\Lib\Map\VisualPanel\VisualNavPanelEntry; |
|
9
|
|
|
use Stu\Lib\Map\VisualPanel\VisualPanelEntryData; |
|
10
|
|
|
use Stu\Module\Logging\LoggerUtilInterface; |
|
11
|
|
|
use Stu\Orm\Entity\LayerInterface; |
|
12
|
|
|
use Stu\Orm\Entity\ShipInterface; |
|
13
|
|
|
use Stu\Orm\Entity\UserInterface; |
|
14
|
|
|
use Stu\Orm\Repository\ShipRepositoryInterface; |
|
15
|
|
|
use Stu\Orm\Repository\UserMapRepositoryInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Creates ship and ui related items |
|
19
|
|
|
*/ |
|
20
|
|
|
final class ShipUiFactory implements ShipUiFactoryInterface |
|
21
|
|
|
{ |
|
22
|
|
|
private UserMapRepositoryInterface $userMapRepository; |
|
23
|
|
|
|
|
24
|
|
|
private ShipRepositoryInterface $shipRepository; |
|
25
|
|
|
|
|
26
|
|
|
private EncodedMapInterface $encodedMap; |
|
27
|
|
|
|
|
28
|
2 |
|
public function __construct( |
|
29
|
|
|
UserMapRepositoryInterface $userMapRepository, |
|
30
|
|
|
ShipRepositoryInterface $shipRepository, |
|
31
|
|
|
EncodedMapInterface $encodedMap |
|
32
|
|
|
) { |
|
33
|
2 |
|
$this->userMapRepository = $userMapRepository; |
|
34
|
2 |
|
$this->shipRepository = $shipRepository; |
|
35
|
2 |
|
$this->encodedMap = $encodedMap; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
1 |
|
public function createVisualNavPanel( |
|
39
|
|
|
ShipInterface $currentShip, |
|
40
|
|
|
UserInterface $user, |
|
41
|
|
|
LoggerUtilInterface $loggerUtil, |
|
42
|
|
|
bool $isTachyonSystemActive, |
|
43
|
|
|
bool $tachyonFresh |
|
44
|
|
|
): VisualNavPanel { |
|
45
|
1 |
|
return new VisualNavPanel( |
|
46
|
1 |
|
$this, |
|
47
|
1 |
|
$this->userMapRepository, |
|
48
|
1 |
|
$this->shipRepository, |
|
49
|
1 |
|
$currentShip, |
|
50
|
1 |
|
$user, |
|
51
|
1 |
|
$loggerUtil, |
|
52
|
1 |
|
$isTachyonSystemActive, |
|
53
|
1 |
|
$tachyonFresh |
|
54
|
1 |
|
); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
1 |
|
public function createVisualNavPanelEntry( |
|
58
|
|
|
VisualPanelEntryData $data, |
|
59
|
|
|
?LayerInterface $layer, |
|
60
|
|
|
ShipInterface $currentShip, |
|
61
|
|
|
bool $isTachyonSystemActive = false, |
|
62
|
|
|
bool $tachyonFresh = false |
|
63
|
|
|
): VisualNavPanelEntry { |
|
64
|
1 |
|
return new VisualNavPanelEntry( |
|
65
|
1 |
|
$data, |
|
66
|
1 |
|
$layer, |
|
67
|
1 |
|
$this->encodedMap, |
|
68
|
1 |
|
$currentShip, |
|
69
|
1 |
|
$isTachyonSystemActive, |
|
70
|
1 |
|
$tachyonFresh |
|
71
|
1 |
|
); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|