design improvements
This commit is contained in:
parent
6ae3bb3f20
commit
5701fc3313
@ -117,21 +117,21 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$searchString = '';
|
$searchString = '';
|
||||||
$author = '';
|
$author = '';
|
||||||
$environment = '';
|
$environment = '';
|
||||||
if(count($params) >= 1) {
|
if (count($params) >= 1) {
|
||||||
foreach($params as $param) {
|
foreach($params as $param) {
|
||||||
if($param == '/xlist' || $param == MapCommands::ACTION_OPEN_XLIST) {
|
if ($param == '/xlist' || $param == MapCommands::ACTION_OPEN_XLIST) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($param == self::ACTION_SEARCH_MAPNAME) {
|
if ($param == self::ACTION_SEARCH_MAPNAME) {
|
||||||
$searchString = $chatCallback[1][3][0]['Value'];
|
$searchString = $chatCallback[1][3][0]['Value'];
|
||||||
} else if($param == self::ACTION_SEARCH_AUTHOR) {
|
} else if ($param == self::ACTION_SEARCH_AUTHOR) {
|
||||||
$author = $chatCallback[1][3][0]['Value'];
|
$author = $chatCallback[1][3][0]['Value'];
|
||||||
} else if(strtolower(substr($param, 0, 5)) == 'auth:') {
|
} else if (strtolower(substr($param, 0, 5)) == 'auth:') {
|
||||||
$author = substr($param, 5);
|
$author = substr($param, 5);
|
||||||
} else if(strtolower(substr($param, 0, 4)) == 'env:') {
|
} else if (strtolower(substr($param, 0, 4)) == 'env:') {
|
||||||
$environment = substr($param, 4);
|
$environment = substr($param, 4);
|
||||||
} else {
|
} else {
|
||||||
if($searchString == '') {
|
if ($searchString == '') {
|
||||||
$searchString = $param;
|
$searchString = $param;
|
||||||
} else { // concatenate words in name
|
} else { // concatenate words in name
|
||||||
$searchString .= '%20' . $param;
|
$searchString .= '%20' . $param;
|
||||||
@ -144,7 +144,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$maps = $this->maniaControl->mapManager->mxManager->getMaps($searchString, $author, $environment);
|
$maps = $this->maniaControl->mapManager->mxManager->getMaps($searchString, $author, $environment);
|
||||||
|
|
||||||
// check if there are any results
|
// check if there are any results
|
||||||
if($maps == null) {
|
if ($maps == null) {
|
||||||
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
|
$this->maniaControl->chat->sendError('No maps found, or MX is down!', $player->login);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -212,10 +212,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$y = $height / 2 - 16;
|
$y = $height / 2 - 16;
|
||||||
$pageFrames = array();
|
$pageFrames = array();
|
||||||
foreach($maps as $map) { //TODO order possabilities
|
foreach($maps as $map) { //TODO order possabilities
|
||||||
if(!isset($pageFrame)) {
|
if (!isset($pageFrame)) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
if(!empty($pageFrames)) {
|
if (!empty($pageFrames)) {
|
||||||
$pageFrame->setVisible(false);
|
$pageFrame->setVisible(false);
|
||||||
}
|
}
|
||||||
array_push($pageFrames, $pageFrame);
|
array_push($pageFrames, $pageFrame);
|
||||||
@ -227,7 +227,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mapFrame = new Frame();
|
$mapFrame = new Frame();
|
||||||
$pageFrame->add($mapFrame);
|
$pageFrame->add($mapFrame);
|
||||||
|
|
||||||
if($i % 2 == 0) {
|
if ($i % 2 == 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$mapFrame->add($lineQuad);
|
$mapFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -256,7 +256,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View " . $map->name . " on Mania-Exchange"));
|
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View " . $map->name . " on Mania-Exchange"));
|
||||||
|
|
||||||
//TODO permission Clear Jukebox
|
//TODO permission Clear Jukebox
|
||||||
if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||||
$addQuad = new Quad_Icons64x64_1();
|
$addQuad = new Quad_Icons64x64_1();
|
||||||
$mapFrame->add($addQuad);
|
$mapFrame->add($addQuad);
|
||||||
$addQuad->setX($x + 59);
|
$addQuad->setX($x + 59);
|
||||||
@ -270,7 +270,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Award Quad
|
//Award Quad
|
||||||
if($map->awards > 0) {
|
if ($map->awards > 0) {
|
||||||
$awardQuad = new Quad_Icons64x64_1();
|
$awardQuad = new Quad_Icons64x64_1();
|
||||||
$mapFrame->add($awardQuad);
|
$mapFrame->add($awardQuad);
|
||||||
$awardQuad->setSize(3, 3);
|
$awardQuad->setSize(3, 3);
|
||||||
@ -288,7 +288,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
$i++;
|
$i++;
|
||||||
if($i % self::MAX_MX_MAPS_PER_PAGE == 0) {
|
if ($i % self::MAX_MX_MAPS_PER_PAGE == 0) {
|
||||||
unset($pageFrame);
|
unset($pageFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$pagerSize = 6.;
|
$pagerSize = 6.;
|
||||||
$pagesId = 'MapListPages';
|
$pagesId = 'MapListPages';
|
||||||
|
|
||||||
if(count($mapList) > self::MAX_MAPS_PER_PAGE) {
|
if (count($mapList) > self::MAX_MAPS_PER_PAGE) {
|
||||||
$pagerPrev = new Quad_Icons64x64_1();
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
$frame->add($pagerPrev);
|
$frame->add($pagerPrev);
|
||||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||||
@ -429,7 +429,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Admin Buttons
|
//Admin Buttons
|
||||||
if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||||
//Clear Jukebox
|
//Clear Jukebox
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
@ -492,7 +492,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
$queuedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking();
|
$queuedMaps = $this->maniaControl->mapManager->mapQueue->getQueuedMapsRanking();
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var KarmaPlugin $karmaPlugin
|
* @var KarmaPlugin $karmaPlugin
|
||||||
*/
|
*/
|
||||||
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN);
|
$karmaPlugin = $this->maniaControl->pluginManager->getPlugin(self::DEFAULT_KARMA_PLUGIN);
|
||||||
@ -501,14 +500,13 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$y = $height / 2 - 10;
|
$y = $height / 2 - 10;
|
||||||
$pageFrames = array();
|
$pageFrames = array();
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var Map $map
|
* @var Map $map
|
||||||
*/
|
*/
|
||||||
foreach($mapList as $map) {
|
foreach($mapList as $map) {
|
||||||
if(!isset($pageFrame)) {
|
if (!isset($pageFrame)) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
if(!empty($pageFrames)) {
|
if (!empty($pageFrames)) {
|
||||||
$pageFrame->setVisible(false);
|
$pageFrame->setVisible(false);
|
||||||
}
|
}
|
||||||
array_push($pageFrames, $pageFrame);
|
array_push($pageFrames, $pageFrame);
|
||||||
@ -522,7 +520,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mapFrame->setZ(0.1);
|
$mapFrame->setZ(0.1);
|
||||||
$mapFrame->setY($y);
|
$mapFrame->setY($y);
|
||||||
|
|
||||||
if($id % 2 != 0) {
|
if ($id % 2 != 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$mapFrame->add($lineQuad);
|
$mapFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -530,7 +528,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$lineQuad->setZ(0.001);
|
$lineQuad->setZ(0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->maniaControl->mapManager->getCurrentMap() === $map) {
|
if ($this->maniaControl->mapManager->getCurrentMap() === $map) {
|
||||||
$currentQuad = new Quad_Icons64x64_1();
|
$currentQuad = new Quad_Icons64x64_1();
|
||||||
$mapFrame->add($currentQuad);
|
$mapFrame->add($currentQuad);
|
||||||
$currentQuad->setX($x + 3.5);
|
$currentQuad->setX($x + 3.5);
|
||||||
@ -540,7 +538,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mxId = '-';
|
$mxId = '-';
|
||||||
if(isset($map->mx->id)) {
|
if (isset($map->mx->id)) {
|
||||||
$mxId = $map->mx->id;
|
$mxId = $map->mx->id;
|
||||||
|
|
||||||
$mxQuad = new Quad();
|
$mxQuad = new Quad();
|
||||||
@ -553,7 +551,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$mxQuad->setZ(0.01);
|
$mxQuad->setZ(0.01);
|
||||||
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View $<" . $map->name . "$> on Mania-Exchange"));
|
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "View $<" . $map->name . "$> on Mania-Exchange"));
|
||||||
|
|
||||||
if($map->updateAvailable()) {
|
if ($map->updateAvailable()) {
|
||||||
$mxQuad = new Quad();
|
$mxQuad = new Quad();
|
||||||
$mapFrame->add($mxQuad);
|
$mapFrame->add($mxQuad);
|
||||||
$mxQuad->setSize(3, 3);
|
$mxQuad->setSize(3, 3);
|
||||||
@ -565,7 +563,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Update of $<" . $map->name . "$> available on Mania-Exchange"));
|
$script->addTooltip($mxQuad, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => "Update of $<" . $map->name . "$> available on Mania-Exchange"));
|
||||||
|
|
||||||
//Update Button
|
//Update Button
|
||||||
if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||||
$mxQuad->setAction(self::ACTION_UPDATE_MAP . '.' . $map->uid);
|
$mxQuad->setAction(self::ACTION_UPDATE_MAP . '.' . $map->uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -573,12 +571,14 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display Maps
|
// Display Maps
|
||||||
$array = array($id => $x + 5, $mxId => $x + 10, Formatter::stripDirtyCodes($map->name) => $x + 20, $map->authorNick => $x + 68);
|
$array = array($id => $x + 5, $mxId => $x + 10, Formatter::stripDirtyCodes($map->name) => $x + 20, $map->authorNick => $x + 68);
|
||||||
$this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
$labels = $this->maniaControl->manialinkManager->labelLine($mapFrame, $array);
|
||||||
|
$script->addTooltip($labels[3], $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => '$<' . $map->name . '$> made by $<' . $map->authorLogin . '$>'));
|
||||||
|
|
||||||
// TODO action detailed map info including mx info
|
// TODO action detailed map info including mx info
|
||||||
|
|
||||||
// Map-Queue-Map-Label
|
// Map-Queue-Map-Label
|
||||||
if(isset($queuedMaps[$map->uid])) {
|
if (isset($queuedMaps[$map->uid])) {
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$mapFrame->add($label);
|
$mapFrame->add($label);
|
||||||
$label->setX($width / 2 - 15);
|
$label->setX($width / 2 - 15);
|
||||||
@ -602,7 +602,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$script->addTooltip($queueLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Add Map to the Map Queue: $<' . $map->name . '$>'));
|
$script->addTooltip($queueLabel, $descriptionLabel, array(Script::OPTION_TOOLTIP_TEXT => 'Add Map to the Map Queue: $<' . $map->name . '$>'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) {
|
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) {
|
||||||
// erase map quad
|
// erase map quad
|
||||||
$eraseLabel = new Label_Button();
|
$eraseLabel = new Label_Button();
|
||||||
$mapFrame->add($eraseLabel);
|
$mapFrame->add($eraseLabel);
|
||||||
@ -619,7 +619,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
|
||||||
// Switch to map
|
// Switch to map
|
||||||
$switchLabel = new Label_Button();
|
$switchLabel = new Label_Button();
|
||||||
$mapFrame->add($switchLabel);
|
$mapFrame->add($switchLabel);
|
||||||
@ -638,10 +638,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display Karma bar
|
// Display Karma bar
|
||||||
if($karmaPlugin) {
|
if ($karmaPlugin) {
|
||||||
$karma = $karmaPlugin->getMapKarma($map);
|
$karma = $karmaPlugin->getMapKarma($map);
|
||||||
$votes = $karmaPlugin->getMapVotes($map);
|
$votes = $karmaPlugin->getMapVotes($map);
|
||||||
if(is_numeric($karma)) {
|
if (is_numeric($karma)) {
|
||||||
$karmaGauge = new Gauge();
|
$karmaGauge = new Gauge();
|
||||||
$mapFrame->add($karmaGauge);
|
$mapFrame->add($karmaGauge);
|
||||||
$karmaGauge->setZ(2);
|
$karmaGauge->setZ(2);
|
||||||
@ -666,7 +666,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
if($id % self::MAX_MAPS_PER_PAGE == 0) {
|
if ($id % self::MAX_MAPS_PER_PAGE == 0) {
|
||||||
unset($pageFrame);
|
unset($pageFrame);
|
||||||
}
|
}
|
||||||
$id++;
|
$id++;
|
||||||
@ -717,7 +717,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$buttLabel->setSize(3, 3);
|
$buttLabel->setSize(3, 3);
|
||||||
$buttLabel->setAlign(Control::CENTER, Control::CENTER);
|
$buttLabel->setAlign(Control::CENTER, Control::CENTER);
|
||||||
|
|
||||||
if(!$mapUid) {
|
if (!$mapUid) {
|
||||||
$quad->setAction(self::ACTION_SWITCH_MAP . '.' . ($id - 1));
|
$quad->setAction(self::ACTION_SWITCH_MAP . '.' . ($id - 1));
|
||||||
$buttLabel->setText('»');
|
$buttLabel->setText('»');
|
||||||
$buttLabel->setTextColor('0f0');
|
$buttLabel->setTextColor('0f0');
|
||||||
@ -740,7 +740,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$player = $callback[1];
|
$player = $callback[1];
|
||||||
$openedWidget = $callback[2];
|
$openedWidget = $callback[2];
|
||||||
//unset when another main widget got opened
|
//unset when another main widget got opened
|
||||||
if($openedWidget != 'MapList' && $openedWidget != 'MxList') {
|
if ($openedWidget != 'MapList' && $openedWidget != 'MxList') {
|
||||||
unset($this->mapListShown[$player->login]);
|
unset($this->mapListShown[$player->login]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -773,7 +773,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
public function handleManialinkPageAnswer(array $callback) {
|
public function handleManialinkPageAnswer(array $callback) {
|
||||||
$actionId = $callback[1][2];
|
$actionId = $callback[1][2];
|
||||||
$actionArray = explode('.', $actionId);
|
$actionArray = explode('.', $actionId);
|
||||||
if(count($actionArray) <= 2) {
|
if (count($actionArray) <= 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,12 +828,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
*/
|
*/
|
||||||
public function updateWidget(array $callback) {
|
public function updateWidget(array $callback) {
|
||||||
foreach($this->mapListShown as $login => $shown) {
|
foreach($this->mapListShown as $login => $shown) {
|
||||||
if($shown) {
|
if ($shown) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
if($player != null) {
|
if ($player != null) {
|
||||||
if($shown == self::SHOW_MX_LIST) {
|
if ($shown == self::SHOW_MX_LIST) {
|
||||||
//nothing to update yet
|
//nothing to update yet
|
||||||
} else if($shown == self::SHOW_MAP_LIST) {
|
} else if ($shown == self::SHOW_MAP_LIST) {
|
||||||
$this->showMapList($player);
|
$this->showMapList($player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -128,7 +128,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
// get PlayerList
|
// get PlayerList
|
||||||
$players = $this->maniaControl->playerManager->getPlayers();
|
$players = $this->maniaControl->playerManager->getPlayers();
|
||||||
|
|
||||||
if(count($players) > self::MAX_PLAYERS_PER_PAGE) {
|
if (count($players) > self::MAX_PLAYERS_PER_PAGE) {
|
||||||
$pagerPrev = new Quad_Icons64x64_1();
|
$pagerPrev = new Quad_Icons64x64_1();
|
||||||
$frame->add($pagerPrev);
|
$frame->add($pagerPrev);
|
||||||
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
$pagerPrev->setPosition($width * 0.42, $height * -0.44, 2);
|
||||||
@ -140,6 +140,17 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
$pagerNext->setPosition($width * 0.45, $height * -0.44, 2);
|
||||||
$pagerNext->setSize($pagerSize, $pagerSize);
|
$pagerNext->setSize($pagerSize, $pagerSize);
|
||||||
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
$pagerNext->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_ArrowNext);
|
||||||
|
|
||||||
|
$script->addPager($pagerPrev, -1, $pagesId);
|
||||||
|
$script->addPager($pagerNext, 1, $pagesId);
|
||||||
|
|
||||||
|
$pageCountLabel = new Label_Text();
|
||||||
|
$frame->add($pageCountLabel);
|
||||||
|
$pageCountLabel->setHAlign(Control::RIGHT);
|
||||||
|
$pageCountLabel->setPosition($width * 0.40, $height * -0.44, 1);
|
||||||
|
$pageCountLabel->setStyle($pageCountLabel::STYLE_TextTitle1);
|
||||||
|
$pageCountLabel->setTextSize(1.3);
|
||||||
|
$script->addPageLabel($pageCountLabel, $pagesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start offsets
|
// Start offsets
|
||||||
@ -160,26 +171,26 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($y - 5);
|
||||||
// $array = array("Id" => $x + 5, "Nickname" => $x + 10, "Login" => $x + 40, "Ladder" => $x + 60,"Zone" => $x + 85);
|
// $array = array("Id" => $x + 5, "Nickname" => $x + 10, "Login" => $x + 40, "Ladder" => $x + 60,"Zone" => $x + 85);
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101, "Actions" => $x + 135);
|
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101, "Actions" => $x + 135);
|
||||||
} else {
|
} else {
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101);
|
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 70, "Location" => $x + 101);
|
||||||
}
|
}
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$y -= 10;
|
$y = $height / 2 - 10;
|
||||||
$pageFrames = array();
|
$pageFrames = array();
|
||||||
foreach($players as $listPlayer) {
|
foreach($players as $listPlayer) {
|
||||||
/** @var Player $listPlayer * */
|
/** @var Player $listPlayer * */
|
||||||
if(!isset($pageFrame)) {
|
if (!isset($pageFrame)) {
|
||||||
$pageFrame = new Frame();
|
$pageFrame = new Frame();
|
||||||
$frame->add($pageFrame);
|
$frame->add($pageFrame);
|
||||||
if(!empty($pageFrames)) {
|
if (!empty($pageFrames)) {
|
||||||
$pageFrame->setVisible(false);
|
$pageFrame->setVisible(false);
|
||||||
}
|
}
|
||||||
array_push($pageFrames, $pageFrame);
|
array_push($pageFrames, $pageFrame);
|
||||||
$y = $height / 2 - 16;
|
$y = $height / 2 - 10;
|
||||||
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
$script->addPage($pageFrame, count($pageFrames), $pagesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +199,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$pageFrame->add($playerFrame);
|
$pageFrame->add($playerFrame);
|
||||||
|
|
||||||
if($i % 2 != 0) {
|
if ($i % 2 != 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($width, 4);
|
$lineQuad->setSize($width, 4);
|
||||||
@ -202,7 +213,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$playerFrame->setY($y);
|
$playerFrame->setY($y);
|
||||||
|
|
||||||
// Team Emblem
|
// Team Emblem
|
||||||
if($listPlayer->teamId >= 0) {
|
if ($listPlayer->teamId >= 0) {
|
||||||
// Player is in a Team
|
// Player is in a Team
|
||||||
$teamQuad = new Quad_Emblems();
|
$teamQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($teamQuad);
|
$playerFrame->add($teamQuad);
|
||||||
@ -218,7 +229,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$teamQuad->setSubStyle($teamQuad::SUBSTYLE_2);
|
$teamQuad->setSubStyle($teamQuad::SUBSTYLE_2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if($listPlayer->isSpectator) {
|
} else if ($listPlayer->isSpectator) {
|
||||||
// Player is in Spectator Mode
|
// Player is in Spectator Mode
|
||||||
$specQuad = new Quad_BgRaceScore2();
|
$specQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($specQuad);
|
$playerFrame->add($specQuad);
|
||||||
@ -228,7 +239,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$specQuad->setSize(3.8, 3.8);
|
$specQuad->setSize(3.8, 3.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$listPlayer->isFakePlayer()) {
|
if (!$listPlayer->isFakePlayer()) {
|
||||||
// Nation Quad
|
// Nation Quad
|
||||||
$countryQuad = new Quad();
|
$countryQuad = new Quad();
|
||||||
$playerFrame->add($countryQuad);
|
$playerFrame->add($countryQuad);
|
||||||
@ -305,7 +316,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
$rightLabel->setTextColor("fff");
|
$rightLabel->setTextColor("fff");
|
||||||
|
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||||
// Further Player actions Quad
|
// Further Player actions Quad
|
||||||
$playerQuad = new Quad_Icons64x64_1();
|
$playerQuad = new Quad_Icons64x64_1();
|
||||||
$playerFrame->add($playerQuad);
|
$playerFrame->add($playerQuad);
|
||||||
@ -356,13 +367,13 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
}
|
}
|
||||||
$y -= 4;
|
$y -= 4;
|
||||||
$i++;
|
$i++;
|
||||||
if($i % self::MAX_PLAYERS_PER_PAGE == 0) {
|
if ($i % self::MAX_PLAYERS_PER_PAGE == 0) {
|
||||||
unset($pageFrame);
|
unset($pageFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show advanced window
|
// Show advanced window
|
||||||
if($this->playersListShown[$player->login] && $this->playersListShown[$player->login] != self::SHOWN_MAIN_WINDOW) {
|
if ($this->playersListShown[$player->login] && $this->playersListShown[$player->login] != self::SHOWN_MAIN_WINDOW) {
|
||||||
$frame = $this->showAdvancedPlayerWidget($this->playersListShown[$player->login]);
|
$frame = $this->showAdvancedPlayerWidget($this->playersListShown[$player->login]);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
}
|
}
|
||||||
@ -477,7 +488,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextSize($textSize);
|
$label->setTextSize($textSize);
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
if(!$this->maniaControl->playerManager->playerActions->isPlayerMuted($login)) {
|
if (!$this->maniaControl->playerManager->playerActions->isPlayerMuted($login)) {
|
||||||
$label->setText("Mute");
|
$label->setText("Mute");
|
||||||
$quad->setAction(self::ACTION_MUTE_PLAYER . "." . $login);
|
$quad->setAction(self::ACTION_MUTE_PLAYER . "." . $login);
|
||||||
} else {
|
} else {
|
||||||
@ -566,7 +577,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setText("Set Moderator");
|
$label->setText("Set Moderator");
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR)) {
|
||||||
$y -= 5;
|
$y -= 5;
|
||||||
// Revoke Rights
|
// Revoke Rights
|
||||||
$quad = clone $quad;
|
$quad = clone $quad;
|
||||||
@ -593,7 +604,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$player = $callback[1];
|
$player = $callback[1];
|
||||||
$openedWidget = $callback[2];
|
$openedWidget = $callback[2];
|
||||||
//unset when another main widget got opened
|
//unset when another main widget got opened
|
||||||
if($openedWidget != 'PlayerList') {
|
if ($openedWidget != 'PlayerList') {
|
||||||
unset($this->playersListShown[$player->login]);
|
unset($this->playersListShown[$player->login]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,7 +638,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
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) {
|
if (count($actionArray) <= 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,13 +711,13 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
*/
|
*/
|
||||||
public function updateWidget(array $callback) {
|
public function updateWidget(array $callback) {
|
||||||
foreach($this->playersListShown as $login => $shown) {
|
foreach($this->playersListShown as $login => $shown) {
|
||||||
if($shown) {
|
if ($shown) {
|
||||||
// Check if Shown player still exists
|
// Check if Shown player still exists
|
||||||
if($shown != self::SHOWN_MAIN_WINDOW && $this->maniaControl->playerManager->getPlayer($shown) == null) {
|
if ($shown != self::SHOWN_MAIN_WINDOW && $this->maniaControl->playerManager->getPlayer($shown) == null) {
|
||||||
$this->playersListShown[$login] = false;
|
$this->playersListShown[$login] = false;
|
||||||
}
|
}
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
if($player != null) {
|
if ($player != null) {
|
||||||
$this->showPlayerList($player);
|
$this->showPlayerList($player);
|
||||||
} else {
|
} else {
|
||||||
// if player with the open widget disconnected remove him from the shownlist
|
// if player with the open widget disconnected remove him from the shownlist
|
||||||
|
Loading…
Reference in New Issue
Block a user