require("game.sociality.SocialityView") require("game.sociality.SocialityModel") require("game.sociality.SocialityFriendView") require("game.sociality.SocialityMailView") require("game.sociality.SocialityTabBar") require("game.sociality.SocialityTabBtn") require("game.sociality.SocialityTabSubBtn") require("game.sociality.OperationView") require("game.sociality.OperationItem") require("game.sociality.SocialityAddFriendView") require("game.sociality.SocialityAddFriendItem") require("game.sociality.SocialityApplyItem") require("game.sociality.SocialityFlowerView") require("game.sociality.SocialityFlowerItem") require("game.sociality.SocialityFriendSelectItem") require("game.sociality.SocialityFriendSelectView") require("game.sociality.SocialityFriendMsg") require("game.sociality.SocialityReceiveItem") require("game.sociality.SocialityAssistantChatItem") require("game.sociality.SocialityAssistanChatBar") require("game.sociality.SocialityGiftRecordView") require("game.sociality.SocialityGiftRecordReceiveView") require("game.sociality.SocialityGiftRecordGiveView") require("game.sociality.SocialityGiveItem") require("game.sociality.SocialityGiftAdditionItem") require("game.sociality.SocialityGiftRecordIntimacyView") require("game.sociality.SocialityGiftRecordFameView") require("game.proto.140.Require140") require("game.proto.223.Require223") SocialityController = SocialityController or BaseClass(BaseController) function SocialityController:__init() SocialityController.Instance = self self.model = SocialityModel:getInstance() self:InitEvent() self:RegisterAllProtocals() end function SocialityController:InitEvent() local function onRequestHandler(...) local args_list = {...} if args_list[1] == 14000 then self:SendFmtToGame(args_list[1], "c", args_list[2]) elseif args_list[1] == 14001 then self:SendFmtToGame(args_list[1], "c", args_list[2]) elseif args_list[1] == 14002 then self:SendFmtToGame(args_list[1], "s", args_list[2]) elseif args_list[1] == 14003 then self:SendFmtToGame(args_list[1], "l", args_list[2]) elseif args_list[1] == 14004 then self:SendFmtToGame(args_list[1], "c", args_list[2]) elseif args_list[1] == 14005 then self:SendFmtToGame(args_list[1], "lc", args_list[2], args_list[3]) elseif args_list[1] == 14006 then self:SendFmtToGame(args_list[1]) elseif args_list[1] == 14007 then self:SendFmtToGame(args_list[1], "cl", args_list[2], args_list[3]) elseif args_list[1] == 14008 then self:SendFmtToGame(args_list[1], "lshi", args_list[2],args_list[3], args_list[4], args_list[5]) elseif args_list[1] == 14009 then self:SendFmtToGame(args_list[1], "lscc", args_list[2],args_list[3], args_list[4], args_list[5]) elseif args_list[1] == 14010 then local role_id = tonumber(args_list[2]) if role_id and RoleManager.Instance.mainRoleInfo.role_id ~= role_id then self:SendFmtToGame(args_list[1], "l",role_id) end elseif args_list[1] == 14011 then local role_id = tonumber(args_list[2]) self:SendFmtToGame(args_list[1],"l",role_id) elseif args_list[1] == 22301 then self:SendFmtToGame(args_list[1], "licc", args_list[2],args_list[3], args_list[4], args_list[5]) elseif args_list[1] == 14015 then self:SendFmtToGame(args_list[1]) elseif args_list[1] == 14017 then self:SendFmtToGame(args_list[1], "lc", args_list[2],args_list[3]) elseif args_list[1] == 14018 then self:SendFmtToGame(args_list[1], "lc", args_list[2],args_list[3]) elseif args_list[1] == 14020 then self:SendFmtToGame(args_list[1], "l", args_list[2]) elseif args_list[1] == 14021 then local data = args_list[2] UserMsgAdapter.WriteBegin(14021) UserMsgAdapter.WriteFMT("h", #data) for k,v in ipairs(data) do UserMsgAdapter.WriteFMT("l", v) end UserMsgAdapter.SendToGame() elseif args_list[1] == 14022 then local data = args_list[2] UserMsgAdapter.WriteBegin(14022) UserMsgAdapter.WriteFMT("h", #data) for k,v in ipairs(data) do UserMsgAdapter.WriteFMT("l", v) end UserMsgAdapter.SendToGame() elseif args_list[1] == 14024 then self:SendFmtToGame(args_list[1], "l", args_list[2]) elseif args_list[1] == 22309 then self:SendFmtToGame(args_list[1], "l", args_list[2]) else self:SendFmtToGame(args_list[1]) end end self.model:Bind(SocialityModel.REQUEST_CCMD_EVENT,onRequestHandler) local function gameStartHandler( ) self.model:InitRelaList() self.model:Fire(SocialityModel.REQUEST_SOCIAL_LIST) self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT,22307) self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT,22303) self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT,14016) self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT,22308) self.game_start_req_handler = true end GlobalEventSystem:Bind(EventName.GAME_START, gameStartHandler) -- 满足等级后请求信息 local function onLevelUp(level) -- local lv = RoleManager.Instance.mainRoleInfo.level if level == GetModuleOpenLevel(140) then gameStartHandler() end --小助手消息推送 for k,v in pairs(Config.AssistantChat.LevelPushMsg) do if v.lv == level then self.model:AssistantSendMsg(v.msg) end end end RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp) local function OnTaskSuccess(task_id) --小助手消息推送 for k,v in pairs(Config.AssistantChat.TaskPushMsg) do if task_id == v.task_id then self.model:AssistantSendMsg(v.msg) end end end GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, OnTaskSuccess) --绑定打开界面方法 local function onOpenSocialityView(tab_index) local is_open = GetModuleIsOpen(140) or GetModuleIsOpen(190) local open_min_lv = GetModuleOpenLevel(140) <= GetModuleOpenLevel(190) and GetModuleOpenLevel(140) or GetModuleOpenLevel(190) if not is_open then Message.show(string.format("%d级开放", open_min_lv)) return end if self.SocialityView == nil then self.SocialityView = SocialityView.New() end self.SocialityView:Open(tab_index) -- GlobalEventSystem:Fire(EventName.SOCIAL_CHAT_SEL) --在打开界面的情况下要选中私聊好友 MailModel:getInstance():Fire(MailEvent.UPDATE_TOP_BAR_RED)--打开界面时刷新一下主界面的邮件图标红点 end GlobalEventSystem:Bind(EventName.OPEN_SOCIALITY_VIEW, onOpenSocialityView) local function onCloseSocialityView() if self.SocialityView and self.SocialityView:HasOpen() then self.SocialityView:Close() end end GlobalEventSystem:Bind(EventName.CLOSE_SOCIALITY_VIEW, onCloseSocialityView) local function onOpenOperationView(info) if self.OperationView == nil then self.OperationView = OperationView.New() end -- if self.OperationView:HasOpen() then -- self.OperationView:Close() -- else self.OperationView:Open(info) -- end end GlobalEventSystem:Bind(EventName.OPEN_OPERATION_VIEW,onOpenOperationView) local function onOpenSocialityFlowerView(roleVo, select_goods_id) if roleVo and RoleManager.Instance.mainRoleInfo.role_id == roleVo.role_id then Message.show("不能给自己送花") return end if self.SocialityFlowerView == nil then self.SocialityFlowerView = SocialityFlowerView.New() end self.SocialityFlowerView:Open(roleVo, select_goods_id) end GlobalEventSystem:Bind(EventName.OPEN_SOCIAL_FLOWER_VIEW, onOpenSocialityFlowerView) local function onCloseSocialityFlowerView() if self.SocialityFlowerView and self.SocialityFlowerView:HasOpen() then self.SocialityFlowerView:Close() end end GlobalEventSystem:Bind(EventName.CLOSE_SOCIAL_FLOWER_VIEW, onCloseSocialityFlowerView) local function onOpenSocialityFriendSelView(flag, friend_list, op_type) op_type = op_type or 1--点击类型,1为显示右侧按钮,2为不显示按钮,整个区域做点击热区 if flag then if self.SocialityFriendSelectView == nil then self.SocialityFriendSelectView = SocialityFriendSelectView.New() end self.SocialityFriendSelectView:Open(friend_list,op_type) else if self.SocialityFriendSelectView and self.SocialityFriendSelectView:HasOpen() then self.SocialityFriendSelectView:Close() end end end GlobalEventSystem:Bind(EventName.OPEN_SOCIAL_FRIEND_SEL_VIEW, onOpenSocialityFriendSelView) local function RequestSocialList() self.wait_update = 3 -- self.wait_update = 1 self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 1)--请求好友 self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊 self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 5)--请求最近联系人 self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 6)--请求单向好友列表 end self.model:Bind(SocialityModel.REQUEST_SOCIAL_LIST, RequestSocialList) --初始化界面时请求一部分需要红点判断的数据 local onInitMainUIHandler = function () self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14006) --好友列表 self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22302) --送花收花记录 self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22304) --上线之后下线期间的送花提醒 end self:Bind(EventName.INIT_MAINUI_EVENT, onInitMainUIHandler) local function onRequestOther( role_id, x, y, chat_info, force_x, force_y ) --记录点击坐标 SocialityModel:getInstance().mousePos = Vector2(x, y) if force_x and force_y then SocialityModel:getInstance().operationPos = Vector2(force_x, force_y) else SocialityModel:getInstance().operationPos = false end self.model.need_show_operation = true--重置为14010协议回调后打开好友互动面板 if chat_info and chat_info.ser_id ~= RoleManager.Instance:GetMainRoleServerId() then -- 外服玩家时仅显示“查看信息按钮” chat_info.rela = 1 -- OPERATION_VIEW查看时展示出来的需要这个参 GlobalEventSystem:Fire(EventName.OPEN_OPERATION_VIEW, chat_info) self.model.need_show_operation = false else SocialityModel:getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14010, role_id) end end self.model:Bind(SocialityModel.REQUEST_OTHER_INFO, onRequestOther) --和指定id的人私聊(如陌生人聊天) local function onChatWithRoleId(role_id, msg_content) --不在最近联系人列表中人发来消息时加入最近联系人列表 if role_id ~= RoleManager.Instance.mainRoleInfo.role_id and not self.model:IsRelaviveType(role_id,Config.ConfigSocial.RelativeType.recent) then self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT,14020,role_id) end ChatModel:getInstance().need_chat_key = role_id self.model.only_request_recent_flag = true--标识:只请求最近联系人列表 if msg_content then self.model.temp_chat_msg_content = msg_content else self.model.temp_chat_msg_content = nil end self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 5)--请求最近联系人 -- GlobalEventSystem:Fire(EventName.OPEN_SOCIALITY_VIEW, 1) end self.model:Bind(SocialityModel.CHAT_WITH_ROLEID,onChatWithRoleId) --intimacy 只在查看好友的亲密度时才传 local function onOpenSocialityGiftRecordView(index,intimacy,info,figure) if self.sociality_gift_record_view == nil then self.sociality_gift_record_view = SocialityGiftRecordView.New() end -- if self.sociality_gift_record_view:HasOpen() then -- self.sociality_gift_record_view:Close() -- else self.sociality_gift_record_view:Open(index,intimacy,info,figure) -- end end GlobalEventSystem:Bind(EventName.OPEN_SOCIAL_GIFT_RECORD_VIEW, onOpenSocialityGiftRecordView) end function SocialityController:RegisterAllProtocals() self:RegisterProtocal(14000,"handle14000") self:RegisterProtocal(14001,"handle14001") self:RegisterProtocal(14002,"handle14002") self:RegisterProtocal(14003,"handle14003") self:RegisterProtocal(14004,"handle14004") self:RegisterProtocal(14005,"handle14005") self:RegisterProtocal(14006,"handle14006") self:RegisterProtocal(14007,"handle14007") self:RegisterProtocal(14008,"handle14008") self:RegisterProtocal(14009,"handle14009") self:RegisterProtocal(14010,"handle14010") self:RegisterProtocal(14011,"handle14011") self:RegisterProtocal(14013,"handle14013") self:RegisterProtocal(14014,"handle14014") self:RegisterProtocal(14015,"handle14015") self:RegisterProtocal(14016,"handle14016") self:RegisterProtocal(14017,"handle14017") self:RegisterProtocal(14018,"handle14018") self:RegisterProtocal(14019,"handle14019") self:RegisterProtocal(14021,"handle14021") self:RegisterProtocal(14022,"handle14022") self:RegisterProtocal(14023,"handle14023") self:RegisterProtocal(14024,"handle14024") self:RegisterProtocal(22300,"handle22300") self:RegisterProtocal(22301,"handle22301") self:RegisterProtocal(22302,"handle22302") self:RegisterProtocal(22303,"handle22303") self:RegisterProtocal(22304,"handle22304") self:RegisterProtocal(22308,"handle22308") self:RegisterProtocal(22309,"handle22309") end function SocialityController:handle14000() local vo = SCMD14000.New(true) --14007删除好友时不重新刷新最近联系人列表,防止最近联系人列表顺序立刻刷新 if self.model.not_update_recent and vo.type == 5 then self.model.not_update_recent = false -- 重置刷新的flag else self.model:SetRelativeInfo(vo.type, vo.rela_list) end if self.model.only_request_recent_flag then--如果是单独只请求了最近联系人的情况,不需要等待其他列表返回再刷新界面 self.model.only_request_recent_flag = false if self.SocialityView == nil then self.SocialityView = SocialityView.New() self.SocialityView:Open(1) end self.model.only_show_recent_view = true--单独给从外部私聊他人的情况处理界面刷新 self.model:Fire(SocialityModel.UPDATE_SOCIALITY_RECENT_VIEW) return end if self.model.only_request_mate_flag then--如果是单独只请求了羁绊好友的情况,直接记录好数据就行 self.model.only_request_mate_flag = false return end if self.wait_update and self.wait_update > 0 then self.wait_update = self.wait_update - 1 else --发送14021协议请求自己对好友的状态列表 if self.game_start_req_handler then local friend_data = {} for k,v in pairs(self.model:GetRelativeInfoByType(1)) do if v.role_id ~= 1 then--ai管家排除 table.insert(friend_data,v.role_id) end end self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14021, friend_data) end self.game_start_req_handler = false if not self.model.only_rqeuest_data then self.model:Fire(SocialityModel.UPDATE_SOCIALITY_VIEW) end self.model.only_rqeuest_data = false end end --请求添加好友界面的随机可添加的数据 function SocialityController:handle14001() local vo = SCMD14001.New(true) if vo.code == 1 then --先过滤一遍,防止好友进入推荐列表中 local true_recommended_list = {} for k,v in pairs(vo.recommended_list) do local is_friend = self.model:IsRelaviveType(v.role_id,Config.ConfigSocial.RelativeType.friend) if not is_friend then true_recommended_list[#true_recommended_list+1] = v end end self.model:Fire(SocialityModel.UPDATE_ADD_FRIEND_VIEW, true_recommended_list) else ErrorCodeShow(vo.code) end end --在发送添加成功后刷新添加好友的界面 function SocialityController:handle14002() local vo = SCMD14002.New(true) self.model:SetSearchInfo(vo) if vo.code == 1 then local is_friend = self.model:IsRelaviveType(vo.role_id,Config.ConfigSocial.RelativeType.friend) if is_friend then Message.show("对方已经是好友了") else self.model:Fire(SocialityModel.UPDATE_ADD_FRIEND_VIEW, {[1] = vo}) self.model:Fire(SocialityModel.UPDATE_RECOMMEND_TEXT) end else ErrorCodeShow(vo.code) end end --点击一键添加所有好友之后的添加好友界面的刷新 function SocialityController:handle14015() -- body end function SocialityController:handle14003() local vo = SCMD14003.New(true) if vo.code == 1 then Message.show("您已成功添加对方为好友") self.model:Fire(SocialityModel.UPDATE_ADD_FRIEND_BTN_STATE) else ErrorCodeShow(vo.code) end end function SocialityController:handle14004() local vo = SCMD14004.New(true) ErrorCodeShow(vo.code) --请求好友申请列表 if vo.code == 1 then self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14006) end end function SocialityController:handle14005() local vo = SCMD14005.New(true) ErrorCodeShow(vo.code) --请求好友申请列表 if vo.code == 1 then self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14006) end end function SocialityController:handle14006() local vo = SCMD14006.New(true) ------------------------- -- local tb = {type = Config.ConfigMainIcon.TipType.friend} -- if TableSize(vo.ask_list) > 0 then -- if self.model:CheckIsFullFriend() then -- if MsgManager:getInstance():IsMsgTypeShow(tb.type) then -- MsgManager:getInstance():Remove(tb.type) -- end -- else -- MsgManager:getInstance():Add(tb) -- end -- else -- MsgManager:getInstance():Remove(tb.type) -- end ------------------------- --先过滤一遍,防止好友进入推荐列表中 local true_recommended_list = {} true_recommended_list.ask_list = {} for k,v in pairs(vo.ask_list) do local is_friend = self.model:IsRelaviveType(v.role_id,Config.ConfigSocial.RelativeType.friend) if not is_friend then true_recommended_list.ask_list[#true_recommended_list.ask_list+1] = v end end self.model:SetApplyInfo(true_recommended_list) self.model:Fire(SocialityModel.UPDATE_APPLY_FRIEND_VIEW) self.model:Fire(SocialityModel.UPDATE_ADD_FRIEND_BTN_STATE) GlobalEventSystem:Fire(EventName.REFRESH_SOCIAL_RED_DOT) --刷新红点 if #true_recommended_list.ask_list > 0 then MsgManager:getInstance():Add({type=Config.ConfigMainIcon.TipType.friend}) else MsgManager:getInstance():Remove(Config.ConfigMainIcon.TipType.friend) end end function SocialityController:handle14007() local vo = SCMD14007.New(true) ErrorCodeShow(vo.code) if vo.code == 1 then self.model.not_update_recent = true -- 删除好友时不要立刻刷新最近联系人的顺序 self.model:Fire(SocialityModel.REQUEST_SOCIAL_LIST) end end function SocialityController:handle14008() local vo = SCMD14008.New(true) if GetModuleIsOpen(140,0) then local is_friend = self.model:IsRelaviveType(vo.role_id,Config.ConfigSocial.RelativeType.friend) if not is_friend then self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14006) end end end function SocialityController:handle14009() local vo = SCMD14009.New(true) local strName = "" local strType = "" local rela_id = 1 --不管后端发过来rela是1还是6,他都是好友 if vo.rela_type == 1 or vo.rela_type == 6 then vo.rela_type = 1 end if vo.rela_type == 1 then strName = "好友" end -- 最近联系人列表也要刷新其在线状态 local recent_list = self.model:GetRelativeInfoByType(Config.ConfigSocial.RelativeType.recent) for i,v in ipairs(recent_list) do if v.role_id == vo.role_id then recent_list[i].online_flag = vo.online_flag end end rela_id = Config.ConfigSocial.OnAndOffLine[vo.rela_type].relative_list_id if vo.online_flag == 0 then strType = "下线了" elseif vo.online_flag == 1 then strType = "上线了" end if self.model:IsRelaviveType(vo.role_id, Config.ConfigSocial.RelativeType.friend) then Message.show(string.format("您的%s%s%s", strName, vo.role_name, strType)) end --更新数据 local role = self.model:GetVoById(rela_id, vo.role_id) --公用的更新 if role then role.online_flag = vo.online_flag if vo.online_flag == 0 then --玩家下线时 更新上次登录的时间为当前的时间 role.last_logout_time = TimeUtil:getServerTime() end end local info = self.model:GetRelativeInfoByType(rela_id) if info then self.model:SetRelativeInfo(rela_id, info,true)--不排序了,重新打开界面才排序 end --特殊标记:有好友上下线通知时,会重排序好友列表,此标记避免选中其他好友 self.model.special_flag_online_changed = true -- self.model:Fire(SocialityModel.UPDATE_SOCIALITY_VIEW, true)--重新刷列表太浪费了,改成单独刷item吧 self.model:Fire(SocialityModel.UPDATE_TAB_SUB_ITEM,vo.role_id) end function SocialityController:handle14010( ) local vo = SCMD14010.New(true) if vo.code == 1 then if self.model.need_show_operation == "none" then --什麽都不用做的版本 elseif self.model.need_show_operation == "showLookView" then --直接打开查看界面 GlobalEventSystem:Fire(EventName.OPEN_LOOK_ROLE_INFO_VIEW,vo.role_id,vo.rela) elseif not self.model.need_show_operation then GlobalEventSystem:Fire(EventName.OPEN_SOCIAL_FLOWER_VIEW, vo) else GlobalEventSystem:Fire(EventName.OPEN_OPERATION_VIEW, vo) self.model.need_show_operation = false end self.model:Fire(SocialityModel.ANS_FRIEND_SHOW_DATA,vo) self.model.need_show_operation = nil else ErrorCodeShow(vo.code) GlobalEventSystem:Fire(EventName.SHOW_OTHER_HEAD, false) end end function SocialityController:handle14013( ) local vo = SCMD14013.New(true) for m,n in pairs(vo.update_list) do local list = self.model:GetRelativeInfoByType(n.type) for k,t in pairs(n.role_list) do local find = false for i,v in ipairs(list) do if v.role_id == t.role_id then list[i] = t find = true break end end if not find then table.insert(list, t) end ------------------------- --如果是好友,需要去羁绊数据同步修改 if n.type == 1 then local mate_list = self.model:GetRelativeInfoByType(2) for i,v in ipairs(mate_list) do if v.role_id == t.role_id then mate_list[i] = t break end end end ------------------------- ------------------------- --如果是从单向好友变成好友,需要去单向好友列表修改 if n.type == 1 then local one_way_list = self.model:GetRelativeInfoByType(6) for i,v in ipairs(one_way_list) do if v.role_id == t.role_id then TableRemove(one_way_list,v) break end end end --如果是从好友变成单向好友,需要去删除好友列表中的数据 if n.type == 6 then local friend_list = self.model:GetRelativeInfoByType(1) for i,v in ipairs(friend_list) do if v.role_id == t.role_id then TableRemove(friend_list,v) break end end end ------------------------- -- 最近联系人列表也要刷新,但是聊天时间不要变 local recent_list = self.model:GetRelativeInfoByType(Config.ConfigSocial.RelativeType.recent) for i,v in ipairs(recent_list) do if v.role_id == t.role_id then local old_chat_time = v.last_chat_time recent_list[i] = t recent_list[i].last_chat_time = old_chat_time end end end end for i=1,3 do --列表排序 local info = self.model:GetRelativeInfoByType(i) if info then -- self.model:SetRelativeInfo(i, info) self.model:SetRelativeInfo(i, info,true) end end self.model.tab_sub_btn_do_not_scroll_to = true self.model:Fire(SocialityModel.UPDATE_SOCIALITY_VIEW, false) self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14006) end function SocialityController:handle14014( ) local vo = SCMD14014.New(true) for m,n in pairs(vo.update_list) do local delete_list = nil local list = self.model:GetRelativeInfoByType(n.type) for k,t in pairs(n.role_ids) do for i,v in ipairs(list) do if v.role_id == t.role_id then delete_list = delete_list or {} table.insert(delete_list, i) break end end end if delete_list then for i, id in ipairs(delete_list) do list[id] = nil end end --重新排列 local temp = DeepCopy(list) self.model.relative_info[n.type] = {} for k,v in pairs(temp) do table.insert(self.model.relative_info[n.type], v) end end -- self.model:SaveRelativeInfo(vo) self.model:Fire(SocialityModel.UPDATE_SOCIALITY_VIEW) end function SocialityController:handle14011( ) local vo = SCMD14011.New(true) self.model:Fire(SocialityModel.UPDATE_OTHER_ROLE_RELA, vo) end function SocialityController:handle14016( ) local vo = SCMD14016.New(true) self.model:SetTicketsData(vo) GlobalEventSystem:Fire(EventName.REFRESH_SOCIAL_RED_DOT) end function SocialityController:handle14017( ) local vo = SCMD14017.New(true) if vo.errcode == 1 then if vo.type == SocialityModel.TicketType.Friend then--赠送名望券 Message.show("赠送成功!","success") elseif vo.type == SocialityModel.TicketType.Mate then--赠送羁绊点 Message.show("赠送羁绊点成功","success") end self.model:UpdateTicketsState(1,vo.torole,vo.type) self.model:Fire(SocialityModel.UPDATE_TICKETS_STATE,vo.torole) GlobalEventSystem:Fire(EventName.REFRESH_SOCIAL_RED_DOT) else ErrorCodeShow(vo.errcode) end end function SocialityController:handle14018( ) local vo = SCMD14018.New(true) if vo.errcode == 1 then if vo.type == SocialityModel.TicketType.Friend then -- local goods_type_id = 100003 -- local goods_name = GoodsModel:getInstance():getGoodsName(goods_type_id,true,true) -- local message_str = string.format("领取 %s x%s",goods_name,5) -- Message.show(message_str,"award") elseif vo.type == SocialityModel.TicketType.Mate then Message.show("领取羁绊点成功","award") end self.model:UpdateTicketsState(2,vo.fromid,vo.type) self.model:Fire(SocialityModel.UPDATE_TICKETS_STATE,vo.fromid) GlobalEventSystem:Fire(EventName.REFRESH_SOCIAL_RED_DOT) else ErrorCodeShow(vo.errcode) end end function SocialityController:handle14019( ) local vo = SCMD14019.New(true) self.model:UpdateGiftRoleList(vo.from_id,vo.type) self.model:Fire(SocialityModel.UPDATE_TICKETS_STATE,vo.from_id) GlobalEventSystem:Fire(EventName.REFRESH_SOCIAL_RED_DOT) end function SocialityController:handle22300( ) local vo = SCMD22300.New(true) ErrorCodeShow(vo.code) end function SocialityController:handle22301( ) local vo = SCMD22301.New(true) if vo.code~=1 then ErrorCodeShow(vo.code) lua_soundM:PlayEffect(self, "fault",false,LuaSoundManager.SOUND_TYPE.UI) else Message.show("赠送成功","success") self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22302) self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 22303) self.model:Fire(SocialityModel.UPDATE_FLOWER_NUM,vo.receive_id,vo.week_charm,vo.intimacy) end end function SocialityController:handle22302( ) local vo = SCMD22302.New(true) -- print("==WQ==:SocialityController [start:743] vo:", vo) -- PrintTable(vo) -- print("==WQ==:SocialityController [end]") if vo then self.model:SetReceiveInfo(vo) self.model:Fire(SocialityModel.UPDATE_RECEIVE_VIEW) end end function SocialityController:handle22303( ) local vo = SCMD22303.New(true) self.model:SetCharmInfo(vo) self.model:Fire(SocialityModel.UPDATE_CHARM_VIEW) end function SocialityController:handle22304() local vo = SCMD22304.New(true) if vo.code == 1 then --在下线时有新的送花礼物 就显示提示 local tb = {} tb.type = Config.ConfigMainIcon.TipType.flower MsgManager:getInstance():Add(tb) self.model.has_new_flower_record = true end end -- ############ 陌生人私聊将其加入到最近联系人列表中 ############## -- protocol=14020 -- { -- c2s{ -- role_id:int64 // 将要私聊的陌生人id -- } -- } function SocialityController:handle14020() local vo = SCMD14020.New(true) end -- ############ 双向好友一方删除好友更新对方前端亲密度 ############## -- protocol=14021 -- { -- c2s{ -- friend_list:array{ -- role_id:int64 // 存在好友关系的角色Id -- } -- } -- s2c{ -- type:int8 // 操作类型 1-客户端主动请求 2-服务端推送 -- opp_rela_list:array{ -- role_id:int64 // 存在好友关系的角色Id -- opp_rela_type:int8 // 我在对方所处的关系 -- ask_response_status:int8 // 我在对方申请列表里面的处理状态 0-未响应 1-已拒绝 2-同意加好友 -- } -- } -- } function SocialityController:handle14021() local vo = SCMD14021.New(true) self.model:SetFriendStateList(vo) if vo.type == 1 then -- if not self.model.only_rqeuest_data then -- self.model:Fire(SocialityModel.UPDATE_SOCIALITY_VIEW) -- end -- self.model.only_rqeuest_data = false elseif vo.type == 2 then for k,v in pairs(vo.opp_rela_list) do self.model:Fire(SocialityModel.UPDATE_TICKETS_STATE,v.role_id) end end end function SocialityController:handle14022( ) local vo = SCMD14022.New(true) if vo.errcode~=1 then ErrorCodeShow(vo.errcode) else self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14016) end end function SocialityController:handle14023( ) local vo = SCMD14023.New(true) if vo.errcode~=1 then ErrorCodeShow(vo.errcode) else self.model:Fire(SocialityModel.REQUEST_CCMD_EVENT, 14016) end end function SocialityController:handle14024( ) local vo = SCMD14024.New(true) if vo.errcode~=1 then ErrorCodeShow(vo.errcode) else self.model:Fire(SocialityModel.OPEN_SOCIALITY_INTIMACY_ADDITION_AFTER_FIGURE,vo) end end function SocialityController:handle22308( ) local vo = SCMD22308.New(true) self.model:SetSpGiftLimitData(vo) self.model:Fire(SocialityModel.REFRESH_SOCIALITY_SP_GIFT_LIMIT) end function SocialityController:handle22309( ) local vo = SCMD22309.New(true) -- print("==WQ==:SocialityController [start:847] vo:", vo) -- PrintTable(vo) -- print("==WQ==:SocialityController [end]") if vo.errcode == 1 then Message.show("感谢成功!") self.model:UpdateGiftReciveThankState(vo) self.model:Fire(SocialityModel.UPDATE_RECEIVE_RECORD_THANK_STATE) else ErrorCodeShow(vo.errcode) end end