Added shadows to chatmessages

This commit is contained in:
Max Klaversma 2014-04-27 14:58:58 +02:00 committed by Steffen Schröder
parent a125deaf8d
commit 7e025c5626
3 changed files with 37 additions and 8 deletions

View File

@ -72,7 +72,7 @@ class Chat {
if (!$this->maniaControl->client) { if (!$this->maniaControl->client) {
return false; return false;
} }
$chatMessage = '$z$<' . $this->getPrefix($prefix) . $message . '$>$z'; $chatMessage = '$z$s$<' . $this->getPrefix($prefix) . $message . '$>$z$s';
if (!$login) { if (!$login) {
$this->maniaControl->client->chatSendServerMessage($chatMessage); $this->maniaControl->client->chatSendServerMessage($chatMessage);
} else { } else {

View File

@ -51,7 +51,7 @@ class HelpManager implements CommandListener, CallbackListener {
*/ */
public function command_adminHelp(array $chat, Player $player) { public function command_adminHelp(array $chat, Player $player) {
//TODO only show first command in command arrays //TODO only show first command in command arrays
$message = '$sSupported Admin Commands: '; $message = 'Supported Admin Commands: ';
foreach(array_reverse($this->adminCommands) as $command) { foreach(array_reverse($this->adminCommands) as $command) {
$message .= $command['Name'] . ','; $message .= $command['Name'] . ',';
} }
@ -67,7 +67,7 @@ class HelpManager implements CommandListener, CallbackListener {
*/ */
public function command_playerHelp(array $chat, Player $player) { public function command_playerHelp(array $chat, Player $player) {
//TODO only show first command in command arrays //TODO only show first command in command arrays
$message = '$sSupported Player Commands: '; $message = 'Supported Player Commands: ';
foreach(array_reverse($this->playerCommands) as $command) { foreach(array_reverse($this->playerCommands) as $command) {
$message .= $command['Name'] . ','; $message .= $command['Name'] . ',';
} }

View File

@ -52,8 +52,9 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
/* /*
* Private Properties * Private Properties
*/ */
private $maniaControl = null; private $maniaControl = null;
private $mapListShown = array(); private $mapListShown = array();
private $mapsInListShown = array();
/** /**
* Create a new MapList Instance * Create a new MapList Instance
@ -67,7 +68,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget'); $this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this, 'closeWidget');
$this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened'); $this->maniaControl->callbackManager->registerCallbackListener(ManialinkManager::CB_MAIN_WINDOW_OPENED, $this, 'handleWidgetOpened');
$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(MapQueue::CB_MAPQUEUE_CHANGED, $this, 'updateWidgetQueue');
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_MAPS_UPDATED, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_KARMA_UPDATED, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_BEGINMAP, $this, 'updateWidget'); $this->maniaControl->callbackManager->registerCallbackListener(MapManager::CB_BEGINMAP, $this, 'updateWidget');
@ -107,14 +108,24 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
* *
* @param Player $player * @param Player $player
*/ */
public function showMapList(Player $player) { public function showMapList(Player $player, $maps = null) {
$width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth(); $width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
$height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight(); $height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
$this->mapListShown[$player->login] = true; $this->mapListShown[$player->login] = true;
// Get Maps // Get Maps
$mapList = $this->maniaControl->mapManager->getMaps(); if(is_null($maps) && $maps != 'redirect') {
$mapList = $this->maniaControl->mapManager->getMaps();
} else {
if(array_key_exists($player->login, $this->mapsInListShown) && $maps == 'redirect') {
$mapList = $this->mapsInListShown[$player->login];
} else {
$mapList = $maps;
}
}
$this->mapsInListShown[$player->login] = $mapList;
$pagesId = ''; $pagesId = '';
if (count($mapList) > self::MAX_MAPS_PER_PAGE) { if (count($mapList) > self::MAX_MAPS_PER_PAGE) {
@ -563,9 +574,11 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
break; break;
case self::ACTION_QUEUED_MAP: case self::ACTION_QUEUED_MAP:
$this->maniaControl->mapManager->mapQueue->addMapToMapQueue($callback[1][1], $actionArray[2]); $this->maniaControl->mapManager->mapQueue->addMapToMapQueue($callback[1][1], $actionArray[2]);
$this->showMapList($player, 'redirect');
break; break;
case self::ACTION_UNQUEUE_MAP: case self::ACTION_UNQUEUE_MAP:
$this->maniaControl->mapManager->mapQueue->removeFromMapQueue($player, $actionArray[2]); $this->maniaControl->mapManager->mapQueue->removeFromMapQueue($player, $actionArray[2]);
$this->showMapList($player, 'redirect');
break; break;
} }
} }
@ -585,4 +598,20 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
} }
} }
} }
/**
* Reopen the widget on MapQueue changed
*/
public function updateWidgetQueue() {
foreach($this->mapListShown as $login => $shown) {
if ($shown) {
$player = $this->maniaControl->playerManager->getPlayer($login);
if ($player) {
$this->showMapList($player, 'redirect');
} else {
unset($this->mapListShown[$login]);
}
}
}
}
} }