コード例 #1
0
 function rules($matchFile = '')
 {
     list(, , $system) = $this->fetchAndAssertConfig(_('setting game options'));
     $service = new \DedicatedManager\Services\MatchSettingsFileService();
     if ($matchFile) {
         list($gameInfos, $maps, $scriptSettings, $randomize) = $service->get($matchFile);
         $this->session->set('matchFile', $matchFile);
         $this->session->set('gameInfos', $gameInfos);
         $this->session->set('selected', $maps);
         $this->session->set('scriptSettings', $scriptSettings);
         $this->session->set('randomize', $randomize);
     } else {
         $gameInfos = new GameInfos();
         $scriptSettings = array();
     }
     $scriptService = new \DedicatedManager\Services\ScriptService();
     $scripts = $scriptService->getList($system->title);
     $scriptIds = array();
     $scriptsRules = array();
     foreach ($scripts as $script) {
         $scriptIds[$script] = uniqid('', true);
         $scriptsRules[$script] = $scriptService->getFileMatchRules($system->title, $script);
     }
     $gameInfos = $this->session->get('gameInfos', $gameInfos);
     if (($gameInfos->scriptName || $system->title) && $scriptSettings) {
         foreach ($scriptSettings as $scriptSetting) {
             $scriptsRules[$gameInfos->scriptName][$scriptSetting->name]->default = $scriptSetting->default;
         }
     }
     $this->response->matchFile = $matchFile;
     $this->response->settingsList = $service->getList();
     $this->response->gameInfos = $gameInfos;
     $this->response->scripts = $scripts;
     $this->response->scriptIds = $scriptIds;
     $this->response->scriptsRules = $scriptsRules;
     $this->response->title = $system->title;
     $header = \DedicatedManager\Helpers\Header::getInstance();
     $header->rightText = _('Back to server configuration');
     $header->rightIcon = 'back';
     $header->rightLink = $this->request->createLinkArgList('../config');
 }