removed old jukebox labels
This commit is contained in:
parent
060211204d
commit
f23001e1fc
@ -6,13 +6,9 @@ use FML\Controls\Gauge;
|
|||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
use FML\Controls\Labels\Label_Button;
|
use FML\Controls\Labels\Label_Button;
|
||||||
use FML\Controls\Labels\Label_Text;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Quads\Quad_Bgs1;
|
|
||||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||||
use FML\Controls\Quads\Quad_Icons128x128_1;
|
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\Tooltips;
|
|
||||||
use KarmaPlugin;
|
use KarmaPlugin;
|
||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
@ -23,7 +19,6 @@ use ManiaControl\Manialinks\ManialinkManager;
|
|||||||
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Quad;
|
use FML\Controls\Quad;
|
||||||
use FML\Controls\Quads\Quad_BgRaceScore2;
|
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
@ -43,7 +38,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
const ACTION_ADD_MAP = 'MapList.AddMap';
|
const ACTION_ADD_MAP = 'MapList.AddMap';
|
||||||
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
const ACTION_ERASE_MAP = 'MapList.EraseMap';
|
||||||
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
const ACTION_SWITCH_MAP = 'MapList.SwitchMap';
|
||||||
const ACTION_JUKE_MAP = 'MapList.JukeMap';
|
const ACTION_QUEUED_MAP = 'MapList.QueueMap';
|
||||||
const MAX_MAPS_PER_PAGE = 15;
|
const MAX_MAPS_PER_PAGE = 15;
|
||||||
const SHOW_MX_LIST = 1;
|
const SHOW_MX_LIST = 1;
|
||||||
const SHOW_MAP_LIST = 2;
|
const SHOW_MAP_LIST = 2;
|
||||||
@ -257,7 +252,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
//TODO add pages
|
//TODO add pages
|
||||||
|
|
||||||
$jukedMaps = $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);
|
||||||
|
|
||||||
@ -302,7 +297,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
//TODO side switch
|
//TODO side switch
|
||||||
|
|
||||||
|
|
||||||
//Jukebox Description Label
|
//MapQueue Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -311,40 +306,37 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$descriptionLabel->setTextSize(2);
|
$descriptionLabel->setTextSize(2);
|
||||||
$descriptionLabel->setVisible(false);
|
$descriptionLabel->setVisible(false);
|
||||||
|
|
||||||
//Juke-Map-Label
|
//Map-Queue-Map-Label
|
||||||
if(isset($jukedMaps[$map->uid])){
|
if(isset($queuedMaps[$map->uid])){
|
||||||
$jukeLabel = new Label_Text();
|
$label = new Label_Text();
|
||||||
$mapFrame->add($jukeLabel);
|
$mapFrame->add($label);
|
||||||
$jukeLabel->setX($this->width/2 - 15);
|
$label->setX($this->width/2 - 15);
|
||||||
$jukeLabel->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER,Control::CENTER);
|
||||||
$jukeLabel->setZ(0.2);
|
$label->setZ(0.2);
|
||||||
$jukeLabel->setTextSize(1.5);
|
$label->setTextSize(1.5);
|
||||||
$jukeLabel->setText($jukedMaps[$map->uid]);
|
$label->setText($queuedMaps[$map->uid]);
|
||||||
$jukeLabel->setTextColor("FFF");
|
$label->setTextColor("FFF");
|
||||||
|
|
||||||
$descriptionLabel->setText("{$map->name} \$zis on Jukebox Position: {$jukedMaps[$map->uid]}");
|
$descriptionLabel->setText("{$map->name} \$zis on Map-Queue Position: {$queuedMaps[$map->uid]}");
|
||||||
//$tooltips->add($jukeLabel, $descriptionLabel);
|
//$tooltips->add($jukeLabel, $descriptionLabel);
|
||||||
}else{
|
}else{
|
||||||
//Juke-Map-Button
|
//Map-Queue-Map-Button
|
||||||
//$jukeQuad = new Quad_Icons128x128_1();
|
$buttLabel = new Label_Button();
|
||||||
$jukeQuad = new Label_Button();
|
$mapFrame->add($buttLabel);
|
||||||
$mapFrame->add($jukeQuad);
|
$buttLabel->setX($this->width/2 - 15);
|
||||||
$jukeQuad->setX($this->width/2 - 15);
|
$buttLabel->setZ(0.2);
|
||||||
$jukeQuad->setZ(0.2);
|
$buttLabel->setSize(3,3);
|
||||||
$jukeQuad->setSize(3,3);
|
$buttLabel->setAction(self::ACTION_QUEUED_MAP . "." . $map->uid);
|
||||||
// $jukeQuad->setSubStyle($jukeQuad::SUBSTYLE_Load);
|
$buttLabel->setText("+");
|
||||||
$jukeQuad->setAction(self::ACTION_JUKE_MAP . "." . $map->uid);
|
$buttLabel->setTextColor("09F");
|
||||||
$jukeQuad->setText("+");
|
|
||||||
$jukeQuad->setTextColor("09F");
|
|
||||||
|
|
||||||
|
|
||||||
$descriptionLabel->setText("Add Map to Jukebox: {$map->name}");
|
$descriptionLabel->setText("Add Map to the Map Queue: {$map->name}");
|
||||||
$script->addTooltip($jukeQuad, $descriptionLabel);
|
$script->addTooltip($buttLabel, $descriptionLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //TODO SET as setting who can add maps
|
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)){ //TODO SET as setting who can add maps
|
||||||
//erase map quad
|
//erase map quad
|
||||||
//$eraseQuad = new Quad_UIConstruction_Buttons();
|
|
||||||
$eraseQuad = new Label_Button(); //TODO change name to label
|
$eraseQuad = new Label_Button(); //TODO change name to label
|
||||||
$mapFrame->add($eraseQuad);
|
$mapFrame->add($eraseQuad);
|
||||||
$eraseQuad->setX($this->width/2 - 5);
|
$eraseQuad->setX($this->width/2 - 5);
|
||||||
@ -353,7 +345,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$eraseQuad->setTextSize(1);
|
$eraseQuad->setTextSize(1);
|
||||||
$eraseQuad->setText("x");
|
$eraseQuad->setText("x");
|
||||||
$eraseQuad->setTextColor("A00");
|
$eraseQuad->setTextColor("A00");
|
||||||
//$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase);
|
|
||||||
$eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid);
|
$eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid);
|
||||||
|
|
||||||
//Description Label
|
//Description Label
|
||||||
@ -451,9 +442,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$addMap = (strpos($actionId, self::ACTION_ADD_MAP) === 0);
|
$addMap = (strpos($actionId, self::ACTION_ADD_MAP) === 0);
|
||||||
$eraseMap = (strpos($actionId, self::ACTION_ERASE_MAP) === 0);
|
$eraseMap = (strpos($actionId, self::ACTION_ERASE_MAP) === 0);
|
||||||
$switchMap = (strpos($actionId, self::ACTION_SWITCH_MAP) === 0);
|
$switchMap = (strpos($actionId, self::ACTION_SWITCH_MAP) === 0);
|
||||||
$jukeMap = (strpos($actionId, self::ACTION_JUKE_MAP) === 0);
|
$queueMap = (strpos($actionId, self::ACTION_QUEUED_MAP) === 0);
|
||||||
|
|
||||||
if(!$addMap && !$eraseMap && !$switchMap && !$jukeMap)
|
if(!$addMap && !$eraseMap && !$switchMap && !$queueMap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$actionArray = explode(".", $actionId);
|
$actionArray = explode(".", $actionId);
|
||||||
@ -471,8 +462,8 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
$this->maniaControl->chat->sendSuccess('Map switched to $z$<' . $mapList[$actionArray[2]]->name . '$>!'); //TODO specified message, who done it?
|
$this->maniaControl->chat->sendSuccess('Map switched to $z$<' . $mapList[$actionArray[2]]->name . '$>!'); //TODO specified message, who done it?
|
||||||
$this->maniaControl->log(Formatter::stripCodes('Skipped to $z$<' . $mapList[$actionArray[2]]->name . '$>!'));
|
$this->maniaControl->log(Formatter::stripCodes('Skipped to $z$<' . $mapList[$actionArray[2]]->name . '$>!'));
|
||||||
}else if($jukeMap){
|
}else if($queueMap){
|
||||||
$this->maniaControl->mapManager->jukebox->addMapToJukebox($callback[1][1], $actionArray[2]);
|
$this->maniaControl->mapManager->mapQueue->addMapToMapQueue($callback[1][1], $actionArray[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
private $nextMap = null;
|
private $nextMap = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new server jukebox
|
* Create a new server MapQueue
|
||||||
*
|
*
|
||||||
* @param ManiaControl $maniaControl
|
* @param ManiaControl $maniaControl
|
||||||
*/
|
*/
|
||||||
@ -51,14 +51,14 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the map-queue via admin command clearjukebox
|
* Clears the map-queue via admin command clearmap queue
|
||||||
* @param array $chat
|
* @param array $chat
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function command_ClearMapQueue(array $chat, Player $admin){
|
public function command_ClearMapQueue(array $chat, Player $admin){
|
||||||
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
|
$title = $this->maniaControl->authenticationManager->getAuthLevelName($admin->authLevel);
|
||||||
|
|
||||||
//Destroy jukebox list
|
//Destroy map - queue list
|
||||||
$this->queuedMaps = array();
|
$this->queuedMaps = array();
|
||||||
|
|
||||||
$this->maniaControl->chat->sendInformation($title . ' $<' . $admin->nickname . '$> cleared the Queued-Map list!');
|
$this->maniaControl->chat->sendInformation($title . ' $<' . $admin->nickname . '$> cleared the Queued-Map list!');
|
||||||
@ -88,7 +88,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
|
|
||||||
$this->queuedMaps[$uid] = array($player, $map);
|
$this->queuedMaps[$uid] = array($player, $map);
|
||||||
|
|
||||||
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> added $<' . $map->name . '$> to the Map-Queue');
|
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> added $<' . $map->name . '$> to the Map Queue');
|
||||||
|
|
||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('add', $this->queuedMaps[$uid]));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('add', $this->queuedMaps[$uid]));
|
||||||
@ -123,7 +123,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_SKIP_MAPQUEUE_ADMIN) == FALSE){
|
if($this->maniaControl->settingManager->getSetting($this, self::SETTING_SKIP_MAPQUEUE_ADMIN) == FALSE){
|
||||||
//Check if the juker is a admin
|
//Check if the queuer is a admin
|
||||||
if($player->authLevel > 0){
|
if($player->authLevel > 0){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
// Trigger callback
|
// Trigger callback
|
||||||
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('skip', $queuedMap[0]));
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAPQUEUE_CHANGED, array('skip', $queuedMap[0]));
|
||||||
|
|
||||||
//Player not found, so remove the map from the jukebox
|
//Player not found, so remove the map from the mapqueue
|
||||||
array_shift($this->queuedMaps);
|
array_shift($this->queuedMaps);
|
||||||
|
|
||||||
$this->maniaControl->chat->sendInformation('Requested Map skipped because $<' . $player->nickname . '$> left!');
|
$this->maniaControl->chat->sendInformation('Requested Map skipped because $<' . $player->nickname . '$> left!');
|
||||||
@ -141,7 +141,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
|
|
||||||
$this->nextMap = array_shift($this->queuedMaps);
|
$this->nextMap = array_shift($this->queuedMaps);
|
||||||
|
|
||||||
//Check if Jukebox is empty
|
//Check if Map Queue is empty
|
||||||
if($this->nextMap == null)
|
if($this->nextMap == null)
|
||||||
return;
|
return;
|
||||||
$map = $this->nextMap[1];
|
$map = $this->nextMap[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user