LocalRecords Bugfix

This commit is contained in:
Jocy 2017-05-19 14:44:34 +02:00
parent c534db0877
commit 04d07ac986

View File

@ -244,9 +244,7 @@ class LocalRecordsPlugin implements ManialinkPageAnswerListener,CallbackListener
$playerRecords[$record->playerIndex] = $index;
}
$maniaLink = new ManiaLink(self::MLID_RECORDS);
$frame = new Frame();
$maniaLink->addChild($frame);
$frame->setPosition($posX, $posY);
$backgroundQuad = new Quad();
@ -273,15 +271,22 @@ class LocalRecordsPlugin implements ManialinkPageAnswerListener,CallbackListener
$players = $this->maniaControl->getPlayerManager()->getPlayers();
foreach ($players as $player) {
$maniaLink = new ManiaLink(self::MLID_RECORDS);
$maniaLink->addChild($frame);
$listFrame = new Frame();
$maniaLink->addChild($listFrame);
$listFrame->setPosition($posX, $posY);
if (isset($playerRecords[$player->index]) && $playerRecords[$player->index] >= $topRecordsCount) {
$frame->addChild($preGeneratedRecordsFrame);
$listFrame->addChild($preGeneratedRecordsFrame);
$y = -8 - $topRecordsCount * $lineHeight;
$playerIndex = $playerRecords[$player->index];
//Line separator
$quad = new Quad();
$frame->addChild($quad);
$listFrame->addChild($quad);
$quad->setStyles(Quad_Bgs1InRace::STYLE, Quad_Bgs1InRace::SUBSTYLE_BgCardList);
$quad->setSize($width, 0.4);
$quad->setY($y + $lineHeight / 2);
@ -290,12 +295,12 @@ class LocalRecordsPlugin implements ManialinkPageAnswerListener,CallbackListener
for ($i = $playerIndex - $recordsBeforeAfter; $i <= $playerIndex + $recordsBeforeAfter; $i++) {
$recordFrame = $this->generateRecordLineFrame($records[$i], $player);
$recordFrame->setY($y);
$frame->addChild($recordFrame);
$listFrame->addChild($recordFrame);
$y -= $lineHeight;
}
} else {
$frame->addChild($this->generateRecordsFrame($records, $lines, $player));
$listFrame->addChild($this->generateRecordsFrame($records, $lines, $player));
}
$this->maniaControl->getManialinkManager()->sendManialink($maniaLink, $player);
@ -595,6 +600,7 @@ class LocalRecordsPlugin implements ManialinkPageAnswerListener,CallbackListener
/**
* Handle Player Connect Callback
*
* @internal
*/
public function handlePlayerConnect() {
@ -603,6 +609,7 @@ class LocalRecordsPlugin implements ManialinkPageAnswerListener,CallbackListener
/**
* Handle Begin Map Callback
*
* @internal
*/
public function handleMapBegin() {