map widget map info feature
This commit is contained in:
parent
5fd8c2cf1b
commit
84b12967af
@ -15,7 +15,7 @@ use ManiaControl\Players\Player;
|
|||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\Plugin;
|
use ManiaControl\Plugins\Plugin;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
|
use FML\Script\Script;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ManiaControl Widget Plugin
|
* ManiaControl Widget Plugin
|
||||||
@ -67,7 +67,9 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
/**
|
/**
|
||||||
* Private Properties
|
* Private Properties
|
||||||
*/
|
*/
|
||||||
/** @var maniaControl $maniaControl */
|
/**
|
||||||
|
* @var maniaControl $maniaControl
|
||||||
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,6 +128,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Clock Widget
|
* Displays the Clock Widget
|
||||||
|
*
|
||||||
* @param bool $login
|
* @param bool $login
|
||||||
*/
|
*/
|
||||||
public function displayClockWidget($login = false) {
|
public function displayClockWidget($login = false) {
|
||||||
@ -198,7 +201,9 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
// Check if the Next Map is a juked Map
|
// Check if the Next Map is a juked Map
|
||||||
$jukedMap = $this->maniaControl->mapManager->jukebox->getNextMap();
|
$jukedMap = $this->maniaControl->mapManager->jukebox->getNextMap();
|
||||||
|
|
||||||
/** @var Player $requester */
|
/**
|
||||||
|
* @var Player $requester
|
||||||
|
*/
|
||||||
$requester = null;
|
$requester = null;
|
||||||
// if the nextmap is not a juked map, get it from map info
|
// if the nextmap is not a juked map, get it from map info
|
||||||
if ($jukedMap == null) {
|
if ($jukedMap == null) {
|
||||||
@ -287,7 +292,6 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$frame->setSize($width, $height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($pos_x, $pos_y);
|
$frame->setPosition($pos_x, $pos_y);
|
||||||
|
|
||||||
|
|
||||||
// Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
@ -305,7 +309,9 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$players = $this->maniaControl->playerManager->getPlayers();
|
$players = $this->maniaControl->playerManager->getPlayers();
|
||||||
$playerCount = 0;
|
$playerCount = 0;
|
||||||
$spectatorCount = 0;
|
$spectatorCount = 0;
|
||||||
/** @var Player $player */
|
/**
|
||||||
|
* @var Player $player
|
||||||
|
*/
|
||||||
foreach ($players as $player) {
|
foreach ($players as $player) {
|
||||||
if ($player->isSpectator)
|
if ($player->isSpectator)
|
||||||
$spectatorCount++;
|
$spectatorCount++;
|
||||||
@ -331,7 +337,6 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$label->setText($playerCount . " / " . $maxPlayers['NextValue']);
|
$label->setText($playerCount . " / " . $maxPlayers['NextValue']);
|
||||||
$label->setTextColor("FFF");
|
$label->setTextColor("FFF");
|
||||||
|
|
||||||
|
|
||||||
$quad = new Quad_Icons128x128_1();
|
$quad = new Quad_Icons128x128_1();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_Multiplayer);
|
$quad->setSubStyle($quad::SUBSTYLE_Multiplayer);
|
||||||
@ -386,6 +391,8 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
|
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultQuadSubstyle();
|
||||||
|
|
||||||
$maniaLink = new ManiaLink(self::MLID_MAPWIDGET);
|
$maniaLink = new ManiaLink(self::MLID_MAPWIDGET);
|
||||||
|
$script = new Script();
|
||||||
|
$maniaLink->setScript($script);
|
||||||
|
|
||||||
// mainframe
|
// mainframe
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
@ -398,6 +405,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
$backgroundQuad->setSize($width, $height);
|
$backgroundQuad->setSize($width, $height);
|
||||||
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
||||||
|
$script->addMapInfoButton($backgroundQuad);
|
||||||
|
|
||||||
$map = $this->maniaControl->mapManager->getCurrentMap();
|
$map = $this->maniaControl->mapManager->getCurrentMap();
|
||||||
|
|
||||||
@ -424,9 +432,10 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
$label->setTextColor("FFF");
|
$label->setTextColor("FFF");
|
||||||
|
|
||||||
if (isset($map->mx->pageurl)) {
|
if (isset($map->mx->pageurl)) {
|
||||||
$quad = new Quad;
|
$quad = new Quad();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setImage("http://wiki.maniaplanet.com/pool/images/b/bf/ManiaExchange_logo.png"); //TODO include image into maniacontrol
|
$quad->setImage("http://wiki.maniaplanet.com/pool/images/b/bf/ManiaExchange_logo.png"); // TODO include image into
|
||||||
|
// maniacontrol
|
||||||
$quad->setPosition(-$width / 2 + 4, -1.5, -0.5);
|
$quad->setPosition(-$width / 2 + 4, -1.5, -0.5);
|
||||||
$quad->setSize(4, 4);
|
$quad->setSize(4, 4);
|
||||||
$quad->setHAlign(Control::CENTER);
|
$quad->setHAlign(Control::CENTER);
|
||||||
@ -441,8 +450,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
|
|||||||
/**
|
/**
|
||||||
* Closes a Widget
|
* Closes a Widget
|
||||||
*
|
*
|
||||||
* @param
|
* @param $widgetId
|
||||||
* $widgetId
|
|
||||||
*/
|
*/
|
||||||
public function closeWidget($widgetId) {
|
public function closeWidget($widgetId) {
|
||||||
$emptyManialink = new ManiaLink($widgetId);
|
$emptyManialink = new ManiaLink($widgetId);
|
||||||
|
Loading…
Reference in New Issue
Block a user