small fixes
This commit is contained in:
parent
6d2aa1b487
commit
a7212c13c5
@ -59,8 +59,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
|
||||
// Register for Callbacks
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||
'handleManialinkPageAnswer');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget');
|
||||
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget');
|
||||
@ -95,15 +94,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
if(strtolower(substr($param, 0, 5)) == 'auth:') {
|
||||
$author = substr($param, 5);
|
||||
}
|
||||
elseif (strtolower(substr($param, 0, 4)) == 'env:') {
|
||||
} elseif(strtolower(substr($param, 0, 4)) == 'env:') {
|
||||
$environment = substr($param, 4);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if($mapName == '') {
|
||||
$mapName = $param;
|
||||
}
|
||||
else { // concatenate words in name
|
||||
} else { // concatenate words in name
|
||||
$mapName .= '%20' . $param;
|
||||
}
|
||||
}
|
||||
@ -280,8 +276,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$frame->add($headFrame);
|
||||
$headFrame->setY($height / 2 - 5);
|
||||
$x = -$width / 2;
|
||||
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115,
|
||||
'Actions' => $width / 2 - 15);
|
||||
$array = array('Id' => $x + 5, 'Mx Id' => $x + 10, 'Map Name' => $x + 20, 'Author' => $x + 68, 'Karma' => $x + 115, 'Actions' => $width / 2 - 15);
|
||||
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||
|
||||
// Predefine Description Label
|
||||
@ -368,8 +363,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$label->setText($queuedMaps[$map->uid]);
|
||||
$label->setTextColor('fff');
|
||||
$descriptionLabel->setText('$<' . $map->name . '$> is on Map-Queue Position: ' . $queuedMaps[$map->uid]);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Map-Queue-Map-Button
|
||||
$queueLabel = new Label_Button();
|
||||
$mapFrame->add($queueLabel);
|
||||
@ -463,7 +457,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
}
|
||||
$id++;
|
||||
}
|
||||
// TODO page 0 bug?
|
||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
||||
}
|
||||
|
||||
@ -515,8 +508,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$buttLabel->setText('»');
|
||||
$buttLabel->setTextColor('0f0');
|
||||
$buttLabel->setTextSize(2);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$buttLabel->setTextSize(1);
|
||||
$buttLabel->setText('x');
|
||||
$buttLabel->setTextColor('a00');
|
||||
@ -553,7 +545,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
public function handleManialinkPageAnswer(array $callback) {
|
||||
$actionId = $callback[1][2];
|
||||
$actionArray = explode('.', $actionId);
|
||||
if (count($actionArray) <= 2) return;
|
||||
if(count($actionArray) <= 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
$action = $actionArray[0] . '.' . $actionArray[1];
|
||||
$login = $callback[1][1];
|
||||
@ -565,12 +559,12 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$this->maniaControl->mapManager->addMapFromMx($mapId, $player->login);
|
||||
break;
|
||||
case self::ACTION_ERASE_MAP:
|
||||
$this->maniaControl->mapManager->eraseMap($mapId, $actionArray[3]);
|
||||
$this->maniaControl->mapManager->removeMap($mapId, $actionArray[3]);
|
||||
$this->showMapList($player);
|
||||
break;
|
||||
case self::ACTION_SWITCH_MAP:
|
||||
$this->maniaControl->client->query('JumpToMapIndex', $mapId);
|
||||
$mapList = $this->maniaControl->mapManager->getMapList();
|
||||
$mapList = $this->maniaControl->mapManager->getMaps();
|
||||
$map = $mapList[$mapId];
|
||||
|
||||
$message = '$<' . $player->nickname . '$> skipped to Map $z$<' . $map->name . '$>!';
|
||||
@ -597,12 +591,10 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
if($player != null) {
|
||||
if($shown == self::SHOW_MX_LIST) {
|
||||
//TODO
|
||||
}
|
||||
else if ($shown == self::SHOW_MAP_LIST) {
|
||||
} else if($shown == self::SHOW_MAP_LIST) {
|
||||
$this->showMapList($player);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
unset($this->mapListShown[$login]);
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,10 @@
|
||||
|
||||
namespace ManiaControl\Maps;
|
||||
|
||||
use ManiaControl\FileUtil;
|
||||
use ManiaControl\Formatter;
|
||||
use ManiaControl\ManiaControl;
|
||||
use ManiaControl\Callbacks\CallbackListener;
|
||||
use ManiaControl\Callbacks\CallbackManager;
|
||||
use ManiaControl\FileUtil;
|
||||
use ManiaControl\ManiaControl;
|
||||
|
||||
require_once __DIR__ . '/Map.php';
|
||||
require_once __DIR__ . '/MapCommands.php';
|
||||
@ -131,7 +130,7 @@ class MapManager implements CallbackListener {
|
||||
* @param string $uid
|
||||
* @param bool $eraseFile
|
||||
*/
|
||||
public function removeMap($id, $uid, $eraseFile = false) {
|
||||
public function removeMap($id, $uid, $eraseFile = false) { //TODO erasefile?
|
||||
$map = $this->mapsUids[$uid];
|
||||
$this->maniaControl->client->query('RemoveMap', $map->fileName);
|
||||
$this->maniaControl->chat->sendSuccess('Map $<' . $map->name . '$> removed!');
|
||||
@ -157,8 +156,7 @@ class MapManager implements CallbackListener {
|
||||
if(array_key_exists($rpcMap["UId"], $this->mapsUids)) {
|
||||
// Map already exists, only update index
|
||||
$tempList[] = $this->mapsUids[$rpcMap["UId"]];
|
||||
}
|
||||
else { // Insert Map Object
|
||||
} else { // Insert Map Object
|
||||
$map = new Map($this->maniaControl, $rpcMap);
|
||||
$this->saveMap($map);
|
||||
$tempList[] = $map;
|
||||
@ -237,8 +235,7 @@ class MapManager implements CallbackListener {
|
||||
if(array_key_exists($callback[1][0]["UId"], $this->mapsUids)) {
|
||||
// Map already exists, only update index
|
||||
$this->currentMap = $this->mapsUids[$callback[1][0]["UId"]];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// can this ever happen?
|
||||
$this->fetchCurrentMap();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user