playerlist clone description label

This commit is contained in:
kremsy 2014-01-02 13:20:42 +01:00
parent 3ca2879fd1
commit 449719aa99

View File

@ -57,7 +57,6 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
private $quadStyle; private $quadStyle;
private $quadSubstyle; private $quadSubstyle;
private $playersListShown = array(); private $playersListShown = array();
/** /**
* Create a new server commands instance * Create a new server commands instance
* *
@ -84,6 +83,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$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) {
@ -117,10 +117,20 @@ 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;
//Predefine Description Label
$preDefinedDescriptionLabel = new Label();
$preDefinedDescriptionLabel->setAlign(Control::LEFT, Control::TOP);
$preDefinedDescriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$preDefinedDescriptionLabel->setSize($this->width * 0.7, 4);
$preDefinedDescriptionLabel->setTextSize(2);
$preDefinedDescriptionLabel->setVisible(false);
// Headline // Headline
$headFrame = new Frame(); $headFrame = new Frame();
$frame->add($headFrame); $frame->add($headFrame);
@ -202,14 +212,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$countryQuad->setSize(4, 4); $countryQuad->setSize(4, 4);
$countryQuad->setZ(-0.1); $countryQuad->setZ(-0.1);
// Nation Description Label $descriptionLabel = clone $preDefinedDescriptionLabel;
$descriptionLabel = new Label();
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText($listPlayer->nickname . " from " . $listPlayer->path); $descriptionLabel->setText($listPlayer->nickname . " from " . $listPlayer->path);
$script->addTooltip($countryQuad, $descriptionLabel); $script->addTooltip($countryQuad, $descriptionLabel);
} }
@ -228,16 +232,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$rightLabel->setTextSize(0.8); $rightLabel->setTextSize(0.8);
$rightLabel->setZ(10); $rightLabel->setZ(10);
// Description Label $descriptionLabel = clone $preDefinedDescriptionLabel;
$descriptionLabel = new Label();
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP); $descriptionLabel->setText($this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText(
$this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
$script->addTooltip($rightQuad, $descriptionLabel); $script->addTooltip($rightQuad, $descriptionLabel);
// Player Profile Quad // Player Profile Quad
@ -250,13 +247,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$script->addProfileButton($playerQuad, $listPlayer->login); $script->addProfileButton($playerQuad, $listPlayer->login);
// Description Label // Description Label
$descriptionLabel = new Label(); $descriptionLabel = clone $preDefinedDescriptionLabel;
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("View Player profile of " . $listPlayer->nickname); $descriptionLabel->setText("View Player profile of " . $listPlayer->nickname);
$script->addTooltip($playerQuad, $descriptionLabel); $script->addTooltip($playerQuad, $descriptionLabel);
@ -286,14 +278,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$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 $descriptionLabel = clone $preDefinedDescriptionLabel;
$descriptionLabel = new Label();
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Advanced Player Actions on " . $listPlayer->nickname); $descriptionLabel->setText("Advanced Player Actions on " . $listPlayer->nickname);
$script->addTooltip($playerQuad, $descriptionLabel); $script->addTooltip($playerQuad, $descriptionLabel);
@ -307,16 +293,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$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 = clone $preDefinedDescriptionLabel;;
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$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);
@ -327,13 +309,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$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 = clone $preDefinedDescriptionLabel;
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$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);
@ -347,13 +324,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$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 = clone $preDefinedDescriptionLabel;
$frame->add($descriptionLabel); $frame->add($descriptionLabel);
$descriptionLabel->setAlign(Control::LEFT, Control::TOP);
$descriptionLabel->setPosition($x + 10, -$this->height / 2 + 5);
$descriptionLabel->setSize($this->width * 0.7, 4);
$descriptionLabel->setTextSize(2);
$descriptionLabel->setVisible(false);
$descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Spectator!'); $descriptionLabel->setText("Force " . $listPlayer->nickname . '$z to Spectator!');
$script->addTooltip($spectatorQuad, $descriptionLabel); $script->addTooltip($spectatorQuad, $descriptionLabel);
} }