minor coding improvements

This commit is contained in:
Steffen Schröder 2014-07-26 16:31:47 +02:00
parent 4d5e0ee6b0
commit 46c5706375
5 changed files with 12 additions and 20 deletions

View File

@ -421,8 +421,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$switchLabel->setTextSize(2); $switchLabel->setTextSize(2);
$switchLabel->setText('»'); $switchLabel->setText('»');
$switchLabel->setTextColor('0f0'); $switchLabel->setTextColor('0f0');
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($map->uid)); $switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . $map->uid);
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>'; $description = 'Start Map-Switch Vote: ' . $map->getEscapedName();
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description); $switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
} }
} }
@ -596,7 +596,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
public function handleManialinkPageAnswer(array $callback) { public function handleManialinkPageAnswer(array $callback) {
$actionId = $callback[1][2]; $actionId = $callback[1][2];
$actionArray = explode('.', $actionId); $actionArray = explode('.', $actionId);
if (count($actionArray) <= 2) { if (count($actionArray) <= 2) {
return; return;
} }

View File

@ -703,7 +703,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE); $this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login); $this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch (PlayerStateException $e) { } catch (PlayerStateException $e) {
} catch (UnknownPlayerException $e){ } catch (UnknownPlayerException $e) {
} }
}); });
break; break;

View File

@ -276,7 +276,7 @@ class PluginManager {
} }
$pluginFiles = scandir($directory); $pluginFiles = scandir($directory);
foreach ($pluginFiles as $pluginFile) { foreach ($pluginFiles as $pluginFile) {
if (stripos($pluginFile, '.') === 0) { if (substr($pluginFile, 0, 1) === '.') {
continue; continue;
} }

View File

@ -169,8 +169,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$array['$oId'] = $posX + 5; $array['$oId'] = $posX + 5;
$array['$oNickname'] = $posX + 14; $array['$oNickname'] = $posX + 14;
// Headline
//Compute Headline
$posX = $xStart + 55; $posX = $xStart + 55;
$statRankings = array(); $statRankings = array();
foreach ($this->statArray as $key => $stat) { foreach ($this->statArray as $key => $stat) {
@ -186,14 +185,14 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$labels = $this->maniaControl->manialinkManager->labelLine($headFrame, $array); $labels = $this->maniaControl->manialinkManager->labelLine($headFrame, $array);
//Description Label // Description Label
$index = 2; $index = 2;
foreach ($this->statArray as $statArray) { foreach ($this->statArray as $statArray) {
if (!isset($labels[$index])) { if (!isset($labels[$index])) {
break; break;
} }
/** @var Label_Text $label [] */ /** @var Label_Text $label */
$label = $labels[$index]; $label = $labels[$index];
$label->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]); $label->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]);
@ -223,7 +222,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$playerFrame = new Frame(); $playerFrame = new Frame();
$frame->add($playerFrame); $frame->add($playerFrame);
//Show current Player Arrow // Show current Player Arrow
if ($playerId == $player->index) { if ($playerId == $player->index) {
$currentQuad = new Quad_Icons64x64_1(); $currentQuad = new Quad_Icons64x64_1();
$playerFrame->add($currentQuad); $playerFrame->add($currentQuad);
@ -245,14 +244,12 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$statValue = round(floatval($statValue), 2); $statValue = round(floatval($statValue), 2);
} }
} }
$displayArray[$stat['Name']] = array("Value" => strval($statValue), "Width" => $stat['Width']); $displayArray[$stat['Name']] = array('Value' => strval($statValue), 'Width' => $stat['Width']);
} }
$array = array($index => $xStart + 5, $listPlayer->nickname => $xStart + 14); $array = array($index => $xStart + 5, $listPlayer->nickname => $xStart + 14);
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array); $this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
$posX = $xStart + 55; $posX = $xStart + 55;
foreach ($displayArray as $key => $array) { foreach ($displayArray as $key => $array) {
$label = new Label_Text(); $label = new Label_Text();
@ -267,7 +264,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$posX += $array['Width']; $posX += $array['Width'];
} }
$playerFrame->setY($posY); $playerFrame->setY($posY);
if ($index % 2 !== 0) { if ($index % 2 !== 0) {
@ -278,12 +274,10 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$lineQuad->setZ(0.001); $lineQuad->setZ(0.001);
} }
$index++; $index++;
$posY -= 4; $posY -= 4;
} }
// Render and display xml
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'SimpleStatsList'); $this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'SimpleStatsList');
} }
@ -299,7 +293,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
return; return;
} }
$action = $actionArray[0] . "." . $actionArray[1]; $action = $actionArray[0] . '.' . $actionArray[1];
switch ($action) { switch ($action) {
case self::ACTION_SORT_STATS: case self::ACTION_SORT_STATS:

View File

@ -917,5 +917,4 @@ class CurrentVote {
public function getVoteCount() { public function getVoteCount() {
return count($this->playersVoted); return count($this->playersVoted);
} }
} }