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

View File

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

View File

@ -169,8 +169,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$array['$oId'] = $posX + 5;
$array['$oNickname'] = $posX + 14;
//Compute Headline
// Headline
$posX = $xStart + 55;
$statRankings = array();
foreach ($this->statArray as $key => $stat) {
@ -193,7 +192,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
break;
}
/** @var Label_Text $label [] */
/** @var Label_Text $label */
$label = $labels[$index];
$label->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]);
@ -245,14 +244,12 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$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);
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array);
$posX = $xStart + 55;
foreach ($displayArray as $key => $array) {
$label = new Label_Text();
@ -267,7 +264,6 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$posX += $array['Width'];
}
$playerFrame->setY($posY);
if ($index % 2 !== 0) {
@ -278,12 +274,10 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
$lineQuad->setZ(0.001);
}
$index++;
$posY -= 4;
}
// Render and display xml
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'SimpleStatsList');
}
@ -299,7 +293,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
return;
}
$action = $actionArray[0] . "." . $actionArray[1];
$action = $actionArray[0] . '.' . $actionArray[1];
switch ($action) {
case self::ACTION_SORT_STATS:

View File

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