minor things

This commit is contained in:
kremsy 2013-12-30 23:53:42 +01:00
parent e6c6c35dbb
commit 3b3bac2b0d
4 changed files with 67 additions and 11 deletions

View File

@ -134,7 +134,6 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener {
$settingValue = $scriptSettings[$settingName]; $settingValue = $scriptSettings[$settingName];
$substyle = ''; $substyle = '';
$action = '';
if($settingValue === false){ if($settingValue === false){
$substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed; $substyle = Quad_Icons64x64_1::SUBSTYLE_LvlRed;
}else if($settingValue === true){ }else if($settingValue === true){
@ -168,8 +167,9 @@ class ScriptSettings implements ConfiguratorMenu,CallbackListener {
$descriptionLabel->setHAlign(Control::LEFT); $descriptionLabel->setHAlign(Control::LEFT);
$descriptionLabel->setPosition($width * -0.45, $height * -0.44); $descriptionLabel->setPosition($width * -0.45, $height * -0.44);
$descriptionLabel->setSize($width * 0.7, $settingHeight); $descriptionLabel->setSize($width * 0.7, $settingHeight);
$descriptionLabel->setTextSize($labelTextSize);
$descriptionLabel->setTranslate(true); $descriptionLabel->setTranslate(true);
$descriptionLabel->setTextPrefix('Desc: '); //$descriptionLabel->setTextPrefix('Desc: ');
$descriptionLabel->setText($scriptParam['Desc']); $descriptionLabel->setText($scriptParam['Desc']);
$tooltips->add($nameLabel, $descriptionLabel); $tooltips->add($nameLabel, $descriptionLabel);

View File

@ -2,6 +2,7 @@
namespace ManiaControl\Maps; namespace ManiaControl\Maps;
use ManiaControl\Formatter;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
/** /**
@ -77,7 +78,7 @@ class Map {
trigger_error($e->getMessage(), E_USER_WARNING); 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->authorEInfo = $this->mapFetcher->authorEInfo;
$this->authorZone = $this->mapFetcher->authorZone; $this->authorZone = $this->mapFetcher->authorZone;
$this->comment = $this->mapFetcher->comment; $this->comment = $this->mapFetcher->comment;

View File

@ -251,7 +251,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$frame->add($headFrame); $frame->add($headFrame);
$headFrame->setY($this->height / 2 - 5); $headFrame->setY($this->height / 2 - 5);
$x = -$this->width / 2; $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); $this->maniaControl->manialinkManager->labelLine($headFrame,$array);
//Get Maplist //Get Maplist
@ -288,7 +288,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$mxId = $map->mx->id; $mxId = $map->mx->id;
//Display Maps //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); $this->maniaControl->manialinkManager->labelLine($mapFrame,$array);
//TODO detailed mx info page with link to mxo //TODO detailed mx info page with link to mxo
//TODO action detailed map info //TODO action detailed map info
@ -380,7 +380,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
if(is_numeric($karma)){ if(is_numeric($karma)){
$karmaGauge = new Gauge(); $karmaGauge = new Gauge();
$mapFrame->add($karmaGauge); $mapFrame->add($karmaGauge);
$karmaGauge->setX($x + 110); $karmaGauge->setX($x + 120);
$karmaGauge->setSize(20, 9); $karmaGauge->setSize(20, 9);
$karmaGauge->setDrawBg(false); $karmaGauge->setDrawBg(false);
$karma = floatval($karma); $karma = floatval($karma);
@ -390,7 +390,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$karmaLabel = new Label(); $karmaLabel = new Label();
$mapFrame->add($karmaLabel); $mapFrame->add($karmaLabel);
$karmaLabel->setX($x + 110); $karmaLabel->setX($x + 120);
$karmaLabel->setSize(20 * 0.9, 5); $karmaLabel->setSize(20 * 0.9, 5);
$karmaLabel->setTextSize(0.9); $karmaLabel->setTextSize(0.9);
$karmaLabel->setTextColor("000"); $karmaLabel->setTextColor("000");

View File

@ -3,6 +3,8 @@ use FML\Controls\Control;
use FML\Controls\Frame; use FML\Controls\Frame;
use FML\Controls\Labels\Label_Text; use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad; use FML\Controls\Quad;
use FML\Controls\Quads\Quad_Icons128x128_1;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
@ -262,7 +264,7 @@ class WidgetPlugin implements CallbackListener, Plugin {
} }
/** /**
* Displays the Map Widget * Displays the Server Info Widget
* *
* @param String $login * @param String $login
*/ */
@ -289,18 +291,71 @@ class WidgetPlugin implements CallbackListener, Plugin {
$backgroundQuad->setStyles($quadStyle, $quadSubstyle); $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(); $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(); $label = new Label_Text();
$frame->add($label); $frame->add($label);
$label->setY(1.5); $label->setPosition(0, 1.5, 0.2);
$label->setX(0);
$label->setAlign(Control::CENTER, Control::CENTER); $label->setAlign(Control::CENTER, Control::CENTER);
$label->setZ(0.2);
$label->setTextSize(1.3); $label->setTextSize(1.3);
$label->setText($serverName); $label->setText($serverName);
$label->setTextColor("FFF"); $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 // Send manialink
$manialinkText = $maniaLink->render()->saveXML(); $manialinkText = $maniaLink->render()->saveXML();
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $login); $this->maniaControl->manialinkManager->sendManialink($manialinkText, $login);