|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\WidgetCurrentMap\Plugins; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Bundle\WidgetCurrentMap\Plugins\Gui\CurrentMapWidgetFactory; |
|
6
|
|
|
use eXpansion\Framework\Core\DataProviders\Listener\ListenerInterfaceExpApplication; |
|
7
|
|
|
use eXpansion\Framework\Core\Model\UserGroups\Group; |
|
8
|
|
|
use eXpansion\Framework\Core\Plugins\StatusAwarePluginInterface; |
|
9
|
|
|
use eXpansion\Framework\Core\Storage\PlayerStorage; |
|
10
|
|
|
use eXpansion\Framework\GameManiaplanet\DataProviders\Listener\ListenerInterfaceMpLegacyMap; |
|
11
|
|
|
use Maniaplanet\DedicatedServer\Connection; |
|
12
|
|
|
use Maniaplanet\DedicatedServer\Structures\Map; |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
class WidgetCurrentMap implements StatusAwarePluginInterface, ListenerInterfaceMpLegacyMap |
|
16
|
|
|
{ |
|
17
|
|
|
/** @var Connection */ |
|
18
|
|
|
protected $connection; |
|
19
|
|
|
/** |
|
20
|
|
|
* @var PlayerStorage |
|
21
|
|
|
*/ |
|
22
|
|
|
private $playerStorage; |
|
23
|
|
|
/** |
|
24
|
|
|
* @var CurrentMapWidgetFactory |
|
25
|
|
|
*/ |
|
26
|
|
|
private $widget; |
|
27
|
|
|
/** |
|
28
|
|
|
* @var Group |
|
29
|
|
|
*/ |
|
30
|
|
|
private $players; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Debug constructor. |
|
34
|
|
|
* |
|
35
|
|
|
* @param Connection $connection |
|
36
|
|
|
* @param PlayerStorage $playerStorage |
|
37
|
|
|
* @param CurrentMapWidgetFactory $widget |
|
38
|
|
|
* @param Group $players |
|
39
|
|
|
*/ |
|
40
|
|
|
public function __construct( |
|
41
|
|
|
Connection $connection, |
|
42
|
|
|
PlayerStorage $playerStorage, |
|
43
|
|
|
CurrentMapWidgetFactory $widget, |
|
44
|
|
|
Group $players |
|
45
|
|
|
) { |
|
46
|
|
|
$this->connection = $connection; |
|
47
|
|
|
$this->playerStorage = $playerStorage; |
|
48
|
|
|
$this->widget = $widget; |
|
49
|
|
|
$this->players = $players; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
|
|
53
|
|
|
public function setStatus($status) |
|
54
|
|
|
{ |
|
55
|
|
|
if ($status) { |
|
56
|
|
|
$this->widget->create($this->players); |
|
57
|
|
|
} else { |
|
58
|
|
|
$this->widget->destroy($this->players); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param Map $map |
|
64
|
|
|
* |
|
65
|
|
|
* @return void |
|
66
|
|
|
*/ |
|
67
|
|
|
public function onBeginMap(Map $map) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->widget->update($this->players); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param Map $map |
|
74
|
|
|
* |
|
75
|
|
|
* @return void |
|
76
|
|
|
*/ |
|
77
|
|
|
public function onEndMap(Map $map) |
|
78
|
|
|
{ |
|
79
|
|
|
// TODO: Implement onEndMap() method. |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|