2014-01-24 15:49:28 +01:00
|
|
|
<?php
|
|
|
|
use FML\Controls\Frame;
|
|
|
|
use FML\Controls\Labels\Label_Button;
|
|
|
|
use FML\Controls\Labels\Label_Text;
|
|
|
|
use FML\Controls\Quad;
|
|
|
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
|
|
|
use FML\ManiaLink;
|
|
|
|
use ManiaControl\Callbacks\CallbackListener;
|
|
|
|
use ManiaControl\Callbacks\CallbackManager;
|
|
|
|
use ManiaControl\Commands\CommandListener;
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
|
|
|
use ManiaControl\Players\Player;
|
|
|
|
use ManiaControl\Players\PlayerManager;
|
|
|
|
use ManiaControl\Plugins\Plugin;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Queue plugin
|
|
|
|
*
|
|
|
|
* @author TheM
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO: worst kick function
|
|
|
|
// TODO: idlekick function (?)
|
|
|
|
|
|
|
|
class QueuePlugin implements CallbackListener, CommandListener, ManialinkPageAnswerListener, Plugin {
|
2014-01-24 21:40:12 +01:00
|
|
|
/**
|
|
|
|
* Constants
|
|
|
|
*/
|
|
|
|
const ID = 12;
|
|
|
|
const VERSION = 0.1;
|
|
|
|
const ML_ID = 'Queue.Widget';
|
|
|
|
const ML_ADDTOQUEUE = 'Queue.Add';
|
|
|
|
const ML_REMOVEFROMQUEUE = 'Queue.Remove';
|
|
|
|
|
|
|
|
const QUEUE_MAX = 'Maximum number in the queue';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Private properties
|
|
|
|
*/
|
|
|
|
/** @var ManiaControl $maniaControl */
|
|
|
|
private $maniaControl = null;
|
|
|
|
private $queue = array();
|
|
|
|
private $spectators = array();
|
|
|
|
private $showPlay = array();
|
|
|
|
|
2014-01-27 20:39:10 +01:00
|
|
|
/**
|
|
|
|
* Prepares the Plugin
|
|
|
|
*
|
|
|
|
* @param ManiaControl $maniaControl
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public static function prepare(ManiaControl $maniaControl) {
|
|
|
|
// TODO: Implement prepare() method.
|
|
|
|
}
|
|
|
|
|
2014-01-24 21:40:12 +01:00
|
|
|
/**
|
|
|
|
* Load the plugin
|
|
|
|
*
|
|
|
|
* @param \ManiaControl\ManiaControl $maniaControl
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function load(ManiaControl $maniaControl) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
|
|
|
|
|
|
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERJOINED, $this, 'handlePlayerConnect');
|
|
|
|
$this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERDISCONNECTED, $this, 'handlePlayerDisconnect');
|
|
|
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_PLAYERINFOCHANGED, $this, 'handlePlayerInfoChanged');
|
|
|
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_1_SECOND, $this, 'handleEverySecond');
|
|
|
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ML_ADDTOQUEUE, $this, 'handleManiaLinkAnswerAdd');
|
|
|
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ML_REMOVEFROMQUEUE, $this, 'handleManiaLinkAnswerRemove');
|
|
|
|
|
|
|
|
$this->maniaControl->settingManager->initSetting($this, self::QUEUE_MAX, 8);
|
|
|
|
|
|
|
|
foreach($this->maniaControl->playerManager->getPlayers() as $player) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($player->isSpectator) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->spectators[$player->login] = $player->login;
|
|
|
|
$this->maniaControl->client->forceSpectator($player->login, 1);
|
|
|
|
$this->showJoinQueueWidget($player);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unload the plugin and its resources
|
|
|
|
*/
|
|
|
|
public function unload() {
|
|
|
|
$this->maniaControl->manialinkManager->unregisterManialinkPageAnswerListener($this);
|
|
|
|
$this->maniaControl->callbackManager->unregisterCallbackListener($this);
|
|
|
|
|
|
|
|
foreach($this->spectators as $spectator) {
|
|
|
|
$this->maniaControl->client->forceSpectator($spectator, 3);
|
|
|
|
$this->maniaControl->client->forceSpectator($spectator, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($this->maniaControl->playerManager->getPlayers() as $player) {
|
|
|
|
$this->hideQueueWidget($player);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->queue = array();
|
|
|
|
$this->spectators = array();
|
|
|
|
$this->showPlay = array();
|
|
|
|
$this->maniaControl = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get plugin id
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public static function getId() {
|
|
|
|
return self::ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Plugin Name
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function getName() {
|
|
|
|
return 'Queue Plugin';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Plugin Version
|
|
|
|
*
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
public static function getVersion() {
|
|
|
|
return self::VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Plugin Author
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function getAuthor() {
|
|
|
|
return 'TheM';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get Plugin Description
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function getDescription() {
|
|
|
|
return 'Plugin offers the known AutoQueue/SpecJam options.';
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function handling on the connection of a player.
|
|
|
|
*
|
|
|
|
* @param array $callback
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
public function handlePlayerConnect(array $callback) {
|
|
|
|
$login = $callback[1]->login;
|
|
|
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
|
|
|
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($player->isSpectator) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->spectators[$player->login] = $player->login;
|
|
|
|
$this->maniaControl->client->forceSpectator($player->login, 1);
|
|
|
|
$this->showJoinQueueWidget($player);
|
|
|
|
} else {
|
2014-01-28 20:09:09 +01:00
|
|
|
if (count($this->queue) != 0) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->maniaControl->client->forceSpectator($player->login, 1);
|
|
|
|
$this->spectators[$player->login] = $player->login;
|
|
|
|
$this->showJoinQueueWidget($player);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function handling on the disconnection of a player.
|
|
|
|
*
|
|
|
|
* @param array $callback
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
public function handlePlayerDisconnect(array $callback) {
|
|
|
|
/** @var Player $player */
|
|
|
|
$player = $callback[1];
|
2014-01-28 20:09:09 +01:00
|
|
|
if (isset($this->spectators[$player->login])) {
|
2014-01-24 21:40:12 +01:00
|
|
|
unset($this->spectators[$player->login]);
|
|
|
|
}
|
|
|
|
$this->removePlayerFromQueue($player->login);
|
|
|
|
$this->moveFirstPlayerToPlay();
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function handling the change of player information.
|
|
|
|
*
|
|
|
|
* @param array $callback
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
public function handlePlayerInfoChanged(array $callback) {
|
|
|
|
$login = $callback[1][0]['Login'];
|
|
|
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
|
|
|
|
2014-01-28 20:09:09 +01:00
|
|
|
if (!is_null($player)) {
|
|
|
|
if ($player->isSpectator) {
|
|
|
|
if (!isset($this->spectators[$player->login])) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->maniaControl->client->forceSpectator($player->login, 1);
|
|
|
|
$this->spectators[$player->login] = $player->login;
|
|
|
|
$this->showJoinQueueWidget($player);
|
|
|
|
}
|
2014-01-25 20:00:41 +01:00
|
|
|
} else {
|
|
|
|
$this->removePlayerFromQueue($player->login);
|
2014-01-28 20:09:09 +01:00
|
|
|
if (isset($this->spectators[$player->login])) {
|
|
|
|
unset($this->spectators[$player->login]);
|
|
|
|
}
|
2014-01-27 21:45:28 +01:00
|
|
|
|
|
|
|
$found = false;
|
|
|
|
foreach($this->showPlay as $showPlay) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($showPlay['player']->login == $player->login) {
|
2014-01-27 21:45:28 +01:00
|
|
|
$found = true;
|
|
|
|
}
|
|
|
|
}
|
2014-01-28 20:09:09 +01:00
|
|
|
|
|
|
|
if (!$found) {
|
|
|
|
$this->hideQueueWidget($player);
|
|
|
|
}
|
2014-01-24 21:40:12 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function called on every second.
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
public function handleEverySecond() {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($this->maniaControl->client->getMaxPlayers()['CurrentValue'] > (count($this->maniaControl->playerManager->players) - count($this->spectators))) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->moveFirstPlayerToPlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($this->spectators as $login) {
|
|
|
|
$player = $this->maniaControl->playerManager->getPlayer($login);
|
|
|
|
$this->showJoinQueueWidget($player);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($this->showPlay as $showPlay) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if (($showPlay['time'] + 5) < time()) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->hideQueueWidget($showPlay['player']);
|
|
|
|
unset($this->showPlay[$showPlay['player']->login]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function handling the click of the widget to add them to the queue.
|
|
|
|
*
|
|
|
|
* @param array $chatCallback
|
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
public function handleManiaLinkAnswerAdd(array $chatCallback, Player $player) {
|
|
|
|
$this->addPlayerToQueue($player);
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function handling the click of the widget to remove them from the queue.
|
|
|
|
*
|
|
|
|
* @param array $chatCallback
|
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
public function handleManiaLinkAnswerRemove(array $chatCallback, Player $player) {
|
|
|
|
$this->removePlayerFromQueue($player->login);
|
|
|
|
$this->showJoinQueueWidget($player);
|
|
|
|
$this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> has left the queue!');
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function used to move the first queued player to the
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function moveFirstPlayerToPlay() {
|
2014-01-28 20:09:09 +01:00
|
|
|
if (count($this->queue) > 0) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$firstPlayer = $this->maniaControl->playerManager->getPlayer($this->queue[0]->login);
|
|
|
|
$this->forcePlayerToPlay($firstPlayer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function to force a player to play status.
|
|
|
|
*
|
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function forcePlayerToPlay(Player $player) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($this->maniaControl->client->getMaxPlayers()['CurrentValue'] > count($this->maniaControl->playerManager->players)) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->maniaControl->client->forceSpectator($player->login, 2);
|
|
|
|
$this->maniaControl->client->forceSpectator($player->login, 0);
|
2014-01-28 20:09:09 +01:00
|
|
|
if (isset($this->spectators[$player->login])) {
|
2014-01-24 21:40:12 +01:00
|
|
|
unset($this->spectators[$player->login]);
|
|
|
|
}
|
|
|
|
$this->removePlayerFromQueue($player->login);
|
|
|
|
$this->showPlayWidget($player);
|
|
|
|
$this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> has a free spot and is now playing!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function adds a player to the queue.
|
|
|
|
*
|
|
|
|
* @param Player $player
|
2014-01-25 22:32:05 +01:00
|
|
|
* @return bool
|
2014-01-24 23:39:25 +01:00
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function addPlayerToQueue(Player $player) {
|
2014-01-25 22:32:05 +01:00
|
|
|
foreach($this->queue as $queuedPlayer) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($queuedPlayer->login == $player->login) {
|
2014-01-25 22:32:05 +01:00
|
|
|
$this->maniaControl->chat->sendError('You\'re already in the queue!', $player->login);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2014-01-28 20:09:09 +01:00
|
|
|
|
|
|
|
if ($this->maniaControl->settingManager->getSetting($this, self::QUEUE_MAX) > count($this->queue)) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$this->queue[count($this->queue)] = $player;
|
|
|
|
$this->maniaControl->chat->sendChat('$z$s$090[Queue] $<$fff' . $player->nickname . '$> just joined the queue!');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function removes a player from the queue.
|
|
|
|
*
|
|
|
|
* @param $login
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function removePlayerFromQueue($login) {
|
|
|
|
$count = 0;
|
|
|
|
$newQueue = array();
|
|
|
|
foreach($this->queue as $queuePlayer) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($queuePlayer->login != $login) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$newQueue[$count] = $queuePlayer;
|
|
|
|
$count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->queue = $newQueue;
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function shows the join queue widget to a player.
|
|
|
|
*
|
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function showJoinQueueWidget(Player $player) {
|
|
|
|
$maniaLink = new ManiaLink(self::ML_ID);
|
|
|
|
|
|
|
|
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
|
|
|
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
|
|
|
$max_queue = $this->maniaControl->settingManager->getSetting($this, self::QUEUE_MAX);
|
|
|
|
|
|
|
|
// Main frame
|
|
|
|
$frame = new Frame();
|
|
|
|
$maniaLink->add($frame);
|
|
|
|
$frame->setSize(60, 6);
|
|
|
|
$frame->setPosition(0, 67, 0);
|
|
|
|
|
|
|
|
// Background
|
|
|
|
$backgroundQuad = new Quad();
|
|
|
|
$frame->add($backgroundQuad);
|
|
|
|
$backgroundQuad->setPosition(0, 0, 0);
|
|
|
|
$backgroundQuad->setSize(70, 10);
|
|
|
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
|
|
|
|
|
|
|
$cameraQuad = new Quad_Icons64x64_1();
|
|
|
|
$frame->add($cameraQuad);
|
|
|
|
$cameraQuad->setPosition(-29, 0.4, 2);
|
|
|
|
$cameraQuad->setSize(9, 9);
|
|
|
|
$cameraQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_Camera);
|
|
|
|
|
|
|
|
$statusLabel = new Label_Text();
|
|
|
|
$frame->add($statusLabel);
|
|
|
|
$statusLabel->setPosition(4.5, 2.8, 1);
|
|
|
|
$statusLabel->setSize(66, 4);
|
|
|
|
$statusLabel->setAlign('center', 'center');
|
|
|
|
$statusLabel->setScale(0.8);
|
|
|
|
$statusLabel->setStyle(Label_Text::STYLE_TextStaticSmall);
|
|
|
|
|
|
|
|
$messageLabel = new Label_Button();
|
|
|
|
$frame->add($messageLabel);
|
|
|
|
$messageLabel->setPosition(4.5, -1.6, 1);
|
|
|
|
$messageLabel->setSize(56, 4);
|
|
|
|
$messageLabel->setAlign('center', 'center');
|
|
|
|
$messageLabel->setScale(1.0);
|
|
|
|
|
|
|
|
$inQueue = false;
|
|
|
|
foreach($this->queue as $queuedPlayer) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($queuedPlayer->login == $player->login) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$inQueue = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($inQueue) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$message = '$fff$sYou\'re in the queue (click to unqueue).';
|
|
|
|
|
|
|
|
$position = 0;
|
|
|
|
foreach(array_values($this->queue) as $i => $queuePlayer) {
|
2014-01-28 20:09:09 +01:00
|
|
|
if ($player->login == $queuePlayer->login) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$position = ($i + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-24 21:42:16 +01:00
|
|
|
$statusLabel->setText('$aaaStatus: In queue (' . $position . '/' . count($this->queue) . ') Waiting: ' . count($this->queue) . '/' . $max_queue . '');
|
2014-01-24 21:40:12 +01:00
|
|
|
$messageLabel->setAction(self::ML_REMOVEFROMQUEUE);
|
|
|
|
$backgroundQuad->setAction(self::ML_REMOVEFROMQUEUE);
|
|
|
|
$statusLabel->setAction(self::ML_REMOVEFROMQUEUE);
|
|
|
|
$cameraQuad->setAction(self::ML_REMOVEFROMQUEUE);
|
|
|
|
} else {
|
2014-01-28 20:09:09 +01:00
|
|
|
if (count($this->queue) < $max_queue) {
|
2014-01-24 21:40:12 +01:00
|
|
|
$message = '$0ff$sClick to join spectator waiting list.';
|
|
|
|
$messageLabel->setAction(self::ML_ADDTOQUEUE);
|
|
|
|
$backgroundQuad->setAction(self::ML_ADDTOQUEUE);
|
|
|
|
$statusLabel->setAction(self::ML_ADDTOQUEUE);
|
|
|
|
$cameraQuad->setAction(self::ML_ADDTOQUEUE);
|
|
|
|
} else {
|
|
|
|
$message = '$f00The waiting list is full!';
|
|
|
|
}
|
|
|
|
|
|
|
|
$statusLabel->setText('$aaaStatus: Not queued spectator Waiting: ' . count($this->queue) . '/' . $max_queue . '');
|
|
|
|
}
|
|
|
|
|
|
|
|
$messageLabel->setText($message);
|
|
|
|
$messageLabel->setStyle(Label_Text::STYLE_TextStaticSmall);
|
|
|
|
|
2014-01-28 20:09:09 +01:00
|
|
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player);
|
2014-01-24 21:40:12 +01:00
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function shows the "You got a free spot, enjoy playing!" widget.
|
|
|
|
*
|
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function showPlayWidget(Player $player) {
|
|
|
|
$maniaLink = new ManiaLink(self::ML_ID);
|
|
|
|
|
|
|
|
$quadStyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowStyle();
|
|
|
|
$quadSubstyle = $this->maniaControl->manialinkManager->styleManager->getDefaultMainWindowSubStyle();
|
|
|
|
|
|
|
|
// Main frame
|
|
|
|
$frame = new Frame();
|
|
|
|
$maniaLink->add($frame);
|
|
|
|
$frame->setSize(60, 6);
|
|
|
|
$frame->setPosition(0, 67, 0);
|
|
|
|
|
|
|
|
// Background
|
|
|
|
$backgroundQuad = new Quad();
|
|
|
|
$frame->add($backgroundQuad);
|
|
|
|
$backgroundQuad->setPosition(0, 0, 0);
|
|
|
|
$backgroundQuad->setSize(70, 10);
|
|
|
|
$backgroundQuad->setStyles($quadStyle, $quadSubstyle);
|
|
|
|
|
|
|
|
$cameraQuad = new Quad_Icons64x64_1();
|
|
|
|
$frame->add($cameraQuad);
|
|
|
|
$cameraQuad->setPosition(-29, 0.4, 2);
|
|
|
|
$cameraQuad->setSize(9, 9);
|
|
|
|
$cameraQuad->setSubStyle(Quad_Icons64x64_1::SUBSTYLE_Camera);
|
|
|
|
|
|
|
|
$messageLabel = new Label_Button();
|
|
|
|
$frame->add($messageLabel);
|
|
|
|
$messageLabel->setPosition(4.5, 0.6, 1);
|
|
|
|
$messageLabel->setSize(56, 4);
|
|
|
|
$messageLabel->setAlign('center', 'center');
|
|
|
|
$messageLabel->setScale(1.0);
|
|
|
|
$messageLabel->setText('$090You got a free spot, enjoy playing!');
|
|
|
|
$messageLabel->setStyle(Label_Text::STYLE_TextStaticSmall);
|
|
|
|
|
|
|
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'Queue');
|
|
|
|
$this->showPlay[$player->login] = array('time' => time(), 'player' => $player);
|
|
|
|
}
|
|
|
|
|
2014-01-24 23:39:25 +01:00
|
|
|
/**
|
|
|
|
* Function hides the queue widget from the player.
|
|
|
|
*
|
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-24 21:40:12 +01:00
|
|
|
private function hideQueueWidget(Player $player) {
|
|
|
|
$maniaLink = new ManiaLink(self::ML_ID);
|
|
|
|
$this->maniaControl->manialinkManager->displayWidget($maniaLink, $player, 'Queue');
|
|
|
|
}
|
2014-01-24 15:49:28 +01:00
|
|
|
}
|