本文整理汇总了PHP中Protocol::_arrProtocol方法的典型用法代码示例。如果您正苦于以下问题:PHP Protocol::_arrProtocol方法的具体用法?PHP Protocol::_arrProtocol怎么用?PHP Protocol::_arrProtocol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::_arrProtocol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: out
public static function out($gateway = null)
{
$asyncProtocol = '';
if (empty(self::$_arrProtocol)) {
return;
}
if (defined('JSON_PROTOCOL') && JSON_PROTOCOL > 0) {
#测试的时候返回的下行是json格式
foreach (self::$_arrProtocol as $protocol) {
if ($protocol['cmd0'] == 7 || $protocol['cmd0'] == 8) {
$asyncProtocol[$protocol['player_id']] .= self::decode($protocol['player_id'], $protocol['cmd0'], $protocol['cmd1'], $protocol['cmd2'], $protocol['data']);
}
echo json_encode($protocol);
// Com_Log::write("json_out.".$protocol['player_id'],var_export($protocol,true));
}
} else {
foreach (self::$_arrProtocol as $protocol) {
// Com_Log::write('out_protocol.'.$protocol['player_id'],"protocol:".var_export($protocol,true));
// Com_Log::write("player_upgrade.".$protocol['player_id'],"pro:".var_export($protocol,true));
if ($protocol['cmd0'] == 7 || $protocol['cmd0'] == 8) {
$asyncProtocol[$protocol['player_id']] .= self::decode($protocol['player_id'], $protocol['cmd0'], $protocol['cmd1'], $protocol['cmd2'], $protocol['data']);
} else {
if (isset($_GET['debug']) && $_GET['debug'] == 1) {
echo "<pre>";
}
echo self::decode($protocol['player_id'], $protocol['cmd0'], $protocol['cmd1'], $protocol['cmd2'], $protocol['data']);
if (isset($_GET['debug']) && $_GET['debug'] == 1) {
echo "<pre>";
}
}
}
}
self::$_arrProtocol = array();
//清空协议
if (!empty($asyncProtocol)) {
foreach ($asyncProtocol as $player_id => $protocol) {
Game_AsyncProtocol::getInstance()->rsync_protocol($player_id, $protocol, $gateway);
}
}
}