Jocy 2017-05-17 16:08:51 +02:00
parent d636da86cb
commit b5494576d2
5 changed files with 27 additions and 8 deletions

View File

@ -61,7 +61,6 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
} else { } else {
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA); $posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA);
} }
$pos = new Position(); $pos = new Position();
$pos->setX($posX); $pos->setX($posX);
$pos->setY($posY); $pos->setY($posY);
@ -69,6 +68,16 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
return $pos; return $pos;
} }
private function getElementCountbeforeAdminMenu(){
$count = 0;
foreach($this->menuEntries as $k => $entry){
if($k < SidebarMenuManager::ORDER_ADMIN_MENU){
$count++;
}
}
return $count;
}
/** /**
* Returns PositionObject of a menu item of the sidebar, or null if it's not found * Returns PositionObject of a menu item of the sidebar, or null if it's not found
* *
@ -81,6 +90,10 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
$itemMarginFactor = 1.2; $itemMarginFactor = 1.2;
$pos = $this->getSidebarPosition(); $pos = $this->getSidebarPosition();
$count = $this->getElementCountbeforeAdminMenu();
$pos->setY($pos->getY() + $itemSize * $itemMarginFactor * $count);
if (isset($this->yPositions[$id])) { if (isset($this->yPositions[$id])) {
$pos->setY($this->yPositions[$id]); $pos->setY($this->yPositions[$id]);
return $pos; return $pos;

View File

@ -56,7 +56,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor'; const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor';
const ACTION_RESET = 'MapList.ResetMapList'; const ACTION_RESET = 'MapList.ResetMapList';
const MAX_MAPS_PER_PAGE = 13; const MAX_MAPS_PER_PAGE = 13;
const MAX_PAGES_PER_CHUNK = 10; const MAX_PAGES_PER_CHUNK = 2;
const DEFAULT_KARMA_PLUGIN = 'MCTeam\KarmaPlugin'; const DEFAULT_KARMA_PLUGIN = 'MCTeam\KarmaPlugin';
const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin'; const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin';
const CACHE_CURRENT_PAGE = 'CurrentPage'; const CACHE_CURRENT_PAGE = 'CurrentPage';

View File

@ -60,7 +60,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin'; const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin';
const SHOWN_MAIN_WINDOW = -1; const SHOWN_MAIN_WINDOW = -1;
const MAX_PLAYERS_PER_PAGE = 15; const MAX_PLAYERS_PER_PAGE = 15;
const MAX_PAGES_PER_CHUNK = 10; const MAX_PAGES_PER_CHUNK = 2;
/* /*
* Private properties * Private properties
@ -674,7 +674,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
public function handleManialinkPageAnswer(array $callback) { public function handleManialinkPageAnswer(array $callback) {
$actionId = $callback[1][2]; $actionId = $callback[1][2];
$actionArray = explode('.', $actionId, 3); $actionArray = explode('.', $actionId, 3);
if(count($actionArray) < 2){
return;
}
$action = $actionArray[0] . '.' . $actionArray[1]; $action = $actionArray[0] . '.' . $actionArray[1];
if (count($actionArray) > 2) { if (count($actionArray) > 2) {
$adminLogin = $callback[1][1]; $adminLogin = $callback[1][1];

View File

@ -311,7 +311,7 @@ class ServerOptionsMenu implements CallbackListener, ConfiguratorMenu, TimerList
$entry->setStyle(Label_Text::STYLE_TextValueSmall)->setX($width * 0.23)->setTextSize(1)->setSize($width * 0.48, $optionHeight * 0.9)->setName(self::ACTION_PREFIX_OPTION . $name)->setDefault($value); $entry->setStyle(Label_Text::STYLE_TextValueSmall)->setX($width * 0.23)->setTextSize(1)->setSize($width * 0.48, $optionHeight * 0.9)->setName(self::ACTION_PREFIX_OPTION . $name)->setDefault($value);
if ($name === 'Comment') { if ($name === 'Comment') {
$entry->setSize($width * 0.48, $optionHeight * 3. + $optionHeight * 0.9)->setAutoNewLine(true); $entry->setSize($width * 0.48, $optionHeight * 3. + $optionHeight * 0.9)->setAutoNewLine(true)->setVerticalAlign($entry::TOP)->setY($optionHeight * 1.5 + 2.5);
$optionsFrame->setY($posY - $optionHeight * 1.5); $optionsFrame->setY($posY - $optionHeight * 1.5);
$posY -= $optionHeight * 3.; $posY -= $optionHeight * 3.;
$index += 3; $index += 3;

View File

@ -317,6 +317,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
$popoutFrame = new Frame(); $popoutFrame = new Frame();
$maniaLink->addChild($popoutFrame); $maniaLink->addChild($popoutFrame);
$popoutFrame->setPosition($pos->getX() - $itemSize * 0.5, $pos->getY()); $popoutFrame->setPosition($pos->getX() - $itemSize * 0.5, $pos->getY());
$popoutFrame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT); $popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY); $popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
$popoutFrame->setVisible(false); $popoutFrame->setVisible(false);
@ -708,7 +709,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
$frame->addChild($timeGauge); $frame->addChild($timeGauge);
$timeGauge->setY(1.5); $timeGauge->setY(1.5);
$timeGauge->setSize($width * 0.95, 6); $timeGauge->setSize($width * 0.95, 6);
$timeGauge->setDrawBg(false); $timeGauge->setDrawBlockBackground(false);
if (!$timeUntilExpire) { if (!$timeUntilExpire) {
$timeUntilExpire = 1; $timeUntilExpire = 1;
} }
@ -731,10 +732,11 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
$frame->addChild($voteGauge); $frame->addChild($voteGauge);
$voteGauge->setY(-4); $voteGauge->setY(-4);
$voteGauge->setSize($width * 0.65, 12); $voteGauge->setSize($width * 0.65, 12);
$voteGauge->setDrawBg(false); $voteGauge->setDrawBlockBackground(false);
$voteGauge->setRatio($votePercentage + 0.10 - $votePercentage * 0.10); $voteGauge->setRatio($votePercentage + 0.10 - $votePercentage * 0.10);
$gaugeColor = ColorUtil::floatToStatusColor($votePercentage); $gaugeColor = ColorUtil::floatToStatusColor($votePercentage);
$voteGauge->setColor($gaugeColor . '6'); $voteGauge->setColor($gaugeColor . '6');
$voteGauge->setZ(-0.1);
$posY = -4.4; $posY = -4.4;
$voteLabel = new Label(); $voteLabel = new Label();