コード例 #1
1
 function close($onPurpose = true)
 {
     if ($this->server) {
         if ($onPurpose) {
             $this->server->notifyUnregister();
             foreach ($this->privilegeKeys as $key) {
                 $this->server->privilegeKeyDelete($key);
             }
         }
         $this->server->clientListReset();
         $this->server->channelListReset();
         $this->server = null;
         $this->playersGroupId = 0;
         $this->privilegeKeys = array();
     }
     if ($this->processHandler && $this->processId) {
         $this->processHandler->killThread($this->processId);
         $this->processId = null;
     }
     Dispatcher::unregister(AppEvent::getClass(), $this);
     Dispatcher::unregister(TickEvent::getClass(), $this);
     // TODO something to avoid memory leaks when unloading the plugin
     // but the TS framework is f*cked up (plenty of circular references
     // which can't be unset from outside...)
 }
コード例 #2
0
 protected function __construct()
 {
     $this->modalBg = new Bgs1(340, 200);
     $this->modalBg->setSubStyle(Bgs1::BgDialogBlur);
     $this->modalBg->setAlign('center', 'center');
     $this->modalBg->setPosZ(Window::Z_MODAL);
     $this->modalBg->setScriptEvents();
     $this->nextLoop = microtime(true);
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ALL & ~AppEvent::ON_POST_LOOP);
     Dispatcher::register(PlayerEvent::getClass(), $this, PlayerEvent::ON_PLAYER_CHANGE_SIDE);
     Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_PLAYER_CONNECT | ServerEvent::ON_PLAYER_DISCONNECT);
     $config = \ManiaLive\DedicatedApi\Config::getInstance();
     $this->connection = Connection::factory($config->host, $config->port, $config->timeout, $config->user, $config->password);
 }
コード例 #3
0
ファイル: Storage.php プロジェクト: ketsuekiro/manialive
 protected function __construct()
 {
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ON_INIT | AppEvent::ON_POST_LOOP);
     Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ALL);
 }
コード例 #4
0
 function stop()
 {
     $this->running = false;
     Dispatcher::unregister(AppEvent::getClass(), $this);
     Dispatcher::unregister(TickEvent::getClass(), $this);
 }
コード例 #5
0
 protected function __construct()
 {
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ON_INIT | AppEvent::ON_TERMINATE);
     Dispatcher::register(ServerEvent::getClass(), $this, ServerEvent::ON_SERVER_START | ServerEvent::ON_SERVER_STOP);
 }
コード例 #6
0
ファイル: Ticker.php プロジェクト: maniaplanet/manialive-lib
 function __construct()
 {
     $this->time = time();
     Dispatcher::register(AppEvent::getClass(), $this, AppEvent::ON_PRE_LOOP);
 }
コード例 #7
0
ファイル: Plugin.php プロジェクト: ketsuekiro/manialive
 /**
  * Stop listening for application events.
  */
 protected final function disableApplicationEvents($events = AppEvent::ALL)
 {
     $this->restrictIfUnloaded();
     Dispatcher::unregister(AppEvent::getClass(), $this, $events & $this->eventsApplication);
     $this->eventsApplication &= ~$events;
 }