diff --git a/application/core/Configurators/ScriptSettings.php b/application/core/Configurators/ScriptSettings.php index 7cf80172..0298eb2d 100644 --- a/application/core/Configurators/ScriptSettings.php +++ b/application/core/Configurators/ScriptSettings.php @@ -134,7 +134,6 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener { $settingValue = $scriptSettings[$settingName]; $substyle = ''; - $action = ''; if($settingValue === false){ $substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed; }else if($settingValue === true){ @@ -168,8 +167,9 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener { $descriptionLabel->setHAlign(Control::LEFT); $descriptionLabel->setPosition($width * -0.45, $height * -0.44); $descriptionLabel->setSize($width * 0.7, $settingHeight); + $descriptionLabel->setTextSize($labelTextSize); $descriptionLabel->setTranslate(true); - $descriptionLabel->setTextPrefix('Desc: '); + //$descriptionLabel->setTextPrefix('Desc: '); $descriptionLabel->setText($scriptParam['Desc']); $tooltips->add($nameLabel, $descriptionLabel); diff --git a/application/core/Maps/Map.php b/application/core/Maps/Map.php index c4ecca81..d43f1596 100644 --- a/application/core/Maps/Map.php +++ b/application/core/Maps/Map.php @@ -2,6 +2,7 @@ namespace ManiaControl\Maps; +use ManiaControl\Formatter; use ManiaControl\ManiaControl; /** @@ -77,7 +78,7 @@ class Map { trigger_error($e->getMessage(), E_USER_WARNING); } - $this->authorNick = $this->mapFetcher->authorNick; + $this->authorNick = FORMATTER::stripDirtyCodes($this->mapFetcher->authorNick); $this->authorEInfo = $this->mapFetcher->authorEInfo; $this->authorZone = $this->mapFetcher->authorZone; $this->comment = $this->mapFetcher->comment; diff --git a/application/core/Maps/MapList.php b/application/core/Maps/MapList.php index 646bc4cd..770e12eb 100644 --- a/application/core/Maps/MapList.php +++ b/application/core/Maps/MapList.php @@ -251,7 +251,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $frame->add($headFrame); $headFrame->setY($this->height / 2 - 5); $x = -$this->width / 2; - $array = array("Id" => $x + 5, "Mx ID" => $x + 10, "MapName" => $x + 20, "Author" => $x + 73, "Karma" => $x + 105, "Actions" => $this->width / 2 - 15); + $array = array("Id" => $x + 5, "Mx ID" => $x + 10, "MapName" => $x + 20, "Author" => $x + 68, "Karma" => $x + 115, "Actions" => $this->width / 2 - 15); $this->maniaControl->manialinkManager->labelLine($headFrame,$array); //Get Maplist @@ -288,7 +288,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $mxId = $map->mx->id; //Display Maps - $array = array($id => $x + 5, $mxId => $x + 10, $map->name => $x + 20, $map->authorNick => $x + 73); + $array = array($id => $x + 5, $mxId => $x + 10, $map->name => $x + 20, $map->authorNick => $x + 68); $this->maniaControl->manialinkManager->labelLine($mapFrame,$array); //TODO detailed mx info page with link to mxo //TODO action detailed map info @@ -380,7 +380,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { if(is_numeric($karma)){ $karmaGauge = new Gauge(); $mapFrame->add($karmaGauge); - $karmaGauge->setX($x + 110); + $karmaGauge->setX($x + 120); $karmaGauge->setSize(20, 9); $karmaGauge->setDrawBg(false); $karma = floatval($karma); @@ -390,7 +390,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $karmaLabel = new Label(); $mapFrame->add($karmaLabel); - $karmaLabel->setX($x + 110); + $karmaLabel->setX($x + 120); $karmaLabel->setSize(20 * 0.9, 5); $karmaLabel->setTextSize(0.9); $karmaLabel->setTextColor("000"); diff --git a/application/plugins/WidgetPlugin.php b/application/plugins/WidgetPlugin.php index 48b8e673..c1499543 100644 --- a/application/plugins/WidgetPlugin.php +++ b/application/plugins/WidgetPlugin.php @@ -3,6 +3,8 @@ use FML\Controls\Control; use FML\Controls\Frame; use FML\Controls\Labels\Label_Text; use FML\Controls\Quad; +use FML\Controls\Quads\Quad_Icons128x128_1; +use FML\Controls\Quads\Quad_Icons64x64_1; use FML\ManiaLink; use ManiaControl\Callbacks\CallbackListener; use ManiaControl\ManiaControl; @@ -262,7 +264,7 @@ class WidgetPlugin implements CallbackListener, Plugin { } /** - * Displays the Map Widget + * Displays the Server Info Widget * * @param String $login */ @@ -289,18 +291,71 @@ class WidgetPlugin implements CallbackListener, Plugin { $backgroundQuad->setStyles($quadStyle, $quadSubstyle); # + $this->maniaControl->client->query('GetMaxPlayers'); + $maxPlayers = $this->maniaControl->client->getResponse(); + + $this->maniaControl->client->query('GetMaxSpectators'); + $maxSpectators = $this->maniaControl->client->getResponse(); + $serverName= $this->maniaControl->server->getName(); + $players = $this->maniaControl->playerManager->getPlayers(); + $playerCount = 0; + $spectatorCount = 0; + /** @var Player $player */ + foreach($players as $player){ + if($player->isSpectator) + $spectatorCount++; + else + $playerCount++; + } + + + //Player Quad / Label $label = new Label_Text(); $frame->add($label); - $label->setY(1.5); - $label->setX(0); + $label->setPosition(0, 1.5, 0.2); $label->setAlign(Control::CENTER, Control::CENTER); - $label->setZ(0.2); $label->setTextSize(1.3); $label->setText($serverName); $label->setTextColor("FFF"); + $label = new Label_Text(); + $frame->add($label); + $label->setPosition(-3.9, -1.5, 0.2); + $label->setAlign(Control::CENTER, Control::CENTER); + $label->setTextSize(1); + $label->setScale(0.8); + $label->setText($playerCount . " / " . $maxPlayers['NextValue']); + $label->setTextColor("FFF"); + + + $quad = new Quad_Icons128x128_1(); + $frame->add($quad); + $quad->setSubStyle($quad::SUBSTYLE_Multiplayer); + $quad->setPosition(-8, -1.6, 0.2); + $quad->setSize(2.5, 2.5); + $quad->setHAlign(Control::CENTER); + + //Spectator Quad / Label + $label = new Label_Text(); + $frame->add($label); + $label->setPosition(8.5, -1.5, 0.2); + $label->setAlign(Control::CENTER, Control::CENTER); + $label->setTextSize(1); + $label->setScale(0.8); + $label->setText($spectatorCount . " / " . $maxSpectators['NextValue']); + $label->setTextColor("FFF"); + + $quad = new Quad_Icons64x64_1(); + $frame->add($quad); + $quad->setSubStyle($quad::SUBSTYLE_Camera); + $quad->setPosition(3.5, -1.6, 0.2); + $quad->setSize(3.3,2.5); + $quad->setHAlign(Control::CENTER); + + + // Send manialink $manialinkText = $maniaLink->render()->saveXML(); $this->maniaControl->manialinkManager->sendManialink($manialinkText, $login);