testmover
This commit is contained in:
parent
f935fa9b43
commit
40219b7367
@ -2,17 +2,17 @@
|
||||
|
||||
namespace ManiaControl\Admin;
|
||||
|
||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use FML\ManiaLink;
|
||||
use FML\Controls\Control;
|
||||
use FML\Controls\Frame;
|
||||
use FML\Controls\Quad;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
use FML\ManiaLink;
|
||||
use FML\Script\Script;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||
use ManiaControl\Players\Player;
|
||||
use ManiaControl\Players\PlayerManager;
|
||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||
|
||||
/**
|
||||
* Class managing Actions Menus
|
||||
@ -53,10 +53,8 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
// Register for callbacks
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_ONINIT, $this, 'handleOnInit');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerJoined');
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMIN_MENU, $this,
|
||||
'openAdminMenu');
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYER_MENU, $this,
|
||||
'openPlayerMenu');
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_ADMIN_MENU, $this, 'openAdminMenu');
|
||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYER_MENU, $this, 'openPlayerMenu');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,8 +67,7 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
public function addMenuItem(Control $control, $playerAction = true, $order = 0) {
|
||||
if($playerAction) {
|
||||
$this->addPlayerMenuItem($control, $order);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->addAdminMenuItem($control, $order);
|
||||
}
|
||||
}
|
||||
@ -169,6 +166,10 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$iconFrame = new Frame();
|
||||
$frame->add($iconFrame);
|
||||
|
||||
// Create script and features
|
||||
$script = new Script();
|
||||
$manialink->setScript($script);
|
||||
|
||||
$iconFrame->setSize($itemSize, $itemSize);
|
||||
$itemQuad = new Quad_Icons64x64_1();
|
||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_IconServers);
|
||||
@ -196,9 +197,73 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$iconFrame->add($itemQuad);
|
||||
$itemQuad->setAction(self::ACTION_OPEN_PLAYER_MENU);
|
||||
|
||||
|
||||
/** TEST TOOLTIP */
|
||||
$testf = new Frame();
|
||||
$manialink->add($testf);
|
||||
$testf->setPosition($posX - $itemSize * $itemMarginFactorX, $posY - $itemSize * $itemMarginFactorY);
|
||||
//$testf->setHAlign(Control::RIGHT);
|
||||
$testf->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$testq = new Quad();
|
||||
$testf->add($testq);
|
||||
//$testq->setPosition($posX - $itemSize * $itemMarginFactorX, $posY - $itemSize * $itemMarginFactorY);
|
||||
$testq->setHAlign(Control::CENTER);
|
||||
$testq->setStyles($quadStyle, $quadSubstyle);
|
||||
$testq->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
|
||||
$testf->add($testq);
|
||||
|
||||
$script->addTooltip($itemQuad, $testf);
|
||||
$script->addTooltip($testf, $testf);
|
||||
/** TEST TOOLTIP */
|
||||
|
||||
|
||||
return $manialink;
|
||||
}
|
||||
|
||||
private function playerMenuManialink(Player $player) {
|
||||
|
||||
$posX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSX);
|
||||
$posY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSY);
|
||||
$itemSize = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_ITEMSIZE);
|
||||
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadStyle();
|
||||
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
|
||||
|
||||
$itemCount = count($this->playerMenuItems);
|
||||
|
||||
$manialink = new ManiaLink(self::MLID_MENU);
|
||||
$itemMarginFactorX = 1.3;
|
||||
$itemMarginFactorY = 1.2;
|
||||
|
||||
$frame = new Frame();
|
||||
$manialink->add($frame);
|
||||
$frame->setPosition($posX, $posY);
|
||||
|
||||
$backgroundQuad = new Quad();
|
||||
$frame->add($backgroundQuad);
|
||||
$backgroundQuad->setSize($itemCount * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||
|
||||
$itemsFrame = new Frame();
|
||||
$frame->add($itemsFrame);
|
||||
|
||||
// Add items
|
||||
$x = 0.5 * $itemSize * $itemMarginFactorX;
|
||||
foreach($this->menuItems as $menuItems) {
|
||||
foreach($menuItems as $menuItem) {
|
||||
$menuItem->setSize($itemSize, $itemSize);
|
||||
$itemsFrame->add($menuItem);
|
||||
|
||||
$x += $itemSize * $itemMarginFactorX;
|
||||
}
|
||||
}
|
||||
|
||||
$maniaLinkText = $manialink->render()->saveXML();
|
||||
$this->maniaControl->manialinkManager->sendManialink($maniaLinkText, $player->login);
|
||||
|
||||
}
|
||||
|
||||
private function buildMenuIconsManialink2() {
|
||||
$posX = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSX);
|
||||
$posY = $this->maniaControl->settingManager->getSetting($this, self::SETTING_MENU_POSY);
|
||||
|
Loading…
Reference in New Issue
Block a user