function displayWrongState($login) { $info = Info::Create($login, false); $info->setSize(100, 27); $info->setTitle('Bad Server State!'); $info->setText("This cannot be done at the current server state.\nWait a bit and try again!"); $info->centerOnScreen(); $info->show(); }
function onClickMode($login, $mode) { try { $config = \ManiaLive\DedicatedApi\Config::getInstance(); Connection::factory($config->host, $config->port)->setGameMode($mode); $dialog = Dialog::Create($login, false); $dialog->setSize(125, 40); $dialog->setTitle('Game Mode Changed!'); $dialog->setText('You have selected ' . self::$modes[$mode][0] . ",\n" . 'New game mode will be set on map change!' . "\n" . 'Do you want to restart now?'); $dialog->setButtons(Dialog::YES | Dialog::NO); $dialog->addCloseCallback(array($this, 'onDialogClosed')); $dialog->centerOnScreen(); $dialog->showModal(); $this->show(); } catch (\Exception $ex) { $win = Info::Create($login, false); $win->setSize(40, 23); $win->setTitle('Error'); $win->setText($ex->getMessage()); $win->centerOnScreen(); $win->showModal(); } }
function sendToTaskbar($login) { $window = $this->managedWindow[$login]; // seeking an empty place in the player taskbar $taskbarIndex = 0; $freePlaceFound = false; foreach ($this->thumbnails[$login] as $taskbarIndex => $placedThumbnail) { if (!$placedThumbnail) { $freePlaceFound = true; break; } } if (!$freePlaceFound) { if ($taskbarIndex == self::MAX_THUMBNAILS - 1) { $info = Info::Create($login, false); $info->setSize(40, 25); $info->setTitle('Too many Windows!'); $info->setText("You are in the process of minimizing another window ...\n" . "Due to restricted resources you have reached the limit of allowed concurrent displayable minimized windows.\n" . "Please close some old windows in order to be able to open and minimize new ones."); $this->addModal($info); return false; } else { $taskbarIndex = count($this->thumbnails[$login]); } } // create the thumbnail $thumbnail = Thumbnail::Create($login, false, $window); $this->thumbnails[$login][$taskbarIndex] = $thumbnail; $thumbnail->setSize(30, 26); $thumbnail->setPosition(80 - 31 * $taskbarIndex, 85); $thumbnail->addCloseCallback(array($this, 'onThumbnailClosed')); $thumbnail->show(); $window->hide(); $this->managedWindow[$login] = null; return true; }