1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Stu\Component\Game; |
6
|
|
|
|
7
|
|
|
use BadMethodCallException; |
8
|
|
|
use Stu\Lib\Component\ComponentEnumInterface; |
9
|
|
|
use Stu\Module\Colony\Component\ColonyComponentEnum; |
10
|
|
|
use Stu\Module\Game\Component\GameComponentEnum; |
11
|
|
|
|
12
|
|
|
enum ModuleEnum: string |
13
|
|
|
{ |
14
|
|
|
case INDEX = 'index'; |
15
|
|
|
case GAME = 'game'; |
16
|
|
|
case MAINDESK = 'maindesk'; |
17
|
|
|
case COLONY = 'colony'; |
18
|
|
|
case SHIP = 'ship'; |
19
|
|
|
case STATION = 'station'; |
20
|
|
|
case COMMUNICATION = 'comm'; |
21
|
|
|
case PM = 'pm'; |
22
|
|
|
case NOTES = 'notes'; |
23
|
|
|
case RESEARCH = 'research'; |
24
|
|
|
case TRADE = 'trade'; |
25
|
|
|
case ALLIANCE = 'alliance'; |
26
|
|
|
case DATABASE = 'database'; |
27
|
|
|
case HISTORY = 'history'; |
28
|
|
|
case STARMAP = 'starmap'; |
29
|
|
|
case OPTIONS = 'options'; |
30
|
|
|
case USERPROFILE = 'userprofile'; |
31
|
|
|
case ADMIN = 'admin'; |
32
|
|
|
case NPC = 'npc'; |
33
|
|
|
|
34
|
42 |
|
public function getPhpPage(): string |
35
|
|
|
{ |
36
|
42 |
|
return sprintf('%s.php', $this->value); |
37
|
|
|
} |
38
|
|
|
|
39
|
19 |
|
public function getTitle(): string |
40
|
|
|
{ |
41
|
19 |
|
return match ($this) { |
42
|
19 |
|
self::INDEX => 'Star Trek Universe - Login', |
43
|
18 |
|
self::GAME => 'Star Trek Universe', |
44
|
18 |
|
self::MAINDESK => 'Maindesk', |
45
|
15 |
|
self::COLONY => 'Kolonien', |
46
|
14 |
|
self::SHIP => 'Schiffe', |
47
|
13 |
|
self::STATION => 'Stationen', |
48
|
12 |
|
self::COMMUNICATION => 'KommNet', |
49
|
12 |
|
self::PM => 'Nachrichten', |
50
|
10 |
|
self::RESEARCH => 'Forschung', |
51
|
9 |
|
self::TRADE => 'Handel', |
52
|
8 |
|
self::ALLIANCE => 'Allianz', |
53
|
7 |
|
self::DATABASE => 'Datenbank', |
54
|
6 |
|
self::HISTORY => 'Ereignisse', |
55
|
5 |
|
self::STARMAP => 'Karte', |
56
|
2 |
|
self::NOTES => 'Notizen', |
57
|
2 |
|
self::OPTIONS => 'Optionen', |
58
|
2 |
|
self::USERPROFILE => 'Spielerprofil', |
59
|
|
|
self::ADMIN => 'Adminbereich', |
60
|
19 |
|
self::NPC => 'NPC' |
61
|
19 |
|
}; |
62
|
|
|
} |
63
|
|
|
|
64
|
23 |
|
public function getTemplate(): string |
65
|
|
|
{ |
66
|
23 |
|
return match ($this) { |
67
|
23 |
|
self::INDEX => 'html/index/index.twig', |
68
|
22 |
|
self::GAME => 'html/game/game.twig', |
69
|
19 |
|
self::MAINDESK => 'html/view/maindesk.twig', |
70
|
17 |
|
self::COLONY => 'html/view/colonylist.twig', |
71
|
16 |
|
self::SHIP => 'html/view/shiplist.twig', |
72
|
15 |
|
self::STATION => 'html/view/stationList.twig', |
73
|
14 |
|
self::COMMUNICATION => 'html/view/communication.twig', |
74
|
10 |
|
self::PM => 'html/view/pmCategory.twig', |
75
|
8 |
|
self::RESEARCH => 'html/view/research.twig', |
76
|
7 |
|
self::TRADE => 'html/view/trade.twig', |
77
|
6 |
|
self::ALLIANCE => 'html/view/alliance.twig', |
78
|
5 |
|
self::DATABASE => 'html/view/database.twig', |
79
|
4 |
|
self::HISTORY => 'html/view/history.twig', |
80
|
3 |
|
self::STARMAP => 'html/view/map.twig', |
81
|
2 |
|
self::OPTIONS => 'html/view/options.twig', |
82
|
1 |
|
self::USERPROFILE => 'html/view/userprofile.twig', |
83
|
23 |
|
self::NOTES, |
84
|
23 |
|
self::ADMIN, |
85
|
23 |
|
self::NPC => 'not needed' |
86
|
23 |
|
}; |
87
|
|
|
} |
88
|
|
|
|
89
|
17 |
|
public function getComponentEnum(string $value): ComponentEnumInterface |
90
|
|
|
{ |
91
|
17 |
|
$result = match ($this) { |
92
|
17 |
|
self::GAME => GameComponentEnum::tryFrom($value), |
93
|
6 |
|
self::COLONY => ColonyComponentEnum::tryFrom($value), |
94
|
1 |
|
default => throw new BadMethodCallException('no components in this module view') |
95
|
17 |
|
}; |
96
|
|
|
|
97
|
16 |
|
return $result ?? GameComponentEnum::OUTDATED; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getCommonModule(): ?string |
101
|
|
|
{ |
102
|
|
|
return match ($this) { |
103
|
|
|
self::SHIP, |
104
|
|
|
self::STATION => 'SPACECRAFT', |
105
|
|
|
default => null |
106
|
|
|
}; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|