maniaControl = $maniaControl; $this->prepareManialink(); // Register for callbacks $this->maniaControl->timerManager->registerTimerListening($this, 'handle1Second', 1000); $this->maniaControl->callbackManager->registerCallbackListener(PlayerManager::CB_PLAYERCONNECT, $this, 'handlePlayerJoined'); } /** * Create the ManiaLink and CustomUI instances */ private function prepareManialink() { $this->customUI = new CustomUI(); } /** * Update the CustomUI Manialink * * @param Player $player */ private function updateManialink(Player $player = null) { if ($player) { $this->maniaControl->manialinkManager->sendManialink($this->customUI, $player->login); return; } $this->maniaControl->manialinkManager->sendManialink($this->customUI); } /** * Handle 1Second * * @param $time */ public function handle1Second($time) { if (!$this->updateManialink) { return; } $this->updateManialink = false; $this->updateManialink(); } /** * Handle PlayerJoined Callback * * @param Player $player */ public function handlePlayerJoined(Player $player) { $this->updateManialink($player); } /** * Set Showing of Notices * * @param bool $visible */ public function setNoticeVisible($visible) { $this->customUI->setNoticeVisible($visible); $this->updateManialink = true; } /** * Set Showing of the Challenge Info * * @param bool $visible */ public function setChallengeInfoVisible($visible) { $this->customUI->setChallengeInfoVisible($visible); $this->updateManialink = true; } /** * Set Showing of the Net Infos * * @param bool $visible */ public function setNetInfosVisible($visible) { $this->customUI->setNetInfosVisible($visible); $this->updateManialink = true; } /** * Set Showing of the Chat * * @param bool $visible */ public function setChatVisible($visible) { $this->customUI->setChatVisible($visible); $this->updateManialink = true; } /** * Set Showing of the Checkpoint List * * @param bool $visible */ public function setCheckpointListVisible($visible) { $this->customUI->setCheckpointListVisible($visible); $this->updateManialink = true; } /** * Set Showing of Round Scores * * @param bool $visible */ public function setRoundScoresVisible($visible) { $this->customUI->setRoundScoresVisible($visible); $this->updateManialink = true; } /** * Set Showing of the Scoretable * * @param bool $visible */ public function setScoretableVisible($visible) { $this->customUI->setScoretableVisible($visible); $this->updateManialink = true; } /** * Set Global Showing * * @param bool $visible */ public function setGlobalVisible($visible) { $this->customUI->setGlobalVisible($visible); $this->updateManialink = true; } }