update widget playerlist properties

This commit is contained in:
kremsy 2013-12-23 21:52:30 +01:00
parent b72e036cf7
commit 5926a06654

View File

@ -69,8 +69,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
'closePlayerAdvancedWidget'); 'closePlayerAdvancedWidget');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, $this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
'handleManialinkPageAnswer'); 'handleManialinkPageAnswer');
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'playerInfoChanged'); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERCONNECT, $this, 'updateWidget');
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERDISCONNECT, $this, 'updateWidget');
//settings //settings
$this->width = 150; $this->width = 150;
$this->height = 80; $this->height = 80;
@ -551,10 +552,10 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
} }
/** /**
* Reopen the widget on PlayerInfoChanged * Reopen the widget on PlayerInfoChanged / Player Connect and Disconnect
* @param array $callback * @param array $callback
*/ */
public function playerInfoChanged(array $callback){ public function updateWidget(array $callback){
foreach($this->playersListShown as $login => $shown){ foreach($this->playersListShown as $login => $shown){
if($shown == true){ if($shown == true){
$player = $this->maniaControl->playerManager->getPlayer($login); $player = $this->maniaControl->playerManager->getPlayer($login);