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) { public function __construct(ManiaControl $maniaControl, CallbackManager $callbackManager) {
$this->maniaControl = $maniaControl; $this->maniaControl = $maniaControl;
//FIXME $callbackManager->registerCallbackListener(Callbacks::SCRIPTCALLBACK, $this, 'handleScriptCallbacks');
//$callbackManager->registerCallbackListener(Callbacks::SCRIPTCALLBACK, $this, 'handleScriptCallbacks');
} }
/** /**
* Handle Script Callbacks * Handle Script Callbacks
* *
* @param string $name * @param string $name
* @param array $data * @param mixed $data
*/ */
public function handleScriptCallbacks($name, array $data) { public function handleScriptCallbacks($name, $data) {
switch ($name) { switch ($name) {
case 'LibXmlRpc_BeginMatch': case 'LibXmlRpc_BeginMatch':
$this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMATCH, $data[0]); $this->maniaControl->callbackManager->triggerCallback(Callbacks::BEGINMATCH, $data[0]);

View File

@ -324,6 +324,9 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
* @return bool * @return bool
*/ */
private function applyNewServerSettings(array $newSettings, Player $player) { 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) { if (!$newSettings) {
return true; return true;
} }

View File

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