function msg_login_notify_status( agent, info ) if info.ret and info.ret ~= 0 then trace("登陆时发生错误:%s", info.err_msg) end end --msg_user_list function msg_user_list(agent, list) end function msg_create_user(agent, info) end function msg_enter_game(agent, info) ME_D.me_updated(agent, info) enter_room() end function msg_common_op(user, info) end function msg_object_updated(user, rid, info) local object = find_object_by_rid(rid) if not is_object(object) then trace("物件:%s不存在", rid) return end for k,v in pairs(info) do trace("属性更新:%o->[%o]=%o", object:query("name"), k, v) object:set(k, v) end end function msg_property_loaded(user, rid, info_list) for _,v in pairs(info_list) do local obj = PROPERTY_D.clone_object_from(v.class_id, v) user:load_property(obj) end end function msg_bonus(user, info, bonus_type) if bonus_type == BONUS_TYPE_SHOW then for _,v in pairs(info.properties or {}) do local obj = find_basic_object_by_class_id(v.class_id) assert(obj, "物品不存在") trace("获得物品:%o,数量:%o", obj:query("name"), v.amount) end end end function msg_sale_object(user, info) if info.ret ~= 0 then trace("出售物品失败:%o", info.err_msg) else trace("出售物品成功") end end function msg_property_delete(user, rids) for _,rid in ipairs(rids) do local object = find_object_by_rid(rid) if object then trace("物品:%o,名称:%o消耗完毕", object:query("rid"), object:query("name")) user:unload_property(object) end end end function msg_chat( user, channel, info ) info.chat_info = info.chat_info or {} if channel == CHAT_CHANNEL_WORLD then trace("收到来自:%s的世界聊天, 内容为:\"%s\"", info.send_name, info.chat_info.send_content) end end function msg_room_message(user, oper, info) if oper == "success_enter_room" then trace("成功进入房间:\"%s\"", info.room_name) user:send_message(CMD_ROOM_MESSAGE, "enter_desk", {}) elseif oper == "success_enter_desk" then if info.rid == get_ob_rid(user) then desk_ready() end trace("%s成功进入桌子:\"%d\", 在位置:%d", info.rid, info.idx, info.wheel_idx) elseif oper == "pre_room" then if info.room_name then user:send_message(CMD_ENTER_ROOM, {room_name = info.room_name}) end -- elseif oper == "poker_init" then -- local idx_info = self:get_idx_info(self:get_my_idx()) -- self:show_own_poker(self:get_my_idx(), info.poker_list) -- idx_info.poker_list = info.poker_list -- elseif oper == "success_user_ready" then -- if info.rid == ME_D.get_rid() then -- self.ready_btn:setVisible(false) -- end -- self:show_ready_status(info.idx) -- elseif oper == "step_change" then -- self:turn_step(info.cur_step) -- elseif oper == "success_enter_desk" then -- self.desk_info.details = self.desk_info.details or {} -- self.desk_info.details[info.wheel_idx] = info.info -- self:set_head_status(info.wheel_idx, {is_leave = false}) -- --TODO set user info -- elseif oper == "success_leave_desk" then -- self.desk_info.details = self.desk_info.details or {} -- self.desk_info.details[info.wheel_idx] = {} -- self.desk_info.wheels = self.desk_info.wheels or {} -- self.desk_info.wheels[info.wheel_idx] = {} -- self:show_ready_status(info.wheel_idx, true) -- self:set_head_status(info.wheel_idx, {is_leave = true}) -- --TODO reset user info -- elseif oper == "desk_info" then -- self.desk_info = merge(self.desk_info or {}, info) -- self:turn_step(info.cur_step or DDZ_STEP_NONE) -- self:turn_index(info.cur_op_idx or -1) -- if info.cur_step ~= DDZ_STEP_NONE then -- for i=1,3 do -- local wheel = self.desk_info.wheels[i] -- self:show_own_poker(i, wheel.poker_list, wheel.poker_num) -- end -- self:show_down_poker(info.down_poker) -- else -- for i=1,3 do -- local wheel = self.desk_info.wheels[i] -- self:show_ready_status(i, wheel.is_ready ~= 1) -- end -- end -- if info.lord_idx > 0 then -- self:set_all_head_status({is_in_lord = true}, info.lord_idx) -- else -- self:set_all_head_status({is_in_lord = false}) -- end -- elseif oper == "start_play" then -- for i,wheel in ipairs(info.wheels or {}) do -- self.desk_info.wheels[i] = wheel -- self:show_own_poker(i, wheel.poker_list, wheel.poker_num) -- end -- self:show_down_poker(info.down_poker) -- if info.lord_idx > 0 then -- self:set_all_head_status({is_in_lord = true}, info.lord_idx) -- self.desk_info.lord_idx = info.lord_idx -- end -- elseif oper == "op_idx" then -- self:turn_index(info.cur_op_idx, info.poker_list) -- elseif oper == "deal_poker" then -- if info.is_play == 1 or (info.poker_list and #info.poker_list > 0) then -- local idx_info = self:get_idx_info(info.idx) -- if not idx_info.poker_list or #idx_info.poker_list == 0 then -- local left_poker_num = math.max(0, idx_info.poker_num or 0 - #info.poker_list) -- idx_info.poker_num = left_poker_num -- self:show_own_poker(info.idx, nil, idx_info.poker_num) -- else -- local success, new_poker_list = DDZ_D.sub_poker(idx_info.poker_list, info.poker_list) -- if success then -- idx_info.poker_list = new_poker_list -- self:show_own_poker(info.idx, new_poker_list) -- end -- end -- self.pre_poker_list = info.poker_list -- end -- self.reclick_tip_poker_list = {} -- self:show_play_poker(info.idx, info.poker_list) -- elseif oper == "next_round" then -- self.pre_poker_list = {} -- elseif oper == "team_win" then -- self:show_final_info(info.idx) end end function msg_enter_room(user, info) if info.ret and info.ret < 0 then trace("进入房间错误:\"%s\"", info.err_msg) return end trace("成功进入房间:\"%s\"", info.room_name) end function msg_leave_room(user, info) if info.ret and info.ret < 0 then trace("离开房间错误:\"%s\"", info.err_msg) return end trace("成功离开房间:\"%s\"", info.room_name) end