當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。