|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\CustomUi\Plugins; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Framework\AdminGroups\Helpers\AdminGroups; |
|
6
|
|
|
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceExpApplication; |
|
7
|
|
|
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceMpLegacyChat; |
|
8
|
|
|
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceMpLegacyPlayer; |
|
9
|
|
|
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface; |
|
10
|
|
|
use eXpansion\Framework\Core\Services\Console; |
|
11
|
|
|
use eXpansion\Framework\Core\Storage\Data\Player; |
|
12
|
|
|
use eXpansion\Framework\Core\Storage\PlayerStorage; |
|
13
|
|
|
use Maniaplanet\DedicatedServer\Connection; |
|
14
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
class CustomUi implements ListenerInterfaceExpApplication, StatusAwarePluginInterface, ListenerInterfaceMpLegacyPlayer |
|
17
|
|
|
{ |
|
18
|
|
|
/** @var Connection */ |
|
19
|
|
|
protected $connection; |
|
20
|
|
|
/** |
|
21
|
|
|
* @var PlayerStorage |
|
22
|
|
|
*/ |
|
23
|
|
|
private $playerStorage; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* CustomUi constructor. |
|
27
|
|
|
* @param Connection $connection |
|
28
|
|
|
* @param PlayerStorage $playerStorage |
|
29
|
|
|
*/ |
|
30
|
|
|
public function __construct(Connection $connection, PlayerStorage $playerStorage) |
|
31
|
|
|
{ |
|
32
|
|
|
$this->connection = $connection; |
|
33
|
|
|
$this->playerStorage = $playerStorage; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Set the status of the plugin |
|
38
|
|
|
* |
|
39
|
|
|
* @param boolean $status |
|
40
|
|
|
* |
|
41
|
|
|
* @return null |
|
42
|
|
|
*/ |
|
43
|
|
|
public function setStatus($status) |
|
44
|
|
|
{ |
|
45
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* called at eXpansion init |
|
50
|
|
|
* |
|
51
|
|
|
* @return void |
|
52
|
|
|
*/ |
|
53
|
|
|
public function onApplicationInit() |
|
54
|
|
|
{ |
|
55
|
|
|
// TODO: Implement onApplicationInit() method. |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* called when init is done and callbacks are enabled |
|
60
|
|
|
* |
|
61
|
|
|
* @return void |
|
62
|
|
|
*/ |
|
63
|
|
|
public function onApplicationReady() |
|
64
|
|
|
{ |
|
65
|
|
|
$properties = /** @lang XML */ |
|
66
|
|
|
<<<EOL |
|
67
|
|
|
<ui_properties> |
|
68
|
|
|
<!-- The map name and author displayed in the top right of the screen when viewing the scores table --> |
|
69
|
|
|
<map_info visible="false" pos="-160. 80. 150." /> |
|
70
|
|
|
|
|
71
|
|
|
<!-- Information about live envent displayed in the top right of the screen --> |
|
72
|
|
|
<live_info visible="false" pos="-159. 84. 5." /> |
|
73
|
|
|
|
|
74
|
|
|
<!-- Information about the spectated player displayed in the bottom of the screen --> |
|
75
|
|
|
<spectator_info visible="true" pos="0. -68. 5." /> |
|
76
|
|
|
|
|
77
|
|
|
<!-- Only visible in solo modes, it hides the medal/ghost selection UI --> |
|
78
|
|
|
<opponents_info visible="true" /> |
|
79
|
|
|
<!-- |
|
80
|
|
|
The server chat displayed on the bottom left of the screen |
|
81
|
|
|
The offset values range from 0. to -3.2 for x and from 0. to 1.8 for y |
|
82
|
|
|
The linecount property must be between 0 and 40 |
|
83
|
|
|
use offset 0 1.55 for upper corner |
|
84
|
|
|
--> |
|
85
|
|
|
<chat visible="true" offset="0. 0." linecount="7" /> |
|
86
|
|
|
|
|
87
|
|
|
<!-- Time of the players at the current checkpoint displayed at the bottom of the screen --> |
|
88
|
|
|
<checkpoint_list visible="true" pos="48. -52. 5." /> |
|
89
|
|
|
|
|
90
|
|
|
<!-- Small scores table displayed at the end of race of the round based modes (Rounds, Cup, ...) on the right of the screen --> |
|
91
|
|
|
<round_scores visible="true" pos="-158.5 40. 5." /> |
|
92
|
|
|
|
|
93
|
|
|
<!-- Race time left displayed at the bottom right of the screen --> |
|
94
|
|
|
<countdown visible="true" pos="153. -40. 5." /> |
|
95
|
|
|
|
|
96
|
|
|
<!-- 3, 2, 1, Go! message displayed on the middle of the screen when spawning --> |
|
97
|
|
|
<go visible="true" /> |
|
98
|
|
|
|
|
99
|
|
|
<!-- Current race chrono displayed at the bottom center of the screen --> |
|
100
|
|
|
<chrono visible="true" pos="0. 84. -5." /> |
|
101
|
|
|
|
|
102
|
|
|
<!-- Speed and distance raced displayed in the bottom right of the screen --> |
|
103
|
|
|
<speed_and_distance visible="true" pos="137. -69. 5." /> |
|
104
|
|
|
|
|
105
|
|
|
<!-- Previous and best times displayed at the bottom right of the screen --> |
|
106
|
|
|
<personal_best_and_rank visible="false" pos="157. -24. 5." /> |
|
107
|
|
|
|
|
108
|
|
|
<!-- Current position in the map ranking displayed at the bottom right of the screen --> |
|
109
|
|
|
<position visible="true" pos="0 81. 5." /> |
|
110
|
|
|
|
|
111
|
|
|
<!-- Checkpoint time information displayed in the middle of the screen when crossing a checkpoint --> |
|
112
|
|
|
<checkpoint_time visible="true" pos="0. 3. -10." /> |
|
113
|
|
|
|
|
114
|
|
|
<!-- The avatar of the last player speaking in the chat displayed above the chat --> |
|
115
|
|
|
<chat_avatar visible="false" /> |
|
116
|
|
|
|
|
117
|
|
|
<!-- Warm-up progression displayed on the right of the screen during warm-up --> |
|
118
|
|
|
<warmup visible="true" pos="153. 13. 0." /> |
|
119
|
|
|
|
|
120
|
|
|
<!-- Ladder progression box displayed on the top of the screen at the end of the map --> |
|
121
|
|
|
<endmap_ladder_recap visible="false" /> |
|
122
|
|
|
|
|
123
|
|
|
<!-- Laps count displayed on the right of the screen on multilaps map --> |
|
124
|
|
|
<multilap_info visible="true" pos="140. 84. 5." /> |
|
125
|
|
|
|
|
126
|
|
|
<!-- Player's ranking at the latest checkpoint --> |
|
127
|
|
|
<checkpoint_ranking visible="false" pos="0. 84. 5." /> |
|
128
|
|
|
|
|
129
|
|
|
<!-- Scores table displayed in the middle of the screen --> |
|
130
|
|
|
<scorestable alt_visible="false" /> |
|
131
|
|
|
|
|
132
|
|
|
<!-- Number of players spectating us displayed at the bottom right of the screen --> |
|
133
|
|
|
<viewers_count visible="true" pos="157. -40. 5." /> |
|
134
|
|
|
</ui_properties> |
|
135
|
|
|
EOL; |
|
136
|
|
|
|
|
137
|
|
|
$this->connection->triggerModeScriptEvent('Trackmania.UI.SetProperties', [$properties]); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* called when requesting application stop |
|
142
|
|
|
* |
|
143
|
|
|
* @return void |
|
144
|
|
|
*/ |
|
145
|
|
|
public function onApplicationStop() |
|
146
|
|
|
{ |
|
147
|
|
|
// TODO: Implement onApplicationStop() method. |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
public function onPlayerConnect(Player $player) |
|
151
|
|
|
{ |
|
152
|
|
|
|
|
153
|
|
|
} |
|
154
|
|
|
|
|
155
|
|
|
public function onPlayerDisconnect(Player $player, $disconnectionReason) |
|
156
|
|
|
{ |
|
157
|
|
|
// TODO: Implement onPlayerDisconnect() method. |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
public function onPlayerInfoChanged(Player $oldPlayer, Player $player) |
|
161
|
|
|
{ |
|
162
|
|
|
// TODO: Implement onPlayerInfoChanged() method. |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
public function onPlayerAlliesChanged(Player $oldPlayer, Player $player) |
|
166
|
|
|
{ |
|
167
|
|
|
// TODO: Implement onPlayerAlliesChanged() method. |
|
168
|
|
|
} |
|
169
|
|
|
} |
|
170
|
|
|
|