diff --git a/core/Admin/AdminLists.php b/core/Admin/AdminLists.php index d035ec3d..31d863dc 100644 --- a/core/Admin/AdminLists.php +++ b/core/Admin/AdminLists.php @@ -16,6 +16,7 @@ use ManiaControl\Callbacks\CallbackManager; use ManiaControl\General\UsageInformationAble; use ManiaControl\General\UsageInformationTrait; use ManiaControl\ManiaControl; +use ManiaControl\Manialinks\LabelLine; use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Players\Player; @@ -29,7 +30,7 @@ use ManiaControl\Players\Player; */ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, UsageInformationAble { use UsageInformationTrait; - + /* * Constants */ @@ -94,7 +95,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage //Create ManiaLink $maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID); $paging = new Paging(); - $script = new Script(); + $script = new Script(); $script->addFeature($paging); $maniaLink->setScript($script); @@ -114,11 +115,16 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage $headFrame = new Frame(); $frame->addChild($headFrame); $headFrame->setY($posY - 5); - $array = array('Id' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Actions' => $posX + 120); - $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); - $index = 1; - $posY -= 10; + $labelLine = new LabelLine($headFrame); + $labelLine->addLabelEntryText('Id', $posX + 5); + $labelLine->addLabelEntryText('Nickname', $posX + 18); + $labelLine->addLabelEntryText('Login', $posX + 70); + $labelLine->addLabelEntryText('Actions', $posX + 120); + $labelLine->render(); + + $index = 1; + $posY -= 10; $pageFrame = null; foreach ($admins as $admin) { @@ -142,9 +148,11 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener, Usage $lineQuad->setZ(0.001); } - $positions = array($posX + 5, $posX + 18, $posX + 70); - $texts = array($index, $admin->nickname, $admin->login); - $this->maniaControl->getManialinkManager()->labelLine($playerFrame, array($positions, $texts)); + $labelLine = new LabelLine($playerFrame); + $labelLine->addLabelEntryText($index, $posX + 5, 13); + $labelLine->addLabelEntryText($admin->nickname, $posX + 18, 52); + $labelLine->addLabelEntryText($admin->login, $posX + 70, 48); + $labelLine->render(); // Level Quad $rightQuad = new Quad_BgRaceScore2(); diff --git a/core/Commands/HelpManager.php b/core/Commands/HelpManager.php index becde057..0c243cf8 100644 --- a/core/Commands/HelpManager.php +++ b/core/Commands/HelpManager.php @@ -9,6 +9,7 @@ use FML\Script\Features\Paging; use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\Callbacks; use ManiaControl\ManiaControl; +use ManiaControl\Manialinks\LabelLine; use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Players\Player; @@ -109,7 +110,7 @@ class HelpManager implements CommandListener, CallbackListener { foreach (array_reverse($commands) as $command) { if (array_key_exists($command['Method'], $registeredMethods)) { if ($showCommands[$registeredMethods[$command['Method']]]['Description'] === $command['Description']) { - $name = $registeredMethods[$command['Method']]; + $name = $registeredMethods[$command['Method']]; $showCommands[$name]['Name'] .= '|' . $command['Name']; } else { $showCommands[$command['Name']] = $command; @@ -170,11 +171,14 @@ class HelpManager implements CommandListener, CallbackListener { $headFrame = new Frame(); $frame->addChild($headFrame); $headFrame->setY($posY - 5); - $array = array('Command' => $posX + 5, 'Description' => $posX + 50); - $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); - $index = 1; - $posY -= 10; + $labelLine = new LabelLine($headFrame); + $labelLine->addLabelEntryText('Command', $posX + 5); + $labelLine->addLabelEntryText('Description', $posX + 50); + $labelLine->render(); + + $index = 1; + $posY -= 10; $pageFrame = null; foreach ($commands as $command) { @@ -197,11 +201,10 @@ class HelpManager implements CommandListener, CallbackListener { $lineQuad->setZ(0.001); } - $array = array($command['Name'] => $posX + 5, $command['Description'] => $posX + 50); - $labels = $this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); - - $label = $labels[0]; - $label->setWidth(40); + $labelLine = new LabelLine($playerFrame); + $labelLine->addLabelEntryText($command['Name'], $posX + 5, 45); + $labelLine->addLabelEntryText($command['Description'], $posX + 50, $width / 2 - $posX + 50); + $labelLine->render(); $posY -= 4; $index++; diff --git a/core/ManiaExchange/ManiaExchangeList.php b/core/ManiaExchange/ManiaExchangeList.php index 0c385801..34ef0401 100644 --- a/core/ManiaExchange/ManiaExchangeList.php +++ b/core/ManiaExchange/ManiaExchangeList.php @@ -198,9 +198,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener $headFrame = new Frame(); $frame->addChild($headFrame); $headFrame->setY($posY - 12); - $array = array('$oId' => $posX + 3.5, '$oName' => $posX + 12.5, '$oAuthor' => $posX + 59, '$oKarma' => $posX + 85, '$oType' => $posX + 103, '$oMood' => $posX + 118, - '$oLast Update' => $posX + 130); - $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); $labelLine = new LabelLine($headFrame); $labelLine->addLabelEntryText('Id', $posX + 3.5, 9); @@ -210,7 +207,6 @@ class ManiaExchangeList implements CallbackListener, ManialinkPageAnswerListener $labelLine->addLabelEntryText('Mood', $posX + 118, 12); $labelLine->addLabelEntryText('Last Update', $posX + 130, $width - ($posX + 130)); - $labelLine->setPrefix('$o'); $labelLine->render(); $index = 0; diff --git a/core/Manialinks/LabelLine.php b/core/Manialinks/LabelLine.php index d562dc23..5a2c01e7 100644 --- a/core/Manialinks/LabelLine.php +++ b/core/Manialinks/LabelLine.php @@ -44,15 +44,15 @@ class LabelLine implements UsageInformationAble { */ public function addLabelEntryText($labelText, $posX, $width = 0, $action = '') { $label = new Label_Text(); - $this->frame->addChild($label); $label->setText($labelText); $label->setX($posX); if ($action) { $label->setAction($action); } + if ($width) { $label->setWidth($width); - $label->setHeight(0); //TODO verify if 5 is ok for everywhere + $label->setHeight(0); } $this->addLabel($label); } @@ -62,7 +62,7 @@ class LabelLine implements UsageInformationAble { * * @param \FML\Controls\Labels\Label_Text $label */ - private function addLabel(Label_Text $label) { + public function addLabel(Label_Text $label) { array_push($this->entries, $label); } diff --git a/core/Manialinks/StyleManager.php b/core/Manialinks/StyleManager.php index e936733e..63bb3b43 100644 --- a/core/Manialinks/StyleManager.php +++ b/core/Manialinks/StyleManager.php @@ -24,7 +24,7 @@ use ManiaControl\ManiaControl; */ class StyleManager implements UsageInformationAble { use UsageInformationTrait; - + /* * Constants */ @@ -113,7 +113,7 @@ class StyleManager implements UsageInformationAble { // Predefine Description Label $descriptionLabel = new Label(); - $descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP)->setPosition($width * -0.5 + 10, $height * -0.5 + 5)->setSize($width * 0.7, 4)->setTextSize(2)->setVisible(false); + $descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP)->setPosition($width * -0.5 + 10, $height * -0.5 + 5)->setZ(1)->setSize($width * 0.7, 4)->setTextSize(2)->setVisible(false); return $descriptionLabel; } diff --git a/core/Maps/MapList.php b/core/Maps/MapList.php index 78c675a2..89a75f5b 100644 --- a/core/Maps/MapList.php +++ b/core/Maps/MapList.php @@ -19,6 +19,7 @@ use ManiaControl\Callbacks\Callbacks; use ManiaControl\Logger; use ManiaControl\ManiaControl; use ManiaControl\Manialinks\IconManager; +use ManiaControl\Manialinks\LabelLine; use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Players\Player; @@ -118,8 +119,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { * @param int $pageIndex */ public function showMapList(Player $player, $mapList = null, $pageIndex = -1) { - $width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); - $height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); + $width = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsWidth(); + $height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight(); $buttonY = -$height / 2 + 9; if ($pageIndex < 0) { @@ -154,8 +155,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $maniaLink->addChild($frame); // Admin Buttons - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { // Clear Map-Queue $label = new Label_Button(); $frame->addChild($label); @@ -173,11 +173,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $quad->setAction(self::ACTION_CLEAR_MAPQUEUE); } - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_CHECK_UPDATE) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_CHECK_UPDATE)) { $mxCheckForUpdatesX = $width / 2 - 37; - $buttonWidth = 35; - $iconSize = 3; + $buttonWidth = 35; + $iconSize = 3; // Check Update $label = new Label_Button(); $frame->addChild($label); @@ -206,8 +205,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $mxQuad->setAction(self::ACTION_CHECK_UPDATE); } - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { // Directory browser $browserButton = new Label_Button(); $frame->addChild($browserButton); @@ -227,9 +225,15 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $headFrame = new Frame(); $frame->addChild($headFrame); $headFrame->setY($height / 2 - 5); - $posX = -$width / 2; - $array = array('Id' => $posX + 5, 'Mx Id' => $posX + 10, 'Map Name' => $posX + 20, 'Author' => $posX + 68, 'Karma' => $posX + 115, 'Actions' => $width / 2 - 16); - $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); + $posX = -$width / 2; + + $labelLine = new LabelLine($headFrame); + $labelLine->addLabelEntryText('Id', $posX + 5); + $labelLine->addLabelEntryText('Mx Id', $posX + 10); + $labelLine->addLabelEntryText('Map Name', $posX + 20); + $labelLine->addLabelEntryText('Author', $posX + 68); + $labelLine->addLabelEntryText('Actions', $width / 2 - 16); + $labelLine->render(); // Predefine description Label $descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); @@ -314,23 +318,29 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $mxQuad->addTooltipLabelFeature($descriptionLabel, $description); // Update Button - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { $mxQuad->setAction(self::ACTION_UPDATE_MAP . '.' . $map->uid); } } } // Display Maps - $array = array($mapListId => $posX + 5, $mxId => $posX + 10, Formatter::stripDirtyCodes($map->name) => $posX + 20, $map->authorNick => $posX + 68); - $labels = $this->maniaControl->getManialinkManager()->labelLine($mapFrame, $array); - if (isset($labels[3])) { - /** @var Label $label */ - $label = $labels[3]; - $description = 'Click to checkout all maps by $<' . $map->authorLogin . '$>!'; - $label->setAction(MapCommands::ACTION_SHOW_AUTHOR . $map->authorLogin); - $label->addTooltipLabelFeature($descriptionLabel, $description); - } + $labelLine = new LabelLine($mapFrame); + $labelLine->addLabelEntryText($mapListId, $posX + 5, 5); + $labelLine->addLabelEntryText($mxId, $posX + 10, 10); + $labelLine->addLabelEntryText(Formatter::stripDirtyCodes($map->name), $posX + 20, 42); + + $label = new Label_Text(); + $mapFrame->addChild($label); + $label->setText($map->authorNick); + $label->setX($posX + 68); + $label->setSize(47, 0); + $label->setAction(MapCommands::ACTION_SHOW_AUTHOR . $map->authorLogin); + $description = 'Click to checkout all maps by $<' . $map->authorLogin . '$>!'; + $label->addTooltipLabelFeature($descriptionLabel, $description); + $labelLine->addLabel($label); + + $labelLine->render(); // TODO action detailed map info including mx info @@ -364,8 +374,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $queueLabel->setText('+'); if (in_array($map->uid, $queueBuffer)) { - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapQueue::SETTING_PERMISSION_CLEAR_MAPQUEUE)) { $queueLabel->setAction(self::ACTION_QUEUED_MAP . '.' . $map->uid); } $queueLabel->setTextColor('f00'); @@ -379,8 +388,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { } } - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) { // remove map button $removeButton = new Label_Button(); $mapFrame->addChild($removeButton); @@ -397,8 +405,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $removeButton->addTooltipLabelFeature($descriptionLabel, $description); } - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP) - ) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { // Switch to button $switchLabel = new Label_Button(); $mapFrame->addChild($switchLabel); @@ -415,10 +422,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { $description = 'Switch Directly to Map: ' . $map->getEscapedName(); $switchLabel->addTooltipLabelFeature($descriptionLabel, $description); } - if ($this->maniaControl->getPluginManager()->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN) - ) { - if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP) - ) { + if ($this->maniaControl->getPluginManager()->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) { + if ($this->maniaControl->getAuthenticationManager()->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) { // Switch Map Voting for Admins $switchQuad = new Quad_UIConstruction_Buttons(); $mapFrame->addChild($switchQuad); @@ -461,8 +466,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener { } if (is_numeric($karma) && $votes['count'] > 0) { - if ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA) - ) { + if ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA)) { $karmaText = ' ' . round($karma * 100.) . '% (' . $votes['count'] . ')'; } else { $min = 0; diff --git a/core/Players/PlayerList.php b/core/Players/PlayerList.php index 355c8a02..67bcdbe9 100644 --- a/core/Players/PlayerList.php +++ b/core/Players/PlayerList.php @@ -17,6 +17,7 @@ use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\TimerListener; use ManiaControl\ManiaControl; +use ManiaControl\Manialinks\LabelLine; use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Utils\Formatter; @@ -168,11 +169,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $frame->addChild($headFrame); $headFrame->setY($posY - 5); - $labelLineArray = array('Id' => $posX + 5, 'Nickname' => $posX + 18, 'Login' => $posX + 70, 'Location' => $posX + 101); + $labelLine = new LabelLine($headFrame); + $labelLine->addLabelEntryText('Id', $posX + 5); + $labelLine->addLabelEntryText('Nickname', $posX + 18); + $labelLine->addLabelEntryText('Login', $posX + 70); + $labelLine->addLabelEntryText('Location', $posX + 101); if ($this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) { - $labelLineArray['Actions'] = $posX + 135; + $labelLine->addLabelEntryText('Actions', $posX + 135); } - $this->maniaControl->getManialinkManager()->labelLine($headFrame, $labelLineArray); + $labelLine->render(); + $index = 1; $posY = $height / 2 - 10; @@ -198,10 +204,15 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer $lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig); $lineQuad->setZ($backgroundZ); } + $labelLine = new LabelLine($playerFrame); - $positions = array($posX + 5, $posX + 18, $posX + 70, $posX + 101); - $texts = array($index, $listPlayer->nickname, $listPlayer->login, $path); - $this->maniaControl->getManialinkManager()->labelLine($playerFrame, array($positions, $texts), array('posZ' => $foregroundZ)); + $labelLine->addLabelEntryText($index, $posX + 5, 13); + $labelLine->addLabelEntryText($listPlayer->nickname, $posX + 18, 43); + $labelLine->addLabelEntryText($listPlayer->login, $posX + 70, 26); + $labelLine->addLabelEntryText($path, $posX + 101, 27); + + $labelLine->setPosZ($foregroundZ); + $labelLine->render(); $playerFrame->setY($posY); diff --git a/core/Statistics/SimpleStatsList.php b/core/Statistics/SimpleStatsList.php index 4ba456da..f6a4f361 100644 --- a/core/Statistics/SimpleStatsList.php +++ b/core/Statistics/SimpleStatsList.php @@ -15,6 +15,7 @@ use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\Callbacks; use ManiaControl\Commands\CommandListener; use ManiaControl\ManiaControl; +use ManiaControl\Manialinks\LabelLine; use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkPageAnswerListener; use ManiaControl\Players\Player; @@ -40,8 +41,8 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, */ /** @var ManiaControl $maniaControl */ private $maniaControl = null; - private $statArray = array(); - private $statsWidth = 0; + private $statArray = array(); + private $statsWidth = 0; /** * Construct a new simple stats list instance @@ -99,7 +100,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $this->statArray[$order]["HeadShortCut"] = '$o' . $headShortCut; $this->statArray[$order]["Width"] = $width; $this->statArray[$order]["Format"] = $format; - $this->statsWidth += $width; + $this->statsWidth += $width; } /** @@ -153,13 +154,8 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $posY = $height / 2; // Predefine Description Label - $descriptionLabel = new Label(); + $descriptionLabel = $this->maniaControl->getManialinkManager()->getStyleManager()->getDefaultDescriptionLabel(); $frame->addChild($descriptionLabel); - $descriptionLabel->setAlign($descriptionLabel::LEFT, $descriptionLabel::TOP); - $descriptionLabel->setPosition($xStart + 10, -$height / 2 + 5); - $descriptionLabel->setSize($width * 0.7, 4); - $descriptionLabel->setTextSize(2); - $descriptionLabel->setVisible(false); // Headline $headFrame = new Frame(); @@ -167,9 +163,11 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $headFrame->setY($posY - 5); $headFrame->setZ(1); - $posX = $xStart; - $array['$oId'] = $posX + 5; - $array['$oNickname'] = $posX + 14; + $labelLine = new LabelLine($headFrame); + + $posX = $xStart; + $labelLine->addLabelEntryText('Id', $posX + 5); + $labelLine->addLabelEntryText('Nickname', $posX + 14); // Headline $posX = $xStart + 55; @@ -177,36 +175,27 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, foreach ($this->statArray as $key => $stat) { $ranking = $this->maniaControl->getStatisticManager()->getStatsRanking($stat["Name"]); if (!empty($ranking)) { - $statRankings[$stat["Name"]] = $ranking; - $array[$stat['HeadShortCut']] = $posX; + $statRankings[$stat["Name"]] = $ranking; + + $label = new Label_Text(); + $label->setText($stat['HeadShortCut']); + $label->setX($posX); + $label->setSize($stat['Width'], 0); + $label->setAction(self::ACTION_SORT_STATS . '.' . $stat["Name"]); + $label->addTooltipLabelFeature($descriptionLabel, '$o ' . $stat["Name"]); + $labelLine->addLabel($label); + $posX += $stat["Width"]; } else { unset($this->statArray[$key]); } } + $labelLine->render(); - $labels = $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); - - // Description Label - $index = 2; - foreach ($this->statArray as $statArray) { - if (!isset($labels[$index])) { - break; - } - - /** @var Label_Text $label */ - $label = $labels[$index]; - - $label->setAction(self::ACTION_SORT_STATS . '.' . $statArray["Name"]); - $label->addTooltipLabelFeature($descriptionLabel, '$o ' . $statArray["Name"]); - $index++; - } // define standard properties - $textSize = 1.5; - $textColor = 'fff'; - $index = 1; - $posY -= 10; + $index = 1; + $posY -= 10; if (!isset($statRankings[$order])) { return; @@ -234,8 +223,8 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $currentQuad->setSubStyle($currentQuad::SUBSTYLE_ArrowBlue); } - $displayArray = array(); - + $labelLine = new LabelLine($playerFrame); + $posX = $xStart + 55; foreach ($this->statArray as $stat) { $statValue = 0; if (isset($statRankings[$stat['Name']][$playerId])) { @@ -246,26 +235,20 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener, $statValue = round(floatval($statValue), 2); } } - $displayArray[$stat['Name']] = array('Value' => strval($statValue), 'Width' => $stat['Width']); - } - $array = array($index => $xStart + 5, $listPlayer->nickname => $xStart + 14); - $this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); - - $posX = $xStart + 55; - foreach ($displayArray as $key => $array) { $label = new Label_Text(); - $playerFrame->addChild($label); - $label->setHorizontalAlign($label::LEFT); $label->setX($posX); - $label->setStyle($label::STYLE_TextCardSmall); - $label->setTextSize($textSize); - $label->setText($array['Value']); - $label->setTextColor($textColor); - $label->addTooltipLabelFeature($descriptionLabel, '$o ' . $key); - $posX += $array['Width']; + $label->setText(strval($statValue)); + $label->addTooltipLabelFeature($descriptionLabel, '$o ' . $stat['Name']); + $labelLine->addLabel($label); + + $posX += $stat['Width']; } + $labelLine->addLabelEntryText($index, $xStart + 5, 9); + $labelLine->addLabelEntryText($listPlayer->nickname, $xStart + 14, 41); + $labelLine->render(); + $playerFrame->setY($posY); if ($index % 2 !== 0) {