map eraseing button in list

This commit is contained in:
kremsy 2013-12-16 13:14:26 +01:00
parent 11d966a6ca
commit 6f69ab30a0
2 changed files with 27 additions and 7 deletions

View File

@ -253,8 +253,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$eraseQuad->setZ(0.2); $eraseQuad->setZ(0.2);
$eraseQuad->setSize(4,4); $eraseQuad->setSize(4,4);
$eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase); $eraseQuad->setSubStyle($eraseQuad::SUBSTYLE_Erase);
$eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1)); $eraseQuad->setAction(self::ACTION_ERASE_MAP . "." .($id-1) . "." . $map->uid);
//TODO bestätigung?
//Description Label //Description Label
$descriptionLabel = new Label(); $descriptionLabel = new Label();
@ -276,7 +275,6 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$switchToQuad->setSize(4, 4); $switchToQuad->setSize(4, 4);
$switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext); $switchToQuad->setSubStyle($switchToQuad::SUBSTYLE_ArrowFastNext);
$switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1)); $switchToQuad->setAction(self::ACTION_SWITCH_MAP . "." .($id-1));
//TODO bestätigung?
$descriptionLabel = new Label(); $descriptionLabel = new Label();
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
@ -358,12 +356,19 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$actionArray = explode(".", $actionId); $actionArray = explode(".", $actionId);
$player = $this->maniaControl->playerManager->getPlayer($callback[1][1]);
if($addMap){ //TODO log and chat message if($addMap){ //TODO log and chat message
$this->maniaControl->mapManager->addMapFromMx($actionArray[2],$callback[1][1]); $this->maniaControl->mapManager->addMapFromMx($actionArray[2],$callback[1][1]); //TODO bestätigung
}else if($eraseMap){ }else if($eraseMap){ //TODO log and chat message
$this->maniaControl->mapManager->eraseMap(intval($actionArray[2]), $actionArray[3]); //TODO bestätigung
$this->showMapList($player);
}else if($switchMap){ //TODO log and chat message }else if($switchMap){ //TODO log and chat message
$this->maniaControl->client->query('JumpToMapIndex', intval($actionArray[2])); $this->maniaControl->client->query('JumpToMapIndex', intval($actionArray[2])); //TODO bestätigung
$mapList = $this->maniaControl->mapManager->getMapList();
$this->maniaControl->chat->sendSuccess('Map switched to $z$<' . $mapList[$actionArray[2]]->name . '$>!'); //TODO specified message, who done it?
$this->maniaControl->log('Skipped to $z$<' . $mapList[$actionArray[2]]->name . '$>!');
} }
} }

View File

@ -126,6 +126,21 @@ class MapManager implements CallbackListener {
return true; return true;
} }
/**
* Erases a Map
* @param $id
* @param $uid
*/
public function eraseMap($id, $uid) {
$map = $this->mapListUids[$uid];
$this->maniaControl->client->query('RemoveMap', $map->fileName);
$this->maniaControl->chat->sendSuccess('Map $<' . $map->name . '$> removed!'); //TODO specified message, who done it?
$this->maniaControl->log('Map $<' . $map->name . '$> removed!');
unset($this->mapListUids[$uid]);
unset($this->mapList[$id]);
}
/** /**
* Updates the full Map list, needed on Init, addMap and on ShuffleMaps * Updates the full Map list, needed on Init, addMap and on ShuffleMaps
* @return null * @return null