PlayerList Profile Opening
This commit is contained in:
parent
8db3b2daf4
commit
fd7a229e2c
@ -233,6 +233,8 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
$style = Label_Text::STYLE_TextCardSmall;
|
$style = Label_Text::STYLE_TextCardSmall;
|
||||||
$textSize = 1.5;
|
$textSize = 1.5;
|
||||||
$textColor = 'FFF';
|
$textColor = 'FFF';
|
||||||
|
$profile = (isset($properties['profile']) ? $properties['profile'] : false);
|
||||||
|
$script = (isset($properties['script']) ? $properties['script'] : null);
|
||||||
|
|
||||||
$frames = array();
|
$frames = array();
|
||||||
foreach ($labelStrings as $text => $x) {
|
foreach ($labelStrings as $text => $x) {
|
||||||
@ -245,6 +247,10 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
|
|||||||
$label->setText($text);
|
$label->setText($text);
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
|
if ($profile) {
|
||||||
|
$script->addProfileButton($label, $profile);
|
||||||
|
}
|
||||||
|
|
||||||
$frames[] = $frame; // add Frame to the frames array
|
$frames[] = $frame; // add Frame to the frames array
|
||||||
}
|
}
|
||||||
return $frames;
|
return $frames;
|
||||||
|
@ -36,7 +36,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
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';
|
||||||
|
|
||||||
const ACTION_PLAYER_ADV = 'PlayerList.PlayerAdvancedActions';
|
const ACTION_PLAYER_ADV = 'PlayerList.PlayerAdvancedActions';
|
||||||
const ACTION_CLOSE_PLAYER_ADV = 'PlayerList.ClosePlayerAdvWidget';
|
const ACTION_CLOSE_PLAYER_ADV = 'PlayerList.ClosePlayerAdvWidget';
|
||||||
const ACTION_WARN_PLAYER = 'PlayerList.WarnPlayer';
|
const ACTION_WARN_PLAYER = 'PlayerList.WarnPlayer';
|
||||||
@ -46,7 +45,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
const ACTION_ADD_AS_ADMIN = 'PlayerList.PlayerAddAsAdmin';
|
const ACTION_ADD_AS_ADMIN = 'PlayerList.PlayerAddAsAdmin';
|
||||||
const ACTION_ADD_AS_MOD = 'PlayerList.PlayerAddAsModerator';
|
const ACTION_ADD_AS_MOD = 'PlayerList.PlayerAddAsModerator';
|
||||||
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
|
const ACTION_REVOKE_RIGHTS = 'PlayerList.RevokeRights';
|
||||||
|
|
||||||
const SHOWN_MAIN_WINDOW = -1;
|
const SHOWN_MAIN_WINDOW = -1;
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
@ -66,45 +64,47 @@ 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_CLOSE_PLAYER_ADV , $this, 'closePlayerAdvancedWidget');
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_CLOSE_PLAYER_ADV, $this,
|
||||||
|
'closePlayerAdvancedWidget');
|
||||||
$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(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this, 'handleManialinkPageAnswer');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERMANIALINKPAGEANSWER, $this,
|
||||||
|
'handleManialinkPageAnswer');
|
||||||
|
|
||||||
//Update Widget Events
|
// Update Widget Events
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERINFOCHANGED, $this, 'updateWidget');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'updateWidget');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'updateWidget');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'updateWidget');
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'updateWidget');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this, 'updateWidget');
|
$this->maniaControl->callbackManager->registerCallbackListener(AuthenticationManager::CB_AUTH_LEVEL_CHANGED, $this,
|
||||||
|
'updateWidget');
|
||||||
|
|
||||||
//settings
|
// settings
|
||||||
$this->width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
$this->width = $this->maniaControl->manialinkManager->styleManager->getListWidgetsWidth();
|
||||||
$this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
$this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
|
||||||
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
||||||
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addPlayerToShownList(Player $player, $showStatus = self::SHOWN_MAIN_WINDOW){
|
public function addPlayerToShownList(Player $player, $showStatus = self::SHOWN_MAIN_WINDOW) {
|
||||||
$this->playersListShown[$player->login] = $showStatus;
|
$this->playersListShown[$player->login] = $showStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showPlayerList(Player $player){
|
public function showPlayerList(Player $player) {
|
||||||
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
$maniaLink = new ManiaLink(ManialinkManager::MAIN_MLID);
|
||||||
|
|
||||||
// Create script and features
|
// Create script and features
|
||||||
$script = new Script();
|
$script = new Script();
|
||||||
$maniaLink->setScript($script);
|
$maniaLink->setScript($script);
|
||||||
|
|
||||||
//mainframe
|
// mainframe
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
$frame->setSize($this->width,$this->height);
|
$frame->setSize($this->width, $this->height);
|
||||||
$frame->setPosition(0, 0);
|
$frame->setPosition(0, 0);
|
||||||
|
|
||||||
//Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
$backgroundQuad->setSize($this->width,$this->height);
|
$backgroundQuad->setSize($this->width, $this->height);
|
||||||
$backgroundQuad->setStyles($this->quadStyle, $this->quadSubstyle);
|
$backgroundQuad->setStyles($this->quadStyle, $this->quadSubstyle);
|
||||||
|
|
||||||
// Add Close Quad (X)
|
// Add Close Quad (X)
|
||||||
@ -115,35 +115,39 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
$closeQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_QuitRace);
|
||||||
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
$closeQuad->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
|
||||||
|
|
||||||
//Start offsets
|
// Start offsets
|
||||||
$x = -$this->width / 2;
|
$x = -$this->width / 2;
|
||||||
$y = $this->height / 2;
|
$y = $this->height / 2;
|
||||||
|
|
||||||
//Headline
|
// Headline
|
||||||
$headFrame = new Frame();
|
$headFrame = new Frame();
|
||||||
$frame->add($headFrame);
|
$frame->add($headFrame);
|
||||||
$headFrame->setY($y - 5);
|
$headFrame->setY($y - 5);
|
||||||
//$array = array("Id" => $x + 5, "Nickname" => $x + 10, "Login" => $x + 40, "Ladder" => $x + 60,"Zone" => $x + 85);
|
// $array = array("Id" => $x + 5, "Nickname" => $x + 10, "Login" => $x + 40, "Ladder" => $x + 60,"Zone" => $x + 85);
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 60, "Location" => $x + 91, "Actions" => $x + 135);
|
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 60, "Location" => $x + 91, "Actions" => $x + 135);
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 60, "Location" => $x + 91);
|
$array = array("Id" => $x + 5, "Nickname" => $x + 18, "Login" => $x + 60, "Location" => $x + 91);
|
||||||
}
|
}
|
||||||
$this->maniaControl->manialinkManager->labelLine($headFrame,$array);
|
$this->maniaControl->manialinkManager->labelLine($headFrame, $array);
|
||||||
|
|
||||||
//get PlayerList
|
// get PlayerList
|
||||||
$players = $this->maniaControl->playerManager->getPlayers();
|
$players = $this->maniaControl->playerManager->getPlayers();
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$y -= 10;
|
$y -= 10;
|
||||||
foreach($players as $listPlayer){
|
foreach ($players as $listPlayer) {
|
||||||
/** @var Player $listPlayer */
|
/**
|
||||||
|
*
|
||||||
|
* @var Player $listPlayer
|
||||||
|
*/
|
||||||
|
|
||||||
$path = $listPlayer->getProvince();
|
$path = $listPlayer->getProvince();
|
||||||
$playerFrame = new Frame();
|
$playerFrame = new Frame();
|
||||||
$frame->add($playerFrame);
|
$frame->add($playerFrame);
|
||||||
|
|
||||||
if($i % 2 != 0){
|
if ($i % 2 != 0) {
|
||||||
$lineQuad = new Quad_BgsPlayerCard();
|
$lineQuad = new Quad_BgsPlayerCard();
|
||||||
$playerFrame->add($lineQuad);
|
$playerFrame->add($lineQuad);
|
||||||
$lineQuad->setSize($this->width, 4);
|
$lineQuad->setSize($this->width, 4);
|
||||||
@ -151,46 +155,51 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$lineQuad->setZ(0.001);
|
$lineQuad->setZ(0.001);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $array = array($i => $x + 5, $listPlayer->nickname => $x + 10, $listPlayer->login => $x + 50, $listPlayer->ladderRank =>
|
||||||
//$array = array($i => $x + 5, $listPlayer->nickname => $x + 10, $listPlayer->login => $x + 50, $listPlayer->ladderRank => $x + 60, $listPlayer->ladderScore => $x + 70, $path => $x + 85);
|
// $x + 60, $listPlayer->ladderScore => $x + 70, $path => $x + 85);
|
||||||
$array = array($i => $x + 5, $listPlayer->nickname => $x + 18, $listPlayer->login => $x + 60, $path => $x + 91);
|
$array = array($i => $x + 5, $listPlayer->nickname => $x + 18, $listPlayer->login => $x + 60, $path => $x + 91);
|
||||||
$this->maniaControl->manialinkManager->labelLine($playerFrame,$array);
|
$properties = array('profile' => $listPlayer->login, 'script' => $script);
|
||||||
|
$this->maniaControl->manialinkManager->labelLine($playerFrame, $array, $properties);
|
||||||
$playerFrame->setY($y);
|
$playerFrame->setY($y);
|
||||||
|
|
||||||
//Team Emblem
|
// Team Emblem
|
||||||
if($listPlayer->teamId >= 0){ //Player is in a Team
|
if ($listPlayer->teamId >= 0) { // Player is in a Team
|
||||||
$redQuad = new Quad_Emblems(); //TODO rename quads
|
$redQuad = new Quad_Emblems(); // TODO rename quads
|
||||||
$playerFrame->add($redQuad);
|
$playerFrame->add($redQuad);
|
||||||
$redQuad->setX($x + 10);
|
$redQuad->setX($x + 10);
|
||||||
$redQuad->setZ(0.1);
|
$redQuad->setZ(0.1);
|
||||||
$redQuad->setSize(3.8,3.8);
|
$redQuad->setSize(3.8, 3.8);
|
||||||
|
|
||||||
switch($listPlayer->teamId){
|
switch ($listPlayer->teamId) {
|
||||||
case 0: $redQuad->setSubStyle($redQuad::SUBSTYLE_1); break;
|
case 0:
|
||||||
case 1: $redQuad->setSubStyle($redQuad::SUBSTYLE_2); break;
|
$redQuad->setSubStyle($redQuad::SUBSTYLE_1);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$redQuad->setSubStyle($redQuad::SUBSTYLE_2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}else if($listPlayer->isSpectator){ //Player is in Spectator Mode
|
}
|
||||||
|
else if ($listPlayer->isSpectator) { // Player is in Spectator Mode
|
||||||
$neutralQuad = new Quad_BgRaceScore2();
|
$neutralQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($neutralQuad);
|
$playerFrame->add($neutralQuad);
|
||||||
$neutralQuad->setX($x + 10);
|
$neutralQuad->setX($x + 10);
|
||||||
$neutralQuad->setZ(0.1);
|
$neutralQuad->setZ(0.1);
|
||||||
$neutralQuad->setSubStyle($neutralQuad::SUBSTYLE_Spectator);
|
$neutralQuad->setSubStyle($neutralQuad::SUBSTYLE_Spectator);
|
||||||
$neutralQuad->setSize(3.8,3.8);
|
$neutralQuad->setSize(3.8, 3.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display country quad only on normal players
|
||||||
//Display country quad only on normal players
|
if (!$listPlayer->isFakePlayer()) {
|
||||||
if(!$listPlayer->isFakePlayer()){
|
// Nation Quad
|
||||||
//Nation Quad
|
|
||||||
$countryQuad = new Quad();
|
$countryQuad = new Quad();
|
||||||
$playerFrame->add($countryQuad);
|
$playerFrame->add($countryQuad);
|
||||||
$countryCode = Formatter::mapCountry($listPlayer->getCountry());
|
$countryCode = Formatter::mapCountry($listPlayer->getCountry());
|
||||||
$countryQuad->setImage("file://Skins/Avatars/Flags/{$countryCode}.dds");
|
$countryQuad->setImage("file://Skins/Avatars/Flags/{$countryCode}.dds");
|
||||||
$countryQuad->setX($x + 88);
|
$countryQuad->setX($x + 88);
|
||||||
$countryQuad->setSize(4,4);
|
$countryQuad->setSize(4, 4);
|
||||||
$countryQuad->setZ(-0.1);
|
$countryQuad->setZ(-0.1);
|
||||||
|
|
||||||
//Nation Description Label
|
// Nation Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -202,13 +211,13 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$script->addTooltip($countryQuad, $descriptionLabel);
|
$script->addTooltip($countryQuad, $descriptionLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Level Quad
|
// Level Quad
|
||||||
$rightQuad = new Quad_BgRaceScore2();
|
$rightQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($rightQuad);
|
$playerFrame->add($rightQuad);
|
||||||
$rightQuad->setX($x + 13);
|
$rightQuad->setX($x + 13);
|
||||||
$rightQuad->setZ(5);
|
$rightQuad->setZ(5);
|
||||||
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
$rightQuad->setSubStyle($rightQuad::SUBSTYLE_CupFinisher);
|
||||||
$rightQuad->setSize(7,3.5);
|
$rightQuad->setSize(7, 3.5);
|
||||||
|
|
||||||
$rightLabel = new Label_Text();
|
$rightLabel = new Label_Text();
|
||||||
$playerFrame->add($rightLabel);
|
$playerFrame->add($rightLabel);
|
||||||
@ -216,7 +225,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$rightLabel->setTextSize(0.8);
|
$rightLabel->setTextSize(0.8);
|
||||||
$rightLabel->setZ(10);
|
$rightLabel->setZ(10);
|
||||||
|
|
||||||
//Description Label
|
// Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -224,31 +233,38 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$descriptionLabel->setSize($this->width * 0.7, 4);
|
$descriptionLabel->setSize($this->width * 0.7, 4);
|
||||||
$descriptionLabel->setTextSize(2);
|
$descriptionLabel->setTextSize(2);
|
||||||
$descriptionLabel->setVisible(false);
|
$descriptionLabel->setVisible(false);
|
||||||
$descriptionLabel->setText($this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
|
$descriptionLabel->setText(
|
||||||
|
$this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
|
||||||
$script->addTooltip($rightQuad, $descriptionLabel);
|
$script->addTooltip($rightQuad, $descriptionLabel);
|
||||||
|
|
||||||
switch($listPlayer->authLevel){
|
switch ($listPlayer->authLevel) {
|
||||||
case authenticationManager::AUTH_LEVEL_MASTERADMIN: $rightLabel->setText("MA"); break;
|
case authenticationManager::AUTH_LEVEL_MASTERADMIN:
|
||||||
case authenticationManager::AUTH_LEVEL_SUPERADMIN: $rightLabel->setText("SA"); break;
|
$rightLabel->setText("MA");
|
||||||
case authenticationManager::AUTH_LEVEL_ADMIN: $rightLabel->setText("AD"); break;
|
break;
|
||||||
case authenticationManager::AUTH_LEVEL_OPERATOR: $rightLabel->setText("MOD");
|
case authenticationManager::AUTH_LEVEL_SUPERADMIN:
|
||||||
|
$rightLabel->setText("SA");
|
||||||
|
break;
|
||||||
|
case authenticationManager::AUTH_LEVEL_ADMIN:
|
||||||
|
$rightLabel->setText("AD");
|
||||||
|
break;
|
||||||
|
case authenticationManager::AUTH_LEVEL_OPERATOR:
|
||||||
|
$rightLabel->setText("MOD");
|
||||||
}
|
}
|
||||||
|
|
||||||
$rightLabel->setTextColor("fff");
|
$rightLabel->setTextColor("fff");
|
||||||
|
|
||||||
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
|
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){
|
// Further Player actions Quad
|
||||||
|
|
||||||
//Further Player actions Quad
|
|
||||||
$playerQuad = new Quad_Icons64x64_1();
|
$playerQuad = new Quad_Icons64x64_1();
|
||||||
$playerFrame->add($playerQuad);
|
$playerFrame->add($playerQuad);
|
||||||
$playerQuad->setX($x + 132);
|
$playerQuad->setX($x + 132);
|
||||||
$playerQuad->setZ(0.1);
|
$playerQuad->setZ(0.1);
|
||||||
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Buddy);
|
$playerQuad->setSubStyle($playerQuad::SUBSTYLE_Buddy);
|
||||||
$playerQuad->setSize(3.8,3.8);
|
$playerQuad->setSize(3.8, 3.8);
|
||||||
$playerQuad->setAction(self::ACTION_PLAYER_ADV . "." .$listPlayer->login);
|
$playerQuad->setAction(self::ACTION_PLAYER_ADV . "." . $listPlayer->login);
|
||||||
|
|
||||||
//Further Player actions Mousover Description
|
// Further Player actions Mousover Description
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -260,16 +276,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$script->addTooltip($playerQuad, $descriptionLabel);
|
$script->addTooltip($playerQuad, $descriptionLabel);
|
||||||
// $script->addProfileButton($playerQuad, $listPlayer->login);
|
// $script->addProfileButton($playerQuad, $listPlayer->login);
|
||||||
|
|
||||||
//Force to Red-Team Quad
|
// Force to Red-Team Quad
|
||||||
$redQuad = new Quad_Emblems();
|
$redQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($redQuad);
|
$playerFrame->add($redQuad);
|
||||||
$redQuad->setX($x + 145);
|
$redQuad->setX($x + 145);
|
||||||
$redQuad->setZ(0.1);
|
$redQuad->setZ(0.1);
|
||||||
$redQuad->setSubStyle($redQuad::SUBSTYLE_2);
|
$redQuad->setSubStyle($redQuad::SUBSTYLE_2);
|
||||||
$redQuad->setSize(3.8,3.8);
|
$redQuad->setSize(3.8, 3.8);
|
||||||
$redQuad->setAction(self::ACTION_FORCE_RED . "." .$listPlayer->login);
|
$redQuad->setAction(self::ACTION_FORCE_RED . "." . $listPlayer->login);
|
||||||
|
|
||||||
//Force to Red-Team Description Label
|
// Force to Red-Team Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -280,16 +296,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Red Team!');
|
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Red Team!');
|
||||||
$script->addTooltip($redQuad, $descriptionLabel);
|
$script->addTooltip($redQuad, $descriptionLabel);
|
||||||
|
|
||||||
//Force to Blue-Team Quad
|
// Force to Blue-Team Quad
|
||||||
$blueQuad = new Quad_Emblems();
|
$blueQuad = new Quad_Emblems();
|
||||||
$playerFrame->add($blueQuad);
|
$playerFrame->add($blueQuad);
|
||||||
$blueQuad->setX($x + 141);
|
$blueQuad->setX($x + 141);
|
||||||
$blueQuad->setZ(0.1);
|
$blueQuad->setZ(0.1);
|
||||||
$blueQuad->setSubStyle($blueQuad::SUBSTYLE_1);
|
$blueQuad->setSubStyle($blueQuad::SUBSTYLE_1);
|
||||||
$blueQuad->setSize(3.8,3.8);
|
$blueQuad->setSize(3.8, 3.8);
|
||||||
$blueQuad->setAction(self::ACTION_FORCE_BLUE . "." .$listPlayer->login);
|
$blueQuad->setAction(self::ACTION_FORCE_BLUE . "." . $listPlayer->login);
|
||||||
|
|
||||||
//Force to Blue-Team Description Label
|
// Force to Blue-Team Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -300,16 +316,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Blue Team!');
|
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Blue Team!');
|
||||||
$script->addTooltip($blueQuad, $descriptionLabel);
|
$script->addTooltip($blueQuad, $descriptionLabel);
|
||||||
|
|
||||||
//Force to Spectator Quad
|
// Force to Spectator Quad
|
||||||
$spectatorQuad = new Quad_BgRaceScore2();
|
$spectatorQuad = new Quad_BgRaceScore2();
|
||||||
$playerFrame->add($spectatorQuad);
|
$playerFrame->add($spectatorQuad);
|
||||||
$spectatorQuad->setX($x + 137);
|
$spectatorQuad->setX($x + 137);
|
||||||
$spectatorQuad->setZ(0.1);
|
$spectatorQuad->setZ(0.1);
|
||||||
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
$spectatorQuad->setSubStyle($spectatorQuad::SUBSTYLE_Spectator);
|
||||||
$spectatorQuad->setSize(3.8,3.8);
|
$spectatorQuad->setSize(3.8, 3.8);
|
||||||
$spectatorQuad->setAction(self::ACTION_FORCE_SPEC . "." .$listPlayer->login);
|
$spectatorQuad->setAction(self::ACTION_FORCE_SPEC . "." . $listPlayer->login);
|
||||||
|
|
||||||
//Force to Spectator Description Label
|
// Force to Spectator Description Label
|
||||||
$descriptionLabel = new Label();
|
$descriptionLabel = new Label();
|
||||||
$frame->add($descriptionLabel);
|
$frame->add($descriptionLabel);
|
||||||
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
|
||||||
@ -324,36 +340,37 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$y -= 4;
|
$y -= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
//show advanced window
|
// show advanced window
|
||||||
if($this->playersListShown[$player->login] != false && $this->playersListShown[$player->login] != self::SHOWN_MAIN_WINDOW){
|
if ($this->playersListShown[$player->login] != false && $this->playersListShown[$player->login] != self::SHOWN_MAIN_WINDOW) {
|
||||||
$frame = $this->showAdvancedPlayerWidget($this->playersListShown[$player->login]);
|
$frame = $this->showAdvancedPlayerWidget($this->playersListShown[$player->login]);
|
||||||
$maniaLink->add($frame);
|
$maniaLink->add($frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
//render and display xml
|
// render and display xml
|
||||||
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays the Advanced Player Window
|
* Displays the Advanced Player Window
|
||||||
|
*
|
||||||
* @param Player $caller
|
* @param Player $caller
|
||||||
* @param $login
|
* @param $login
|
||||||
*/
|
*/
|
||||||
public function advancedPlayerWidget(Player $caller, $login){
|
public function advancedPlayerWidget(Player $caller, $login) {
|
||||||
$this->playersListShown[$caller->login] = $login; //Show a certain player
|
$this->playersListShown[$caller->login] = $login; // Show a certain player
|
||||||
$this->showPlayerList($caller); //reopen playerlist
|
$this->showPlayerList($caller); // reopen playerlist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extra window with special actions on players like warn,kick, ban, authorization levels...
|
* Extra window with special actions on players like warn,kick, ban, authorization levels...
|
||||||
|
*
|
||||||
* @param $login
|
* @param $login
|
||||||
* @return Frame
|
* @return Frame
|
||||||
*/
|
*/
|
||||||
public function showAdvancedPlayerWidget($login){
|
public function showAdvancedPlayerWidget($login) {
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
|
|
||||||
//todo all configurable or as constants
|
// todo all configurable or as constants
|
||||||
$x = $this->width / 2 + 2.5;
|
$x = $this->width / 2 + 2.5;
|
||||||
$width = 35;
|
$width = 35;
|
||||||
$height = $this->height * 0.7;
|
$height = $this->height * 0.7;
|
||||||
@ -363,9 +380,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$textColor = 'FFF';
|
$textColor = 'FFF';
|
||||||
$quadWidth = $width - 7;
|
$quadWidth = $width - 7;
|
||||||
|
|
||||||
//mainframe
|
// mainframe
|
||||||
$frame = new Frame();
|
$frame = new Frame();
|
||||||
$frame->setSize($width,$height);
|
$frame->setSize($width, $height);
|
||||||
$frame->setPosition($x + $width / 2, 0);
|
$frame->setPosition($x + $width / 2, 0);
|
||||||
|
|
||||||
// Add Close Quad (X)
|
// Add Close Quad (X)
|
||||||
@ -374,16 +391,16 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$closeQuad->setPosition($width * 0.4, $height * 0.43, 3);
|
$closeQuad->setPosition($width * 0.4, $height * 0.43, 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_CLOSE_PLAYER_ADV );
|
$closeQuad->setAction(self::ACTION_CLOSE_PLAYER_ADV);
|
||||||
|
|
||||||
//Background Quad
|
// Background Quad
|
||||||
$backgroundQuad = new Quad();
|
$backgroundQuad = new Quad();
|
||||||
$frame->add($backgroundQuad);
|
$frame->add($backgroundQuad);
|
||||||
$backgroundQuad->setSize($width,$height);
|
$backgroundQuad->setSize($width, $height);
|
||||||
$backgroundQuad->setStyles($this->quadStyle, $this->quadSubstyle);
|
$backgroundQuad->setStyles($this->quadStyle, $this->quadSubstyle);
|
||||||
$backgroundQuad->setZ(0.1);
|
$backgroundQuad->setZ(0.1);
|
||||||
|
|
||||||
//Show headline
|
// Show headline
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setHAlign($hAlign);
|
$label->setHAlign($hAlign);
|
||||||
@ -394,12 +411,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setText("Advanced Actions");
|
$label->setText("Advanced Actions");
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
//Show Nickname
|
// Show Nickname
|
||||||
$label = new Label_Text();
|
$label = new Label_Text();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setHAlign($hAlign);
|
$label->setHAlign($hAlign);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setY($height / 2 - 8);
|
$label->setY($height / 2 - 8);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
$label->setTextSize($textSize);
|
$label->setTextSize($textSize);
|
||||||
@ -407,19 +424,19 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y = $height / 2 - 14;
|
$y = $height / 2 - 14;
|
||||||
//Show Warn
|
// Show Warn
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_WARN_PLAYER . "." .$login);
|
$quad->setAction(self::ACTION_WARN_PLAYER . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
$label->setTextSize($textSize);
|
$label->setTextSize($textSize);
|
||||||
@ -427,18 +444,18 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y -= 5;
|
$y -= 5;
|
||||||
//Show Kick
|
// Show Kick
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_KICK_PLAYER . "." .$login);
|
$quad->setAction(self::ACTION_KICK_PLAYER . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
@ -447,18 +464,18 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextColor("F90");
|
$label->setTextColor("F90");
|
||||||
|
|
||||||
$y -= 5;
|
$y -= 5;
|
||||||
//Show Ban
|
// Show Ban
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_BAN_PLAYER . "." .$login);
|
$quad->setAction(self::ACTION_BAN_PLAYER . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
@ -467,18 +484,18 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextColor("700");
|
$label->setTextColor("700");
|
||||||
|
|
||||||
$y -= 10;
|
$y -= 10;
|
||||||
//Show Add as Master-Admin
|
// Show Add as Master-Admin
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_ADD_AS_MASTER . "." .$login);
|
$quad->setAction(self::ACTION_ADD_AS_MASTER . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
@ -489,18 +506,18 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y -= 5;
|
$y -= 5;
|
||||||
//Show Add as Admin
|
// Show Add as Admin
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_ADD_AS_ADMIN . "." .$login);
|
$quad->setAction(self::ACTION_ADD_AS_ADMIN . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
@ -509,18 +526,18 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
$y -= 5;
|
$y -= 5;
|
||||||
//Show Add as Moderator
|
// Show Add as Moderator
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_ADD_AS_MOD . "." .$login);
|
$quad->setAction(self::ACTION_ADD_AS_MOD . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
@ -528,28 +545,26 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$label->setText("Set Moderator");
|
$label->setText("Set Moderator");
|
||||||
$label->setTextColor($textColor);
|
$label->setTextColor($textColor);
|
||||||
|
|
||||||
|
if ($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
if($this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)){
|
|
||||||
$y -= 5;
|
$y -= 5;
|
||||||
//Revoke Rights
|
// Revoke Rights
|
||||||
$quad = new Quad_BgsPlayerCard();
|
$quad = new Quad_BgsPlayerCard();
|
||||||
$frame->add($quad);
|
$frame->add($quad);
|
||||||
$quad->setX(0);
|
$quad->setX(0);
|
||||||
$quad->setY($y);
|
$quad->setY($y);
|
||||||
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
$quad->setSubStyle($quad::SUBSTYLE_BgPlayerCardBig);
|
||||||
$quad->setSize($quadWidth, 5);
|
$quad->setSize($quadWidth, 5);
|
||||||
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." .$login);
|
$quad->setAction(self::ACTION_REVOKE_RIGHTS . "." . $login);
|
||||||
|
|
||||||
$label = new Label_Button();
|
$label = new Label_Button();
|
||||||
$frame->add($label);
|
$frame->add($label);
|
||||||
$label->setAlign(Control::CENTER,Control::CENTER);
|
$label->setAlign(Control::CENTER, Control::CENTER);
|
||||||
$label->setX(0);
|
$label->setX(0);
|
||||||
$label->setY($y);
|
$label->setY($y);
|
||||||
$label->setStyle($style);
|
$label->setStyle($style);
|
||||||
$label->setTextSize($textSize);
|
$label->setTextSize($textSize);
|
||||||
$label->setText("Revoke Rights");
|
$label->setText("Revoke Rights");
|
||||||
$label->setTextColor("700");
|
$label->setTextColor("700");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $frame;
|
return $frame;
|
||||||
@ -557,6 +572,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the widget
|
* Closes the widget
|
||||||
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
public function closeWidget(array $callback) {
|
public function closeWidget(array $callback) {
|
||||||
@ -564,59 +580,64 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
unset($this->playersListShown[$player->login]);
|
unset($this->playersListShown[$player->login]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the player advanced widget widget
|
* Closes the player advanced widget widget
|
||||||
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function closePlayerAdvancedWidget(array $callback, Player $player) {
|
public function closePlayerAdvancedWidget(array $callback, Player $player) {
|
||||||
$this->playersListShown[$player->login] = self::SHOWN_MAIN_WINDOW;
|
$this->playersListShown[$player->login] = self::SHOWN_MAIN_WINDOW;
|
||||||
$this->showPlayerList($player); //overwrite the manialink
|
$this->showPlayerList($player); // overwrite the manialink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called on ManialinkPageAnswer
|
* Called on ManialinkPageAnswer
|
||||||
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
public function handleManialinkPageAnswer(array $callback){
|
public function handleManialinkPageAnswer(array $callback) {
|
||||||
$actionId = $callback[1][2];
|
$actionId = $callback[1][2];
|
||||||
$actionArray = explode(".", $actionId);
|
$actionArray = explode(".", $actionId);
|
||||||
|
|
||||||
//TODO maybe with ids instead of logins, lower network traffic
|
// TODO maybe with ids instead of logins, lower network traffic
|
||||||
switch($actionArray[0].".".$actionArray[1]){
|
switch ($actionArray[0] . "." . $actionArray[1]) {
|
||||||
case self::ACTION_FORCE_BLUE:
|
case self::ACTION_FORCE_BLUE:
|
||||||
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($callback[1][1],$actionArray[2],playerActions::BLUE_TEAM);
|
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($callback[1][1], $actionArray[2],
|
||||||
|
playerActions::BLUE_TEAM);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_FORCE_RED:
|
case self::ACTION_FORCE_RED:
|
||||||
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($callback[1][1],$actionArray[2],playerActions::RED_TEAM);
|
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($callback[1][1], $actionArray[2],
|
||||||
|
playerActions::RED_TEAM);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_FORCE_SPEC:
|
case self::ACTION_FORCE_SPEC:
|
||||||
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($callback[1][1],$actionArray[2],playerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($callback[1][1], $actionArray[2],
|
||||||
|
playerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_WARN_PLAYER:
|
case self::ACTION_WARN_PLAYER:
|
||||||
$this->maniaControl->playerManager->playerActions->warnPlayer($callback[1][1],$actionArray[2]);
|
$this->maniaControl->playerManager->playerActions->warnPlayer($callback[1][1], $actionArray[2]);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_KICK_PLAYER:
|
case self::ACTION_KICK_PLAYER:
|
||||||
$this->maniaControl->playerManager->playerActions->kickPlayer($callback[1][1],$actionArray[2]);
|
$this->maniaControl->playerManager->playerActions->kickPlayer($callback[1][1], $actionArray[2]);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_BAN_PLAYER:
|
case self::ACTION_BAN_PLAYER:
|
||||||
$this->maniaControl->playerManager->playerActions->banPlayer($callback[1][1],$actionArray[2]);
|
$this->maniaControl->playerManager->playerActions->banPlayer($callback[1][1], $actionArray[2]);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_PLAYER_ADV:
|
case self::ACTION_PLAYER_ADV:
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($callback[1][1]);
|
$player = $this->maniaControl->playerManager->getPlayer($callback[1][1]);
|
||||||
$this->advancedPlayerWidget($player, $actionArray[2]);
|
$this->advancedPlayerWidget($player, $actionArray[2]);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_ADD_AS_MASTER:
|
case self::ACTION_ADD_AS_MASTER:
|
||||||
$this->maniaControl->playerManager->playerActions->grandAuthLevel($callback[1][1], $actionArray[2], AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
|
$this->maniaControl->playerManager->playerActions->grandAuthLevel($callback[1][1], $actionArray[2],
|
||||||
|
AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_ADD_AS_ADMIN:
|
case self::ACTION_ADD_AS_ADMIN:
|
||||||
$this->maniaControl->playerManager->playerActions->grandAuthLevel($callback[1][1], $actionArray[2], AuthenticationManager::AUTH_LEVEL_ADMIN);
|
$this->maniaControl->playerManager->playerActions->grandAuthLevel($callback[1][1], $actionArray[2],
|
||||||
|
AuthenticationManager::AUTH_LEVEL_ADMIN);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_ADD_AS_MOD:
|
case self::ACTION_ADD_AS_MOD:
|
||||||
$this->maniaControl->playerManager->playerActions->grandAuthLevel($callback[1][1], $actionArray[2], AuthenticationManager::AUTH_LEVEL_OPERATOR);
|
$this->maniaControl->playerManager->playerActions->grandAuthLevel($callback[1][1], $actionArray[2],
|
||||||
|
AuthenticationManager::AUTH_LEVEL_OPERATOR);
|
||||||
break;
|
break;
|
||||||
case self::ACTION_REVOKE_RIGHTS:
|
case self::ACTION_REVOKE_RIGHTS:
|
||||||
$this->maniaControl->playerManager->playerActions->revokeAuthLevel($callback[1][1], $actionArray[2]);
|
$this->maniaControl->playerManager->playerActions->revokeAuthLevel($callback[1][1], $actionArray[2]);
|
||||||
@ -626,20 +647,22 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reopen the widget on PlayerInfoChanged / Player Connect and Disconnect
|
* Reopen the widget on PlayerInfoChanged / Player Connect and Disconnect
|
||||||
|
*
|
||||||
* @param array $callback
|
* @param array $callback
|
||||||
*/
|
*/
|
||||||
public function updateWidget(array $callback){
|
public function updateWidget(array $callback) {
|
||||||
foreach($this->playersListShown as $login => $shown){
|
foreach ($this->playersListShown as $login => $shown) {
|
||||||
if($shown){
|
if ($shown) {
|
||||||
//Check if Shown player still exists
|
// Check if Shown player still exists
|
||||||
if($shown != self::SHOWN_MAIN_WINDOW && $this->maniaControl->playerManager->getPlayer($shown) == null){
|
if ($shown != self::SHOWN_MAIN_WINDOW && $this->maniaControl->playerManager->getPlayer($shown) == null) {
|
||||||
$this->playersListShown[$login] = false;
|
$this->playersListShown[$login] = false;
|
||||||
}
|
}
|
||||||
$player = $this->maniaControl->playerManager->getPlayer($login);
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
||||||
if($player != null){
|
if ($player != null) {
|
||||||
$this->showPlayerList($player);
|
$this->showPlayerList($player);
|
||||||
}else{
|
}
|
||||||
//if player with the open widget disconnected remove him from the shownlist
|
else {
|
||||||
|
// if player with the open widget disconnected remove him from the shownlist
|
||||||
unset($this->playersListShown[$login]);
|
unset($this->playersListShown[$login]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user