close main widget callback by manialinkmanager
This commit is contained in:
parent
8827251738
commit
2c8eeb2bbd
@ -27,6 +27,8 @@ class ManialinkManager implements ManialinkPageAnswerListener,CallbackListener {
|
|||||||
*/
|
*/
|
||||||
const MAIN_MLID = 'Main.ManiaLinkId';
|
const MAIN_MLID = 'Main.ManiaLinkId';
|
||||||
const ACTION_CLOSEWIDGET = 'ManiaLinkManager.CloseWidget';
|
const ACTION_CLOSEWIDGET = 'ManiaLinkManager.CloseWidget';
|
||||||
|
const CB_MAIN_WINDOW_CLOSED = 'ManialinkManagerCallback.MainWindowClosed';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public properties
|
* Public properties
|
||||||
*/
|
*/
|
||||||
@ -183,7 +185,7 @@ class ManialinkManager implements ManialinkPageAnswerListener,CallbackListener {
|
|||||||
//render and display xml
|
//render and display xml
|
||||||
$maniaLinkText = $maniaLink->render()->saveXML();
|
$maniaLinkText = $maniaLink->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($maniaLinkText, $player->login);
|
$this->maniaControl->manialinkManager->sendManialink($maniaLinkText, $player->login);
|
||||||
$this->maniaControl->manialinkManager->disableAltMenu($player);
|
$this->disableAltMenu($player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -204,8 +206,10 @@ class ManialinkManager implements ManialinkPageAnswerListener,CallbackListener {
|
|||||||
$emptyManialink = new ManiaLink(self::MAIN_MLID);
|
$emptyManialink = new ManiaLink(self::MAIN_MLID);
|
||||||
$manialinkText = $emptyManialink->render()->saveXML();
|
$manialinkText = $emptyManialink->render()->saveXML();
|
||||||
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
$this->maniaControl->manialinkManager->sendManialink($manialinkText, $player->login);
|
||||||
$this->maniaControl->manialinkManager->enableAltMenu($player);
|
$this->enableAltMenu($player);
|
||||||
//unset($this->playersMenuShown[$player->login]);
|
|
||||||
|
// Trigger callback
|
||||||
|
$this->maniaControl->callbackManager->triggerCallback(self::CB_MAIN_WINDOW_CLOSED, array(self::CB_MAIN_WINDOW_CLOSED, $player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Players;
|
namespace ManiaControl\Players;
|
||||||
|
|
||||||
|
|
||||||
use FML\Controls\Control;
|
use FML\Controls\Control;
|
||||||
use FML\Controls\Frame;
|
use FML\Controls\Frame;
|
||||||
use FML\Controls\Label;
|
use FML\Controls\Label;
|
||||||
@ -10,12 +9,9 @@ use FML\Controls\Labels\Label_Button;
|
|||||||
use FML\Controls\Labels\Label_Text;
|
use FML\Controls\Labels\Label_Text;
|
||||||
use FML\Controls\Quad;
|
use FML\Controls\Quad;
|
||||||
use FML\Controls\Quads\Quad_BgRaceScore2;
|
use FML\Controls\Quads\Quad_BgRaceScore2;
|
||||||
use FML\Controls\Quads\Quad_Bgs1;
|
|
||||||
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
use FML\Controls\Quads\Quad_BgsPlayerCard;
|
||||||
use FML\Controls\Quads\Quad_Emblems;
|
use FML\Controls\Quads\Quad_Emblems;
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
use FML\Controls\Quads\Quad_Icons64x64_2;
|
|
||||||
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use FML\Script\Script;
|
use FML\Script\Script;
|
||||||
use FML\Script\Tooltips;
|
use FML\Script\Tooltips;
|
||||||
@ -31,7 +27,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
const ACTION_CLOSEWIDGET = 'PlayerList.CloseWidget';
|
|
||||||
const ACTION_FORCE_RED = 'PlayerList.ForceRed';
|
const ACTION_FORCE_RED = 'PlayerList.ForceRed';
|
||||||
const ACTION_FORCE_BLUE = 'PlayerList.ForceBlue';
|
const ACTION_FORCE_BLUE = 'PlayerList.ForceBlue';
|
||||||
const ACTION_FORCE_SPEC = 'PlayerList.ForceSpec';
|
const ACTION_FORCE_SPEC = 'PlayerList.ForceSpec';
|
||||||
@ -63,7 +58,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLOSEWIDGET , $this,
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(ManialinkManager::CB_MAIN_WINDOW_CLOSED, $this,
|
||||||
'closeWidget');
|
'closeWidget');
|
||||||
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLOSE_PLAYER_ADV , $this,
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLOSE_PLAYER_ADV , $this,
|
||||||
'closePlayerAdvancedWidget');
|
'closePlayerAdvancedWidget');
|
||||||
@ -111,7 +106,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$closeQuad->setPosition($this->width * 0.483, $this->height * 0.467, 3);
|
$closeQuad->setPosition($this->width * 0.483, $this->height * 0.467, 3);
|
||||||
$closeQuad->setSize(6, 6);
|
$closeQuad->setSize(6, 6);
|
||||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
||||||
$closeQuad->setAction(self::ACTION_CLOSEWIDGET );
|
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
||||||
|
|
||||||
//Start offsets
|
//Start offsets
|
||||||
$x = -$this->width / 2;
|
$x = -$this->width / 2;
|
||||||
@ -492,7 +487,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
*/
|
*/
|
||||||
public function closeWidget(array $callback, Player $player) {
|
public function closeWidget(array $callback, Player $player) {
|
||||||
$this->playersListShown[$player->login] = false; //TODO unset
|
$this->playersListShown[$player->login] = false; //TODO unset
|
||||||
$this->maniaControl->manialinkManager->closeWidget($player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -503,6 +497,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
*/
|
*/
|
||||||
public function closePlayerAdvancedWidget(array $callback, Player $player) {
|
public function closePlayerAdvancedWidget(array $callback, Player $player) {
|
||||||
$this->showPlayerList($player); //overwrite the manialink
|
$this->showPlayerList($player); //overwrite the manialink
|
||||||
|
//TODO remove double rendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +162,6 @@ class PlayerManager implements CallbackListener {
|
|||||||
|
|
||||||
|
|
||||||
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES)) {
|
if ($this->maniaControl->settingManager->getSetting($this, self::SETTING_JOIN_LEAVE_MESSAGES)) {
|
||||||
//$this->maniaControl->chat->sendChat('$<' . $player->nickname . '$> $ff0left the game. Played:$fff ' . $played);
|
|
||||||
$this->maniaControl->chat->sendChat('$<' . $player->nickname . '$> $s$0f0has left the game');
|
$this->maniaControl->chat->sendChat('$<' . $player->nickname . '$> $s$0f0has left the game');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user