当前位置: 首页>>代码示例>>PHP>>正文


PHP Binary::writeLShort方法代码示例

本文整理汇总了PHP中pocketmine\utils\Binary::writeLShort方法的典型用法代码示例。如果您正苦于以下问题:PHP Binary::writeLShort方法的具体用法?PHP Binary::writeLShort怎么用?PHP Binary::writeLShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\utils\Binary的用法示例。


在下文中一共展示了Binary::writeLShort方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: putLShort

 public function putLShort($v)
 {
     $this->buffer .= Binary::writeLShort($v);
 }
开发者ID:Cecil107,项目名称:PocketMine-0.13.0,代码行数:4,代码来源:BinaryStream.php

示例2: putShort

 public function putShort($v)
 {
     $this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeShort($v) : Binary::writeLShort($v);
 }
开发者ID:ianju,项目名称:PocketMine-MP,代码行数:4,代码来源:NBT.php

示例3: handle

 public function handle($address, $port, $packet)
 {
     $offset = 2;
     $packetType = ord($packet[$offset++]);
     $sessionID = Binary::readInt(substr($packet, $offset, 4));
     $offset += 4;
     $payload = substr($packet, $offset);
     switch ($packetType) {
         case self::HANDSHAKE:
             //Handshake
             $reply = chr(self::HANDSHAKE);
             $reply .= Binary::writeInt($sessionID);
             $reply .= self::getTokenString($this->token, $address) . "";
             $this->server->sendPacket($address, $port, $reply);
             break;
         case self::STATISTICS:
             //Stat
             $token = Binary::readInt(substr($payload, 0, 4));
             if ($token !== self::getTokenString($this->token, $address) and $token !== self::getTokenString($this->lastToken, $address)) {
                 break;
             }
             $reply = chr(self::STATISTICS);
             $reply .= Binary::writeInt($sessionID);
             if (strlen($payload) === 8) {
                 if ($this->timeout < microtime(true)) {
                     $this->regenerateInfo();
                 }
                 $reply .= $this->longData;
             } else {
                 $reply .= $this->server->getServerName() . "" . (($this->server->getGamemode() & 0x1) === 0 ? "SMP" : "CMP") . "" . ($this->server->getDefaultLevel() === null ? "unknown" : $this->server->getDefaultLevel()->getName()) . "" . count($this->server->getOnlinePlayers()) . "" . $this->server->getMaxPlayers() . "" . Binary::writeLShort($this->server->getPort()) . $this->server->getIp() . "";
             }
             $this->server->sendPacket($address, $port, $reply);
             break;
     }
 }
开发者ID:boybook,项目名称:PocketMine-MP,代码行数:35,代码来源:QueryHandler.php

示例4: getShortQuery

 public function getShortQuery()
 {
     return $this->serverName . "" . $this->gametype . "" . $this->map . "" . $this->numPlayers . "" . $this->maxPlayers . "" . Binary::writeLShort($this->port) . $this->ip . "";
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:4,代码来源:QueryRegenerateEvent.php

示例5: putString

 public function putString($string)
 {
     $this->buffer .= Binary::writeLShort(strlen($string));
     $this->buffer .= $string;
 }
开发者ID:Ad5001,项目名称:WorldEditArt,代码行数:5,代码来源:ByteBufferWriter.php


注:本文中的pocketmine\utils\Binary::writeLShort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。