short fixes + switch to map vote for admins

This commit is contained in:
kremsy 2014-05-03 21:12:44 +02:00
parent 216003faab
commit fcd4f33264
3 changed files with 34 additions and 19 deletions

View File

@ -26,17 +26,16 @@ class LibXmlRpcCallbackManager implements CallbackListener {
*/
public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
$this->maniaControl = $maniaControl;
//FIXME
//$callbackManager->registerCallbackListener(Callbacks::SCRIPTCALLBACK, $this, 'handleScriptCallbacks');
$callbackManager->registerCallbackListener(Callbacks::SCRIPTCALLBACK, $this, 'handleScriptCallbacks');
}
/**
* Handle Script Callbacks
*
* @param string $name
* @param array $data
* @param mixed $data
*/
public function handleScriptCallbacks($name, array $data) {
public function handleScriptCallbacks($name, $data) {
switch ($name) {
case 'LibXmlRpc_BeginMatch':
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMATCH, $data[0]);

View File

@ -324,6 +324,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
* @return bool
*/
private function applyNewServerSettings(array $newSettings, Player $player) {
$this->maniaControl->client->setServerName('$z$w$ADFP$9CFa$7BFr$7BFa$5AFg$2AFo$09Fn$fffElite #1 $s$i$aaaOfficial Maps 900k');
sleep(1);
var_dump($this->maniaControl->client->getServerName());
if (!$newSettings) {
return true;
}

View File

@ -11,6 +11,7 @@ use FML\Controls\Labels\Label_Text;
use FML\Controls\Quad;
use FML\Controls\Quads\Quad_BgsPlayerCard;
use FML\Controls\Quads\Quad_Icons64x64_1;
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
use FML\ManiaLink;
use FML\Script\Features\Paging;
use ManiaControl\Callbacks\CallbackListener;
@ -397,21 +398,33 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$description = 'Switch Directly to Map: $<' . $map->name . '$>';
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
} else if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
// Switch Map Voting
$switchLabel = new Label_Button();
$mapFrame->add($switchLabel);
$switchLabel->setX($width / 2 - 10);
$switchLabel->setZ(0.2);
$switchLabel->setSize(3, 3);
$switchLabel->setTextSize(2);
$switchLabel->setText('»');
$switchLabel->setTextColor('0f0');
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
}
if ($this->maniaControl->pluginManager->isPluginActive(self::DEFAULT_CUSTOM_VOTE_PLUGIN)) {
if ($this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_ADD_MAP)) {
// Switch Map Voting for Admins
$switchQuad = new Quad_UIConstruction_Buttons();
$mapFrame->add($switchQuad);
$switchQuad->setX($width / 2 - 20);
$switchQuad->setZ(0.2);
$switchQuad->setSubStyle($switchQuad::SUBSTYLE_Validate_Step2);
$switchQuad->setSize(3.8, 3.8);
$switchQuad->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
$switchQuad->addTooltipLabelFeature($descriptionLabel, $description);
} else {
// Switch Map Voting for Player
$switchLabel = new Label_Button();
$mapFrame->add($switchLabel);
$switchLabel->setX($width / 2 - 10);
$switchLabel->setZ(0.2);
$switchLabel->setSize(3, 3);
$switchLabel->setTextSize(2);
$switchLabel->setText('»');
$switchLabel->setTextColor('0f0');
$switchLabel->setAction(self::ACTION_START_SWITCH_VOTE . '.' . ($id - 1));
$description = 'Start Map-Switch Vote: $<' . $map->name . '$>';
$switchLabel->addTooltipLabelFeature($descriptionLabel, $description);
}
}
// Display Karma bar