pause button (wusste garnet dass es das wort pause auch im englishen gibt aber wabbit meinte dass is dort genauso, und break wär blöd^^)

This commit is contained in:
kremsy 2014-01-10 00:18:15 +01:00
parent fe3a57f66f
commit c8d45a14a4
3 changed files with 32 additions and 6 deletions

View File

@ -187,10 +187,6 @@ class ManiaExchangeInfoSearcher { //TODO rename to ManiaExchangeManager
$this->maniaControl->client->query('GetModeScriptInfo');
$scriptInfos = $this->maniaControl->client->getResponse();
/*
$this->maniaControl->client->query('SendModeScriptCommands', array('Command_ForceWarmUp' => True));
$test = $this->maniaControl->client->getResponse(); Just a test, and its working!*/
$mapTypes = $scriptInfos["CompatibleMapTypes"];
// compile search URL

View File

@ -85,7 +85,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
$itemQuad = new Quad_Icons64x64_1();
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ArrowFastNext);
$itemQuad->setAction(self::ACTION_SKIP_MAP);
$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 1, 'Skip Map');
$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 2, 'Skip Map');
}
/**

View File

@ -2,11 +2,14 @@
namespace ManiaControl\Server;
use FML\Controls\Quads\Quad_Icons128x32_1;
use FML\Controls\Quads\Quad_Icons64x64_1;
use ManiaControl\ManiaControl;
use ManiaControl\Admin\AuthenticationManager;
use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Commands\CommandListener;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
/**
@ -14,7 +17,12 @@ use ManiaControl\Players\Player;
*
* @author steeffeen & kremsy
*/
class ServerCommands implements CallbackListener, CommandListener {
class ServerCommands implements CallbackListener, CommandListener, ManialinkPageAnswerListener {
/**
* Constants
*/
const ACTION_SET_PAUSE = 'ServerCommands.SetPause';
/**
* Private properties
*/
@ -47,6 +55,28 @@ class ServerCommands implements CallbackListener, CommandListener {
$this->maniaControl->commandManager->registerCommandListener('disablemapdownload', $this, 'command_DisableMapDownload', true);
$this->maniaControl->commandManager->registerCommandListener('enablehorns', $this, 'command_EnableHorns', true);
$this->maniaControl->commandManager->registerCommandListener('disablehorns', $this, 'command_DisableHorns', true);
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_SET_PAUSE, $this, 'setPause');
//TODO correct class?
// Set Pause
$itemQuad = new Quad_Icons128x32_1(); //TODO check if mode supports it
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_ManiaLinkSwitch);
$itemQuad->setAction(self::ACTION_SET_PAUSE);
$this->maniaControl->actionsMenu->addAdminMenuItem($itemQuad, 1, 'Pauses the current map.');
}
/**
* Breaks the current game
* @param array $callback
*/
public function setPause(array $callback){
$this->maniaControl->client->query('SendModeScriptCommands', array('Command_ForceWarmUp' => True));
$success = $this->maniaControl->client->getResponse();
if(!$success)
$this->maniaControl->chat->sendError("Error while setting the break");
}
/**