本文整理汇总了PHP中Protocol::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Protocol::input方法的具体用法?PHP Protocol::input怎么用?PHP Protocol::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: out
/**
* 输出协议
* @param $player_id
*/
public static function out($player_id)
{
if (isset(self::$_gain_msg[$player_id]) && !empty(self::$_gain_msg[$player_id])) {
Protocol::input($player_id, 8, 7, 740, self::$_gain_msg[$player_id]);
unset(self::$_gain_msg[$player_id]);
}
}
示例2: out
public static function out($player_id, $player_info = null)
{
if (!empty(self::$_guide_list)) {
$out = array();
$logs = array();
$data = self::get_data('PlayerDetail')->get_player_detail($player_id, 'guide');
foreach (self::$_guide_list as $guide) {
$out[$guide['guide_id']] = array('guide_id' => $guide['guide_id'], 'step' => $guide['step']);
$logs[$guide['guide_id']] = array('type' => 1, 'task_id' => $guide['guide_id'], 'step' => $guide['step'], 'status' => 0);
$data[$guide['guide_id']] = 1;
}
$result = self::get_data('PlayerDetail')->update_player_detail($player_id, array('guide' => $data));
if (!$result) {
return;
}
if (!IS_FRONT || defined('FROM_GATEWAY')) {
$cmd0 = 8;
} else {
$cmd0 = 3;
}
// Com_Log::write('guide_'.$player_id,var_export($out,true));
Protocol::input($player_id, $cmd0, 7, 787, array(0 => $out));
if (empty($player_info) || !isset($player_info['level']) || !isset($player_info['vip'])) {
$player_info = self::get_data('Player')->get_player_info($player_id, array('level', 'vip'));
}
Log_Guide::getInstance()->add_multi_guide_log($player_id, $player_info['level'], $player_info['vip'], $logs);
self::$_guide_list = null;
}
}
示例3: run
public function run($player_id, $s_task_id)
{
$player_info = $this->get_data('Player')->get_player_info($player_id, array('level'));
$level = $player_info['level'];
// $task_id = $this->get_random_chain_task_id($level,0);
$task_id = $s_task_id;
$data = array();
if (!empty($task_id)) {
$arr_player_task = $this->get_game('TaskChain')->get_init_chain_val($player_id, $task_id, 1);
$result = $this->get_data('PlayerTask')->set_task_info($player_id, array('chain_val' => $arr_player_task['chain_val'], 'target_val' => $arr_player_task['target_val']));
if ($result) {
$result = $this->get_data('PlayerTask')->set_chain_task_count($player_id);
}
if ($result) {
$data = $this->get_game('TaskChain')->get_chain_task_list($player_id, $arr_player_task);
Protocol::input($player_id, 8, 10, 1025, $data);
}
}
Protocol::out();
if ($result) {
echo 'success';
} else {
echo 'error';
}
exit;
}
示例4: prop_806
/**
* 道具变更下行协议
* @param $player_id
* @param $change_prop 二维数组 传进去player_prop的内容
* 如果是位置变更 要加上 ['from_item_position'] 原始位置 ['from_grid'] 原始格子数
* player_prop里面的 item_position 赋值为新的位置编号 grid 赋值为新的格子编号
* @param $error_code 0 失败 1成功
* @param $cmd0 3 直接返回给flash 8 通过异步返回
* @param $flag 协议输出格式 0 直接输出 1 标志为粘包 2返回协议内容 3 附加粘包
*
*/
public static function prop_806($player_id, $change_prop, $func_id = 0, $error_code = 1, $cmd0 = 3, $flag = 3)
{
//后面三个参数不用了
$data['type'] = 1;
$data['result'] = $error_code;
$data['box'] = array();
if (!empty($change_prop)) {
foreach ($change_prop as $prop) {
$tmp_prop = array();
if ($prop['item_num'] <= 0) {
//道具数量等于0的时候 只给位置信息就好了
$tmp_prop['item_position'] = $prop['item_position'];
$tmp_prop['grid'] = $prop['grid'];
} else {
# 要求只有新发的道具的from_item_position=0,老道具都要求非0
$tmp_prop = $prop;
$tmp_prop['from_item_position'] = $prop['from_item_position'];
}
$data['box'][] = Struct_Prop::get_item_box_operate_struct($tmp_prop);
}
}
$data['func_id'] = $func_id;
if (!IS_FRONT) {
Protocol::input($player_id, 8, 8, 806, $data);
Protocol::out();
} else {
if (defined('FROM_GATEWAY')) {
$cmd0 = 8;
}
Protocol::input($player_id, $cmd0, 8, 806, $data);
}
}
示例5: async_update_union_guide
/**
* @Purpose:
* 异步更新公会引导状态
* @Param $player_id 玩家ID
* @Param $cur_times 当前完成次数
* @Param $max_times 最大完成次数
* @Param $type 公会引导类型(1:福利2:悬赏3:巨炮4:科技5:商店6:活动)
* @Param $sub_type 公会引导子类型(1:福利2:悬赏3:巨炮4:科技5:商店6:活动)
*/
public function async_update_union_guide($player_id, $cur_times, $max_times, $type, $sub_type)
{
$player_id = intval($player_id);
$cur_times = intval($cur_times);
$max_times = intval($max_times);
$type = intval($type);
$sub_type = intval($sub_type);
if ($player_id > 0 && $cur_times >= $max_times && $type > 0 && $sub_type > 0) {
#获取玩家公会引导天数据
$ug_data = $this->get_data('UnionGuide')->get_union_guide_info($player_id, 'ug', 'day');
if ($ug_data[$type . $sub_type] != 1) {
$ug_data[$type . $sub_type] = 1;
$this->start_trans();
#更新公会引导天数据
$update_res = $this->get_data('UnionGuide')->update_union_guide_data($player_id, 'ug', $ug_data);
if (!$update_res) {
$this->throw_error('10104');
}
$this->commit();
#主动更新Flash面板数据
Protocol::input($player_id, 8, 17, 1778, array($type, $sub_type, $ug_data[$type . $sub_type]));
if (!IS_FRONT) {
Protocol::out();
}
}
}
}
示例6: router
public function router($cmd0, $cmd1, $cmd2, $player_id, $arr_param)
{
global $arrParam, $arrAuthUser, $logHandler;
$arrAuthUser['player_id'] = $player_id;
$arrParam = $arr_param;
$class = 'S2P_' . $cmd1;
$include_file = ACTION_PATH . "/S2P/S2P_{$cmd1}.php";
if (is_file($include_file)) {
require $include_file;
try {
//调用对应指令函数
$obj = new $class();
$exec_cmd2 = 'CMD2_' . $cmd2;
if (ECONOMY_LOG_SWITCH === TRUE) {
$logHandler['logger'] = new Com_Logger($cmd0, $cmd1, $cmd2, $player_id);
}
call_user_func_array(array($obj, $exec_cmd2), array());
$protocols = Protocol::get_protocol();
Protocol::out();
Statistic::report($cmd0, $cmd1, $cmd2, $arrAuthUser, $arrParam, 1, 'exec fun success', $protocols);
if (ECONOMY_LOG_SWITCH === TRUE) {
$logHandler['logger']->flush_log();
}
exit;
} catch (Exception $e) {
//有异常
$msg = json_decode($e->getMessage(), true);
$error = "Exception: " . $e->getFile() . " line:" . $e->getLine() . " error code " . $msg['error']['code'];
Statistic::report($cmd0, $cmd1, $cmd2, $arrAuthUser, $arrParam, 0, $error);
Protocol::input($player_id, 8, 7, 742, array(0 => array($msg['error'])));
Protocol::out();
exit;
}
}
}
示例7: doAction
public function doAction()
{
$userInfo_json = base64_decode($_POST['data']);
$userInfo_array = json_decode($userInfo_json, true);
$state = isset($userInfo_array['state']) ? $userInfo_array['state'] : "";
$ips = isset($userInfo_array['ips']) ? $userInfo_array['ips'] : "";
$data = array();
$res = array();
if (!empty($state) && !in_array($state, $this->state)) {
$data['status'] = 8;
exit;
} else {
$data['status'] = 0;
}
if ($state == 'open') {
#开服
#Protocol::input(0, 7, 4, 514, array('type_id'=>1,'role_id'=>0));
#Protocol::out();
$res['status'] = 1;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
} elseif ($state == 'close') {
#关服维护
Protocol::input(0, 7, 4, 514, array('type_id' => 1, 'role_id' => 0));
Protocol::out();
$res['status'] = 0;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
TenYear::getInstance();
$objSession = TenYear::getInstance('session');
$objSession->del_all_session();
} else {
$data['status'] = 0;
}
} elseif ('write_ip' == $state) {
#白名单
$res['write_ip'] = $ips;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
} elseif ('black_id' == $state) {
#黑名单
$res['black_id'] = $ips;
if ($this->get_data('Online')->set_server_state($res)) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
}
echo json_encode($data);
return;
}
示例8: doAction
public function doAction()
{
$userInfo_json = base64_decode($_POST['data']);
$userInfo_array = json_decode($userInfo_json, true);
$ban = array();
$result['data'] = $this->get_data('Player')->update_player_info($userInfo_array['player_id'], array('is_ban' => 3));
$result['status'] = 1;
Protocol::input(0, 7, 4, 514, array('type_id' => 2, 'role_id' => $userInfo_array['player_id']));
Protocol::out();
echo json_encode($result);
}
示例9: adult_remind
protected function adult_remind($player_id, $status)
{
if ($status == 1) {
$msg = Language_Message::make_message('10223');
$type = 1;
} else {
$msg = Language_Message::make_message('10224');
$type = 2;
}
Com_Log::write("do_timeer." . $player_id, "msg:" . var_export($msg, true));
Protocol::input($player_id, 8, 7, 755, array(0 => $msg, 1 => $type));
}
示例10: sync_func_data
/**
* 功能图标变更下行协议
* @param $player_id
* @param $func_id
* @param $action_type: 0关闭,1开启
*
*/
public static function sync_func_data($player_id, $func_id, $action_type = 0, $func_config = null)
{
if (empty($func_config) || !is_array($func_config)) {
$func_config = Cache_FuncConfig::getInstance()->get_func_config_info($func_id);
}
if ($action_type == 0) {
# 告知Flash关闭功能
$out_741['funcs'][] = array('operate' => 2, 'func_id' => $func_config['func_id'], 'func_name' => $func_config['func_name'], 'open' => 1, 'pos' => $func_config['pos'], 'order' => $func_config['order']);
} elseif ($action_type == 1) {
# 告知Flash开启功能
$out_741['funcs'][] = array('operate' => 1, 'func_id' => $func_config['func_id'], 'func_name' => $func_config['func_name'], 'open' => 1, 'pos' => $func_config['pos'], 'order' => $func_config['order']);
}
Protocol::input($player_id, 8, 7, 741, $out_741);
}
示例11: run
public function run($player_id, $s_task_id)
{
$arr_player_task = $this->get_data('PlayerTask')->get_task_info($player_id);
$out = array();
$this->get_game('TaskMain')->do_guide_task($player_id, $s_task_id, 1, $arr_player_task, $out);
$result = $this->get_data('PlayerTask')->set_task_info($player_id, $arr_player_task);
Protocol::input($player_id, 8, 10, 1002, array(0 => $out));
if ($result) {
echo 'success';
} else {
echo 'error';
}
exit;
}
示例12: msg
public static function msg($player_id, $code, $out_code = 0)
{
if (!IS_FRONT || defined('FROM_GATEWAY')) {
$cmd0 = 8;
} else {
$cmd0 = 3;
}
if ($out_code > 0) {
$msg = Language_Message::make_message($code, array(0 => array('rep_type' => 7, 'rep_val' => "-" . $out_code)));
} else {
$msg = Language_Message::make_message($code);
}
Protocol::input($player_id, $cmd0, 7, 742, array(0 => array($msg)));
#提示采集成功
}
示例13: out
public static function out($func_id = 0)
{
if (!empty(self::$_reward)) {
foreach (self::$_reward as $player_id => $reward) {
$out = array('type' => 1, 'reward' => array());
foreach ($reward as $r) {
if (isset($r['overlay_num']) && $r['overlay_num'] > 0) {
$r['item_num'] = $r['overlay_num'];
}
$out['reward'][] = Struct_Prop::get_prop_struct($r);
}
$out['func_id'] = $func_id;
Protocol::input($player_id, 8, 7, 843, $out);
}
self::$_reward = null;
}
}
示例14: start_task
public function start_task($player_id)
{
$player_info = $this->get_data('Player')->get_player_info($player_id, array('level'));
$level = $player_info['level'];
$task_id = $this->get_game('TaskChain')->get_random_chain_task_id($level, 0);
echo "player_id;{$player_id} task_id:{$task_id}\n";
$data = array();
if (!empty($task_id)) {
$arr_player_task = $this->get_game('TaskChain')->get_init_chain_val($player_id, $task_id, 1);
$result = $this->get_data('PlayerTask')->set_task_info($player_id, array('chain_val' => $arr_player_task['chain_val'], 'target_val' => $arr_player_task['target_val']));
if ($result) {
$data = $this->get_game('TaskChain')->get_chain_task_list($player_id, $arr_player_task, null, 1, 1);
Protocol::input($player_id, 8, 10, 1025, $data);
Protocol::out();
return true;
}
}
return false;
}
示例15: doAction
public function doAction()
{
$userInfo_json = base64_decode($_POST['data']);
$userInfo_array = json_decode($userInfo_json, true);
$state = isset($userInfo_array['state']) ? $userInfo_array['state'] : "";
$data = array();
if (!empty($state) && !in_array($state, $this->state)) {
$data['status'] = 8;
echo json_encode($data);
exit;
} else {
$data['status'] = 0;
}
if ($state == 'reload') {
#reload tables
$data['status'] = 1;
$data['data'] = 'ok';
Protocol::input(0, 7, 4, 402, array(1));
Protocol::out();
} elseif ($state == 'memcache') {
#清memcache 不通知前端
$data['status'] = 1;
$data['data'] = 'ok';
Com_Cache::factory('setting')->flush();
} elseif ($state == 'memcache_2') {
#清memcache、并通知前端
$data['status'] = 1;
$data['data'] = 'ok';
Com_Cache::factory('setting')->flush();
Protocol::input(0, 7, 4, 525, array(1));
Protocol::out();
session_unset();
} elseif ('reset' == $state) {
Protocol::input(0, 7, 4, 525, array(1));
Protocol::out();
session_unset();
$data['status'] = 1;
$data['data'] = 'ok';
}
echo json_encode($data);
return;
}