Donation plugin replaced old with new Labelline

This commit is contained in:
Jocy 2017-05-08 19:58:48 +02:00
parent c3f5de1f29
commit 8d7ddcd220

View File

@ -17,6 +17,7 @@ use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Commands\CommandListener; use ManiaControl\Commands\CommandListener;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\LabelLine;
use ManiaControl\Manialinks\ManialinkManager; use ManiaControl\Manialinks\ManialinkManager;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerManager; use ManiaControl\Players\PlayerManager;
@ -490,8 +491,14 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$headFrame = new Frame(); $headFrame = new Frame();
$frame->addChild($headFrame); $frame->addChild($headFrame);
$headFrame->setY($posY - 5); $headFrame->setY($posY - 5);
$array = array('$oId' => $posX + 5, '$oNickname' => $posX + 18, '$oLogin' => $posX + 70, '$oDonated planets' => $posX + 110);
$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); $labelLine = new LabelLine($headFrame);
$labelLine->setPrefix('$o');
$labelLine->addLabelEntryText('Id',$posX + 5);
$labelLine->addLabelEntryText('Nickname', $posX + 18);
$labelLine->addLabelEntryText('Login',$posX + 70);
$labelLine->addLabelEntryText('Donated planets', $posX + 110);
$labelLine->render();
$index = 1; $index = 1;
$posY = $posY - 10; $posY = $posY - 10;
@ -502,7 +509,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$pageFrame = new Frame(); $pageFrame = new Frame();
$frame->addChild($pageFrame); $frame->addChild($pageFrame);
$posY = $height / 2 - 10; $posY = $height / 2 - 10;
$paging->addPage($pageFrame); $paging->addPageControl($pageFrame);
} }
$playerFrame = new Frame(); $playerFrame = new Frame();
@ -514,14 +521,17 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$playerFrame->addChild($lineQuad); $playerFrame->addChild($lineQuad);
$lineQuad->setSize($width, 4); $lineQuad->setSize($width, 4);
$lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig); $lineQuad->setSubStyle($lineQuad::SUBSTYLE_BgPlayerCardBig);
$lineQuad->setZ(0.001); $lineQuad->setZ(-0.001);
} }
$donatingPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($playerIndex); $donatingPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($playerIndex);
$positions = array($posX + 5, $posX + 18, $posX + 70, $posX + 110); $labelLine = new LabelLine($playerFrame);
$texts = array($index, $donatingPlayer->nickname, $donatingPlayer->login, $donations); $labelLine->addLabelEntryText($index, $posX + 5, 13);
$this->maniaControl->getManialinkManager()->labelLine($playerFrame, array($positions, $texts)); $labelLine->addLabelEntryText($donatingPlayer->nickname,$posX + 18, 52);
$labelLine->addLabelEntryText($donatingPlayer->login,$posX + 70, 40);
$labelLine->addLabelEntryText($donations,$posX + 110, $width / 2 - ($posX + 110));
$labelLine->render();
$posY -= 4; $posY -= 4;
$index++; $index++;