源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1343 lines
41 KiB

  1. require("game.child.ChildModel")
  2. require("game.child.ChildConst")
  3. --宝宝基础
  4. require("game.child.ChildMainTaskItem")--任务item界面
  5. require("game.child.ChildGrowItem")--属性item界面
  6. require("game.child.ChildGetView")--求子界面
  7. require("game.child.ChildRenameView")--改名界面
  8. require("game.child.ChildNiceRecordView")--宝宝点赞记录
  9. require("game.child.ChildNiceRecordItem")--记录item
  10. require("game.child.ChildRankView")--榜单界面
  11. require("game.child.ChildRankItem")--榜单item
  12. require("game.child.ChildRankRewardItem")--榜单item
  13. require("game.child.ChildChatNiceView")--宝宝在聊天弹出的点赞界面
  14. --宝宝技能
  15. require("game.child.ChildSkillItem")--宝宝技能item
  16. require("game.child.ChildSkillAttrItem")--宝宝技能attr
  17. --宝宝载具
  18. require("game.child.ChildVehicleItem")
  19. require("game.child.ChildVehicleSkillItem")
  20. --宝宝装扮
  21. require("game.child.ChildDressItem") --装扮
  22. require("game.child.ChildDressAttrItem") --装扮
  23. --宝宝图鉴(玩具)
  24. require("game.child.ChildHandbookView") --
  25. require("game.child.ChildHandbookSuitItem") --
  26. require("game.child.ChildHandbookItem") --
  27. require("game.child.ChildHandbookBreakView") --
  28. require("game.child.ChildHandbookSuitRewardView") --
  29. require("game.child.ChildHandbookSuitRewardItem") --
  30. require("game.child.ChildHandbookAttrItem") --
  31. require("game.child.ChildHandbookUpgradeView") -- 图鉴升级界面
  32. -- 宝宝同心界面
  33. require("game.child.ChildHeartTaskView") -- 主界面
  34. require("game.child.ChildHeartRewardItem") -- 同心奖励
  35. ----------------------------------------
  36. require("game.child.ChildMainViewNew") -- 新主界面
  37. require("game.child.ChildTrainView") -- 宝宝培养界面(原主界面)
  38. require("game.child.ChildSkillViewNew") -- 宝宝新技能界面
  39. require("game.child.ChildHandbookViewNew") -- 宝宝新玩具收集界面
  40. require("game.child.ChildDressViewNew") -- 宝宝新时装界面
  41. require("game.child.ChildVehicleViewNew") -- 宝宝新载具界面
  42. require("game.child.ChildShowBabyView") -- 宝宝晒娃界面
  43. require("game.proto.165.Require165")
  44. ChildController = ChildController or BaseClass(BaseController, true)
  45. local ChildController = ChildController
  46. function ChildController:__init()
  47. ChildController.Instance = self
  48. self.model = ChildModel:GetInstance()
  49. self.mainVo = RoleManager.Instance.mainRoleInfo
  50. self:AddEvents()
  51. self:RegisterProtocals()
  52. end
  53. function ChildController:__delete()
  54. end
  55. function ChildController:RegisterProtocals( )
  56. self:RegisterProtocal(16500, "on16500")
  57. self:RegisterProtocal(16501, "on16501")
  58. self:RegisterProtocal(16502, "on16502")
  59. self:RegisterProtocal(16503, "on16503")
  60. self:RegisterProtocal(16504, "on16504")
  61. self:RegisterProtocal(16505, "on16505")
  62. self:RegisterProtocal(16506, "on16506")
  63. self:RegisterProtocal(16507, "on16507")
  64. self:RegisterProtocal(16508, "on16508")
  65. self:RegisterProtocal(16509, "on16509")
  66. self:RegisterProtocal(16510, "on16510")
  67. self:RegisterProtocal(16511, "on16511")
  68. self:RegisterProtocal(16512, "on16512")
  69. self:RegisterProtocal(16513, "on16513")
  70. self:RegisterProtocal(16514, "on16514")
  71. self:RegisterProtocal(16515, "on16515")
  72. self:RegisterProtocal(16516, "on16516")
  73. self:RegisterProtocal(16517, "on16517")
  74. self:RegisterProtocal(16518, "on16518")
  75. self:RegisterProtocal(16519, "on16519")
  76. --装扮
  77. self:RegisterProtocal(16529, "on16529")
  78. self:RegisterProtocal(16530, "on16530")
  79. self:RegisterProtocal(16531, "on16531")
  80. --图鉴
  81. self:RegisterProtocal(16533, "on16533")
  82. self:RegisterProtocal(16534, "on16534")
  83. self:RegisterProtocal(16535, "on16535")
  84. self:RegisterProtocal(16536, "on16536")
  85. self:RegisterProtocal(16537, "on16537")
  86. --完成日常任务推送给前端
  87. self:RegisterProtocal(16538, "on16538")
  88. self:RegisterProtocal(16539, "on16539") -- 领取同心经验阶段奖励
  89. self:RegisterProtocal(16540, "on16540") -- 领取晒娃奖励
  90. end
  91. function ChildController:OnChildGoodsUpdateMakeAndSkill( )
  92. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildTrain)
  93. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildSkill)
  94. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook)
  95. self.model:Fire(ChildConst.UPDATA_CHILD_MAIN_INFO)
  96. self.model:Fire(ChildConst.UPDATA_CHILD_SKILL_INFO)
  97. local child_coin_good_id = self.model:GetChildCoinId() -- uimoneyCon的刷新
  98. self.model:Fire(ChildConst.UPDATA_CHILD_COIN_NUM,GoodsModel:getInstance():GetTypeGoodsNum(child_coin_good_id))
  99. end
  100. function ChildController:OnChildGoodsUpdateVehicle( )
  101. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildVehicle)
  102. end
  103. function ChildController:OnChildGoodsUpdateDress( )
  104. -- Message.show("宝宝装扮道具获得")
  105. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildDress)
  106. end
  107. function ChildController:OnChildGoodsUpdateEquip( )
  108. --Message.show("宝宝图鉴玩具获得")
  109. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook)
  110. self.model:Fire(ChildConst.UPDATA_CHILD_HB_SUIT_INFO)
  111. end
  112. -- 检查宝宝同心前置任务图标是否开启
  113. --[[function ChildController:CheckHeartLinkIconOpen( )
  114. if self.model:CheckHeartLinkIconShow( ) then
  115. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505)
  116. ActivityIconManager:getInstance():addIcon(16500, -1)
  117. else
  118. ActivityIconManager:getInstance():deleteIcon(16500)
  119. end
  120. --logWarn('=======Msh:ChildController.lua[169]=======', self.model:GetHeartIconRed())
  121. self.model:UpdateHeartIconRed( )
  122. GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed())
  123. end--]]
  124. function ChildController:AddEvents()
  125. local function on_game_start( )--开服天数初始化
  126. if self.mainVo.level >= Config.Moduleid[165].open_lv then
  127. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501) -- 孩子基本信息
  128. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) -- 获取任务
  129. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512)
  130. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514)
  131. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16519)
  132. --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16520) --宝宝装备列表
  133. --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16525) --宝宝打造装备列表
  134. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,1) --宝宝时装列表
  135. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,2) --宝宝装扮列表
  136. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533) --宝宝玩具套装信息
  137. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534) --套装奖励信息
  138. end
  139. end
  140. GlobalEventSystem:Bind(EventName.GAME_START, on_game_start)
  141. -- 检查同心任务图标开启
  142. --[[ local function check_heart_link_icon_open( )
  143. self:CheckHeartLinkIconOpen()
  144. end
  145. GlobalEventSystem:Bind(EventName.SHOW_FUNC_OPEN_ICON, check_heart_link_icon_open)--]]
  146. local function check_heart_link_icon_open2( task_id )
  147. if task_id == Config.Moduleid[165].task_id or not task_id then
  148. -- self:CheckHeartLinkIconOpen()
  149. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505)
  150. end
  151. end
  152. GlobalEventSystem:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, check_heart_link_icon_open2)
  153. -- 过天检测
  154. local function change_day_func( )
  155. local function delay_method( )
  156. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  157. end
  158. setTimeout(delay_method, 2)
  159. end
  160. GlobalEventSystem:Bind(EventName.CHANE_DAY, change_day_func)
  161. --升级 领养宝宝之后再刷就行
  162. --[[local function onLevelUp(level)
  163. print("============>>> YiRan:ChildController [start:92] level:",level)
  164. if level == Config.Moduleid[165].open_lv then
  165. print("============>>> YiRan:ChildController [start:94] Config.Moduleid[165].open_lv :",Config.Moduleid[165].open_lv)
  166. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  167. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) -- 获取任务
  168. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512)
  169. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514)
  170. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16519)
  171. --self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16511,self.mainVo.role_id) -- 获取点赞数
  172. end
  173. end
  174. RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp)]]
  175. local func_update_red_dot = function(id)
  176. local delay_fun = function(id)
  177. self.model:IsNeedRed(id)
  178. self.model:Fire(ChildConst.Child_RED_DOT_VIEW,id)
  179. end
  180. TimeManager.GetInstance():StartDalayTime("CheckChildRedDot", 2, delay_fun(id))
  181. end
  182. self.model:Bind(ChildConst.Child_RED_DOT,func_update_red_dot)
  183. local onChangeMoneyHandler = function()
  184. self.model:Fire(ChildConst.Child_RED_DOT, ChildConst.TabId.ChildHandbook)
  185. end
  186. GoodsModel:getInstance():Bind(GoodsModel.UPDATE_SPECIAL_SCORE, onChangeMoneyHandler)
  187. -- 打开open_ranTest_baseView
  188. local function open_child_baseView(show, view_id, param)
  189. -- 检查同心任务是否完成
  190. if not self.model:HasGetAllHeartReward( ) then
  191. -- if self.model:GetCurHeartValue( ) >= ChildConst.MAX_HERAT_VALUE then -- 已经做完任务了
  192. -- Message.show("最终奖励尚未领取")
  193. -- else
  194. -- Message.show("宝宝同心任务未完成")
  195. -- end
  196. --logWarn('=======Msh:ChildController.lua[250]=宝宝同心任务未完成======')
  197. self.model:Fire(ChildConst.OPEN_CHILD_HEART_TASK_VIEW, true)
  198. return
  199. end
  200. -- 检查是否领养了孩子
  201. if not self.model:IsPlayerHadChild() then
  202. self.model:Fire(ChildConst.OPEN_CHILD_GET_VIEW, true)
  203. return
  204. end
  205. -- 显示/关闭界面
  206. if show then
  207. if self.childMainViewNew == nil then
  208. self.childMainViewNew = ChildMainViewNew.New()
  209. end
  210. if not self.childMainViewNew:HasOpen() then
  211. self.childMainViewNew:Open(view_id, param)
  212. end
  213. else
  214. if self.childMainViewNew then
  215. self.childMainViewNew:Close()
  216. end
  217. end
  218. end
  219. self.model:Bind(ChildConst.OPEN_CHILD_BASE_VIEW,open_child_baseView)
  220. -- 打开点赞记录界面
  221. local function open_niceRecordView_View(show,data,callback)
  222. if show then
  223. if self.childNiceRecordView == nil then
  224. self.childNiceRecordView = ChildNiceRecordView.New()
  225. if not self.childNiceRecordView:HasOpen() then
  226. self.childNiceRecordView:Open(data,callback)
  227. end
  228. end
  229. else
  230. if self.childNiceRecordView then
  231. self.childNiceRecordView:Close()
  232. end
  233. end
  234. end
  235. self.model:Bind(ChildConst.OPEN_CHILD_NICE_RECORD_VIEW,open_niceRecordView_View)
  236. -- 打开点赞排行界面
  237. local function open_rankView_View(show,data,callback)
  238. if show then
  239. if self.childRankView == nil then
  240. self.childRankView = ChildRankView.New()
  241. if not self.childRankView:HasOpen() then
  242. self.childRankView:Open(data,callback)
  243. end
  244. end
  245. else
  246. if self.childRankView then
  247. self.childRankView:Close()
  248. end
  249. end
  250. end
  251. self.model:Bind(ChildConst.OPEN_CHILD_RANK_VIEW,open_rankView_View)
  252. -- 打开求子界面
  253. local function open_getChild_View(show)
  254. if show then
  255. if self.childGetView == nil then
  256. self.childGetView = ChildGetView.New()
  257. if not self.childGetView:HasOpen() then
  258. self.childGetView:Open()
  259. end
  260. end
  261. else
  262. if self.childGetView then
  263. self.childGetView:Close()
  264. end
  265. end
  266. end
  267. self.model:Bind(ChildConst.OPEN_CHILD_GET_VIEW,open_getChild_View)
  268. -- 打开同心界面
  269. local function open_heart_task_View(show)
  270. if show then
  271. if self.childHeartTaskView == nil then
  272. self.childHeartTaskView = ChildHeartTaskView.New()
  273. if not self.childHeartTaskView:HasOpen() then
  274. self.childHeartTaskView:Open()
  275. end
  276. end
  277. else
  278. if self.childHeartTaskView then
  279. self.childHeartTaskView:Close()
  280. end
  281. end
  282. end
  283. self.model:Bind(ChildConst.OPEN_CHILD_HEART_TASK_VIEW, open_heart_task_View)
  284. -- 打开培养界面
  285. local function open_child_train_view(show)
  286. if show then
  287. if self.childTrainView == nil then
  288. self.childTrainView = ChildTrainView.New()
  289. if not self.childTrainView:HasOpen() then
  290. self.childTrainView:Open()
  291. end
  292. end
  293. else
  294. if self.childTrainView then
  295. self.childTrainView:Close()
  296. end
  297. end
  298. end
  299. self.model:Bind(ChildConst.OPEN_CHILD_TRAIN_VIEW, open_child_train_view)
  300. -- 打开新宝宝技能界面
  301. local function open_child_skill_view(show)
  302. if show then
  303. if self.childSkillViewNew == nil then
  304. self.childSkillViewNew = ChildSkillViewNew.New()
  305. if not self.childSkillViewNew:HasOpen() then
  306. self.childSkillViewNew:Open()
  307. end
  308. end
  309. else
  310. if self.childSkillViewNew then
  311. self.childSkillViewNew:Close()
  312. end
  313. end
  314. end
  315. self.model:Bind(ChildConst.OPEN_CHILD_SKILL_VIEW, open_child_skill_view)
  316. -- 打开新宝宝玩具收集界面
  317. local function open_child_hand_book_view(show)
  318. if show then
  319. if self.childHandbookViewNew == nil then
  320. self.childHandbookViewNew = ChildHandbookViewNew.New()
  321. if not self.childHandbookViewNew:HasOpen() then
  322. self.childHandbookViewNew:Open()
  323. end
  324. end
  325. else
  326. if self.childHandbookViewNew then
  327. self.childHandbookViewNew:Close()
  328. end
  329. end
  330. end
  331. self.model:Bind(ChildConst.OPEN_CHILD_HAND_BOOK_VIEW, open_child_hand_book_view)
  332. -- 打开新宝宝时装界面
  333. local function open_child_dress_view(show)
  334. if show then
  335. if self.childDressViewNew == nil then
  336. self.childDressViewNew = ChildDressViewNew.New()
  337. if not self.childDressViewNew:HasOpen() then
  338. self.childDressViewNew:Open()
  339. end
  340. end
  341. else
  342. if self.childDressViewNew then
  343. self.childDressViewNew:Close()
  344. end
  345. end
  346. end
  347. self.model:Bind(ChildConst.OPEN_CHILD_DRESS_VIEW, open_child_dress_view)
  348. -- 打开改名界面
  349. local function open_childRename_View(show,data,callback)
  350. if show then
  351. if self.childRenameView == nil then
  352. self.childRenameView = ChildRenameView.New()
  353. if not self.childRenameView:HasOpen() then
  354. self.childRenameView:Open(data,callback)
  355. end
  356. end
  357. else
  358. if self.childRenameView then
  359. self.childRenameView:Close()
  360. end
  361. end
  362. end
  363. self.model:Bind(ChildConst.OPEN_CHILD_RENAME_VIEW,open_childRename_View)
  364. --打开宝宝展示点赞界面
  365. local function open_childChatNice_View(show,data,callback)
  366. if show then
  367. if self.childChatNiceView == nil then
  368. self.childChatNiceView = ChildChatNiceView.New()
  369. if not self.childChatNiceView:HasOpen() then
  370. self.childChatNiceView:Open(data,callback)
  371. end
  372. end
  373. else
  374. if self.childChatNiceView then
  375. self.childChatNiceView:Close()
  376. end
  377. end
  378. end
  379. self.model:Bind(ChildConst.OPEN_CHILD_CHAT_NICE_VIEW,open_childChatNice_View)
  380. -- 打开新宝宝载具界面
  381. local function open_child_vehicle_view(show)
  382. if show then
  383. if self.childVehicleViewNew == nil then
  384. self.childVehicleViewNew = ChildVehicleViewNew.New()
  385. if not self.childVehicleViewNew:HasOpen() then
  386. self.childVehicleViewNew:Open()
  387. end
  388. end
  389. else
  390. if self.childVehicleViewNew then
  391. self.childVehicleViewNew:Close()
  392. end
  393. end
  394. end
  395. self.model:Bind(ChildConst.OPEN_CHILD_VEHICLE_VIEW, open_child_vehicle_view)
  396. --装备拆解
  397. local function open_childEquipBreakBaseView( ... )
  398. if not self.childEquipBreakBaseView then
  399. self.childEquipBreakBaseView = ChildEquipBreakBaseView.New()
  400. end
  401. self.childEquipBreakBaseView:Open()
  402. end
  403. self.model:Bind(ChildConst.OPEN_CHILD_EQUIP_BREAK_VIEW, open_childEquipBreakBaseView)
  404. --装备Tips
  405. local function open_childEquipTipsView(vo)
  406. if not self.childEquipTipsView then
  407. self.childEquipTipsView = ChildEquipTipsView.New()
  408. end
  409. self.childEquipTipsView:Open(vo)
  410. end
  411. self.model:Bind(ChildConst.OPEN_CHILD_EQUIP_TIPS_VIEW, open_childEquipTipsView,vo)
  412. --一键合成选择界面
  413. local function open_childEquipComposeSelectView()
  414. if not self.childEquipComposeSelectView then
  415. self.childEquipComposeSelectView = ChildEquipComposeSelectView.New()
  416. end
  417. self.childEquipComposeSelectView:Open()
  418. end
  419. self.model:Bind(ChildConst.OPEN_CHILD_COMPOSE_TOGGLE_SELECT_VIEW, open_childEquipComposeSelectView)
  420. --装备合成
  421. local function open_childEquipComposeBaseView(show)
  422. if show then
  423. if self.childEquipComposeBaseView == nil then
  424. self.childEquipComposeBaseView = ChildEquipComposeBaseView.New()
  425. if not self.childEquipComposeBaseView:HasOpen() then
  426. self.childEquipComposeBaseView:Open()
  427. end
  428. end
  429. else
  430. if self.childEquipComposeBaseView then
  431. self.childEquipComposeBaseView:Close()
  432. end
  433. end
  434. end
  435. self.model:Bind(ChildConst.OPEN_CHILD_EQUIP_COMPOSE_SELECT_VIEW, open_childEquipComposeBaseView)
  436. -- 打开图集分解界面
  437. local function open_childHandbookBreak_View( )
  438. if not self.childHandbookBreakView then
  439. self.childHandbookBreakView = ChildHandbookBreakView.New()
  440. end
  441. self.childHandbookBreakView:Open()
  442. end
  443. self.model:Bind(ChildConst.OPEN_CHILD_HANDBOOK_BREAK_VIEW, open_childHandbookBreak_View)
  444. -- 打开图集升级界面
  445. local function open_childHandbookUpgradeView( )
  446. if not self.childHandbookUpgradeView then
  447. self.childHandbookUpgradeView = ChildHandbookUpgradeView.New()
  448. end
  449. self.childHandbookUpgradeView:Open()
  450. end
  451. self.model:Bind(ChildConst.OPEN_CHILD_HANDBOOK_UPGRADE_VIEW, open_childHandbookUpgradeView)
  452. --
  453. local function open_childHandbookSuitRewardView_View( )
  454. if not self.childHandbookSuitRewardView then
  455. self.childHandbookSuitRewardView = ChildHandbookSuitRewardView.New()
  456. end
  457. self.childHandbookSuitRewardView:Open()
  458. end
  459. self.model:Bind(ChildConst.OPEN_CHILD_HANDBOOK_SUIT_REWARD_VIEW, open_childHandbookSuitRewardView_View)
  460. --请求协议
  461. local function ON_REQUEST_EVENT(...)
  462. local args = {...}
  463. if args[1] == 16502 then
  464. self:SendFmtToGame(args[1], "cs", args[2], args[3])
  465. elseif args[1] == 16503 then
  466. self:SendFmtToGame(args[1],"s",args[2])
  467. elseif args[1] == 16504 then
  468. self:SendFmtToGame(args[1],"cic",args[2], args[3], args[4])
  469. elseif args[1] == 16506 then
  470. self:SendFmtToGame(args[1],"cic",args[2], args[3], args[4])
  471. elseif args[1] == 16509 or args[1] == 16540 then
  472. self:SendFmtToGame(args[1],"c",args[2])
  473. elseif args[1] == 16510 then
  474. self:SendFmtToGame(args[1],"l",args[2])
  475. elseif args[1] == 16511 then
  476. self:SendFmtToGame(args[1],"l",args[2])
  477. elseif args[1] == 16513 or args[1] == 16515 or args[1] == 16517 then
  478. self:SendFmtToGame(args[1],"ci",args[2], args[3])
  479. -- elseif args[1] == 16517 then
  480. -- self:SendFmtToGame(args[1],"ch",args[2], args[3])
  481. elseif args[1] == 16522 then
  482. self:SendFmtToGame(args[1],"ccl",args[2], args[3], args[4])
  483. elseif args[1] == 16523 then
  484. self:SendFmtToGame(args[1],"clh",args[2], args[3], args[4])
  485. elseif args[1] == 16524 then
  486. --玩具合成
  487. self:WriteBegin(16524)
  488. self:WriteFMT("h", TableSize(args[2]))
  489. for k, v in pairs(args[2]) do
  490. self:WriteFMT("l", v)
  491. --print("============>>> YiRan:ChildController [start:342] v :",v)
  492. end
  493. self:SendToGame()
  494. elseif args[1] == 16526 or args[1] == 16527 or args[1] == 16528 or args[1] == 16529 then
  495. self:SendFmtToGame(args[1],"c",args[2])
  496. elseif args[1] == 16532 then
  497. self:SendFmtToGame(args[1],"ci",args[2], args[3])
  498. elseif args[1] == 16531 then
  499. self:SendFmtToGame(args[1],"cic",args[2], args[3], args[4])
  500. elseif args[1] == 16535 then
  501. self:SendFmtToGame(args[1],"c",args[2])
  502. elseif args[1] == 16536 then
  503. self:SendFmtToGame(args[1],"ci",args[2], args[3])
  504. elseif args[1] == 16530 then
  505. self:SendFmtToGame(args[1],"cci",args[2], args[3], args[4])
  506. elseif args[1] == 16539 then
  507. self:SendFmtToGame(args[1],"cc",args[2], args[3])
  508. else
  509. self:SendFmtToGame(args[1])
  510. end
  511. end
  512. self.model:Bind(ChildConst.CHILD_REQ_EVENT, ON_REQUEST_EVENT)
  513. -- 打开培养界面
  514. local function open_show_baby_view(show)
  515. if show then
  516. if self.ChildShowBabyView == nil then
  517. self.ChildShowBabyView = ChildShowBabyView.New()
  518. if not self.ChildShowBabyView:HasOpen() then
  519. self.ChildShowBabyView:Open()
  520. end
  521. end
  522. else
  523. if self.ChildShowBabyView then
  524. self.ChildShowBabyView:Close()
  525. end
  526. end
  527. end
  528. self.model:Bind(ChildConst.OPEN_SHOW_BABY_VIEW, open_show_baby_view)
  529. end
  530. --[[################ 错误码展示 ################
  531. protocol=16500
  532. {
  533. s2c{
  534. errcode :int32
  535. }
  536. }]]
  537. function ChildController:on16500( )
  538. local vo = SCMD16500.New(true)
  539. if not vo then return end
  540. --logWarn('=======Msh:ChildController.lua[487]=======', vo.errcode)
  541. if vo then
  542. if vo.errcode ~= 1650001 then -- 没宝宝到等级弹出太突兀
  543. ErrorCodeShow(vo.errcode)
  544. end
  545. end
  546. end
  547. --[[################ 孩子基础信息 ################
  548. protocol=16501
  549. {
  550. c2s{}
  551. s2c{
  552. child_name :string //
  553. child_sex :int8 //
  554. child_age_year :int8 // -
  555. child_age_month :int8 // -
  556. child_age_exp :int32 //()
  557. heart_link_exp :int32 //()
  558. heart_reward:array{ //
  559. reward_id :int8 //Id
  560. status :int8 //0- 1-
  561. }
  562. child_power :int64 //
  563. is_follow :int8 //
  564. can_carry :int16 //
  565. adopt_time :int32 // 0- -
  566. }
  567. }]]
  568. function ChildController:on16501( )
  569. local vo = SCMD16501.New(true)
  570. -- logWarn('=======Msh:ChildController.lua[615]=======')
  571. -- PrintTable(vo)
  572. if not vo then return end
  573. self.model:SetChildInfo(vo)
  574. self.model:Fire(ChildConst.UPDATA_CHILD_MAIN_INFO, true)
  575. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.GetChild)
  576. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildSkill)
  577. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.HeartLink)
  578. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ShowBabyReward)
  579. end
  580. --[[################ 宝宝基础信息 ################
  581. protocol=16501
  582. {
  583. c2s{}
  584. s2c{
  585. child_name :string //
  586. child_sex :int8 //
  587. child_age_year :int8 // -
  588. child_age_month :int8 // -
  589. child_age_exp :int32 //()
  590. heart_link_level :int16 //
  591. heart_link_exp :int32 //()
  592. child_power :int64 //
  593. is_follow :int8 //
  594. can_carry :int16 //
  595. }
  596. }]]
  597. function ChildController:on16502( )
  598. local vo = SCMD16502.New(true)
  599. if not vo then return end
  600. Message.show("领养宝宝成功","success")
  601. self.model:SetIsPlayerHadChild(true)
  602. self.model:SetChildInfo(vo)
  603. --self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  604. --self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505) -- 获取任务
  605. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512)
  606. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514)
  607. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16519)
  608. --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16520) --宝宝装备列表
  609. --宝宝装备玩具被砍掉了20/04/15 self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16525) --宝宝打造装备列表
  610. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,1)
  611. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533) --宝宝玩具套装信息
  612. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534) --套装奖励信息
  613. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildTrain)
  614. -- self.model:Fire(ChildConst.OPEN_CHILD_BASE_VIEW,true,1) -- 打开宝宝主界面
  615. if vo.child_sex == 1 then
  616. GlobalEventSystem:Fire(EventName.TEST_HELP_STEP, HelpType.GET_CHILD_BOY)
  617. else
  618. GlobalEventSystem:Fire(EventName.TEST_HELP_STEP, HelpType.GET_CHILD_GIRL)
  619. end
  620. end
  621. --[[################ 宝宝改名 ################
  622. protocol=16503
  623. {
  624. c2s{
  625. child_name :string //
  626. }
  627. s2c{
  628. child_name :string //
  629. }
  630. }]]
  631. function ChildController:on16503( )
  632. local vo = SCMD16503.New(true)
  633. if not vo then return end
  634. Message.show("宝宝已改昵称","success")
  635. self.model:Fire(ChildConst.OPEN_CHILD_RENAME_VIEW,false)
  636. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  637. end
  638. --[[################ 宝宝成长培养 ################
  639. protocol=16504
  640. {
  641. c2s{
  642. is_auto :int8 //
  643. goods_id :int32 //()
  644. goods_num :int8 //
  645. }
  646. s2c{
  647. child_age_year :int8 // -
  648. child_age_month :int8 // -
  649. child_age_exp :int16 //()
  650. }
  651. }]]
  652. function ChildController:on16504( )
  653. local vo = SCMD16504.New(true)
  654. if not vo then return end
  655. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  656. Message.show("使用培养材料成功","success")
  657. end
  658. --[[################ 每日任务信息 ################
  659. protocol=16505
  660. {
  661. c2s{}
  662. s2c{
  663. task_list:array{
  664. sequence :int8 //
  665. task_id :int16 //Id
  666. progress :int8 //()
  667. task_state :int8 // 0- 1- 2-
  668. }
  669. }
  670. } ]]
  671. function ChildController:on16505( )
  672. local vo = SCMD16505.New(true)
  673. if not vo then return end
  674. self.model:SetTaskInfo(vo.task_list)
  675. self.model:Fire(ChildConst.UPDATA_CHILD_TASK_INFO)
  676. -- 更新图标红点
  677. -- self.model:UpdateHeartIconRed( )
  678. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.HeartLink)
  679. -- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed())
  680. end
  681. --[[################ 孩子同心度培养 ################
  682. protocol=16506
  683. {
  684. c2s{
  685. type :int8 // 1- 2-
  686. id :int32 //Id Id
  687. num :int8 //(0)
  688. }
  689. s2c{
  690. heart_link_exp :int32 //()
  691. }
  692. }]]
  693. function ChildController:on16506( )
  694. local vo = SCMD16506.New(true)
  695. if not vo then return end
  696. self.model:SetChildInfoForTask(vo.heart_link_exp)
  697. self.model:Fire(ChildConst.UPDATE_HEART_LINK_VALUE)
  698. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505)
  699. self.model:Fire(ChildConst.Child_RED_DOT, ChildConst.TabId.HeartLink)
  700. -- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed())
  701. Message.show("培养成功","success")
  702. end
  703. --[[################ 宝宝点赞排行榜 ################
  704. protocol=16507
  705. {
  706. c2s{}
  707. s2c{
  708. my_rank:array{
  709. rank :int8 //
  710. figure :rec_figure //
  711. child_name :string //
  712. role_power :int64 //
  713. vote_num :int32 //
  714. }
  715. rank_list:array{
  716. rank :int8 //
  717. role_name :string //
  718. child_name :string //
  719. role_power :int64 //
  720. vote_num :int32 //
  721. }
  722. }
  723. }]]
  724. function ChildController:on16507( )
  725. local vo = SCMD16507.New(true)
  726. if not vo then return end
  727. self.model:Fire(ChildConst.UPDATA_CHILD_NICE_RANK_INFO,vo)
  728. end
  729. --[[############### 点赞记录(被点赞) ###############
  730. protocol=16508
  731. {
  732. c2s{}
  733. s2c{
  734. be_vote_log:array{
  735. vote_role_name :string //
  736. time :int32 //
  737. feed_back_status :int8 //
  738. }
  739. }
  740. }]]
  741. function ChildController:on16508( )
  742. local vo = SCMD16508.New(true)
  743. if not vo then return end
  744. self.model:Fire(ChildConst.UPDATA_CHILD_NICE_RECORD_INFO,vo.be_vote_log)
  745. end
  746. --[[################## 频道晒娃 ####################
  747. protocol=16509
  748. {
  749. c2s{
  750. channel :int8 //
  751. }
  752. s2c{
  753. has_share_count :int8 //
  754. }
  755. }]]
  756. function ChildController:on16509( )
  757. local vo = SCMD16509.New(true)
  758. if not vo or not vo.channel then return end
  759. local childList = self.model:GetChildInfo()
  760. local mainVo = RoleManager:getInstance():GetMainRoleVo()
  761. local child_name = childList.child_name
  762. local name = mainVo.name or ""
  763. local role_id = mainVo.role_id or ""
  764. local sex = mainVo.sex
  765. local child_clothe_res_id = self.model:GetChildCloth()
  766. local career = mainVo.career
  767. local level = mainVo.level
  768. local turn = mainVo.turn
  769. local profile_photo_id = mainVo.profile_photo_id
  770. local vip_flag = mainVo.vip_flag
  771. local sup_vip_type = mainVo.sup_vip_type
  772. local fashion_id = self.model:GetCurWearID()
  773. local child_level = childList.child_age_month
  774. local child_sex = childList.child_sex
  775. -- local moment = 2
  776. -- local blood = 4
  777. -- local constellation = 5
  778. -- local nick_name = 6
  779. -- local fashion_list = 0
  780. -- local type = 0
  781. local base_str = self.model:GetShowBabyStr()
  782. local sub_str = "<" .. child_name .. ">"
  783. base_str = string.gsub(base_str, sub_str, HtmlColorTxt( sub_str, ColorUtil.BLUE_DARK), 1)
  784. local content = string.format("%s <a@showbaby@%s@%s@%s@%s@%s@%s@%s@%s@%s@%s@%s@%s@%s@%s><color=#2cf89a>[逗逗宝宝]</color></a>",
  785. base_str,
  786. child_name,
  787. name,
  788. role_id,
  789. sex,
  790. child_clothe_res_id,
  791. career,
  792. level,
  793. turn,
  794. profile_photo_id,
  795. vip_flag,
  796. sup_vip_type,
  797. fashion_id,
  798. child_level,
  799. child_sex
  800. )
  801. -- logWarn('=======Msh:ChildController.lua[860]=======', fashion_id)
  802. local tmpArgs = ChatModel:getInstance():GetAllArgsText(content)
  803. content = ChatModel:getInstance():GetHyperlinkText(content)
  804. --私聊发送晒宝宝
  805. if ChatModel:getInstance().chating_key_id and ChatModel:getInstance().chating_key_id ~= 0 then
  806. 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
  807. else
  808. ChatModel:getInstance():Fire(ChatModel.SEND_MSG,vo.channel,content,role_id,tmpArgs,ChatModel.CHAT_COMMON_TYPE.SYSTEM)
  809. end
  810. Message.show(string.format("晒娃成功,今日次数:%s", vo.has_share_count),"success")
  811. if vo.has_share_count > 0 then
  812. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  813. end
  814. end
  815. --[[############### 点赞宝宝(其他人的) #################
  816. protocol=16510
  817. {
  818. c2s{
  819. be_vote_role_id :int64 //Id
  820. }
  821. s2c{
  822. has_vote_count :int8 //
  823. }
  824. }]]
  825. function ChildController:on16510( )
  826. local vo = SCMD16510.New(true)
  827. if not vo then return end
  828. Message.show(string.format("点赞成功,今日已点赞数:%s", vo.has_vote_count),"success")
  829. self.model:Fire(ChildConst.SUCCESS_CHILD_NICE)
  830. end
  831. function ChildController:on16511( )
  832. local vo = SCMD16511.New(true)
  833. if not vo then return end
  834. --print('=======Msh:ChildController.lua[929] ===TABLE====')
  835. --PrintTable(vo)
  836. --self.model:SetChildInfoForVotedNum(vo.be_voted_num)
  837. self.model:Fire(ChildConst.SUCCESS_CHECK_CHILD_NICE,vo.be_voted_num)
  838. end
  839. --[[
  840. {
  841. c2s{}
  842. s2c{
  843. skill_list:array{
  844. skill_id :int32 //Id
  845. skill_lv :int16 //
  846. }
  847. }]]
  848. function ChildController:on16512( )
  849. local vo = SCMD16512.New(true)
  850. if not vo then return end
  851. self.model:SetChildSkillList(vo)
  852. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildSkill) -- 可能比物品刷新慢
  853. end
  854. --[[
  855. ############### #################
  856. protocol=16513
  857. {
  858. c2s{
  859. type :int8 // 1- 2-
  860. skill_id :int32 //Id
  861. }
  862. s2c{
  863. skill_id :int32 //Id
  864. skill_lv :int16 //
  865. }
  866. }
  867. ]]
  868. function ChildController:on16513( )
  869. local vo = SCMD16513.New(true)
  870. if not vo then return end
  871. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  872. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16512)
  873. if vo.skill_id and vo.skill_lv then
  874. self.model:Fire(ChildConst.UPDATA_CHILD_SKILL_INFO,vo.skill_id,vo.skill_lv)
  875. end
  876. end
  877. --[[
  878. ############### #################
  879. protocol=16514
  880. {
  881. c2s{}
  882. s2c{
  883. show_vehicle :int32 //使Id 0- -Id
  884. vehicle_list:array{
  885. vehicle_id :int32 //Id
  886. vehicle_stage :int16 //
  887. }
  888. }
  889. }
  890. ]]
  891. function ChildController:on16514( )
  892. local vo = SCMD16514.New(true)
  893. if not vo then return end
  894. -- logWarn('=======Msh:ChildController.lua[955]=======')
  895. -- PrintTable(vo)
  896. self.model:SetChildVehicleFollow(1, vo.show_vehicle)
  897. self.model:SetChildVehicleList(vo.vehicle_list)
  898. -- self.model:Fire(ChildConst.UPDATA_CHILD_DRESS_INFO, nil, true)
  899. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildVehicle)
  900. self.model:Fire(ChildConst.UPDATA_CHILD_VEHICLE_INFO)
  901. -- self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildDress)
  902. end
  903. --[[
  904. ############### #################
  905. protocol=16515
  906. {
  907. c2s{
  908. type :int8 // 1- 2-
  909. vehicle_id :int32 //Id
  910. }
  911. s2c{
  912. vehicle_id :int32 //Id
  913. vehicle_stage :int16 //
  914. }
  915. }]]
  916. function ChildController:on16515( )
  917. local vo = SCMD16515.New(true)
  918. if not vo then return end
  919. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  920. ---激活后默认穿戴(如果可以穿的话)
  921. if vo.type == 1 and self.model:CanUseTargetVehicle(vo.vehicle_id) then
  922. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16517, 1, vo.vehicle_id)
  923. else
  924. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514)
  925. end
  926. end
  927. --[[
  928. ############### #################
  929. protocol=16516
  930. {
  931. c2s{}
  932. s2c{
  933. is_follow :int8 //
  934. }
  935. }
  936. ]]
  937. function ChildController:on16516( )
  938. local vo = SCMD16516.New(true)
  939. if not vo then return end
  940. if vo.is_follow == 1 then
  941. Message.show("宝宝场景跟随","success")
  942. else
  943. Message.show("取消宝宝跟随")
  944. end
  945. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  946. end
  947. --[[
  948. ############### () #################
  949. protocol=16517
  950. {
  951. c2s{
  952. type :int8 //1- 2-
  953. vehicle_id :int32 //Id
  954. }
  955. s2c{
  956. type :int8 //1- 2-
  957. vehicle_id :int32 //Id 0- -Id
  958. }
  959. }
  960. ]]
  961. function ChildController:on16517( )
  962. local vo = SCMD16517.New(true)
  963. if not vo then return end
  964. if vo.type == 1 then
  965. Message.show("出战成功","success")
  966. else
  967. Message.show("取消出战")
  968. end
  969. if vo.type and vo.vehicle_id then
  970. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16514)
  971. -- self.model:SetChildVehicleFollow(vo.type,vo.vehicle_id) -- 修改载具信息
  972. self.model:Fire(ChildConst.UPDATA_CHILD_VEHICLE_FOLLOW, vo.type, vo.vehicle_id)
  973. -- self.model:Fire(ChildConst.UPDATA_CHILD_DRESS_INFO)
  974. end
  975. end
  976. --[[######### 更新场景中孩子相关数据(推送协议) #################
  977. protocol=16518
  978. {
  979. c2s{}
  980. s2c{
  981. role_id :int64 //Id
  982. child_sex :int8 //
  983. child_age_month :int8 // -
  984. child_is_follow :int8 // 0- 1-
  985. vehicle_id :int32 //使Id 0- -Id
  986. fashion_list:array{
  987. type :int8 // 1- 2-
  988. fashion_id :int32 //Id 0-穿 -穿Id
  989. }
  990. }
  991. }]]
  992. function ChildController:on16518( )
  993. local scmd = SCMD16518.New(true)
  994. -- logWarn('=======Msh:ChildController.lua[1043]=======')
  995. -- PrintTable(scmd)
  996. if not scmd then return end
  997. Scene.Instance:BabyChange(scmd)
  998. end
  999. --[[
  1000. ######### (,) #################
  1001. protocol=16519
  1002. {
  1003. c2s{}
  1004. s2c{
  1005. role_list:array{
  1006. role_id :int64 //Id
  1007. }
  1008. }
  1009. }
  1010. ]]
  1011. function ChildController:on16519( )
  1012. local vo = SCMD16519.New(true)
  1013. if not vo then return end
  1014. self.model:SetChildVotedRoleList(vo)
  1015. self.model:Fire(ChildConst.UPDATA_CHILD_VOTED_ROLE_INFO)
  1016. end
  1017. --[[
  1018. ######### #################
  1019. protocol=16529
  1020. {
  1021. c2s{
  1022. type :int8 // 1- 2-
  1023. }
  1024. s2c{
  1025. type :int8 // 1- 2-
  1026. fashion_list:array{
  1027. fashion_id :int32 //Id
  1028. lv :int16 //
  1029. state :int8 //穿 0-穿 1-穿
  1030. }
  1031. }
  1032. }]]
  1033. function ChildController:on16529( )
  1034. local vo = SCMD16529.New(true)
  1035. if not vo then return end
  1036. --logWarn('=======Msh:ChildController.lua[1301]=======')
  1037. --PrintTable(vo)
  1038. if vo.type and vo.fashion_list then
  1039. self.model:SetChildDressList(vo.type, vo.fashion_list)
  1040. self.model:Fire(ChildConst.UPDATA_CHILD_DRESS_INFO, vo.type, true)
  1041. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildDress)
  1042. end
  1043. end
  1044. --[[
  1045. ######### 穿 #################
  1046. protocol=16530
  1047. {
  1048. c2s{
  1049. option :int8 //1-穿 2-
  1050. type :int8 // 1- 2-
  1051. fashion_id :int32 //Id
  1052. }
  1053. s2c{
  1054. option :int8 //1-穿 2-
  1055. type :int8 // 1- 2-
  1056. fashion_id :int32 //Id
  1057. }
  1058. }]]
  1059. function ChildController:on16530( )
  1060. local vo = SCMD16530.New(true)
  1061. if not vo then return end
  1062. --logWarn('=======Msh:ChildController.lua[1328]=======')
  1063. --PrintTable(vo)
  1064. if vo.option == 1 then
  1065. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  1066. elseif vo.option == 2 then
  1067. end
  1068. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529 , vo.type) --宝宝时装列表
  1069. end
  1070. --[[
  1071. ######### / #################
  1072. protocol=16531
  1073. {
  1074. c2s{
  1075. type :int8 // 1- 2-
  1076. fashion_id :int32 //Id
  1077. is_auto :int8 // 0- 1-
  1078. }
  1079. s2c{
  1080. type :int8 // 1- 2-
  1081. fashion_id :int32 //Id
  1082. lv :int16 //
  1083. }
  1084. }
  1085. ]]
  1086. function ChildController:on16531( )
  1087. local vo = SCMD16531.New(true)
  1088. if not vo then return end
  1089. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  1090. local fashion_type = 1 --获取它的type
  1091. ---激活后默认穿戴
  1092. if vo.type == 1 then
  1093. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16530, 1,fashion_type, vo.fashion_id) --宝宝时装列表
  1094. else
  1095. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16529,fashion_type or 1) --宝宝时装列表
  1096. end
  1097. end
  1098. --[[
  1099. ######### #################
  1100. protocol=16533
  1101. {
  1102. c2s{}
  1103. s2c{
  1104. toy_box_lv :int16 //
  1105. toy_list:array{
  1106. toy_id :int32 //Id
  1107. }
  1108. }
  1109. }]]
  1110. function ChildController:on16533( )
  1111. local vo = SCMD16533.New(true)
  1112. if not vo then return end
  1113. self.model:SetSuitTypeToyList(vo)
  1114. self.model:Fire(ChildConst.UPDATA_CHILD_HB_SUIT_INFO, true)
  1115. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook)
  1116. end
  1117. --[[######### 套装奖励信息 #################
  1118. protocol=16534
  1119. {
  1120. c2s{}
  1121. s2c{
  1122. suit_list:array{
  1123. suit_type :int8 //
  1124. progress :int8 //
  1125. status :int8 // 0- 1- 2-
  1126. time :int64 //
  1127. }
  1128. }
  1129. }]]
  1130. function ChildController:on16534( )
  1131. local vo = SCMD16534.New(true)
  1132. if not vo then return end
  1133. self.model:SetChildSuitRewardList(vo)
  1134. self.model:Fire(ChildConst.UPDATA_CHILD_HB_SUIT_REWARD_INFO)
  1135. self.model:Fire(ChildConst.Child_RED_DOT,ChildConst.TabId.ChildHandbook)
  1136. end
  1137. --[[
  1138. ######### #################
  1139. protocol=16535
  1140. {
  1141. c2s{
  1142. suit_type :int8 //
  1143. }
  1144. s2c{
  1145. suit_type :int8 //
  1146. progress :int8 //
  1147. status :int8 // 0- 1- 2-
  1148. time :int64 //
  1149. }
  1150. }]]
  1151. function ChildController:on16535( )
  1152. local vo = SCMD16535.New(true)
  1153. if not vo then return end
  1154. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  1155. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534)
  1156. end
  1157. --[[
  1158. ############# #################
  1159. protocol=16536
  1160. {
  1161. c2s{
  1162. suit_type :int8 //
  1163. toy_id :int32 //Id
  1164. }
  1165. s2c{
  1166. suit_type :int8 //
  1167. toy_id :int32 //Id
  1168. }
  1169. }
  1170. }]]
  1171. function ChildController:on16536( )
  1172. local vo = SCMD16536.New(true)
  1173. if not vo then return end
  1174. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  1175. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16534)
  1176. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533)
  1177. end
  1178. --[[
  1179. ############# #################
  1180. protocol=16537
  1181. {
  1182. c2s{}
  1183. s2c{
  1184. res :int32 //
  1185. toy_box_lv :int16 //
  1186. }
  1187. }]]
  1188. function ChildController:on16537( )
  1189. local vo = SCMD16537.New(true)
  1190. if not vo then return end
  1191. lua_soundM:PlayEffect(self, "success", false, LuaSoundManager.SOUND_TYPE.UI)
  1192. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16533)
  1193. end
  1194. --[[############# 完成日常任务推送给前端 #################
  1195. protocol=16538
  1196. {
  1197. c2s{}
  1198. s2c{
  1199. sequence :int8 //
  1200. progress :int8 //()
  1201. task_state :int8 // 0- 1- 2-
  1202. }
  1203. }]]
  1204. function ChildController:on16538( )
  1205. local vo = SCMD16538.New(true)
  1206. if not vo then return end
  1207. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16505)
  1208. end
  1209. --[[############# 领取同心经验阶段奖励 #################
  1210. protocol=16539
  1211. {
  1212. c2s{
  1213. reward_id :int8 //Id
  1214. }
  1215. s2c{
  1216. heart_reward:array{ //
  1217. reward_id :int8 //Id
  1218. status :int8 //0- 1-
  1219. }
  1220. }
  1221. }--]]
  1222. function ChildController:on16539( )
  1223. local vo = SCMD16539.New(true)
  1224. if not vo then return end
  1225. self.model:SetHeartRewardData( vo.heart_reward, true )
  1226. self.model:Fire(ChildConst.UPDATE_HEARTLINK_REWARD_STATUS)
  1227. -- self.model:UpdateHeartIconRed()
  1228. self.model:Fire(ChildConst.Child_RED_DOT, ChildConst.TabId.HeartLink)
  1229. -- GlobalEventSystem:Fire(ActivityIconManager.UPDATE_ICON_TIPS, 16500, self.model:GetHeartIconRed())
  1230. end
  1231. -- 领取分享/昨日榜奖励
  1232. function ChildController:on16540( )
  1233. local vo = SCMD16540.New(true)
  1234. if not vo then return end
  1235. if vo.res == 1 then
  1236. self.model:Fire(ChildConst.CHILD_REQ_EVENT, 16501)
  1237. else
  1238. ErrorCodeShow(vo.res)
  1239. end
  1240. end