require("game.child.ChildModel") require("game.child.ChildConst") --宝宝基础 require("game.child.ChildMainTaskItem")--任务item界面 require("game.child.ChildGrowItem")--属性item界面 require("game.child.ChildGetView")--求子界面 require("game.child.ChildRenameView")--改名界面 require("game.child.ChildNiceRecordView")--宝宝点赞记录 require("game.child.ChildNiceRecordItem")--记录item require("game.child.ChildRankView")--榜单界面 require("game.child.ChildRankItem")--榜单item require("game.child.ChildRankRewardItem")--榜单item require("game.child.ChildChatNiceView")--宝宝在聊天弹出的点赞界面 --宝宝技能 require("game.child.ChildSkillItem")--宝宝技能item require("game.child.ChildSkillAttrItem")--宝宝技能attr --宝宝载具 require("game.child.ChildVehicleItem") require("game.child.ChildVehicleSkillItem") --宝宝装扮 require("game.child.ChildDressItem") --装扮 require("game.child.ChildDressAttrItem") --装扮 --宝宝图鉴(玩具) require("game.child.ChildHandbookView") -- require("game.child.ChildHandbookSuitItem") -- require("game.child.ChildHandbookItem") -- require("game.child.ChildHandbookBreakView") -- require("game.child.ChildHandbookSuitRewardView") -- require("game.child.ChildHandbookSuitRewardItem") -- require("game.child.ChildHandbookAttrItem") -- require("game.child.ChildHandbookUpgradeView") -- 图鉴升级界面 -- 宝宝同心界面 require("game.child.ChildHeartTaskView") -- 主界面 require("game.child.ChildHeartRewardItem") -- 同心奖励 ---------------------------------------- require("game.child.ChildMainViewNew") -- 新主界面 require("game.child.ChildTrainView") -- 宝宝培养界面(原主界面) require("game.child.ChildSkillViewNew") -- 宝宝新技能界面 require("game.child.ChildHandbookViewNew") -- 宝宝新玩具收集界面 require("game.child.ChildDressViewNew") -- 宝宝新时装界面 require("game.child.ChildVehicleViewNew") -- 宝宝新载具界面 require("game.child.ChildShowBabyView") -- 宝宝晒娃界面 require("game.proto.165.Require165") ChildController = ChildController or BaseClass(BaseController, true) local ChildController = ChildController function ChildController:__init() ChildController.Instance = self self.model = ChildModel:GetInstance() self.mainVo = RoleManager.Instance.mainRoleInfo self:AddEvents() self:RegisterProtocals() end function ChildController:__delete() end function ChildController:RegisterProtocals( ) self:RegisterProtocal(16500, "on16500") self:RegisterProtocal(16501, "on16501") self:RegisterProtocal(16502, "on16502") self:RegisterProtocal(16503, "on16503") self:RegisterProtocal(16504, "on16504") self:RegisterProtocal(16505, "on16505") self:RegisterProtocal(16506, "on16506") self:RegisterProtocal(16507, "on16507") self:RegisterProtocal(16508, "on16508") self:RegisterProtocal(16509, "on16509") self:RegisterProtocal(16510, "on16510") self:RegisterProtocal(16511, "on16511") self:RegisterProtocal(16512, "on16512") self:RegisterProtocal(16513, "on16513") self:RegisterProtocal(16514, "on16514") self:RegisterProtocal(16515, "on16515") self:RegisterProtocal(16516, "on16516") self:RegisterProtocal(16517, "on16517") self:RegisterProtocal(16518, "on16518") self:RegisterProtocal(16519, "on16519") --装扮 self:RegisterProtocal(16529, "on16529") self:RegisterProtocal(16530, "on16530") self:RegisterProtocal(16531, "on16531") --图鉴 self:RegisterProtocal(16533, "on16533") self:RegisterProtocal(16534, "on16534") self:RegisterProtocal(16535, "on16535") self:RegisterProtocal(16536, "on16536") self:RegisterProtocal(16537, "on16537") --完成日常任务推送给前端 self:RegisterProtocal(16538, "on16538") self:RegisterProtocal(16539, "on16539") -- 领取同心经验阶段奖励 self:RegisterProtocal(16540, "on16540") -- 领取晒娃奖励 end function ChildController:OnChildGoodsUpdateMakeAndSkill( ) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildTrain) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildSkill) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook) self.model:Fire(ChildConst.UPDATA_CHILD_MAIN_INFO) self.model:Fire(ChildConst.UPDATA_CHILD_SKILL_INFO) local child_coin_good_id = self.model:GetChildCoinId() -- uimoneyCon的刷新 self.model:Fire(ChildConst.UPDATA_CHILD_COIN_NUM,GoodsModel:getInstance():GetTypeGoodsNum(child_coin_good_id)) end function ChildController:OnChildGoodsUpdateVehicle( ) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildVehicle) end function ChildController:OnChildGoodsUpdateDress( ) -- Message.show("宝宝装扮道具获得") self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildDress) end function ChildController:OnChildGoodsUpdateEquip( ) --Message.show("宝宝图鉴玩具获得") self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook) self.model:Fire(ChildConst.UPDATA_CHILD_HB_SUIT_INFO) end -- 检查宝宝同心前置任务图标是否开启 --[[function ChildController:CheckHeartLinkIconOpen( ) if self.model:CheckHeartLinkIconShow( ) then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) ActivityIconManager:getInstance():addIcon(16500, -1) else ActivityIconManager:getInstance():deleteIcon(16500) end --logWarn('=======Msh:ChildController.lua[169]=======', self.model:GetHeartIconRed()) self.model:UpdateHeartIconRed( ) GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed()) end--]] function ChildController:AddEvents() local function on_game_start( )--开服天数初始化 if self.mainVo.level >= Config.Moduleid[165].open_lv then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) -- 孩子基本信息 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) -- 获取任务 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16519) --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16520) --宝宝装备列表 --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16525) --宝宝打造装备列表 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,1) --宝宝时装列表 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,2) --宝宝装扮列表 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533) --宝宝玩具套装信息 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534) --套装奖励信息 end end GlobalEventSystem:Bind(EventName.GAME_START, on_game_start) -- 检查同心任务图标开启 --[[ local function check_heart_link_icon_open( ) self:CheckHeartLinkIconOpen() end GlobalEventSystem:Bind(EventName.SHOW_FUNC_OPEN_ICON, check_heart_link_icon_open)--]] local function check_heart_link_icon_open2( task_id ) if task_id == Config.Moduleid[165].task_id or not task_id then -- self:CheckHeartLinkIconOpen() self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) end end GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, check_heart_link_icon_open2) -- 过天检测 local function change_day_func( ) local function delay_method( ) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) end setTimeout(delay_method, 2) end GlobalEventSystem:Bind(EventName.CHANE_DAY, change_day_func) --升级 领养宝宝之后再刷就行 --[[local function onLevelUp(level) print("============>>> YiRan:ChildController [start:92] level:",level) if level == Config.Moduleid[165].open_lv then print("============>>> YiRan:ChildController [start:94] Config.Moduleid[165].open_lv :",Config.Moduleid[165].open_lv) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) -- 获取任务 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16519) --self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16511,self.mainVo.role_id) -- 获取点赞数 end end RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp)]] local func_update_red_dot = function(id) local delay_fun = function(id) self.model:IsNeedRed(id) self.model:Fire(ChildConst.Child_RED_DOT_VIEW,id) end TimeManager.GetInstance():StartDalayTime("CheckChildRedDot", 2, delay_fun(id)) end self.model:Bind(ChildConst.Child_RED_DOT,func_update_red_dot) local onChangeMoneyHandler = function() self.model:Fire(ChildConst.Child_RED_DOT, ChildConst.TabId.ChildHandbook) end GoodsModel:getInstance():Bind(GoodsModel.UPDATE_SPECIAL_SCORE, onChangeMoneyHandler) -- 打开open_ranTest_baseView local function open_child_baseView(show, view_id, param) -- 检查同心任务是否完成 if not self.model:HasGetAllHeartReward( ) then -- if self.model:GetCurHeartValue( ) >= ChildConst.MAX_HERAT_VALUE then -- 已经做完任务了 -- Message.show("最终奖励尚未领取") -- else -- Message.show("宝宝同心任务未完成") -- end --logWarn('=======Msh:ChildController.lua[250]=宝宝同心任务未完成======') self.model:Fire(ChildConst.OPEN_CHILD_HEART_TASK_VIEW, true) return end -- 检查是否领养了孩子 if not self.model:IsPlayerHadChild() then self.model:Fire(ChildConst.OPEN_CHILD_GET_VIEW, true) return end -- 显示/关闭界面 if show then if self.childMainViewNew == nil then self.childMainViewNew = ChildMainViewNew.New() end if not self.childMainViewNew:HasOpen() then self.childMainViewNew:Open(view_id, param) end else if self.childMainViewNew then self.childMainViewNew:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_BASE_VIEW,open_child_baseView) -- 打开点赞记录界面 local function open_niceRecordView_View(show,data,callback) if show then if self.childNiceRecordView == nil then self.childNiceRecordView = ChildNiceRecordView.New() if not self.childNiceRecordView:HasOpen() then self.childNiceRecordView:Open(data,callback) end end else if self.childNiceRecordView then self.childNiceRecordView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_NICE_RECORD_VIEW,open_niceRecordView_View) -- 打开点赞排行界面 local function open_rankView_View(show,data,callback) if show then if self.childRankView == nil then self.childRankView = ChildRankView.New() if not self.childRankView:HasOpen() then self.childRankView:Open(data,callback) end end else if self.childRankView then self.childRankView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_RANK_VIEW,open_rankView_View) -- 打开求子界面 local function open_getChild_View(show) if show then if self.childGetView == nil then self.childGetView = ChildGetView.New() if not self.childGetView:HasOpen() then self.childGetView:Open() end end else if self.childGetView then self.childGetView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_GET_VIEW,open_getChild_View) -- 打开同心界面 local function open_heart_task_View(show) if show then if self.childHeartTaskView == nil then self.childHeartTaskView = ChildHeartTaskView.New() if not self.childHeartTaskView:HasOpen() then self.childHeartTaskView:Open() end end else if self.childHeartTaskView then self.childHeartTaskView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_HEART_TASK_VIEW, open_heart_task_View) -- 打开培养界面 local function open_child_train_view(show) if show then if self.childTrainView == nil then self.childTrainView = ChildTrainView.New() if not self.childTrainView:HasOpen() then self.childTrainView:Open() end end else if self.childTrainView then self.childTrainView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_TRAIN_VIEW, open_child_train_view) -- 打开新宝宝技能界面 local function open_child_skill_view(show) if show then if self.childSkillViewNew == nil then self.childSkillViewNew = ChildSkillViewNew.New() if not self.childSkillViewNew:HasOpen() then self.childSkillViewNew:Open() end end else if self.childSkillViewNew then self.childSkillViewNew:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_SKILL_VIEW, open_child_skill_view) -- 打开新宝宝玩具收集界面 local function open_child_hand_book_view(show) if show then if self.childHandbookViewNew == nil then self.childHandbookViewNew = ChildHandbookViewNew.New() if not self.childHandbookViewNew:HasOpen() then self.childHandbookViewNew:Open() end end else if self.childHandbookViewNew then self.childHandbookViewNew:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_HAND_BOOK_VIEW, open_child_hand_book_view) -- 打开新宝宝时装界面 local function open_child_dress_view(show) if show then if self.childDressViewNew == nil then self.childDressViewNew = ChildDressViewNew.New() if not self.childDressViewNew:HasOpen() then self.childDressViewNew:Open() end end else if self.childDressViewNew then self.childDressViewNew:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_DRESS_VIEW, open_child_dress_view) -- 打开改名界面 local function open_childRename_View(show,data,callback) if show then if self.childRenameView == nil then self.childRenameView = ChildRenameView.New() if not self.childRenameView:HasOpen() then self.childRenameView:Open(data,callback) end end else if self.childRenameView then self.childRenameView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_RENAME_VIEW,open_childRename_View) --打开宝宝展示点赞界面 local function open_childChatNice_View(show,data,callback) if show then if self.childChatNiceView == nil then self.childChatNiceView = ChildChatNiceView.New() if not self.childChatNiceView:HasOpen() then self.childChatNiceView:Open(data,callback) end end else if self.childChatNiceView then self.childChatNiceView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_CHAT_NICE_VIEW,open_childChatNice_View) -- 打开新宝宝载具界面 local function open_child_vehicle_view(show) if show then if self.childVehicleViewNew == nil then self.childVehicleViewNew = ChildVehicleViewNew.New() if not self.childVehicleViewNew:HasOpen() then self.childVehicleViewNew:Open() end end else if self.childVehicleViewNew then self.childVehicleViewNew:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_VEHICLE_VIEW, open_child_vehicle_view) --装备拆解 local function open_childEquipBreakBaseView( ... ) if not self.childEquipBreakBaseView then self.childEquipBreakBaseView = ChildEquipBreakBaseView.New() end self.childEquipBreakBaseView:Open() end self.model:Bind(ChildConst.OPEN_CHILD_EQUIP_BREAK_VIEW, open_childEquipBreakBaseView) --装备Tips local function open_childEquipTipsView(vo) if not self.childEquipTipsView then self.childEquipTipsView = ChildEquipTipsView.New() end self.childEquipTipsView:Open(vo) end self.model:Bind(ChildConst.OPEN_CHILD_EQUIP_TIPS_VIEW, open_childEquipTipsView,vo) --一键合成选择界面 local function open_childEquipComposeSelectView() if not self.childEquipComposeSelectView then self.childEquipComposeSelectView = ChildEquipComposeSelectView.New() end self.childEquipComposeSelectView:Open() end self.model:Bind(ChildConst.OPEN_CHILD_COMPOSE_TOGGLE_SELECT_VIEW, open_childEquipComposeSelectView) --装备合成 local function open_childEquipComposeBaseView(show) if show then if self.childEquipComposeBaseView == nil then self.childEquipComposeBaseView = ChildEquipComposeBaseView.New() if not self.childEquipComposeBaseView:HasOpen() then self.childEquipComposeBaseView:Open() end end else if self.childEquipComposeBaseView then self.childEquipComposeBaseView:Close() end end end self.model:Bind(ChildConst.OPEN_CHILD_EQUIP_COMPOSE_SELECT_VIEW, open_childEquipComposeBaseView) -- 打开图集分解界面 local function open_childHandbookBreak_View( ) if not self.childHandbookBreakView then self.childHandbookBreakView = ChildHandbookBreakView.New() end self.childHandbookBreakView:Open() end self.model:Bind(ChildConst.OPEN_CHILD_HANDBOOK_BREAK_VIEW, open_childHandbookBreak_View) -- 打开图集升级界面 local function open_childHandbookUpgradeView( ) if not self.childHandbookUpgradeView then self.childHandbookUpgradeView = ChildHandbookUpgradeView.New() end self.childHandbookUpgradeView:Open() end self.model:Bind(ChildConst.OPEN_CHILD_HANDBOOK_UPGRADE_VIEW, open_childHandbookUpgradeView) -- local function open_childHandbookSuitRewardView_View( ) if not self.childHandbookSuitRewardView then self.childHandbookSuitRewardView = ChildHandbookSuitRewardView.New() end self.childHandbookSuitRewardView:Open() end self.model:Bind(ChildConst.OPEN_CHILD_HANDBOOK_SUIT_REWARD_VIEW, open_childHandbookSuitRewardView_View) --请求协议 local function ON_REQUEST_EVENT(...) local args = {...} if args[1] == 16502 then self:SendFmtToGame(args[1], "cs", args[2], args[3]) elseif args[1] == 16503 then self:SendFmtToGame(args[1],"s",args[2]) elseif args[1] == 16504 then self:SendFmtToGame(args[1],"cic",args[2], args[3], args[4]) elseif args[1] == 16506 then self:SendFmtToGame(args[1],"cic",args[2], args[3], args[4]) elseif args[1] == 16509 or args[1] == 16540 then self:SendFmtToGame(args[1],"c",args[2]) elseif args[1] == 16510 then self:SendFmtToGame(args[1],"l",args[2]) elseif args[1] == 16511 then self:SendFmtToGame(args[1],"l",args[2]) elseif args[1] == 16513 or args[1] == 16515 or args[1] == 16517 then self:SendFmtToGame(args[1],"ci",args[2], args[3]) -- elseif args[1] == 16517 then -- self:SendFmtToGame(args[1],"ch",args[2], args[3]) elseif args[1] == 16522 then self:SendFmtToGame(args[1],"ccl",args[2], args[3], args[4]) elseif args[1] == 16523 then self:SendFmtToGame(args[1],"clh",args[2], args[3], args[4]) elseif args[1] == 16524 then --玩具合成 self:WriteBegin(16524) self:WriteFMT("h", TableSize(args[2])) for k, v in pairs(args[2]) do self:WriteFMT("l", v) --print("============>>> YiRan:ChildController [start:342] v :",v) end self:SendToGame() elseif args[1] == 16526 or args[1] == 16527 or args[1] == 16528 or args[1] == 16529 then self:SendFmtToGame(args[1],"c",args[2]) elseif args[1] == 16532 then self:SendFmtToGame(args[1],"ci",args[2], args[3]) elseif args[1] == 16531 then self:SendFmtToGame(args[1],"cic",args[2], args[3], args[4]) elseif args[1] == 16535 then self:SendFmtToGame(args[1],"c",args[2]) elseif args[1] == 16536 then self:SendFmtToGame(args[1],"ci",args[2], args[3]) elseif args[1] == 16530 then self:SendFmtToGame(args[1],"cci",args[2], args[3], args[4]) elseif args[1] == 16539 then self:SendFmtToGame(args[1],"cc",args[2], args[3]) else self:SendFmtToGame(args[1]) end end self.model:Bind(ChildConst.CHILD_REQ_EVENT, ON_REQUEST_EVENT) -- 打开培养界面 local function open_show_baby_view(show) if show then if self.ChildShowBabyView == nil then self.ChildShowBabyView = ChildShowBabyView.New() if not self.ChildShowBabyView:HasOpen() then self.ChildShowBabyView:Open() end end else if self.ChildShowBabyView then self.ChildShowBabyView:Close() end end end self.model:Bind(ChildConst.OPEN_SHOW_BABY_VIEW, open_show_baby_view) end --[[################ 错误码展示 ################ protocol=16500 { s2c{ errcode :int32 } }]] function ChildController:on16500( ) local vo = SCMD16500.New(true) if not vo then return end --logWarn('=======Msh:ChildController.lua[487]=======', vo.errcode) if vo then if vo.errcode ~= 1650001 then -- 没宝宝到等级弹出太突兀 ErrorCodeShow(vo.errcode) end end end --[[################ 孩子基础信息 ################ protocol=16501 { c2s{} s2c{ child_name :string //孩子名字 child_sex :int8 //孩子性别 child_age_year :int8 //孩子年龄 - 年 child_age_month :int8 //孩子年龄 - 月 child_age_exp :int32 //孩子成长进度(经验值) heart_link_exp :int32 //同心度(经验值) heart_reward:array{ //同心奖励 reward_id :int8 //奖励Id status :int8 //奖励领取状态0-未领取 1-已领取 } child_power :int64 //孩子战力 is_follow :int8 //是否跟随 can_carry :int16 //孩子可负重上限 adopt_time :int32 //孩子领养时间 0-未领养 其他-领养时间 } }]] function ChildController:on16501( ) local vo = SCMD16501.New(true) -- logWarn('=======Msh:ChildController.lua[615]=======') -- PrintTable(vo) if not vo then return end self.model:SetChildInfo(vo) self.model:Fire(ChildConst.UPDATA_CHILD_MAIN_INFO, true) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.GetChild) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildSkill) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.HeartLink) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ShowBabyReward) end --[[################ 宝宝基础信息 ################ protocol=16501 { c2s{} s2c{ child_name :string //宝宝名字 child_sex :int8 //宝宝性别 child_age_year :int8 //宝宝年龄 - 年 child_age_month :int8 //宝宝年龄 - 月 child_age_exp :int32 //宝宝成长进度(经验值) heart_link_level :int16 //同心等级 heart_link_exp :int32 //同心度(经验值) child_power :int64 //宝宝战力 is_follow :int8 //是否跟随 can_carry :int16 //宝宝可负重上限 } }]] function ChildController:on16502( ) local vo = SCMD16502.New(true) if not vo then return end Message.show("领养宝宝成功","success") self.model:SetIsPlayerHadChild(true) self.model:SetChildInfo(vo) --self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) --self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) -- 获取任务 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16519) --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16520) --宝宝装备列表 --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16525) --宝宝打造装备列表 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,1) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533) --宝宝玩具套装信息 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534) --套装奖励信息 self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildTrain) -- self.model:Fire(ChildConst.OPEN_CHILD_BASE_VIEW,true,1) -- 打开宝宝主界面 if vo.child_sex == 1 then GlobalEventSystem:Fire(EventName.TEST_HELP_STEP, HelpType.GET_CHILD_BOY) else GlobalEventSystem:Fire(EventName.TEST_HELP_STEP, HelpType.GET_CHILD_GIRL) end end --[[################ 宝宝改名 ################ protocol=16503 { c2s{ child_name :string //宝宝新名字 } s2c{ child_name :string //宝宝新名字 } }]] function ChildController:on16503( ) local vo = SCMD16503.New(true) if not vo then return end Message.show("宝宝已改昵称","success") self.model:Fire(ChildConst.OPEN_CHILD_RENAME_VIEW,false) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) end --[[################ 宝宝成长培养 ################ protocol=16504 { c2s{ is_auto :int8 //是否一键成长 goods_id :int32 //培养材料(物品类型) goods_num :int8 //消耗数量 } s2c{ child_age_year :int8 //宝宝年龄 - 年 child_age_month :int8 //宝宝年龄 - 月 child_age_exp :int16 //宝宝成长进度(经验值) } }]] function ChildController:on16504( ) local vo = SCMD16504.New(true) if not vo then return end self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) Message.show("使用培养材料成功","success") end --[[################ 每日任务信息 ################ protocol=16505 { c2s{} s2c{ task_list:array{ sequence :int8 //任务序号 task_id :int16 //任务Id progress :int8 //任务进度(具体任务完成进度) task_state :int8 //任务状态 0-未完成 1-已完成未领取 2-已领取 } } } ]] function ChildController:on16505( ) local vo = SCMD16505.New(true) if not vo then return end self.model:SetTaskInfo(vo.task_list) self.model:Fire(ChildConst.UPDATA_CHILD_TASK_INFO) -- 更新图标红点 -- self.model:UpdateHeartIconRed( ) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.HeartLink) -- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed()) end --[[################ 孩子同心度培养 ################ protocol=16506 { c2s{ type :int8 //同心培养类型 1-任务领取经验 2-消耗道具获取经验 id :int32 //任务Id 或 道具Id num :int8 //道具数量(任务领取为0) } s2c{ heart_link_exp :int32 //同心度(经验值) } }]] function ChildController:on16506( ) local vo = SCMD16506.New(true) if not vo then return end self.model:SetChildInfoForTask(vo.heart_link_exp) self.model:Fire(ChildConst.UPDATE_HEART_LINK_VALUE) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) self.model:Fire(ChildConst.Child_RED_DOT, ChildConst.TabId.HeartLink) -- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed()) Message.show("培养成功","success") end --[[################ 宝宝点赞排行榜 ################ protocol=16507 { c2s{} s2c{ my_rank:array{ rank :int8 //排名 figure :rec_figure //形象数据 child_name :string //宝宝名字 role_power :int64 //玩家战力 vote_num :int32 //点赞数 } rank_list:array{ rank :int8 //排名 role_name :string //玩家名称 child_name :string //宝宝名字 role_power :int64 //玩家战力 vote_num :int32 //点赞数 } } }]] function ChildController:on16507( ) local vo = SCMD16507.New(true) if not vo then return end self.model:Fire(ChildConst.UPDATA_CHILD_NICE_RANK_INFO,vo) end --[[############### 点赞记录(被点赞) ############### protocol=16508 { c2s{} s2c{ be_vote_log:array{ vote_role_name :string //点赞玩家名称 time :int32 //点赞时间戳 feed_back_status :int8 //回赞状态 } } }]] function ChildController:on16508( ) local vo = SCMD16508.New(true) if not vo then return end self.model:Fire(ChildConst.UPDATA_CHILD_NICE_RECORD_INFO,vo.be_vote_log) end --[[################## 频道晒娃 #################### protocol=16509 { c2s{ channel :int8 //发送频道 } s2c{ has_share_count :int8 //今天已晒娃次数 } }]] function ChildController:on16509( ) local vo = SCMD16509.New(true) if not vo or not vo.channel then return end local childList = self.model:GetChildInfo() local mainVo = RoleManager:getInstance():GetMainRoleVo() local child_name = childList.child_name local name = mainVo.name or "" local role_id = mainVo.role_id or "" local sex = mainVo.sex local child_clothe_res_id = self.model:GetChildCloth() local career = mainVo.career local level = mainVo.level local turn = mainVo.turn local profile_photo_id = mainVo.profile_photo_id local vip_flag = mainVo.vip_flag local sup_vip_type = mainVo.sup_vip_type local fashion_id = self.model:GetCurWearID() local child_level = childList.child_age_month local child_sex = childList.child_sex -- local moment = 2 -- local blood = 4 -- local constellation = 5 -- local nick_name = 6 -- local fashion_list = 0 -- local type = 0 local base_str = self.model:GetShowBabyStr() local sub_str = "<" .. child_name .. ">" base_str = string.gsub(base_str, sub_str, HtmlColorTxt( sub_str, ColorUtil.BLUE_DARK), 1) local content = string.format("%s [逗逗宝宝]", base_str, child_name, name, role_id, sex, child_clothe_res_id, career, level, turn, profile_photo_id, vip_flag, sup_vip_type, fashion_id, child_level, child_sex ) -- logWarn('=======Msh:ChildController.lua[860]=======', fashion_id) local tmpArgs = ChatModel:getInstance():GetAllArgsText(content) content = ChatModel:getInstance():GetHyperlinkText(content) --私聊发送晒宝宝 if ChatModel:getInstance().chating_key_id and ChatModel:getInstance().chating_key_id ~= 0 then ChatModel:getInstance():Fire(ChatModel.SEND_MSG,ChatModel:getInstance().CHANNEL_CECRET,content,ChatModel:getInstance().chating_key_id,tmpArgs,ChatModel.CHAT_COMMON_TYPE.SYSTEM) -- ChatModel:getInstance().curr_bar_index 16509 else ChatModel:getInstance():Fire(ChatModel.SEND_MSG,vo.channel,content,role_id,tmpArgs,ChatModel.CHAT_COMMON_TYPE.SYSTEM) end Message.show(string.format("晒娃成功,今日次数:%s", vo.has_share_count),"success") if vo.has_share_count > 0 then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) end end --[[############### 点赞宝宝(其他人的) ################# protocol=16510 { c2s{ be_vote_role_id :int64 //被点赞玩家Id } s2c{ has_vote_count :int8 //今天已点赞次数 } }]] function ChildController:on16510( ) local vo = SCMD16510.New(true) if not vo then return end Message.show(string.format("点赞成功,今日已点赞数:%s", vo.has_vote_count),"success") self.model:Fire(ChildConst.SUCCESS_CHILD_NICE) end function ChildController:on16511( ) local vo = SCMD16511.New(true) if not vo then return end --print('=======Msh:ChildController.lua[929] ===TABLE====') --PrintTable(vo) --self.model:SetChildInfoForVotedNum(vo.be_voted_num) self.model:Fire(ChildConst.SUCCESS_CHECK_CHILD_NICE,vo.be_voted_num) end --[[ { c2s{} s2c{ skill_list:array{ skill_id :int32 //技能Id skill_lv :int16 //技能等级 } }]] function ChildController:on16512( ) local vo = SCMD16512.New(true) if not vo then return end self.model:SetChildSkillList(vo) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildSkill) -- 可能比物品刷新慢 end --[[ ############### 宝宝技能激活升级 ################# protocol=16513 { c2s{ type :int8 //操作类型 1-激活 2-升级 skill_id :int32 //技能Id } s2c{ skill_id :int32 //技能Id skill_lv :int16 //技能等级 } } ]] function ChildController:on16513( ) local vo = SCMD16513.New(true) if not vo then return end lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512) if vo.skill_id and vo.skill_lv then self.model:Fire(ChildConst.UPDATA_CHILD_SKILL_INFO,vo.skill_id,vo.skill_lv) end end --[[ ############### 查询孩子载具信息 ################# protocol=16514 { c2s{} s2c{ show_vehicle :int32 //场景中使用的载具Id 0-没有幻化的载具 其他-具体幻化载具Id vehicle_list:array{ vehicle_id :int32 //载具Id vehicle_stage :int16 //载具等级 } } } ]] function ChildController:on16514( ) local vo = SCMD16514.New(true) if not vo then return end -- logWarn('=======Msh:ChildController.lua[955]=======') -- PrintTable(vo) self.model:SetChildVehicleFollow(1, vo.show_vehicle) self.model:SetChildVehicleList(vo.vehicle_list) -- self.model:Fire(ChildConst.UPDATA_CHILD_DRESS_INFO, nil, true) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildVehicle) self.model:Fire(ChildConst.UPDATA_CHILD_VEHICLE_INFO) -- self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildDress) end --[[ ############### 孩子载具激活升阶 ################# protocol=16515 { c2s{ type :int8 //操作类型 1-激活 2-升阶 vehicle_id :int32 //载具Id } s2c{ vehicle_id :int32 //载具Id vehicle_stage :int16 //载具等级 } }]] function ChildController:on16515( ) local vo = SCMD16515.New(true) if not vo then return end lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) ---激活后默认穿戴(如果可以穿的话) if vo.type == 1 and self.model:CanUseTargetVehicle(vo.vehicle_id) then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16517, 1, vo.vehicle_id) else self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514) end end --[[ ############### 宝宝场景跟随 ################# protocol=16516 { c2s{} s2c{ is_follow :int8 //宝宝跟随状态 } } ]] function ChildController:on16516( ) local vo = SCMD16516.New(true) if not vo then return end if vo.is_follow == 1 then Message.show("宝宝场景跟随","success") else Message.show("取消宝宝跟随") end self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) end --[[ ############### 载具出战(跟随) ################# protocol=16517 { c2s{ type :int8 //1-出战 2-取消出战 vehicle_id :int32 //载具Id } s2c{ type :int8 //1-出战 2-取消出战 vehicle_id :int32 //载具Id 0-没有幻化的载具 其他-具体幻化载具Id } } ]] function ChildController:on16517( ) local vo = SCMD16517.New(true) if not vo then return end if vo.type == 1 then Message.show("出战成功","success") else Message.show("取消出战") end if vo.type and vo.vehicle_id then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514) -- self.model:SetChildVehicleFollow(vo.type,vo.vehicle_id) -- 修改载具信息 self.model:Fire(ChildConst.UPDATA_CHILD_VEHICLE_FOLLOW, vo.type, vo.vehicle_id) -- self.model:Fire(ChildConst.UPDATA_CHILD_DRESS_INFO) end end --[[######### 更新场景中孩子相关数据(推送协议) ################# protocol=16518 { c2s{} s2c{ role_id :int64 //角色Id child_sex :int8 //孩子性别 child_age_month :int8 //孩子年龄 - 月 child_is_follow :int8 //孩子跟随状态 0-没跟随 1-跟随 vehicle_id :int32 //场景中使用的载具Id 0-没有幻化的载具 其他-具体幻化载具Id fashion_list:array{ type :int8 //时装类型 1-时装 2-装饰 fashion_id :int32 //时装Id 0-没有穿戴时装 其他-具体穿戴时装Id } } }]] function ChildController:on16518( ) local scmd = SCMD16518.New(true) -- logWarn('=======Msh:ChildController.lua[1043]=======') -- PrintTable(scmd) if not scmd then return end Scene.Instance:BabyChange(scmd) end --[[ ######### 查询点赞过的玩家宝宝(同时也是推送协议,有更新即推送) ################# protocol=16519 { c2s{} s2c{ role_list:array{ role_id :int64 //角色Id } } } ]] function ChildController:on16519( ) local vo = SCMD16519.New(true) if not vo then return end self.model:SetChildVotedRoleList(vo) self.model:Fire(ChildConst.UPDATA_CHILD_VOTED_ROLE_INFO) end --[[ ######### 时装基本信息 ################# protocol=16529 { c2s{ type :int8 //时装类型 1-时装 2-装饰 } s2c{ type :int8 //时装类型 1-时装 2-装饰 fashion_list:array{ fashion_id :int32 //时装Id lv :int16 //时装等级 state :int8 //穿戴状态 0-未穿戴 1-已穿戴 } } }]] function ChildController:on16529( ) local vo = SCMD16529.New(true) if not vo then return end --logWarn('=======Msh:ChildController.lua[1301]=======') --PrintTable(vo) if vo.type and vo.fashion_list then self.model:SetChildDressList(vo.type, vo.fashion_list) self.model:Fire(ChildConst.UPDATA_CHILD_DRESS_INFO, vo.type, true) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildDress) end end --[[ ######### 时装穿戴 ################# protocol=16530 { c2s{ option :int8 //1-穿戴时装 2-脱下时装 type :int8 //时装类型 1-时装 2-装饰 fashion_id :int32 //时装Id } s2c{ option :int8 //1-穿戴时装 2-脱下时装 type :int8 //时装类型 1-时装 2-装饰 fashion_id :int32 //时装Id } }]] function ChildController:on16530( ) local vo = SCMD16530.New(true) if not vo then return end --logWarn('=======Msh:ChildController.lua[1328]=======') --PrintTable(vo) if vo.option == 1 then lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) elseif vo.option == 2 then end self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529 , vo.type) --宝宝时装列表 end --[[ ######### 时装激活/升级 ################# protocol=16531 { c2s{ type :int8 //操作类型 1-激活 2-升级 fashion_id :int32 //时装Id is_auto :int8 //是否自动购买 0-非自动购买 1-自动购买 } s2c{ type :int8 //操作类型 1-激活 2-升级 fashion_id :int32 //时装Id lv :int16 //时装等级 } } ]] function ChildController:on16531( ) local vo = SCMD16531.New(true) if not vo then return end lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) local fashion_type = 1 --获取它的type ---激活后默认穿戴 if vo.type == 1 then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16530, 1,fashion_type, vo.fashion_id) --宝宝时装列表 else self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,fashion_type or 1) --宝宝时装列表 end end --[[ ######### 玩具套装信息 ################# protocol=16533 { c2s{} s2c{ toy_box_lv :int16 //玩具箱等级 toy_list:array{ toy_id :int32 //玩具Id } } }]] function ChildController:on16533( ) local vo = SCMD16533.New(true) if not vo then return end self.model:SetSuitTypeToyList(vo) self.model:Fire(ChildConst.UPDATA_CHILD_HB_SUIT_INFO, true) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook) end --[[######### 套装奖励信息 ################# protocol=16534 { c2s{} s2c{ suit_list:array{ suit_type :int8 //套装类型 progress :int8 //套装进度 status :int8 //状态 0-未集齐 1-已集齐未领取 2-已领取 time :int64 //套装集满时间 } } }]] function ChildController:on16534( ) local vo = SCMD16534.New(true) if not vo then return end self.model:SetChildSuitRewardList(vo) self.model:Fire(ChildConst.UPDATA_CHILD_HB_SUIT_REWARD_INFO) self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook) end --[[ ######### 领取套装奖励 ################# protocol=16535 { c2s{ suit_type :int8 //套装类型 } s2c{ suit_type :int8 //套装类型 progress :int8 //套装进度 status :int8 //状态 0-未集齐 1-已集齐未领取 2-已领取 time :int64 //套装集满时间 } }]] function ChildController:on16535( ) local vo = SCMD16535.New(true) if not vo then return end lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534) end --[[ ############# 玩具激活 ################# protocol=16536 { c2s{ suit_type :int8 //套装类型 toy_id :int32 //玩具Id } s2c{ suit_type :int8 //套装类型 toy_id :int32 //玩具Id } } }]] function ChildController:on16536( ) local vo = SCMD16536.New(true) if not vo then return end lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533) end --[[ ############# 玩具盒升级 ################# protocol=16537 { c2s{} s2c{ res :int32 //返回码 toy_box_lv :int16 //玩具盒等级 } }]] function ChildController:on16537( ) local vo = SCMD16537.New(true) if not vo then return end lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI) self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533) end --[[############# 完成日常任务推送给前端 ################# protocol=16538 { c2s{} s2c{ sequence :int8 //任务序号 progress :int8 //任务进度(具体任务完成进度) task_state :int8 //任务状态 0-未完成 1-已完成未领取 2-已领取 } }]] function ChildController:on16538( ) local vo = SCMD16538.New(true) if not vo then return end self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) end --[[############# 领取同心经验阶段奖励 ################# protocol=16539 { c2s{ reward_id :int8 //奖励Id } s2c{ heart_reward:array{ //同心奖励 reward_id :int8 //奖励Id status :int8 //奖励领取状态0-未领取 1-已领取 } } }--]] function ChildController:on16539( ) local vo = SCMD16539.New(true) if not vo then return end self.model:SetHeartRewardData( vo.heart_reward, true ) self.model:Fire(ChildConst.UPDATE_HEARTLINK_REWARD_STATUS) -- self.model:UpdateHeartIconRed() self.model:Fire(ChildConst.Child_RED_DOT, ChildConst.TabId.HeartLink) -- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed()) end -- 领取分享/昨日榜奖励 function ChildController:on16540( ) local vo = SCMD16540.New(true) if not vo then return end if vo.res == 1 then self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) else ErrorCodeShow(vo.res) end end