Fixed https://github.com/ManiaControl/ManiaControl/issues/131 Fixed https://github.com/ManiaControl/ManiaControl/issues/130 Fixed https://github.com/ManiaControl/ManiaControl/issues/129
This commit is contained in:
parent
d636da86cb
commit
b5494576d2
@ -61,7 +61,6 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
|
||||
} else {
|
||||
$posY = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SIDEBAR_POSY_TRACKMANIA);
|
||||
}
|
||||
|
||||
$pos = new Position();
|
||||
$pos->setX($posX);
|
||||
$pos->setY($posY);
|
||||
@ -69,6 +68,16 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
|
||||
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
|
||||
*
|
||||
@ -81,6 +90,10 @@ class SidebarMenuManager implements UsageInformationAble, CallbackListener {
|
||||
$itemMarginFactor = 1.2;
|
||||
$pos = $this->getSidebarPosition();
|
||||
|
||||
$count = $this->getElementCountbeforeAdminMenu();
|
||||
$pos->setY($pos->getY() + $itemSize * $itemMarginFactor * $count);
|
||||
|
||||
|
||||
if (isset($this->yPositions[$id])) {
|
||||
$pos->setY($this->yPositions[$id]);
|
||||
return $pos;
|
||||
|
@ -56,7 +56,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
const ACTION_SEARCH_AUTHOR = 'MapList.SearchAuthor';
|
||||
const ACTION_RESET = 'MapList.ResetMapList';
|
||||
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_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin';
|
||||
const CACHE_CURRENT_PAGE = 'CurrentPage';
|
||||
|
@ -60,7 +60,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
const DEFAULT_CUSTOM_VOTE_PLUGIN = 'MCTeam\CustomVotesPlugin';
|
||||
const SHOWN_MAIN_WINDOW = -1;
|
||||
const MAX_PLAYERS_PER_PAGE = 15;
|
||||
const MAX_PAGES_PER_CHUNK = 10;
|
||||
const MAX_PAGES_PER_CHUNK = 2;
|
||||
|
||||
/*
|
||||
* Private properties
|
||||
@ -674,7 +674,11 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
public function handleManialinkPageAnswer(array $callback) {
|
||||
$actionId = $callback[1][2];
|
||||
$actionArray = explode('.', $actionId, 3);
|
||||
if(count($actionArray) < 2){
|
||||
return;
|
||||
}
|
||||
$action = $actionArray[0] . '.' . $actionArray[1];
|
||||
|
||||
if (count($actionArray) > 2) {
|
||||
|
||||
$adminLogin = $callback[1][1];
|
||||
|
@ -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);
|
||||
|
||||
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);
|
||||
$posY -= $optionHeight * 3.;
|
||||
$index += 3;
|
||||
|
@ -162,7 +162,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_SPECTATOR_ALLOW_START_VOTE, true);
|
||||
$this->maniaControl->getSettingManager()->initSetting($this, self::SETTING_VOTE_TIME, 40);
|
||||
|
||||
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry($this,SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID);
|
||||
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->addMenuEntry($this, SidebarMenuManager::ORDER_PLAYER_MENU + 5, self::CUSTOMVOTES_MENU_ID);
|
||||
|
||||
//Define Votes
|
||||
$this->defineVote("teambalance", "Vote for Team Balance");
|
||||
@ -317,6 +317,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
|
||||
$popoutFrame = new Frame();
|
||||
$maniaLink->addChild($popoutFrame);
|
||||
$popoutFrame->setPosition($pos->getX() - $itemSize * 0.5, $pos->getY());
|
||||
$popoutFrame->setZ(ManialinkManager::MAIN_MANIALINK_Z_VALUE);
|
||||
$popoutFrame->setHorizontalAlign($popoutFrame::RIGHT);
|
||||
$popoutFrame->setSize(4 * $itemSize * $itemMarginFactorX, $itemSize * $itemMarginFactorY);
|
||||
$popoutFrame->setVisible(false);
|
||||
@ -371,7 +372,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
|
||||
|
||||
$this->destroyVote();
|
||||
$this->maniaControl->getManialinkManager()->hideManialink(self::MLID_ICON);
|
||||
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->deleteMenuEntry($this,self::CUSTOMVOTES_MENU_ID,true);
|
||||
$this->maniaControl->getManialinkManager()->getSidebarMenuManager()->deleteMenuEntry($this, self::CUSTOMVOTES_MENU_ID, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -708,7 +709,7 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
|
||||
$frame->addChild($timeGauge);
|
||||
$timeGauge->setY(1.5);
|
||||
$timeGauge->setSize($width * 0.95, 6);
|
||||
$timeGauge->setDrawBg(false);
|
||||
$timeGauge->setDrawBlockBackground(false);
|
||||
if (!$timeUntilExpire) {
|
||||
$timeUntilExpire = 1;
|
||||
}
|
||||
@ -731,10 +732,11 @@ class CustomVotesPlugin implements SidebarMenuEntryRenderable, CommandListener,
|
||||
$frame->addChild($voteGauge);
|
||||
$voteGauge->setY(-4);
|
||||
$voteGauge->setSize($width * 0.65, 12);
|
||||
$voteGauge->setDrawBg(false);
|
||||
$voteGauge->setDrawBlockBackground(false);
|
||||
$voteGauge->setRatio($votePercentage + 0.10 - $votePercentage * 0.10);
|
||||
$gaugeColor = ColorUtil::floatToStatusColor($votePercentage);
|
||||
$voteGauge->setColor($gaugeColor . '6');
|
||||
$voteGauge->setZ(-0.1);
|
||||
|
||||
$posY = -4.4;
|
||||
$voteLabel = new Label();
|
||||
|
Loading…
Reference in New Issue
Block a user