示例#1
0
 function onInit()
 {
     $this->setVersion('4.0.0');
     $this->addDependency(new \ManiaLive\PluginHandler\Dependency('ManiaLive', '4.0.0'));
     $this->config = \ManiaLivePlugins\MatchMakingLobby\Config::getInstance();
     //Get the Script name
     $script = $this->connection->getScriptName();
     $this->scriptName = $this->config->script ?: preg_replace('~(?:.*?[\\\\/])?(.*?)\\.Script\\.txt~ui', '$1', $script['CurrentValue']);
     $this->titleIdString = $this->connection->getSystemInfo()->titleId;
     //Get the GUI abstraction class
     $guiClassName = $this->config->getGuiClassName($this->scriptName);
     if (!class_exists($guiClassName)) {
         throw new \Exception(sprintf("Can't find class %s. You should either set up the config : ManiaLivePlugins\\MatchMakingLobby\\Config.guiClassName or the script name", $guiClassName));
     }
     $this->setGui(new $guiClassName());
     //Load services
     $this->matchMakingService = new Services\MatchMakingService();
     $this->matchMakingService->createTables();
     $this->dictionary = \ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance($this->config->getDictionnary($this->scriptName));
 }
示例#2
0
 function onInit()
 {
     $this->setVersion('4.0.0');
     $this->addDependency(new \ManiaLive\PluginHandler\Dependency('ManiaLive', '4.0.0'));
     //Load MatchMaker and helpers for GUI
     $this->config = Config::getInstance();
     $this->scriptName = \ManiaLivePlugins\MatchMakingLobby\Config::getInstance()->script ?: preg_replace('~(?:.*?[\\\\/])?(.*?)\\.Script\\.txt~ui', '$1', $this->storage->gameInfos->scriptName);
     $matchMakerClassName = $this->config->getMatchMakerClassName($this->scriptName);
     if (!class_exists($matchMakerClassName)) {
         throw new \Exception(sprintf("Can't find class %s. You should either set up the config : ManiaLivePlugins\\MatchMakingLobby\\Config.matchMakerClassName or the script name", $matchMakerClassName));
     }
     $guiClassName = $this->config->getGuiClassName($this->scriptName);
     if (!class_exists($guiClassName)) {
         throw new \Exception(sprintf("Can't find class %s. You should either set up the config : ManiaLivePlugins\\MatchMakingLobby\\Config.guiClassName or the script name", $guiClassName));
     }
     $this->matchMakingService = new Services\MatchMakingService();
     $this->matchMakingService->createTables();
     $this->setGui(new $guiClassName());
     $this->gui->lobbyBoxPosY = 45;
     $this->setMatchMaker($matchMakerClassName::getInstance());
     $this->dictionary = \ManiaLivePlugins\MatchMakingLobby\Utils\Dictionary::getInstance($this->config->getDictionnary($this->scriptName));
     $this->allyService = Services\AllyService::getInstance($this->storage->serverLogin, $this->scriptName, $this->connection->getSystemInfo()->titleId);
     return true;
 }