示例#1
0
 public function initConfig($config)
 {
     $headerSize = isset($config['header_size']) ? intval($config['header_size']) : 4;
     $packChar = isset($config['pack_char']) ? $config['pack_char'] : 'N';
     $defaultBufferSize = isset($config['default_buffer_size']) ? intval($config['default_buffer_size']) : 2048;
     $maxPacketLength = isset($config['max_packet_length']) ? intval($config['max_packet_length']) : 2048;
     unset($config['header_size'], $config['pack_char'], $config['default_buffer_size'], $config['max_packet_length']);
     $this->rBuffProcessor = new HeaderNBufferProcessor($headerSize, $packChar, $defaultBufferSize, $maxPacketLength);
     parent::initConfig($config);
     return $this;
 }
示例#2
0
 public static function sendUserSystemTextChatMessage($to, $text)
 {
     $packet = new TextChat();
     $packet->setFromSystemUser();
     $packet->to = intval($to);
     $packet->setText($text);
     Server::getInstance()->sendPacket($packet);
 }
示例#3
0
 public function _initServer()
 {
     Cache::getInstance()->initConfig(\Yaf\Application::app()->getConfig()->get('application')->get('cache'));
     Server::getInstance()->initConfig(\Yaf\Application::app()->getConfig()->get('application')->get('chat'))->register();
 }