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 $quadSubstyle;
private $playersListShown = array();
/**
* Create a new server commands instance
*
@ -84,6 +83,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$this->height = $this->maniaControl->manialinkManager->styleManager->getListWidgetsHeight();
$this->quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
$this->quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
}
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->setAction(ManialinkManager::ACTION_CLOSEWIDGET);
// Start offsets
$x = -$this->width / 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
$headFrame = new Frame();
$frame->add($headFrame);
@ -202,14 +212,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$countryQuad->setSize(4, 4);
$countryQuad->setZ(-0.1);
// Nation Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$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);
$script->addTooltip($countryQuad, $descriptionLabel);
}
@ -228,16 +232,9 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$rightLabel->setTextSize(0.8);
$rightLabel->setZ(10);
// Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$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(
$this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
$descriptionLabel->setText($this->maniaControl->authenticationManager->getAuthLevelName($listPlayer->authLevel) . " " . $listPlayer->nickname);
$script->addTooltip($rightQuad, $descriptionLabel);
// Player Profile Quad
@ -250,13 +247,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$script->addProfileButton($playerQuad, $listPlayer->login);
// Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$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);
$script->addTooltip($playerQuad, $descriptionLabel);
@ -286,14 +278,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$playerQuad->setSize(3.8, 3.8);
$playerQuad->setAction(self::ACTION_PLAYER_ADV . "." . $listPlayer->login);
// Further Player actions Mousover Description
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$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);
$script->addTooltip($playerQuad, $descriptionLabel);
@ -307,16 +293,12 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$redQuad->setAction(self::ACTION_FORCE_RED . "." . $listPlayer->login);
// Force to Red-Team Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;;
$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!');
$script->addTooltip($redQuad, $descriptionLabel);
// Force to Blue-Team Quad
$blueQuad = new Quad_Emblems();
$playerFrame->add($blueQuad);
@ -327,13 +309,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$blueQuad->setAction(self::ACTION_FORCE_BLUE . "." . $listPlayer->login);
// Force to Blue-Team Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$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!');
$script->addTooltip($blueQuad, $descriptionLabel);
@ -347,13 +324,8 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener {
$spectatorQuad->setAction(self::ACTION_FORCE_SPEC . "." . $listPlayer->login);
// Force to Spectator Description Label
$descriptionLabel = new Label();
$descriptionLabel = clone $preDefinedDescriptionLabel;
$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!');
$script->addTooltip($spectatorQuad, $descriptionLabel);
}