|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace eXpansion\Bundle\ImmersiveWindows\Model\Gui\Factory; |
|
4
|
|
|
|
|
5
|
|
|
use eXpansion\Bundle\Menu\DataProviders\MenuItemProvider; |
|
6
|
|
|
use eXpansion\Bundle\Menu\Gui\MenuTabsFactory; |
|
7
|
|
|
use eXpansion\Framework\Core\Model\Gui\Factory\WindowFrameFactory as OriginalWindowFrameFactory; |
|
8
|
|
|
use eXpansion\Framework\Core\Model\Gui\ManialinkInterface; |
|
9
|
|
|
use eXpansion\Framework\Core\Model\Gui\ManiaScriptFactory; |
|
10
|
|
|
use FML\Controls\Frame; |
|
11
|
|
|
use FML\Controls\Label; |
|
12
|
|
|
use FML\Controls\Quad; |
|
13
|
|
|
use FML\ManiaLink; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class WindowFrameFactory |
|
17
|
|
|
* |
|
18
|
|
|
* @author de Cramer Oliver<[email protected]> |
|
19
|
|
|
* @copyright 2017 Smile |
|
20
|
|
|
* @package eXpansion\Bundle\ImmersiveWindows\Model\Gui\Factory |
|
21
|
|
|
*/ |
|
22
|
|
|
class WindowFrameFactory extends OriginalWindowFrameFactory |
|
23
|
|
|
{ |
|
24
|
|
|
/** @var MenuTabsFactory */ |
|
25
|
|
|
protected $menuTabsFactory; |
|
26
|
|
|
|
|
27
|
|
|
/** @var MenuItemProvider */ |
|
28
|
|
|
protected $menuItemProvider; |
|
29
|
|
|
/** |
|
30
|
|
|
* @var ManiaScriptFactory |
|
31
|
|
|
*/ |
|
32
|
|
|
protected $maniaScriptFactory; |
|
33
|
|
|
/** |
|
34
|
|
|
* @var ManialinkInterface |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $manialinkInterface; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* WindowFrameFactory constructor. |
|
40
|
|
|
* |
|
41
|
|
|
* @param ManiaScriptFactory $maniaScriptFactory |
|
42
|
|
|
* @param MenuTabsFactory $menuTabsFactory |
|
43
|
|
|
* @param MenuItemProvider $menuItemProvider |
|
44
|
|
|
* @param ManialinkInterface $manialink |
|
|
|
|
|
|
45
|
|
|
*/ |
|
46
|
|
|
public function __construct( |
|
47
|
|
|
ManiaScriptFactory $maniaScriptFactory, |
|
48
|
|
|
MenuTabsFactory $menuTabsFactory, |
|
49
|
|
|
MenuItemProvider $menuItemProvider |
|
50
|
|
|
) { |
|
51
|
|
|
parent::__construct($maniaScriptFactory); |
|
52
|
|
|
$this->maniaScriptFactory = $maniaScriptFactory; |
|
53
|
|
|
$this->menuTabsFactory = $menuTabsFactory; |
|
54
|
|
|
$this->menuItemProvider = $menuItemProvider; |
|
55
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @inheritdoc |
|
60
|
|
|
*/ |
|
61
|
|
|
public function build( |
|
62
|
|
|
ManiaLink $manialink, |
|
63
|
|
|
Frame $mainFrame, |
|
64
|
|
|
$name, |
|
65
|
|
|
$sizeX, |
|
66
|
|
|
$sizeY |
|
67
|
|
|
) { |
|
68
|
|
|
// Creating sub frame to keep all the pieces together. Position needs to be top left corner. |
|
69
|
|
|
$frame = new Frame(); |
|
70
|
|
|
$frame->setPosition(-144 - $mainFrame->getX(), 82 - $mainFrame->getY()); |
|
71
|
|
|
$mainFrame->addChild($frame); |
|
72
|
|
|
|
|
73
|
|
|
// Creating the tabs. |
|
74
|
|
|
$mainFrame->addChild( |
|
75
|
|
|
$this->menuTabsFactory->createTabsMenu( |
|
|
|
|
|
|
76
|
|
|
$this->manialinkInterface, |
|
77
|
|
|
$frame, |
|
78
|
|
|
$this->menuItemProvider->getRootItem(), |
|
|
|
|
|
|
79
|
|
|
'admin/admin' |
|
80
|
|
|
) |
|
81
|
|
|
); |
|
82
|
|
|
|
|
83
|
|
|
$closeButton = new Label('Close'); |
|
84
|
|
|
$closeButton->setSize(6, 6) |
|
85
|
|
|
->setPosition(132, 72) |
|
86
|
|
|
->setAlign(Label::CENTER, Label::CENTER2) |
|
87
|
|
|
->setText("✖") |
|
88
|
|
|
->setTextColor('fff') |
|
89
|
|
|
->setTextSize(2) |
|
90
|
|
|
->setTextFont('OswaldMono') |
|
91
|
|
|
->setScriptEvents(true) |
|
92
|
|
|
->setAreaColor("FFF") |
|
93
|
|
|
->setAreaFocusColor('f22'); |
|
94
|
|
|
$frame->addChild($closeButton); |
|
95
|
|
|
|
|
96
|
|
|
/* |
|
97
|
|
|
* Adding background frame |
|
98
|
|
|
*/ |
|
99
|
|
|
$bgFrame = Frame::create("background"); |
|
100
|
|
|
|
|
101
|
|
|
$quad = new Quad(); |
|
102
|
|
|
$quad->addClass("bg") |
|
103
|
|
|
->setId("mainBg") |
|
104
|
|
|
->setPosition(0, 0) |
|
105
|
|
|
->setSize(322, 182); |
|
106
|
|
|
$quad->setAlign("center", "center") |
|
107
|
|
|
->setStyles("Bgs1", "BgDialogBlur"); |
|
108
|
|
|
$bgFrame->addChild($quad); |
|
109
|
|
|
|
|
110
|
|
|
$frame->addChild($bgFrame); |
|
111
|
|
|
|
|
112
|
|
|
return $closeButton; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @param ManialinkInterface $manialinkInterface |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setManialinkInterface(ManialinkInterface $manialinkInterface) |
|
119
|
|
|
{ |
|
120
|
|
|
$this->manialinkInterface = $manialinkInterface; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
|
|
124
|
|
|
} |
|
125
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.