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


PHP Protocol::out方法代码示例

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


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

示例1: 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;
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:26,代码来源:reset_chain_task.php

示例2: 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();
             }
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:36,代码来源:UnionGuide.php

示例3: 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;
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:35,代码来源:S2PRouter.php

示例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);
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:43,代码来源:Prop.php

示例5: sync

 public function sync($data)
 {
     $arr_account = file_get_contents(CACHE_PATH . "/server3.txt");
     $arr_account = json_decode($arr_account, true);
     $player_id = $data['player_id'];
     $user_account = $data['user_account'];
     if (!$player_id || !$user_account) {
         return;
     }
     if (isset($arr_account[$user_account])) {
         if ($arr_account[$user_account]['level'] >= 55) {
             // 生成奖励邮件附件信息
             $attachment = array();
             $attachment[] = array("prop_id" => 95015, "prop_num" => 1);
             // 邮件发送
             $phrase_config = Cache_FuncPhraseConfig::getInstance()->get_phrase_config_info(8005);
             $re = $this->get_game('Mail')->async_trigger_mail($player_id, $phrase_config['title'], $phrase_config['content'], $attachment, $phrase_config['sender'], 1, 108);
             $this->write_check($re);
             Protocol::out();
         }
         if ($arr_account[$user_account]['sum_fpower'] >= 80000) {
             // 生成奖励邮件附件信息
             $attachment = array();
             $attachment[] = array("prop_id" => 95014, "prop_num" => 1);
             // 邮件发送
             $phrase_config = Cache_FuncPhraseConfig::getInstance()->get_phrase_config_info(8006);
             $re = $this->get_game('Mail')->async_trigger_mail($player_id, $phrase_config['title'], $phrase_config['content'], $attachment, $phrase_config['sender'], 1, 108);
             $this->write_check($re);
             Protocol::out();
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:32,代码来源:BetaTestReward.php

示例6: 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;
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:57,代码来源:ServerStateAction.php

示例7: 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);
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:11,代码来源:FengUserAction.php

示例8: refresh_new_union_activities_p2c

 /**
  * @Purpose:
  * 通知C++新一天的优先公会活动
  */
 public function refresh_new_union_activities_p2c()
 {
     #获取公会ID列表
     $union_id_list = $this->get_data('UnionInfo')->get_all_union_id();
     if (Com_Array::is_good_arr($union_id_list)) {
         foreach ($union_id_list as $union_id => $val) {
             #同步活动数据到C++
             $this->get_game('Union')->Sync_Union_msg($union_id, 0);
             Protocol::out();
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:16,代码来源:test_union_active.php

示例9: add_timer

 public function add_timer($player_id)
 {
     $params['type'] = 755;
     $params['id'] = $player_id;
     $params['timeout'] = $this->_timer_len;
     #10秒钟过期时间
     $params['param1'] = 0;
     $params['param2'] = 0;
     $params['param3'] = 0;
     $params['param4'] = 0;
     Com_Log::write("do_timeer." . $player_id, "send:" . $player_id);
     Protocol::input(0, 7, 4, 516, $params);
     Protocol::out();
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:14,代码来源:Adlut.php

示例10: 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;
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:19,代码来源:fix_chain_task.php

示例11: 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;
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:42,代码来源:ResetSettingAction.php

示例12: add_sign

 public function add_sign($player_id, $day, $gold_num)
 {
     if ($day > 7) {
         return false;
     }
     $activity_player = $this->get_data('NewServerActivity')->get_player_info($player_id, array('sign_info', 'extra_rewards_status', 'retro_num', 'buy_info'));
     if (isset($activity_player['sign_info'][$day])) {
         $activity_player['sign_info'][$day]['recharge_num'] += $gold_num;
         $activity_player['sign_info'][$day]['recharge_left_num'] += $gold_num;
     } else {
         $activity_player['sign_info'][$day] = array('recharge_num' => $gold_num, 'recharge_left_num' => $gold_num);
     }
     $up_arr = array('player_id' => $player_id, 'sign_info' => $activity_player['sign_info']);
     $this->get_data('NewServerActivity')->update_player_info($player_id, $up_arr);
     $data = $this->get_sign_panel($player_id);
     Protocol::input($player_id, 8, 23, 2305, $data);
     Protocol::out();
     # 新服活动,蛋疼的数字埋点
     $this->get_game('PlayerFunc')->sync_func_tips($player_id, 1250);
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:20,代码来源:NewServerActivity.php

示例13: doAction

 public function doAction()
 {
     $userInfo_json = base64_decode($_POST['data']);
     $userInfo_array = json_decode($userInfo_json, true);
     $show_type = 1;
     $content = addslashes($userInfo_array['notice']['text']);
     $start_time = $userInfo_array['notice']['begin_time'];
     $end_time = $userInfo_array['notice']['end_time'];
     $interval = $userInfo_array['notice']['exec_time'];
     $location = $userInfo_array['notice']['type'];
     $id = $userInfo_array['notice']['tid'];
     $vip = '0';
     $result = $this->get_game('SystemNotice')->add_system_notice($id, $show_type, $location, $content, $start_time, $end_time, $interval, $vip);
     $data = array();
     $data['status'] = 0;
     if ($result) {
         $data['status'] = 1;
         Protocol::out();
     }
     echo json_encode($data);
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:21,代码来源:NoticeAction.php

示例14: tiren

 public function tiren()
 {
     $data = array();
     $data['data'] = array();
     $data['status'] = $this->success;
     $userInfo_array = array();
     $acc = array();
     $acc[0] = "user_account";
     $acc[1] = $_REQUEST['account'];
     $player_id = $this->get_data('Account')->get_player_id($acc);
     $result['player_id'] = $player_id["player_id"];
     $userInfo_array['ban_time'] = 0;
     $userInfo_array['is_ban'] = 3;
     $userInfo_array['player_id'] = $player_id["player_id"];
     $userInfo = Cache_GetUserInfoGM::getInstance()->update_userInfo($userInfo_array);
     $data['data'] = $userInfo_array;
     Protocol::input(0, 7, 4, 514, array('type_id' => 2, 'role_id' => $userInfo_array['player_id']));
     Protocol::out();
     echo json_encode($data);
     // 		$player_id = $this->get_data("Account")->get_player_id();
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:21,代码来源:PlatAction.php

示例15: trigger_union_achieve


//.........这里部分代码省略.........
             if ($unionAchieveInfo['player_ids']) {
                 if (in_array($player_id, $unionAchieveInfo['player_ids'])) {
                     continue;
                 }
             }
             $unionAchieveInfo['player_ids'][] = $player_id;
         }
         $unionAchieveInfo['sid'] = $achieve_id;
         $unionAchieveInfo['state'] = 0;
         if ($update_type == 1) {
             //累加
             $unionAchieveInfo['num'] += $trigger_val;
             //成就完成
             if ($unionAchieveInfo['num'] >= $total_num) {
                 $unionAchieveInfo['state'] = 1;
             }
         } else {
             if ($update_type == 2) {
                 //赋值
                 $unionAchieveInfo['num'] = $trigger_val;
                 //成就完成
                 if ($unionAchieveInfo['num'] >= $total_num) {
                     $unionAchieveInfo['state'] = 1;
                 }
             } else {
                 if ($update_type == 3) {
                     //小于等于
                     $unionAchieveInfo['num'] = $trigger_val;
                     //成就完成
                     if ($unionAchieveInfo['num'] > 0 && $unionAchieveInfo['num'] <= $total_num) {
                         $unionAchieveInfo['state'] = 1;
                     }
                 } else {
                     continue;
                 }
             }
         }
         if ($player_num) {
             $unionAchieveInfo['state'] = 0;
             if (count($unionAchieveInfo['player_ids']) >= $player_num) {
                 $unionAchieveInfo['state'] = 1;
             }
             $unionAchieveInfo['num'] = count($unionAchieveInfo['player_ids']);
         }
         $progress_task_num = 0;
         $medal_achieve_list = Cache_UnionAchieve::getInstance()->get_union_achieve_info(array("medal_id" => $val["medal_id"]));
         $medal_total_task_num = count($medal_achieve_list);
         foreach ($medal_achieve_list as $medal_task_info) {
             if ($achieve_id == $medal_task_info["sid"]) {
                 if (!$unionAchieveInfo['state']) {
                     break;
                 }
                 $progress_task_num++;
             } else {
                 $achieve_info = $objUnionAchieveData->get_union_achieve_list($union_id, $medal_task_info["sid"]);
                 if (!$achieve_info) {
                     break;
                 }
                 if ($achieve_info['state'] == 1) {
                     $progress_task_num++;
                 }
             }
         }
         $this->start_trans();
         $unionAchieveInfo["rep_time"] = time();
         $retUnionAchieve = $objUnionAchieveData->update_union_achieve($union_id, $achieve_id, $unionAchieveInfo);
         //达成勋章
         $retUnionInfo = true;
         if ($progress_task_num == $medal_total_task_num) {
             $objUnionInfoData = $this->get_data('UnionInfo');
             $UnionInfo = $objUnionInfoData->get_union_info($union_id, array("union_medal"));
             $UnionInfo['union_medal'][] = $val['medal_id'];
             Com_Log::debug_write('update_union_info', "trigger_union_achieve|unoin_id={$union_id}" . json_encode($data));
             $retUnionInfo = $objUnionInfoData->update_union_info($union_id, $UnionInfo);
             $medal_list = Cache_UnionMedal::getInstance()->get_union_medal_info(array("sid" => $val['medal_id']));
             $medal_info = $medal_list[0];
             $arr_replace = array();
             $arr_replace[] = array('rep_type' => 7, 'txt' => $medal_info['name'], 'rep_color' => "ffb901");
             $msg = Language_Message::make_message(174902, $arr_replace);
             $this->get_game('SystemNotice')->send_system_msg($player_id, $msg, 7, 7);
         }
         if ($retUnionAchieve && $retUnionInfo) {
             $this->commit();
             if ($unionAchieveInfo['state'] == 1) {
                 $arr_replace = array();
                 $arr_replace[] = array('rep_type' => 7, 'txt' => $val['name'], 'rep_color' => "ffb901");
                 $msg = Language_Message::make_message(174901, $arr_replace);
                 $this->get_game('SystemNotice')->send_system_msg($player_id, $msg, 7, 7);
             }
             if ($progress_task_num >= $medal_total_task_num) {
                 $this->union_player_add_attr($union_id, $val['medal_id']);
             }
         } else {
             $this->rollback();
         }
         if (!IS_FRONT) {
             Protocol::out();
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:101,代码来源:UnionAchieve.php


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