require("game.mate.MateModel")
|
|
require("game.mate.MateConst")
|
|
require("game.mate.view.MateBaseView")--羁绊基础容器界面
|
|
require("game.mate.view.MateAskView")--邀请羁绊
|
|
require("game.mate.view.MateChangeTagView")--改标签备注界面
|
|
require("game.mate.view.MateShopView")--羁绊商城界面
|
|
require("game.mate.view.MateShopItem")--羁绊商城item
|
|
require("game.mate.view.MateFindFriendView")--羁绊征友界面
|
|
require("game.mate.view.MateFindFriendItem")--羁绊征友界面
|
|
require("game.mate.view.MateFindFriendTip")--羁绊征友tip界面
|
|
require("game.mate.view.MateSingleDogView")--羁绊任务界面
|
|
require("game.mate.view.MateMyFriendView")--所有羁绊好友主界面
|
|
require("game.mate.view.MateFriendItem")--所有羁绊好友主界面子节点
|
|
require("game.mate.view.MateFriendInfoView")--单个羁绊好友信息界面
|
|
require("game.mate.view.MateFriendShareView")--羁绊分享界面
|
|
require("game.mate.view.MateShipView")--羁绊信物
|
|
require("game.mate.view.MateSkillItem")--羁绊信物技能子节点
|
|
require("game.mate.view.MateAttrItem")--羁绊信物属性子节点
|
|
require("game.mate.view.MateFriendSelectTip")--选择羁绊好友
|
|
require("game.mate.view.MateRoleItem")--选择羁绊好友子节点
|
|
require("game.mate.view.MateAnsView")--回复羁绊
|
|
require("game.mate.view.MateChangeTitleView")--改备注称号界面
|
|
require("game.mate.view.MateAskBreakTip")--请求解除羁绊
|
|
require("game.mate.view.MateMarkView")--羁绊纪念日
|
|
require("game.mate.view.MateMarkItem")--羁绊纪念日子节点
|
|
require("game.mate.view.MateDailyView")--羁绊日常界面
|
|
require("game.mate.view.MateDailyItem")--羁绊日常界面子节点
|
|
require("game.mate.view.MateGameAnsView")--回复羁绊游戏
|
|
require("game.mate.view.MateGameRewardView")--羁绊奖励预览界面
|
|
require("game.mate.view.MateGameRewardItem")--羁绊奖励预览子节点
|
|
require("game.mate.view.MateDesignationView")--羁绊头衔
|
|
require("game.mate.view.MateDesignationItem")--羁绊头衔子节点
|
|
require("game.mate.view.MateAttrItemTwo")--羁绊头衔属性子节点
|
|
require("game.mate.view.MateGameResultView")--羁绊游戏结算
|
|
require("game.mate.view.MateMusicGameView")
|
|
require("game.mate.view.MateMusicItem")
|
|
require("game.mate.view.MateMusicTipView")
|
|
require("game.mate.view.MateBallGameView")
|
|
require("game.mate.view.MateBallTipView")
|
|
require("game.mate.view.MateFindFriendTagItem")
|
|
require("game.mate.view.MateAdView")--羁绊预告界面
|
|
require("game.proto.149.Require149")
|
|
|
|
MateController = MateController or BaseClass(BaseController, true)
|
|
local MateController = MateController
|
|
|
|
function MateController:__init()
|
|
MateController.Instance = self
|
|
self.model = MateModel:GetInstance()
|
|
self:AddEvents()
|
|
self:RegisterAllProtocal()
|
|
|
|
end
|
|
|
|
function MateController:__delete()
|
|
end
|
|
|
|
function MateController:RegisterAllProtocal( )
|
|
self:RegisterProtocal(14900, 'on14900') --羁绊基础信息
|
|
self:RegisterProtocal(14901, 'on14901') --请求羁绊
|
|
self:RegisterProtocal(14902, 'on14902') --请求羁绊消息
|
|
self:RegisterProtocal(14903, 'on14903') --回应请求羁绊
|
|
self:RegisterProtocal(14904, 'on14904') --收到羁绊回应
|
|
self:RegisterProtocal(14905, 'on14905') --请求解除羁绊
|
|
self:RegisterProtocal(14906, 'on14906') --解除羁绊消息
|
|
self:RegisterProtocal(14907, 'on14907') --回应解除羁绊
|
|
self:RegisterProtocal(14908, 'on14908') --收到解除羁绊回应
|
|
self:RegisterProtocal(14909, 'on14909') --解除羁绊预览
|
|
self:RegisterProtocal(14910, 'on14910') --修改羁绊称号
|
|
self:RegisterProtocal(14911, 'on14911') --修改羁绊备注
|
|
self:RegisterProtocal(14912, 'on14912') --领取纪念日奖励
|
|
self:RegisterProtocal(14913, 'on14913') --友谊的小船
|
|
self:RegisterProtocal(14914, 'on14914') --强化友谊的小船
|
|
self:RegisterProtocal(14915, 'on14915') --称号佩戴
|
|
self:RegisterProtocal(14916, 'on14916') --查看他人羁绊
|
|
self:RegisterProtocal(14917, 'on14917') --请求羁绊检查
|
|
self:RegisterProtocal(14918, 'on14918') --新手奖励领取状态
|
|
self:RegisterProtocal(14919, 'on14919') --新手奖励领取
|
|
-------------------------
|
|
self:RegisterProtocal(14920, 'on14920') --小游戏情况
|
|
self:RegisterProtocal(14921, 'on14921') --小游戏邀请他人
|
|
self:RegisterProtocal(14922, 'on14922') --小游戏收到邀请
|
|
self:RegisterProtocal(14923, 'on14923') --小游戏回应邀请
|
|
self:RegisterProtocal(14924, 'on14924') --节奏大师游戏预备开始
|
|
self:RegisterProtocal(14925, 'on14925') --节奏大师游戏拍点出现
|
|
self:RegisterProtocal(14926, 'on14926') --节奏大师游戏换人
|
|
self:RegisterProtocal(14927, 'on14927') --节奏大师点击
|
|
self:RegisterProtocal(14928, 'on14928') --节奏大师正确点击广播
|
|
self:RegisterProtocal(14929, 'on14929') --节奏大师游戏积分变化
|
|
self:RegisterProtocal(14930, 'on14930') --节奏大师结算
|
|
self:RegisterProtocal(14932, 'on14932') --收到回应
|
|
self:RegisterProtocal(14934, 'on14934') --关闭羁绊游戏
|
|
self:RegisterProtocal(14935, 'on14935') --抛接球进入准备界面
|
|
self:RegisterProtocal(14936, 'on14936') --抛接球,开球
|
|
self:RegisterProtocal(14938, 'on14938') --抛接球球飞行方向
|
|
self:RegisterProtocal(14939, 'on14939') --抛接球球结算
|
|
|
|
self:RegisterProtocal(14940, 'on14940') --准备状态
|
|
self:RegisterProtocal(14941, 'on14941') --准备
|
|
self:RegisterProtocal(14942, 'on14942') --交友大厅 查看信息
|
|
self:RegisterProtocal(14943, 'on14943') --交友大厅 发布交友信息
|
|
|
|
self:RegisterProtocal(14945, 'on14945') --拍照 发出邀请
|
|
self:RegisterProtocal(14946, 'on14946') --拍照 收到的邀请信息
|
|
self:RegisterProtocal(14947, 'on14947') --拍照 回应邀请
|
|
self:RegisterProtocal(14948, 'on14948') --拍照 活动信息
|
|
self:RegisterProtocal(14949, 'on14949') --拍照 准备
|
|
self:RegisterProtocal(14950, 'on14950') --拍照 拍照
|
|
self:RegisterProtocal(14951, 'on14951') --拍照 结算
|
|
self:RegisterProtocal(14952, 'on14952') --拍照 取消游戏
|
|
|
|
self:RegisterProtocal(14953, 'on14953') --羁绊-日常 日常任务
|
|
self:RegisterProtocal(14954, 'on14954') --羁绊-日常 更新任务进度
|
|
self:RegisterProtocal(14955, 'on14955') --羁绊-日常 领取任务奖励
|
|
end
|
|
|
|
function MateController:AddEvents()
|
|
local function BaseRequest( )
|
|
self.model:Fire(MateConst.REQ_BASIC_INFO)
|
|
self.model:Fire(MateConst.REQ_CONNECT_MESSAGE)
|
|
self.model:Fire(MateConst.REQ_CUT_CONNECT_MESSAGE)
|
|
self.model:Fire(MateConst.REQ_SHIP_INFO)
|
|
self.model:Fire(MateConst.REQ_GAME_INFO)
|
|
self.model:Fire(MateConst.REQ_GAME_INVITE_LIST)
|
|
-- self.model:Fire(MateConst.PROTO_CCMD_EVENT,14953)
|
|
end
|
|
|
|
local function chnage_day_func(type)
|
|
if type == SettingModel.CHANGE_DAY.HOUR_0 then -- 跨0点
|
|
local function delay_method( )
|
|
self.model:Fire(MateConst.PROTO_CCMD_EVENT,14953)--0点刷新任务
|
|
ShopModel:getInstance():Fire(ShopModel.GET_GOODS_LIST, ShopType.MATE) --其他地方购买走商城,需要请求协议
|
|
end
|
|
setTimeout(delay_method, 5)
|
|
end
|
|
end
|
|
GlobalEventSystem:Bind(EventName.CHANE_DAY, chnage_day_func)
|
|
|
|
local function CheckTaskCall( )
|
|
if self.bind_task_init_id then
|
|
TaskModel:getInstance():UnBind(self.bind_task_init_id)
|
|
self.bind_task_init_id = nil
|
|
end
|
|
if self.model:IsFinishAllMarriageTask( 3 ) then
|
|
--所有任务已完成,再也不需要监听
|
|
elseif self.need_task_check then
|
|
local function TASK_LIST_INIT( )
|
|
if self.need_task_check then
|
|
self:CheckTaskRed( )
|
|
if self.model:IsFinishAllMarriageTask( 3 ) then
|
|
--所有任务已完成,再也不需要监听
|
|
self.need_task_check = false
|
|
if self.bind_task_init_id then
|
|
TaskModel:getInstance():UnBind(self.bind_task_init_id)
|
|
self.bind_task_init_id = nil
|
|
end
|
|
end
|
|
end
|
|
end
|
|
TASK_LIST_INIT()
|
|
self.bind_task_init_id = TaskModel:getInstance():Bind(TaskEvent.TASK_LIST_INIT, TASK_LIST_INIT)
|
|
end
|
|
end
|
|
|
|
local function on_game_start()
|
|
self.need_task_check = true -- 是否需要检查任务标记,所有任务完成后就不要再检查了
|
|
self.model:Reset()
|
|
-------------------------
|
|
local function delay( )
|
|
if GetModuleIsOpen( 149 ) then
|
|
BaseRequest()
|
|
end
|
|
if GetModuleIsOpen( 149,1 ) then
|
|
--羁绊任务
|
|
CheckTaskCall()
|
|
end
|
|
-- if GetModuleIsOpen( 149,2 ) then
|
|
--羁绊预告
|
|
-- end
|
|
end
|
|
setTimeout(delay,2)
|
|
self.model:Fire(MateConst.REQ_MATE_AD_AWARD_STATUS)
|
|
end
|
|
GlobalEventSystem:Bind(EventName.GAME_START, on_game_start)
|
|
|
|
local function onLevelChange( level )
|
|
local need_lv = self.model:GetOpenNeed()
|
|
if level == need_lv then
|
|
BaseRequest()
|
|
end
|
|
if level == GetModuleOpenLevel( 149,1) then
|
|
--羁绊任务
|
|
CheckTaskCall()
|
|
end
|
|
|
|
-- 羁绊功能预告
|
|
-- 不再升级自动弹出
|
|
-- if level == GetModuleOpenLevel(149) then
|
|
-- self:ShowMateAdView(true, false, true)
|
|
-- end
|
|
|
|
end
|
|
RoleManager:getInstance().mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelChange)
|
|
|
|
local function UPDATE_TICKETS_STATE( )
|
|
if GetModuleIsOpen( 149 ) then
|
|
self:CheckRed()
|
|
end
|
|
end
|
|
SocialityModel.getInstance():Bind(SocialityModel.UPDATE_TICKETS_STATE, UPDATE_TICKETS_STATE)
|
|
|
|
local function ANS_FINISHED_TASK_LIST(flag)
|
|
-- 羁绊预告界面开启判断
|
|
if Config.Modulesub["149@2"].task_id == flag and (not self.have_show_mate_ad_view) then
|
|
self.have_show_mate_ad_view = true
|
|
self:ShowMateAdView(true, true, true)
|
|
end
|
|
for k,v in pairs(MateConst.SingleDogTask) do
|
|
if v == flag then
|
|
local function delay_call( )
|
|
self:CheckRed( )
|
|
end
|
|
setTimeout(delay_call,2)
|
|
return
|
|
end
|
|
end
|
|
end
|
|
GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, ANS_FINISHED_TASK_LIST)
|
|
|
|
local function update_mate_red()
|
|
self:CheckRed( )
|
|
end
|
|
self.model:Bind(MateConst.UPDATE_MATE_RED, update_mate_red)
|
|
|
|
local function OPEN_BASE_VIEW( show_type, other_data, close_auto_task )
|
|
if other_data == "close" then
|
|
if self.matebaseview then
|
|
self.matebaseview:Close()
|
|
end
|
|
return
|
|
end
|
|
|
|
|
|
-------------------------
|
|
if not self.matebaseview then
|
|
self.matebaseview = MateBaseView.New()
|
|
end
|
|
self.matebaseview:Open(show_type, other_data, close_auto_task)
|
|
end
|
|
self.model:Bind(MateConst.OPEN_BASE_VIEW, OPEN_BASE_VIEW)
|
|
|
|
local function OPEN_FIND_FRIEND_TIP( str,is_close )
|
|
--征友tip
|
|
if is_close then
|
|
if self.matefindfriendtip then
|
|
self.matefindfriendtip:Close()
|
|
end
|
|
return
|
|
end
|
|
if not self.matefindfriendtip then
|
|
self.matefindfriendtip = MateFindFriendTip.New()
|
|
self.matefindfriendtip:Open( str )
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_FIND_FRIEND_TIP, OPEN_FIND_FRIEND_TIP)
|
|
|
|
local function OPEN_FRIENDINFO_VIEW( role_id,look_info )
|
|
if not role_id and not look_info then return end
|
|
if not self.matefriendinfoview then
|
|
self.matefriendinfoview = MateFriendInfoView.New()
|
|
self.matefriendinfoview:Open(role_id,look_info)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_FRIENDINFO_VIEW,OPEN_FRIENDINFO_VIEW)
|
|
|
|
local function OPEN_FRIEND_SHARE_VIEW( look_info )
|
|
if not look_info then return end
|
|
if not self.matefriendshareview then
|
|
self.matefriendshareview = MateFriendShareView.New()
|
|
self.matefriendshareview:Open(look_info)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_FRIEND_SHARE_VIEW,OPEN_FRIEND_SHARE_VIEW)
|
|
|
|
local function OPEN_CHANGETAG_VIEW( role_id )
|
|
if not role_id then return end
|
|
if not self.matechangetagview then
|
|
self.matechangetagview = MateChangeTagView.New()
|
|
self.matechangetagview:Open(role_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_CHANGETAG_VIEW,OPEN_CHANGETAG_VIEW)
|
|
|
|
local function OPEN_SELECT_FRIEND_VIEW( friend_list,tag,call_select,cur_select )
|
|
friend_list = friend_list or {}
|
|
if not self.matefriendselecttip then
|
|
self.matefriendselecttip = MateFriendSelectTip.New()
|
|
self.matefriendselecttip:SetData(friend_list,tag,call_select,cur_select)
|
|
self.matefriendselecttip:Open()
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_SELECT_FRIEND_VIEW,OPEN_SELECT_FRIEND_VIEW)
|
|
|
|
local function OPEN_ASK_MATE_VIEW( role_id, role_info )
|
|
if not self.mateaskview then
|
|
self.mateaskview = MateAskView.New()
|
|
self.mateaskview:Open(role_id,role_info)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_ASK_MATE_VIEW,OPEN_ASK_MATE_VIEW)
|
|
|
|
local function CLOSE_ASK_MATE_VIEW()
|
|
if self.mateaskview and self.mateaskview:HasOpen() then
|
|
self.mateaskview:Close()
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.CLOSE_ASK_MATE_VIEW,CLOSE_ASK_MATE_VIEW)
|
|
|
|
local function OPEN_ANS_MATE_VIEW( role_id )
|
|
if not role_id then return end
|
|
if not self.mateansview then
|
|
self.mateansview = MateAnsView.New()
|
|
self.mateansview:Open(role_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_ANS_MATE_VIEW,OPEN_ANS_MATE_VIEW)
|
|
|
|
local function OPEN_CHANGETITLE_VIEW( role_id )
|
|
if not role_id then return end
|
|
if not self.matechangetitleview then
|
|
self.matechangetitleview = MateChangeTitleView.New()
|
|
self.matechangetitleview:Open(role_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_CHANGETITLE_VIEW,OPEN_CHANGETITLE_VIEW)
|
|
|
|
local function OPEN_MATEAD_VIEW(use_close_anim, use_close_timer)
|
|
self:ShowMateAdView(true, use_close_anim, use_close_timer)
|
|
end
|
|
self.model:Bind(MateConst.OPEN_MATEAD_VIEW, OPEN_MATEAD_VIEW)
|
|
|
|
local function OPEN_ANS_BREAK_VIEW( role_id )
|
|
if not role_id then return end
|
|
--[[local function call_yes( )
|
|
self.model:Fire(MateConst.REQ_RESPOND_CUT_CONNECT, role_id, 1)
|
|
end
|
|
local function call_no( )
|
|
self.model:Fire(MateConst.REQ_RESPOND_CUT_CONNECT, role_id, 2)
|
|
end--]]
|
|
-- local basic = self.model:GetBasicByRoleId( role_id )
|
|
-- if not basic then return end
|
|
-- local str = string.format(MateConst.AnsBreakTip, basic.name)
|
|
-- Alert.show(str, Alert.Type.Two, call_yes, call_no, '同意', '拒绝')
|
|
self.model:Fire(MateConst.OPEN_ASK_BREAK_VIEW, role_id, true)
|
|
end
|
|
self.model:Bind(MateConst.OPEN_ANS_BREAK_VIEW,OPEN_ANS_BREAK_VIEW)
|
|
|
|
local function OPEN_ASK_BREAK_VIEW( role_id,is_ans )
|
|
if not role_id then return end
|
|
if not self.mateaskbreaktip then
|
|
self.mateaskbreaktip = MateAskBreakTip.New()
|
|
self.mateaskbreaktip:Open(role_id,is_ans)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_ASK_BREAK_VIEW,OPEN_ASK_BREAK_VIEW)
|
|
|
|
local function OPEN_MARK_VIEW( role_id )
|
|
if not role_id then return end
|
|
if not self.matemarkview then
|
|
self.matemarkview = MateMarkView.New()
|
|
self.matemarkview:Open(role_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_MARK_VIEW,OPEN_MARK_VIEW)
|
|
|
|
local function OPEN_GAME_ANS_VIEW( role_id,type_id )
|
|
if TableSize(self.model:GetInviteInfo()) == 0 then
|
|
self.model:CheckInviteDot( )
|
|
return
|
|
end
|
|
if not self.mategameansview then
|
|
self.mategameansview = MateGameAnsView.New()
|
|
self.mategameansview:Open(role_id,type_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_GAME_ANS_VIEW,OPEN_GAME_ANS_VIEW)
|
|
|
|
local function OPEN_GAME_ANS_LIST( )
|
|
if not self.mategameanslisttip then
|
|
self.mategameanslisttip = MateFriendSelectTip.New()
|
|
end
|
|
self.mategameanslisttip:SetSpecialStr("邀请游戏","没有人邀请你做游戏哦~","请选择一个参与~")
|
|
-------------------------
|
|
local friend_list = self.model:GetInviteInfo()
|
|
local need_list = {}
|
|
for k,v in pairs(friend_list) do
|
|
if v.type == 2 then
|
|
table.insert( need_list, v )
|
|
end
|
|
end
|
|
local function call_select( role_id,type_id )
|
|
self.model:Fire(MateConst.OPEN_GAME_ANS_VIEW,role_id,type_id)
|
|
end
|
|
self.mategameanslisttip:SetData(need_list,"game_ans",call_select,0)
|
|
-------------------------
|
|
self.mategameanslisttip:Open()
|
|
end
|
|
self.model:Bind(MateConst.OPEN_GAME_ANS_LIST,OPEN_GAME_ANS_LIST)
|
|
|
|
local function OPEN_MUSIC_VIEW( )
|
|
if not self.matemusicgameview then
|
|
self.matemusicgameview = MateMusicGameView.New()
|
|
self.matemusicgameview:Open()
|
|
end
|
|
-------------------------
|
|
local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Common,CookieKey.MATE_GAME_TIP_SHOW_TAG)
|
|
if data and data[RoleManager.Instance.mainRoleInfo.role_id] and data[RoleManager.Instance.mainRoleInfo.role_id][MateConst.GameActId.Music] then
|
|
else
|
|
self.model:Fire(MateConst.OPEN_MUSIC_TIP_VIEW)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_MUSIC_VIEW, OPEN_MUSIC_VIEW)
|
|
|
|
local function OPEN_BALL_VIEW( )
|
|
if not self.mateballgameview then
|
|
self.mateballgameview = MateBallGameView.New()
|
|
self.mateballgameview:Open()
|
|
end
|
|
-------------------------
|
|
local data = CookieWrapper.Instance:GetCookie(CookieLevelType.Common,CookieKey.MATE_GAME_TIP_SHOW_TAG)
|
|
if data and data[RoleManager.Instance.mainRoleInfo.role_id] and data[RoleManager.Instance.mainRoleInfo.role_id][MateConst.GameActId.Ball] then
|
|
else
|
|
self.model:Fire(MateConst.OPEN_BALL_TIP_VIEW)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_BALL_VIEW, OPEN_BALL_VIEW)
|
|
|
|
local function OPEN_MUSIC_TIP_VIEW( )
|
|
if not self.matemusictipview then
|
|
self.matemusictipview = MateMusicTipView.New()
|
|
self.matemusictipview:Open()
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_MUSIC_TIP_VIEW, OPEN_MUSIC_TIP_VIEW)
|
|
|
|
local function OPEN_BALL_TIP_VIEW( )
|
|
if not self.mateballtipview then
|
|
self.mateballtipview = MateBallTipView.New()
|
|
self.mateballtipview:Open()
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_BALL_TIP_VIEW, OPEN_BALL_TIP_VIEW)
|
|
|
|
local function OPEN_GAME_REWARD_VIEW( )
|
|
if not self.mategamerewardview then
|
|
self.mategamerewardview = MateGameRewardView.New()
|
|
self.mategamerewardview:Open()
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_GAME_REWARD_VIEW,OPEN_GAME_REWARD_VIEW)
|
|
|
|
local function OPEN_ASK_PHOTO_VIEW( )
|
|
if self.model:IsNoMateFriend() then
|
|
Message.show("先结交一位羁绊好友吧~")
|
|
return
|
|
end
|
|
if not self.mateaskphotoview then
|
|
self.mateaskphotoview = MateAskPhotoView.New()
|
|
self.mateaskphotoview:Open()
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.OPEN_ASK_PHOTO_VIEW,OPEN_ASK_PHOTO_VIEW)
|
|
|
|
|
|
--羁绊基础信息
|
|
local function REQ_BASIC_INFO()
|
|
self:SendFmtToGame(14900)
|
|
end
|
|
self.model:Bind(MateConst.REQ_BASIC_INFO, REQ_BASIC_INFO)
|
|
|
|
--请求羁绊
|
|
local function REQ_TRY_TO_CONNECT( role_id )
|
|
if role_id then
|
|
self:SendFmtToGame( 14901, "l", role_id )
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_TRY_TO_CONNECT, REQ_TRY_TO_CONNECT)
|
|
|
|
--请求羁绊消息
|
|
local function REQ_CONNECT_MESSAGE( )
|
|
self:SendFmtToGame(14902)
|
|
end
|
|
self.model:Bind(MateConst.REQ_CONNECT_MESSAGE, REQ_CONNECT_MESSAGE)
|
|
|
|
--回应请求羁绊
|
|
local function REQ_RESPOND_CONNECT( role_id, op_type )
|
|
--1答应 2拒绝
|
|
if role_id and op_type then
|
|
self:SendFmtToGame(14903, "lc", role_id, op_type)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_RESPOND_CONNECT, REQ_RESPOND_CONNECT)
|
|
|
|
--请求解除羁绊
|
|
local function REQ_CUT_CONNECT( role_id, op_type )
|
|
--1协议|2强制
|
|
if role_id and op_type then
|
|
self:SendFmtToGame(14905, "lc", role_id, op_type)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_CUT_CONNECT, REQ_CUT_CONNECT)
|
|
|
|
--解除羁绊消息
|
|
local function REQ_CUT_CONNECT_MESSAGE( )
|
|
self:SendFmtToGame(14906)
|
|
end
|
|
self.model:Bind(MateConst.REQ_CUT_CONNECT_MESSAGE, REQ_CUT_CONNECT_MESSAGE)
|
|
|
|
--回应解除羁绊
|
|
local function REQ_RESPOND_CUT_CONNECT( role_id, op_type )
|
|
--1答应 2拒绝
|
|
if role_id and op_type then
|
|
self:SendFmtToGame(14907, "lc", role_id, op_type)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_RESPOND_CUT_CONNECT, REQ_RESPOND_CUT_CONNECT)
|
|
|
|
|
|
--解除羁绊预览
|
|
local function REQ_LOOK_BREAK_AWARD( role_id )
|
|
if role_id then
|
|
self:SendFmtToGame(14909, "l", role_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_LOOK_BREAK_AWARD, REQ_LOOK_BREAK_AWARD)
|
|
|
|
--修改羁绊称号
|
|
local function REQ_CHANGE_FRIEND_NAME( role_id, name )
|
|
if role_id and name then
|
|
self:SendFmtToGame(14910, "ls", role_id, name)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_CHANGE_FRIEND_NAME, REQ_CHANGE_FRIEND_NAME)
|
|
|
|
--修改羁绊备注
|
|
local function REQ_CHANGE_TAG( role_id, remarks_id )
|
|
if role_id and remarks_id then
|
|
self:SendFmtToGame(14911, "lc", role_id, remarks_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_CHANGE_TAG, REQ_CHANGE_TAG)
|
|
|
|
-- 领取纪念日奖励
|
|
local function REQ_GET_MARK_REWARD( role_id, day )
|
|
if role_id and day then
|
|
self:SendFmtToGame(14912, "lh", role_id, day )
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_GET_MARK_REWARD,REQ_GET_MARK_REWARD)
|
|
|
|
--友谊的小船
|
|
local function REQ_SHIP_INFO( )
|
|
self:SendFmtToGame(14913)
|
|
end
|
|
self.model:Bind(MateConst.REQ_SHIP_INFO,REQ_SHIP_INFO)
|
|
|
|
--强化友谊的小船
|
|
local function REQ_UPGRADE_SHIP( )
|
|
self:SendFmtToGame(14914)
|
|
end
|
|
self.model:Bind(MateConst.REQ_UPGRADE_SHIP,REQ_UPGRADE_SHIP)
|
|
|
|
--佩戴羁绊称号
|
|
local function REQ_DRESS_TITLE( role_id,op_type )
|
|
-- 1佩戴|2取消
|
|
if role_id and op_type then
|
|
self:SendFmtToGame(14915,"lc", role_id,op_type)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_DRESS_TITLE,REQ_DRESS_TITLE)
|
|
|
|
--查看他人羁绊
|
|
local function REQ_LOOK_OTHER_MATE( id_1,id_2 )
|
|
if id_1 and id_2 then
|
|
self:SendFmtToGame(14916,"ll",id_1,id_2)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_LOOK_OTHER_MATE,REQ_LOOK_OTHER_MATE)
|
|
|
|
local function REQ_CHECK_BIND_MATE( role_id )
|
|
if role_id then
|
|
self:SendFmtToGame(14917,"l",role_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_CHECK_BIND_MATE, REQ_CHECK_BIND_MATE)
|
|
|
|
--新手奖励领取状态
|
|
local function REQ_MATE_AD_AWARD_STATUS( )
|
|
self:SendFmtToGame(14918)
|
|
end
|
|
self.model:Bind(MateConst.REQ_MATE_AD_AWARD_STATUS, REQ_MATE_AD_AWARD_STATUS)
|
|
|
|
--新手奖励领取
|
|
local function REQ_GET_MATE_AD_AWARD( )
|
|
self:SendFmtToGame(14919)
|
|
end
|
|
self.model:Bind(MateConst.REQ_GET_MATE_AD_AWARD, REQ_GET_MATE_AD_AWARD)
|
|
|
|
--小游戏情况
|
|
local function REQ_GAME_INFO( )
|
|
self:SendFmtToGame(14920)
|
|
end
|
|
self.model:Bind(MateConst.REQ_GAME_INFO,REQ_GAME_INFO)
|
|
|
|
--小游戏邀请他人
|
|
local function REQ_INVITE_ROLE( role_id,act_id )
|
|
if role_id and act_id then
|
|
self:SendFmtToGame(14921,"lc",role_id,act_id)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_INVITE_ROLE,REQ_INVITE_ROLE)
|
|
|
|
--小游戏邀请他人
|
|
local function REQ_GAME_INVITE_LIST( )
|
|
self:SendFmtToGame(14922)
|
|
end
|
|
self.model:Bind(MateConst.REQ_GAME_INVITE_LIST,REQ_GAME_INVITE_LIST)
|
|
|
|
--小游戏回应邀请
|
|
local function REQ_RESPOND_INVITE(act_id,role_id,op_type)
|
|
--op_type 1同意|2拒绝
|
|
if act_id and role_id and op_type then
|
|
self:SendFmtToGame(14923,"clc",act_id,role_id,op_type)
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.REQ_RESPOND_INVITE,REQ_RESPOND_INVITE)
|
|
|
|
local function MUSIC_CLICK_DOT( id,role_id )
|
|
self:SendFmtToGame(14927,"hl",id,role_id)
|
|
end
|
|
self.model:Bind(MateConst.MUSIC_CLICK_DOT,MUSIC_CLICK_DOT)
|
|
|
|
--小游戏取消邀请
|
|
local function REQ_CANCEL_INVITE()
|
|
self:SendFmtToGame(14931)
|
|
end
|
|
self.model:Bind(MateConst.REQ_CANCEL_INVITE,REQ_CANCEL_INVITE)
|
|
|
|
----游戏请求结束
|
|
local function REQ_GAME_OVER( role_id )
|
|
self:SendFmtToGame(14933,"l",role_id)
|
|
end
|
|
self.model:Bind(MateConst.REQ_GAME_OVER,REQ_GAME_OVER)
|
|
|
|
--抛接球,开球
|
|
local function BALL_START_BALL( )
|
|
local data = self.model:GetBallInfo()
|
|
if not data then return end
|
|
local my_role_id = RoleManager.Instance.mainRoleInfo.role_id
|
|
local role_id = data[1].role_id == my_role_id and data[2].role_id or data[1].role_id
|
|
self:SendFmtToGame(14936,"l",role_id)
|
|
end
|
|
self.model:Bind(MateConst.BALL_START_BALL,BALL_START_BALL)
|
|
|
|
--抛接球,击球
|
|
local function BALL_KICK_BALL( )
|
|
local data = self.model:GetBallInfo()
|
|
if not data then return end
|
|
local my_role_id = RoleManager.Instance.mainRoleInfo.role_id
|
|
local role_id = data[1].role_id == my_role_id and data[2].role_id or data[1].role_id
|
|
self:SendFmtToGame(14937,"l",role_id)
|
|
end
|
|
self.model:Bind(MateConst.BALL_KICK_BALL,BALL_KICK_BALL)
|
|
|
|
--游戏准备状态列表
|
|
local function REQ_GAME_WAIT_STATUS( role_id )
|
|
self:SendFmtToGame(14940, "l", role_id)
|
|
end
|
|
self.model:Bind(MateConst.REQ_GAME_WAIT_STATUS, REQ_GAME_WAIT_STATUS)
|
|
|
|
--游戏准备
|
|
local function REQ_GAME_WAIT_READY( role_id )
|
|
self:SendFmtToGame(14941, "l", role_id)
|
|
end
|
|
self.model:Bind(MateConst.REQ_GAME_WAIT_READY, REQ_GAME_WAIT_READY)
|
|
|
|
-- 交友大厅 查看信息
|
|
local function REQ_FIND_FRIEND_DATA( )
|
|
self:SendFmtToGame(14942)
|
|
end
|
|
self.model:Bind(MateConst.REQ_FIND_FRIEND_DATA, REQ_FIND_FRIEND_DATA)
|
|
|
|
-- 交友大厅 发布交友信息
|
|
local function REQ_PUBLISH_FIND_FRIEND( msg, type_id )
|
|
if (not msg) or (not type_id) then
|
|
return
|
|
end
|
|
self:SendFmtToGame(14943, "sc", msg, type_id)
|
|
end
|
|
self.model:Bind(MateConst.REQ_PUBLISH_FIND_FRIEND, REQ_PUBLISH_FIND_FRIEND)
|
|
|
|
local function UPDATE_FLOWER_NUM( role_id,week_charm,intimacy )
|
|
self.model:ChangeFriendInfo("intimacy",role_id,intimacy)
|
|
self.model:Fire(MateConst.ANS_BASIC_INFO)
|
|
end
|
|
SocialityModel:getInstance():Bind(SocialityModel.UPDATE_FLOWER_NUM,UPDATE_FLOWER_NUM)
|
|
|
|
local function onSendCmdFunc( ... )
|
|
local args_list = {...}
|
|
if args_list[1] == 14947 or args_list[1] == 14949 then
|
|
self:SendFmtToGame(args_list[1], "lcc", args_list[2], args_list[3], args_list[4])
|
|
elseif args_list[1] == 14952 then
|
|
self:SendFmtToGame(args_list[1], "l", args_list[2])
|
|
elseif args_list[1] == 14955 then
|
|
self:SendFmtToGame(args_list[1], "l", args_list[2])
|
|
elseif args_list[1] == 14956 then
|
|
self:SendFmtToGame(args_list[1], "cl", args_list[2],args_list[3])
|
|
else
|
|
self:SendFmtToGame(args_list[1])
|
|
end
|
|
end
|
|
self.model:Bind(MateConst.PROTO_CCMD_EVENT, onSendCmdFunc)
|
|
|
|
local function update_goods_list_by_type( type )
|
|
if type == ShopType.MATE then
|
|
self:CheckRed(true)
|
|
end
|
|
end
|
|
ShopModel:getInstance():Bind(ShopModel.ANS_GET_GOODS_LIST, update_goods_list_by_type)
|
|
|
|
local function update_goods_list_by_type_2( )
|
|
self:CheckRed(true)
|
|
end
|
|
ShopModel:getInstance():Bind(ShopModel.UPDATE_GOODS_LIST, update_goods_list_by_type_2)
|
|
|
|
--监听特殊货币变化
|
|
local on_special_score_change = function()
|
|
self:CheckRed(true)
|
|
end
|
|
GoodsModel:getInstance():Bind(GoodsModel.UPDATE_SPECIAL_SCORE, on_special_score_change)
|
|
end
|
|
|
|
--羁绊基础信息
|
|
function MateController:on14900( )
|
|
local scmd = SCMD14900.New(true)
|
|
self.model:SetBasicInfo( scmd.lists )
|
|
self:CheckRed()
|
|
self.model:Fire(MateConst.ANS_BASIC_INFO)
|
|
--刷新羁绊基础信息后要请求一下任务列表
|
|
self.model:Fire(MateConst.PROTO_CCMD_EVENT,14953)
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
end
|
|
|
|
--请求羁绊
|
|
function MateController:on14901( )
|
|
local scmd = SCMD14901.New(true)
|
|
if scmd.code == 1 then
|
|
Message.show("请求成功,请耐心等待对方回复~")
|
|
self.model:Fire(MateConst.ANS_TRY_TO_CONNECT)
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--请求羁绊消息
|
|
function MateController:on14902( )
|
|
--1自己发出的|2收到的
|
|
local scmd = SCMD14902.New(true)
|
|
self.model:SetConnectMessage(scmd.ask_list)
|
|
self.model:Fire(MateConst.ANS_CONNECT_MESSAGE)
|
|
local have = false
|
|
for k,v in pairs(scmd.ask_list) do
|
|
if v.type == 2 then
|
|
--存在待处理消息
|
|
have = true
|
|
break
|
|
end
|
|
end
|
|
if have then
|
|
MsgManager:getInstance():Add({type=Config.ConfigMainIcon.TipType.mate_ans})
|
|
else
|
|
MsgManager:getInstance():Remove(Config.ConfigMainIcon.TipType.mate_ans)
|
|
end
|
|
end
|
|
|
|
--回应请求羁绊
|
|
function MateController:on14903( )
|
|
local scmd = SCMD14903.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
if scmd.type == 1 then
|
|
Message.show("已答应羁绊请求~")
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
else
|
|
Message.show("已谢绝羁绊请求~")
|
|
end
|
|
self.model:Fire(MateConst.ANS_RESPOND_CONNECT)
|
|
local function delay( )
|
|
self.model:Fire(MateConst.REQ_CONNECT_MESSAGE)
|
|
end
|
|
setTimeout(delay,0.5)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--收到羁绊回应
|
|
function MateController:on14904( )
|
|
--1答应 2拒绝
|
|
local scmd = SCMD14904.New(true)
|
|
if scmd.type == 1 then
|
|
Message.show(scmd.name .. "已同意您的羁绊请求~")
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
else
|
|
Message.show(scmd.name .. "已回绝您的羁绊请求~")
|
|
end
|
|
self.model:Fire(MateConst.REQ_CONNECT_MESSAGE)
|
|
end
|
|
|
|
--请求解除羁绊
|
|
function MateController:on14905( )
|
|
local scmd = SCMD14905.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
if scmd.type == 2 then
|
|
Message.show("您已强制解除和对方的羁绊关系~")
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
else
|
|
Message.show("您已申请解除羁绊关系,请耐心等待对方回复~")
|
|
end
|
|
self.model:Fire(MateConst.ANS_CUT_CONNECT)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--解除羁绊消息
|
|
function MateController:on14906( )
|
|
--1自己发出的|2收到的
|
|
local scmd = SCMD14906.New(true)
|
|
self.model:SetCutConnectMessage(scmd.lists)
|
|
self.model:Fire(MateConst.ANS_CUT_CONNECT_MESSAGE)
|
|
-------------------------
|
|
local have = false
|
|
for k,v in pairs(scmd.lists) do
|
|
if v.type == 2 then
|
|
--存在待处理消息
|
|
have = true
|
|
break
|
|
end
|
|
end
|
|
if have then
|
|
MsgManager:getInstance():Add({type=Config.ConfigMainIcon.TipType.mate_ans_break})
|
|
else
|
|
MsgManager:getInstance():Remove(Config.ConfigMainIcon.TipType.mate_ans_break)
|
|
end
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
end
|
|
|
|
--回应解除羁绊
|
|
function MateController:on14907( )
|
|
local scmd = SCMD14907.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
if scmd.type == 1 then
|
|
Message.show("您已同意解除羁绊关系~")
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
else
|
|
Message.show("您已拒绝对方的解除羁绊请求~")
|
|
end
|
|
self.model:Fire(MateConst.ANS_RESPOND_CUT_CONNECT)
|
|
self.model:Fire(MateConst.REQ_CUT_CONNECT_MESSAGE)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--收到解除羁绊回应
|
|
function MateController:on14908( )
|
|
local scmd = SCMD14908.New(true)
|
|
if scmd.type == 1 then
|
|
Message.show(scmd.name .. "已同意您的解除羁绊请求~")
|
|
-- SocialityModel.getInstance().only_request_mate_flag = true
|
|
-- SocialityModel.getInstance():Fire(SocialityModel.REQUEST_CCMD_EVENT, 14000, 2)--请求羁绊
|
|
else
|
|
Message.show(scmd.name .. "已拒绝您的解除羁绊请求~")
|
|
end
|
|
end
|
|
|
|
--解除羁绊预览
|
|
function MateController:on14909( )
|
|
local scmd = SCMD14909.New(true)
|
|
self.model:Fire(MateConst.ANS_LOOK_BREAK_AWARD,scmd)
|
|
end
|
|
|
|
--修改羁绊称号
|
|
function MateController:on14910( )
|
|
local scmd = SCMD14910.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
Message.show("修改成功~")
|
|
self.model:ChangeFriendInfo("other_title",scmd.role_id,scmd.name)
|
|
self.model:Fire(MateConst.ANS_CHANGE_FRIEND_NAME)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--修改羁绊备注
|
|
function MateController:on14911( )
|
|
local scmd = SCMD14911.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
Message.show("修改成功~")
|
|
self.model:ChangeFriendInfo("remarks",scmd.role_id,scmd.remarks_id)
|
|
self.model:Fire(MateConst.ANS_CHANGE_TAG)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--领取纪念日奖励
|
|
function MateController:on14912( )
|
|
local scmd = SCMD14912.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.AWARD)
|
|
Message.show("领取成功~")
|
|
self.model:AddDailyReward(scmd.role_id,scmd.day)
|
|
self.model:Fire(MateConst.REQ_BASIC_INFO)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--友谊的小船
|
|
function MateController:on14913( )
|
|
local scmd = SCMD14913.New(true)
|
|
-------------------------
|
|
local last_data = self.model:GetShipBasic()
|
|
local is_change = false
|
|
if last_data and last_data.star then
|
|
is_change = last_data.star ~= scmd.star
|
|
end
|
|
-------------------------
|
|
self.model:SetShipBasic(scmd)
|
|
self.model:Fire(MateConst.ANS_SHIP_INFO,is_change)
|
|
self:CheckRed()
|
|
end
|
|
|
|
--强化友谊的小船
|
|
function MateController:on14914( )
|
|
local scmd = SCMD14914.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
Message.show("升级成功~")
|
|
self.model:Fire(MateConst.ANS_UPGRADE_SHIP)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--称号佩戴
|
|
function MateController:on14915( )
|
|
local scmd = SCMD14915.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
--1佩戴|2取消
|
|
if scmd.type == 1 then
|
|
Message.show("佩戴成功")
|
|
else
|
|
Message.show("卸下成功")
|
|
end
|
|
self.model:Fire(MateConst.ANS_DRESS_TITLE)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--查看他人羁绊
|
|
function MateController:on14916( )
|
|
local scmd = SCMD14916.New(true)
|
|
self.model:Fire(MateConst.OPEN_FRIEND_SHARE_VIEW,scmd)
|
|
end
|
|
|
|
function MateController:on14917( )
|
|
local scmd = SCMD14917.New(true)
|
|
if scmd.code == 1490003 or scmd.code == 1490004 or scmd.code == 1490025 or scmd.code == 1 then
|
|
self.model:Fire(MateConst.ANS_CHECK_BIND_MATE, scmd.code)
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
function MateController:on14918( )
|
|
local scmd = SCMD14918.New(true)
|
|
self.model:SetMateAdRewardStatus(scmd.state == 1 and true or false)
|
|
self.model:Fire(MateConst.ANS_MATE_AD_AWARD_STATUS)
|
|
end
|
|
|
|
function MateController:on14919( )
|
|
local scmd = SCMD14919.New(true)
|
|
if scmd.res_id ~= 1 then
|
|
ErrorCodeShow(scmd.res)
|
|
end
|
|
-- do nothing
|
|
end
|
|
|
|
--小游戏情况
|
|
function MateController:on14920( )
|
|
local scmd = SCMD14920.New(true)
|
|
self.model:SetGameInfo(scmd.lists)
|
|
self.model:Fire(MateConst.ANS_GAME_INFO)
|
|
self:CheckRed()
|
|
end
|
|
|
|
--小游戏邀请他人
|
|
function MateController:on14921( )
|
|
local scmd = SCMD14921.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
Message.show("邀请成功,请耐心等待回复~")
|
|
self.model:SetSelectGameInfo(scmd,"invite")
|
|
else
|
|
self.model:ResetSelectGameInfo()
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
self.model:Fire(MateConst.ANS_INVITE_ROLE)
|
|
end
|
|
|
|
--小游戏收到邀请
|
|
function MateController:on14922( )
|
|
local scmd = SCMD14922.New(true)
|
|
local need_list = {}
|
|
for k,v in pairs(scmd.lists) do
|
|
if v.type == 2 then
|
|
table.insert( need_list, v )
|
|
end
|
|
end
|
|
if TableSize(need_list) >= 1 then
|
|
Message.show("您有待处理的羁绊游戏消息~")
|
|
end
|
|
self.model:SetInviteInfo(scmd.lists)
|
|
end
|
|
|
|
--小游戏回应邀请
|
|
function MateController:on14923( )
|
|
local scmd = SCMD14923.New(true)
|
|
if scmd.code == 1 then
|
|
GlobalEventSystem:Fire(EventName.PLAY_UI_EFFECT_SOUND,LuaSoundManager.SOUND_UI.SUCCESS)
|
|
Message.show("操作成功")
|
|
if scmd.res == 1 then
|
|
self.model:SetSelectGameInfo(scmd,"together")
|
|
self.model:Fire(MateConst.ANS_INVITE_ROLE)
|
|
end
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--节奏大师游戏预备开始
|
|
function MateController:on14924( )
|
|
self.game_type_id = MateConst.GameActId.Music
|
|
local scmd = SCMD14924.New(true)
|
|
self.model:SetMusicGameInfo(scmd)
|
|
self.model:Fire(MateConst.OPEN_MUSIC_VIEW)
|
|
self.model:Fire(MateConst.GAME_START)
|
|
|
|
local role_list = {}
|
|
for i=1,2 do
|
|
if scmd.role_list[i] then
|
|
role_list[i] = scmd.role_list[i].role_id
|
|
end
|
|
end
|
|
self:SetGameCamera(role_list)
|
|
end
|
|
|
|
--节奏大师游戏拍点出现
|
|
function MateController:on14925( )
|
|
local scmd = SCMD14925.New(true)
|
|
self.model:Fire(MateConst.MUSIC_CREATE_DOT,scmd)
|
|
end
|
|
|
|
--节奏大师游戏换人
|
|
function MateController:on14926( )
|
|
local scmd = SCMD14926.New(true)
|
|
self.model:SetMusicPlayRole(scmd.role_id)
|
|
if scmd.role_id == RoleManager.Instance.mainRoleInfo.role_id then
|
|
Message.show("轮到你操作了~")
|
|
else
|
|
Message.show("轮到对方操作了~")
|
|
end
|
|
local show_type = scmd.role_id == RoleManager.Instance.mainRoleInfo.role_id and 1 or 2
|
|
self.model:Fire(MateConst.MUSIC_ROLE_CHANGE,show_type)
|
|
end
|
|
|
|
--节奏大师点击
|
|
function MateController:on14927( )
|
|
local scmd = SCMD14927.New(true)
|
|
end
|
|
|
|
--节奏大师正确点击广播
|
|
function MateController:on14928( )
|
|
local scmd = SCMD14928.New(true)
|
|
self.model:Fire(MateConst.MUSIC_CLEAN_TYPE,scmd.bit_id,"success")
|
|
end
|
|
|
|
--节奏大师游戏积分变化
|
|
function MateController:on14929( )
|
|
local scmd = SCMD14929.New(true)
|
|
self.model:SetMusicScore(scmd)
|
|
self.model:Fire(MateConst.MUSIC_SCORE_CHANGE)
|
|
end
|
|
|
|
--节奏大师结算
|
|
function MateController:on14930( )
|
|
self.game_type_id = nil
|
|
local function call_back( )
|
|
self:CheckRed()
|
|
end
|
|
local scmd = SCMD14930.New(true)
|
|
-- if not self.matemusicresultview then
|
|
-- self.matemusicresultview = MateGameResultView.New()
|
|
-- self.matemusicresultview:Open(MateConst.GameActId.Music,scmd,call_back)
|
|
-- end
|
|
-------------------------
|
|
scmd.act_id = MateConst.GameActId.Music
|
|
scmd.result = 1
|
|
scmd.reward_list = {}
|
|
-------------------------
|
|
scmd.special_duntype = BaseDungeonModel.DUN_TYPE.MATE
|
|
local _,lv = self.model:GetMusicAwardListAndLv( scmd )
|
|
scmd.special_score_lv = lv - 2
|
|
scmd.title_name = scmd.special_score_lv == 5 and "dun_result_win_title2" or "dun_result_win_title3"
|
|
BaseDungeonModel:getInstance():SetDunResultInfo(scmd)
|
|
BaseDungeonModel:getInstance():Fire(BaseDungeonModel.OPEN_DUNGEON_RESULT_VIEW,true)
|
|
-------------------------
|
|
self.model:Fire(MateConst.ANS_GAME_RESULT)
|
|
MainCamera.Instance:QuitMateCamera()
|
|
self:RemoveTimeClock()
|
|
self:ResetShowRole()
|
|
end
|
|
|
|
--小游戏收到回应
|
|
function MateController:on14932( )
|
|
local scmd = SCMD14932.New(true)
|
|
if scmd.type == 1 then
|
|
Message.show(scmd.name .. "答应了您的小游戏邀请~")
|
|
self.model:SetSelectGameInfo(scmd,"together")
|
|
self.model:Fire(MateConst.ANS_INVITE_ROLE)
|
|
elseif scmd.type == 2 then
|
|
Message.show(scmd.name .. "拒绝了您的小游戏邀请~")
|
|
self.model:SetSelectGameInfo(scmd,"over")
|
|
self.model:Fire(MateConst.ANS_INVITE_ROLE)
|
|
end
|
|
end
|
|
|
|
--关闭羁绊游戏
|
|
function MateController:on14934( )
|
|
local scmd = SCMD14934.New(true)
|
|
ErrorCodeShow(scmd.res)
|
|
self.model:Fire(MateConst.ANS_GAME_RESULT)
|
|
end
|
|
|
|
--抛接球进入准备界面
|
|
function MateController:on14935( )
|
|
self.game_type_id = MateConst.GameActId.Ball
|
|
local scmd = SCMD14935.New(true)
|
|
self.model:SetBallInfo(scmd.role_list)
|
|
self.model:Fire(MateConst.GAME_START)
|
|
self.model:Fire(MateConst.OPEN_BALL_VIEW)
|
|
-------------------------
|
|
local role_list = {}
|
|
for i=1,2 do
|
|
if scmd.role_list[i] then
|
|
role_list[i] = scmd.role_list[i].role_id
|
|
end
|
|
end
|
|
self:SetGameCamera(role_list)
|
|
end
|
|
|
|
--抛接球,开球
|
|
function MateController:on14936( )
|
|
local scmd = SCMD14936.New(true)
|
|
if scmd.role_id == RoleManager.Instance.mainRoleInfo.role_id then
|
|
Message.show("您开球啦~")
|
|
else
|
|
Message.show("对方开球啦~")
|
|
end
|
|
self.model:Fire(MateConst.BALL_FLY,scmd.role_id)
|
|
end
|
|
|
|
--抛接球球飞行方向
|
|
function MateController:on14938( )
|
|
local scmd = SCMD14938.New(true)
|
|
self.model:SetBallFlyInfo(scmd)
|
|
self.model:Fire(MateConst.BALL_FLY)
|
|
end
|
|
|
|
--抛接球结算
|
|
function MateController:on14939( )
|
|
self.game_type_id = nil
|
|
local scmd = SCMD14939.New(true)
|
|
-------------------------
|
|
-- local function call_back( )
|
|
-- self:CheckRed()
|
|
-- end
|
|
-- if not self.matemusicresultview then
|
|
-- self.matemusicresultview = MateGameResultView.New()
|
|
-- self.matemusicresultview:Open(MateConst.GameActId.Ball,scmd,call_back)
|
|
-- end
|
|
scmd.act_id = MateConst.GameActId.Ball
|
|
scmd.result = 1
|
|
scmd.reward_list = {}
|
|
-------------------------
|
|
scmd.special_duntype = BaseDungeonModel.DUN_TYPE.MATE
|
|
local _,lv = self.model:GetBallAwardListAndLv( scmd )
|
|
scmd.special_score_lv = lv - 2
|
|
scmd.title_name = scmd.special_score_lv == 5 and "dun_result_win_title2" or "dun_result_win_title3"
|
|
BaseDungeonModel:getInstance():SetDunResultInfo(scmd)
|
|
BaseDungeonModel:getInstance():Fire(BaseDungeonModel.OPEN_DUNGEON_RESULT_VIEW,true)
|
|
-------------------------
|
|
self.model:Fire(MateConst.ANS_GAME_RESULT)
|
|
MainCamera.Instance:QuitMateCamera()
|
|
self:RemoveTimeClock()
|
|
self:ResetShowRole()
|
|
end
|
|
|
|
--游戏准备状态
|
|
function MateController:on14940( )
|
|
local scmd = SCMD14940.New(true)
|
|
self.model:SetGameWaitStatus(scmd.lists)
|
|
self.model:Fire(MateConst.ANS_GAME_WAIT_STATUS,true)
|
|
end
|
|
|
|
--游戏准备
|
|
function MateController:on14941( )
|
|
local scmd = SCMD14941.New(true)
|
|
if scmd.res == 1 then
|
|
Message.show("准备成功!")
|
|
else
|
|
ErrorCodeShow(scmd.res)
|
|
end
|
|
end
|
|
|
|
--交友大厅 查看信息
|
|
function MateController:on14942( )
|
|
local scmd = SCMD14942.New(true)
|
|
self.model:SetFindFriendData(scmd.list)
|
|
self.model:Fire(MateConst.ANS_FIND_FRIEND_DATA)
|
|
end
|
|
|
|
--交友大厅 发布交友信息
|
|
function MateController:on14943( )
|
|
local scmd = SCMD14943.New(true)
|
|
if scmd.res == 1 then
|
|
self.model:Fire(MateConst.ANS_PUBLISH_FIND_FRIEND)
|
|
self.model:Fire(MateConst.REQ_FIND_FRIEND_DATA)
|
|
self.model:Fire(MateConst.OPEN_FIND_FRIEND_TIP,nil,true)
|
|
else
|
|
ErrorCodeShow(scmd.res)
|
|
end
|
|
end
|
|
|
|
--拍照 发出邀请
|
|
function MateController:on14945( )
|
|
local scmd = SCMD14943.New(true)
|
|
if scmd.res == 1 then
|
|
Message.show("操作成功")
|
|
else
|
|
ErrorCodeShow(scmd.res)
|
|
end
|
|
end
|
|
|
|
--拍照 收到的邀请信息
|
|
function MateController:on14946( )
|
|
local scmd = SCMD14946.New(true)
|
|
-- s2c{
|
|
-- list:array{
|
|
-- role:rec_picture // 头像
|
|
-- position_id :int8 // 地点id
|
|
-- }
|
|
-- }
|
|
end
|
|
|
|
--拍照 回应邀请
|
|
function MateController:on14947( )
|
|
local scmd = SCMD14947.New(true)
|
|
-- c2s{
|
|
-- role_id:int64 // 邀请者id
|
|
-- position_id :int8 // 地点id,用来校验一下
|
|
-- res:int8 // 1同意|2拒绝
|
|
-- }
|
|
-- s2c{
|
|
-- code:int32 // 错误码
|
|
-- role_id:int64 // 邀请者id
|
|
-- res:int8 // 1同意|2拒绝
|
|
-- // 同意邀请会广播14948
|
|
-- }
|
|
end
|
|
|
|
--拍照 活动信息
|
|
function MateController:on14948( )
|
|
local scmd = SCMD14948.New(true)
|
|
self.model:SetPhotoActInfo( scmd )
|
|
end
|
|
|
|
--拍照 准备
|
|
function MateController:on14949( )
|
|
local scmd = SCMD14949.New(true)
|
|
if scmd.code == 1 then
|
|
Message.show("操作成功~")
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
--拍照 拍照
|
|
function MateController:on14950( )
|
|
local scmd = SCMD14950.New(true)
|
|
end
|
|
|
|
--拍照 结算
|
|
function MateController:on14951( )
|
|
local scmd = SCMD14951.New(true)
|
|
-- if scmd.num > 0 then
|
|
-- local function call_back( )
|
|
-- self:CheckRed()
|
|
-- end
|
|
-- if not self.matephotoresultview then
|
|
-- self.matephotoresultview = MateGameResultView.New()
|
|
-- self.matephotoresultview:Open(MateConst.GameActId.Photo,scmd,call_back)
|
|
-- end
|
|
-- end
|
|
end
|
|
|
|
--拍照 取消游戏
|
|
function MateController:on14952( )
|
|
local scmd = SCMD14952.New(true)
|
|
-- self.model:SetPhotoActInfo( false )
|
|
end
|
|
|
|
|
|
--############## 羁绊-日常 日常任务 ##############
|
|
function MateController:on14953( )
|
|
local scmd = SCMD14953.New(true)
|
|
-- print("==WQ==:SCMD14953 [start:1275] scmd:", scmd)
|
|
-- PrintTable(scmd)
|
|
-- print("==WQ==:MateController [end]")
|
|
self.model:SetMateDailyListInfo(scmd)
|
|
self.model:Fire(MateConst.UPDATE_MATE_DAILY_LIST_VIEW)
|
|
self:CheckRed( )
|
|
end
|
|
|
|
--############## 羁绊-日常 更新任务进度 ##############
|
|
function MateController:on14954( )
|
|
local scmd = SCMD14954.New(true)
|
|
self.model:UpdateMateDailyState(scmd)
|
|
self.model:Fire(MateConst.UPDATE_MATE_DAILY_LIST_VIEW)
|
|
self:CheckRed( )
|
|
end
|
|
|
|
--############## 羁绊-日常 领取任务奖励 ##############
|
|
function MateController:on14955( )
|
|
local scmd = SCMD14955.New(true)
|
|
if scmd.code == 1 then
|
|
--更新任务进度状态
|
|
self.model:UpdateMateDailyRewardState(scmd)
|
|
self.model:Fire(MateConst.UPDATE_MATE_DAILY_LIST_VIEW)
|
|
self:CheckRed( )
|
|
else
|
|
ErrorCodeShow(scmd.code)
|
|
end
|
|
end
|
|
|
|
function MateController:SetGameCamera( data_role )
|
|
do return end
|
|
--已经不需要屏蔽了
|
|
data_role = data_role or {}
|
|
self:RemoveTimeClock()
|
|
self:ResetShowRole()
|
|
local dir = co.Vector2(0,-1)--面向屏幕
|
|
local main_role = Scene.Instance:GetMainRole()
|
|
if not main_role then return end
|
|
MainCamera.Instance:SetMateCamera(main_role.real_pos.x,main_role.real_pos.y)
|
|
|
|
local index = 1
|
|
local function clockFun()
|
|
-- if TableSize(self.model_set_list) == 2 or index >= 50 then
|
|
-- self:RemoveTimeClock()
|
|
-- end
|
|
for k,v in pairs(data_role) do
|
|
local role_vo = Scene.Instance:GetRole(v)
|
|
-- if role_vo and not self.model_set_list[v] then
|
|
if role_vo then
|
|
role_vo:SetModelHideFlag(SceneObj.ModelHideFlag.BlockHide, true)
|
|
self.model_set_list[v] = true
|
|
end
|
|
end
|
|
index = index + 1
|
|
end
|
|
self.close_time_face_id = self.close_time_face_id or GlobalTimerQuest:AddPeriodQuest(clockFun, 0.5, -1)
|
|
end
|
|
|
|
function MateController:RemoveTimeClock( )
|
|
if self.close_time_face_id then
|
|
GlobalTimerQuest:CancelQuest(self.close_time_face_id)
|
|
self.close_time_face_id = nil
|
|
end
|
|
end
|
|
|
|
function MateController:ResetShowRole( )
|
|
--已经不需要屏蔽了
|
|
do return end
|
|
self.model_set_list = self.model_set_list or {}
|
|
for k,v in pairs(self.model_set_list) do
|
|
local role_vo = Scene.Instance:GetRole(k)
|
|
if role_vo then
|
|
role_vo:SetModelHideFlag(SceneObj.ModelHideFlag.BlockHide, false)
|
|
end
|
|
end
|
|
self.model_set_list = {}
|
|
end
|
|
|
|
function MateController:CheckRed(force_check)
|
|
local function MateControllerCheckRedDot( )
|
|
local red = false
|
|
if GetModuleIsOpen( 149 ) then
|
|
-- 有的红点需要判断是否完成前置任务
|
|
local is_finish_all_pre_task = self.model:IsFinishAllMarriageTask( 3 )
|
|
self.model:GetGameRedDot(true)
|
|
self.model:GetShipRedDot(true)
|
|
self.model:GetMarkRedDot(true)
|
|
self.model:GetGiftRedDot(true)
|
|
-- 以下两个红点得做完前置才需要显示
|
|
local mark_red = self.model:GetMarkRedDot(false) and is_finish_all_pre_task
|
|
local gift_red = self.model:GetGiftRedDot(false) and is_finish_all_pre_task
|
|
|
|
red = self.model:GetShipRedDot(false) or mark_red or self.model:GetTaskRedDot() or gift_red
|
|
local basic_data = self.model:GetBasicInfo( )
|
|
if basic_data and (TableSize(basic_data) > 0) then
|
|
--判断是否有伙伴影响羁绊游戏红点
|
|
red = red or self.model:GetGameRedDot(false)
|
|
end
|
|
|
|
--羁绊日常红点
|
|
local mate_daily_red = self.model:GetMateDailyRed(true)
|
|
red = red or mate_daily_red
|
|
|
|
--首次结成羁绊一次性红点
|
|
local mate_first_get_friend_red = self.model:GetFirstGetFriendRed()
|
|
red = red or mate_first_get_friend_red
|
|
|
|
--商店红点
|
|
local mate_shop_red = self.model:GetMateShopRed(true)
|
|
red = red or mate_shop_red
|
|
end
|
|
GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 8, red)
|
|
self.model:Fire(MateConst.RedDotRefresh)
|
|
end
|
|
if force_check then
|
|
MateControllerCheckRedDot()
|
|
else
|
|
TimeManager.GetInstance():StartTime("MateControllerRedDot", 0.5, MateControllerCheckRedDot)
|
|
end
|
|
end
|
|
|
|
function MateController:CheckTaskRed( )
|
|
--任务更新,比较频繁就单独拿出来
|
|
local function check_call( )
|
|
--任务图标以及红点
|
|
local red = false
|
|
if GetModuleIsOpen( 149 ) then
|
|
red = self.model:GetShipRedDot(false) or self.model:GetMarkRedDot(false) or self.model:GetTaskRedDot()
|
|
local basic_data = self.model:GetBasicInfo( )
|
|
if basic_data and (TableSize(basic_data) > 0) then
|
|
--判断是否有伙伴影响羁绊游戏红点
|
|
red = red or self.model:GetGameRedDot(false)
|
|
end
|
|
end
|
|
GlobalEventSystem:Fire(EventName.SHOW_FUNCTION_RED_POINT, 8, red)
|
|
self.model:Fire(MateConst.RedDotRefresh)
|
|
end
|
|
TimeManager.GetInstance():StartTime("MateControllerCheckTaskRed", 1, check_call)
|
|
end
|
|
|
|
function MateController:ShowMateAdView(bool, use_close_anim, use_close_timer)
|
|
if bool then
|
|
if not self.MateAdView then
|
|
self.MateAdView = MateAdView.New()
|
|
end
|
|
self.MateAdView:Open(use_close_anim, use_close_timer)
|
|
else
|
|
if self.MateAdView then
|
|
self.MateAdView:Close()
|
|
end
|
|
self.MateAdView = nil
|
|
end
|
|
end
|