源战役客户端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1278 lines
42 KiB

  1. require("game.proto.152.Require152")
  2. require("game.equip.EquipModel")
  3. require("game.equip.EquipConst")
  4. --装备主界面
  5. require("game.equip.view.EquipBaseView")
  6. require("game.equip.view.EquipSuitTab")
  7. require("game.equip.view.EquipBaseTipsView")--装备精炼升星基础提示界面
  8. --装备工坊主界面
  9. require("game.equip.view.EquipBaseToolView")
  10. --精炼
  11. require("game.equip.view.strengthen.EquipStrengthenView")
  12. require("game.equip.view.strengthen.EquipStrengthenItem")
  13. require("game.equip.view.strengthen.EquipStrengthenSuitViewNew")
  14. require("game.equip.view.strengthen.EquipStrengthenSuitItem")
  15. require("game.equip.view.strengthen.EquipStrengthenSuitAttrItem")
  16. require("game.equip.view.strengthen.EquipStrengthenSuitShowItem")
  17. --红装
  18. require("game.equip.view.redEquip.EquipRedEquipView")
  19. require("game.equip.view.redEquip.EquipRedEquipItem")
  20. require("game.equip.view.redEquip.EquipRedEquipAttrItem")
  21. --升星
  22. -- require("game.equip.view.evolution.EquipEvolutionView")
  23. require("game.equip.view.evolution.EquipEvolutionViewNew")--升星界面新
  24. require("game.equip.view.evolution.EquipEvolutionExAttrItem")--升星界面属性item
  25. require("game.equip.view.evolution.EquipEvolutionItem")
  26. require("game.equip.view.evolution.EquipEvolutionAttrItem")
  27. require("game.equip.view.evolution.EquipEvolutionAwardTipView")--升星购买装备展示界面
  28. require("game.equip.view.evolution.EquipStarSuitItem")
  29. require("game.equip.view.evolution.EquipStarSuitNewItem")
  30. require("game.equip.view.evolution.EquipStarSuitToolTipView")
  31. require("game.equip.view.evolution.EquipEvolutionChooseView")--升星装备选择界面
  32. require("game.equip.view.evolution.EquipEvolutionTipView")--升星装备升星概率提示界面
  33. require("game.equip.view.evolution.EquipEvolutionSuccessViewNew")--升星成功界面
  34. require("game.equip.view.evolution.EquipEvolutionAttrFindView")--升星装备升星属性查找界面
  35. --继承
  36. require("game.equip.view.inherit.EquipInheritView")
  37. require("game.equip.view.inherit.EquipInheritItem")
  38. require("game.equip.view.inherit.EquipInheritTabItem")
  39. require("game.equip.view.inherit.EquipInheritTipView")
  40. require("game.equip.view.inherit.EquipInheritTipItem")
  41. require("game.equip.view.inherit.EquipInheritWearTipView")--装备继承穿戴界面
  42. --刻印
  43. require("game.equip.view.draconic.EquipDraconicView")
  44. require("game.equip.view.draconic.EquipDraconicItem")
  45. require("game.equip.view.draconic.EquipDraconicAttrItem")
  46. require("game.equip.view.draconic.EquipDraconicChooseView")
  47. require("game.equip.view.draconic.EquipDraconicChooseAttrItem")
  48. require("game.equip.view.draconic.EquipDraconicAttrShowView")--总刻印属性展示界面
  49. require("game.equip.view.draconic.EquipDraconicAttrShowItem")
  50. require("game.equip.view.draconic.EquipDraconicEquipItem")--装备刻印装备item
  51. --宝石镶嵌
  52. require("game.equip.view.gemstone.EquipGemstoneView")
  53. require("game.equip.view.gemstone.EquipGemstoneItem")
  54. require("game.equip.view.gemstone.EquipGemstoneSuitView")--宝石套装界面
  55. require("game.equip.view.gemstone.EquipGemstoneSuitItem")
  56. require("game.equip.view.gemstone.EquipGemstoneSuitAttrItem")
  57. require("game.equip.view.gemstone.EquipGemstoneChooseView")--选择宝石界面
  58. require("game.equip.view.gemstone.EquipGemstoneChooseItem")
  59. require("game.equip.view.gemstone.EquipGemstoneStateView")--宝石操作界面
  60. require("game.equip.view.gemstone.EquipGemstoneAutoUpView")--宝石一键镶嵌界面
  61. EquipController = EquipController or BaseClass(BaseController)
  62. EquipController.Is_Debug = false
  63. function EquipController:__init()
  64. EquipController.Instance = self
  65. self.model = EquipModel:getInstance()
  66. self.mainVo = RoleManager.Instance.mainRoleInfo
  67. self:EnableCheckoutClear()
  68. self:RegisterAllProtocals()
  69. self:AddAllEvents()
  70. self.is_delay_check = false--红点刷新防止重复刷新的键值
  71. end
  72. function EquipController:__delete()
  73. end
  74. function EquipController:AddAllEvents()
  75. local function game_start_func()
  76. end
  77. GlobalEventSystem:Bind(EventName.GAME_START,game_start_func)
  78. -- local function CheckRedPoint( ... )
  79. -- end
  80. -- GlobalEventSystem:Bind(GoodsModel.CHANGE_BAGLIST,game_start_func)
  81. local function onSceneStartHandler()
  82. end
  83. self:Bind(SceneEventType.SCENE_CHANGED, onSceneStartHandler)
  84. --15201 ccl 99 11 4294971653
  85. --15201 ccl 0 11 4294971653
  86. --请求协议
  87. local function onRequestProtocal(...)
  88. local args = {...}
  89. if args[1] == 15201 then
  90. self:SendFmtToGame(args[1], "ccl", args[2],args[3],args[4])
  91. elseif args[1] == 15202 then
  92. self:SendFmtToGame(args[1], "l", args[2])
  93. elseif args[1] == 15203 then
  94. self:SendFmtToGame(args[1], "lcc", args[2],args[3],args[4])
  95. elseif args[1] == 15205 then
  96. self:SendFmtToGame(args[1], "lclc", args[2],args[3],args[4],args[5])
  97. elseif args[1] == 15209 then
  98. self:SendFmtToGame(args[1], "i", args[2])
  99. elseif args[1] == 15222 or args[1] == 15224 or args[1] == 15206 then
  100. self:SendFmtToGame(args[1], "c", args[2])
  101. elseif args[1] == 15210 or args[1] == 15214 or args[1] == 15225 then
  102. self:SendFmtToGame(args[1], "cc", args[2],args[3])
  103. elseif args[1] == 15215 or args[1] == 15216 or args[1] == 15217 then
  104. self:SendFmtToGame(args[1], "cci", args[2],args[3],args[4])
  105. elseif args[1] == 15212 then
  106. self:SendFmtToGame(args[1], "ich", args[2],args[3],args[4])
  107. elseif args[1] == 15221 then
  108. self:SendFmtToGame(args[1], "lc", args[2],args[3])
  109. elseif args[1] == 15204 then
  110. --装备升星
  111. self:WriteBegin(15204)
  112. self:WriteFMT("l", args[2])
  113. self:WriteFMT("c", args[3])
  114. self:WriteFMT("h", TableSize(args[4]))
  115. for k, v in pairs(args[4]) do
  116. self:WriteFMT("l", v)
  117. end
  118. self:WriteFMT("h", TableSize(args[5]))
  119. for k, v in pairs(args[5]) do
  120. self:WriteFMT("l", v)
  121. end
  122. self:WriteFMT("c", args[6])
  123. self:SendToGame()
  124. else
  125. self:SendFmtToGame(args[1])
  126. end
  127. end
  128. self.model:Bind(EquipModel.REQUEST_CCMD_EVENT, onRequestProtocal)
  129. local function init_open_day( ... )--开服天数初始化
  130. if self.mainVo.level >= Config.Modulesub["152@1"].open_lv then
  131. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15200)
  132. end
  133. if self.mainVo.level >= Config.Modulesub["152@7"].open_lv then
  134. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15213)
  135. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15223)
  136. end
  137. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15208)
  138. local function init_server_info( ... )
  139. self.model:IsNeedRed(EquipModel.MainTab.Strengthen)
  140. self.model:IsNeedRed(EquipModel.MainTab.Evolution)
  141. self.model:IsNeedRed(EquipModel.MainTab.UpQuality)
  142. self.model:IsNeedRed(EquipModel.MainTab.Inherit)
  143. self.model:IsNeedRed(EquipModel.MainTab.RedEquip)
  144. self.model:IsNeedRed(EquipModel.MainTab.Draconic)
  145. self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  146. self.model:Fire(EquipModel.INFO_UPDATE)
  147. end
  148. setTimeout(init_server_info,3.5)
  149. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15226)
  150. end
  151. GlobalEventSystem:Bind(EventName.OPEN_DAY_INIT,init_open_day)
  152. --升级
  153. local function onLevelUp(level)
  154. if level == Config.Modulesub["152@1"].open_lv then--精炼
  155. self.model:IsNeedRed(EquipModel.MainTab.Strengthen)
  156. elseif level == Config.Modulesub["152@2"].open_lv then--升星
  157. self.model:IsNeedRed(EquipModel.MainTab.Evolution)
  158. elseif level == Config.Modulesub["152@3"].open_lv then--继承
  159. self.model:IsNeedRed(EquipModel.MainTab.Inherit)
  160. elseif level == Config.Modulesub["152@4"].open_lv then--升品
  161. self.model:IsNeedRed(EquipModel.MainTab.UpQuality)
  162. elseif level == Config.Modulesub["154@1"].open_lv then--红装
  163. self.model:IsNeedRed(EquipModel.MainTab.RedEquip)
  164. elseif level == Config.Modulesub["154@2"].open_lv then--刻印
  165. self.model:IsNeedRed(EquipModel.MainTab.Draconic)
  166. elseif level == Config.Modulesub["152@7"].open_lv then--宝石
  167. self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  168. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15223)
  169. end
  170. end
  171. RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, onLevelUp)
  172. --装备主界面
  173. local function open_equip_main_view(tab_index,speaciel_data)
  174. if RoleManager.Instance.mainRoleInfo.level < Config.Moduleid[152].open_lv then
  175. Message.show("功能暂未开启","fault")
  176. return
  177. end
  178. tab_index = tonumber(tab_index)
  179. if self.EquipBaseView == nil then
  180. self.EquipBaseView = EquipBaseView.New()
  181. end
  182. if not self.EquipBaseView:HasOpen() then
  183. self.EquipBaseView:Open(tab_index, speaciel_data)
  184. end
  185. end
  186. GlobalEventSystem:Bind(EquipModel.OPEN_MAIN_VIEW,open_equip_main_view)
  187. --主界面关闭
  188. local function close_equip_main_view()
  189. if self.EquipBaseView and self.EquipBaseView:HasOpen() then
  190. self.EquipBaseView:Close()
  191. end
  192. self.EquipBaseView = nil
  193. end
  194. GlobalEventSystem:Bind(EquipModel.CLOSE_MAIN_VIEW,close_equip_main_view)
  195. --装备工坊主界面
  196. local function openEquipBaseToolView(tab_index,speaciel_data)
  197. if RoleManager.Instance.mainRoleInfo.level < Config.Moduleid[152].open_lv then
  198. Message.show("功能暂未开启","fault")
  199. return
  200. end
  201. tab_index = tonumber(tab_index)
  202. if self.EquipBaseToolView == nil then
  203. self.EquipBaseToolView = EquipBaseToolView.New()
  204. end
  205. if not self.EquipBaseToolView:HasOpen() then
  206. self.EquipBaseToolView:Open(tab_index, speaciel_data)
  207. end
  208. end
  209. GlobalEventSystem:Bind(EquipModel.OPEN_TOOL_MAIN_VIEW,openEquipBaseToolView)
  210. --主界面关闭
  211. local function closeEquipBaseToolView()
  212. if self.EquipBaseToolView and self.EquipBaseToolView:HasOpen() then
  213. self.EquipBaseToolView:Close()
  214. end
  215. self.EquipBaseToolView = nil
  216. end
  217. GlobalEventSystem:Bind(EquipModel.CLOSE_MAIN_VIEW,closeEquipBaseToolView)
  218. local onOpenEquipStrengthenSuitViewNew = function (suit_id)--精炼套装界面
  219. print("精炼套装界面 :", suit_id)
  220. if self.EquipStrengthenSuitViewNew == nil then
  221. self.EquipStrengthenSuitViewNew = EquipStrengthenSuitViewNew.New()
  222. end
  223. if self.EquipStrengthenSuitViewNew.isPop then
  224. self.EquipStrengthenSuitViewNew:UpdateView(suit_id)
  225. else
  226. self.EquipStrengthenSuitViewNew:Open(suit_id)
  227. end
  228. end
  229. GlobalEventSystem:Bind(EquipModel.OPEN_STRENGTH_SUIT_VIEW, onOpenEquipStrengthenSuitViewNew)
  230. local onOpenEquipStarSuitToolTipView = function (equip_star_cfg, x, y, offer_x, offer_y)--三星评分展示界面
  231. print("星级套装Tip界面 :",equip_star_cfg)
  232. if self.EquipStarSuitToolTipView == nil then
  233. self.EquipStarSuitToolTipView = EquipStarSuitToolTipView.New()
  234. end
  235. if self.EquipStarSuitToolTipView:HasOpen() then
  236. self.EquipStarSuitToolTipView:UpdateView(equip_star_cfg, x, y, offer_x, offer_y)
  237. else
  238. self.EquipStarSuitToolTipView:Open(equip_star_cfg, x, y, offer_x, offer_y)
  239. end
  240. end
  241. GlobalEventSystem:Bind(EquipModel.OPEN_EQUIP_STAR_TIP_VIEW, onOpenEquipStarSuitToolTipView)
  242. local onOpenEquipInheritTipView = function ( goods_vo )--继承选择装备界面
  243. if not goods_vo then
  244. Message.show("请先选择装备哦!","fault")
  245. return
  246. end
  247. print("继承选择装备界面 :")
  248. if self.EquipInheritTipView == nil then
  249. self.EquipInheritTipView = EquipInheritTipView.New()
  250. end
  251. if self.EquipInheritTipView:HasOpen() then
  252. self.EquipInheritTipView:UpdateView( )
  253. else
  254. self.EquipInheritTipView:Open( goods_vo )
  255. end
  256. end
  257. GlobalEventSystem:Bind(EquipModel.OPEN_EQUIP_INHERIT_TIP_VIEW, onOpenEquipInheritTipView)
  258. local onOpenEquipEvolutionAwardTipView = function ( data )--升星购买装备展示界面
  259. print("升星购买装备展示界面 :")
  260. if self.EquipEvolutionAwardTipView == nil then
  261. self.EquipEvolutionAwardTipView = EquipEvolutionAwardTipView.New()
  262. end
  263. if self.EquipEvolutionAwardTipView:HasOpen() then
  264. self.EquipEvolutionAwardTipView:UpdateView( )
  265. else
  266. self.EquipEvolutionAwardTipView:Open( data )
  267. end
  268. end
  269. GlobalEventSystem:Bind(EquipModel.OPEN_EQUIP_EVOLUTION_AWARD_TIP_VIEW, onOpenEquipEvolutionAwardTipView)
  270. --打开宝石选择界面
  271. local function openEquipGemstoneChooseView(data,x,y,pos_offer)
  272. if self.EquipGemstoneChooseView == nil then
  273. self.EquipGemstoneChooseView = EquipGemstoneChooseView.New()
  274. end
  275. if self.EquipGemstoneChooseView:HasOpen() then
  276. -- self.EquipGemstoneChooseView:UpdateView(data)
  277. else
  278. self.EquipGemstoneChooseView:Open(data,x,y,pos_offer)
  279. end
  280. end
  281. self.model:Bind(EquipModel.OPEN_GEMSTONES_CHOOSE_VIEW, openEquipGemstoneChooseView)
  282. --打开宝石操作界面
  283. local function openEquipGemstoneStateView(data,x,y)
  284. if self.EquipGemstoneStateView == nil then
  285. self.EquipGemstoneStateView = EquipGemstoneStateView.New()
  286. end
  287. if self.EquipGemstoneStateView:HasOpen() then
  288. self.EquipGemstoneStateView:UpdateView(data,x,y)
  289. else
  290. self.EquipGemstoneStateView:Open(data,x,y)
  291. end
  292. end
  293. self.model:Bind(EquipModel.OPEN_GEMSTONES_STATE_VIEW, openEquipGemstoneStateView)
  294. local onOpenEquipGemstoneSuitView = function (suit_id)--宝石套装界面
  295. print("宝石套装界面 :", suit_id)
  296. if self.EquipGemstoneSuitView == nil then
  297. self.EquipGemstoneSuitView = EquipGemstoneSuitView.New()
  298. end
  299. if self.EquipGemstoneSuitView:HasOpen() then
  300. self.EquipGemstoneSuitView:UpdateView(suit_id)
  301. else
  302. self.EquipGemstoneSuitView:Open(suit_id)
  303. end
  304. end
  305. self.model:Bind(EquipModel.OPEN_GEMSTONE_SUIT_VIEW, onOpenEquipGemstoneSuitView)
  306. local onOpenEquipGemstoneAutoUpView= function ()--宝石一键镶嵌表现界面
  307. print("宝石一键镶嵌表现界面 :")
  308. if self.EquipGemstoneAutoUpView == nil then
  309. self.EquipGemstoneAutoUpView = EquipGemstoneAutoUpView.New()
  310. end
  311. if self.EquipGemstoneAutoUpView:HasOpen() then
  312. -- self.EquipGemstoneAutoUpView:UpdateView()
  313. else
  314. self.EquipGemstoneAutoUpView:Open()
  315. end
  316. end
  317. self.model:Bind(EquipModel.OPEN_GEMSTONE_AUTO_VIEW, onOpenEquipGemstoneAutoUpView)
  318. --打开升星装备选择界面
  319. local function openEquipEvolutionChooseView(data)
  320. if self.EquipEvolutionChooseView == nil then
  321. self.EquipEvolutionChooseView = EquipEvolutionChooseView.New()
  322. end
  323. if self.EquipEvolutionChooseView:HasOpen() then
  324. self.EquipEvolutionChooseView:UpdateView(data)
  325. else
  326. self.EquipEvolutionChooseView:Open(data)
  327. end
  328. end
  329. self.model:Bind(EquipModel.OPEN_EVOLUSTION_CHOOSE_VIEW, openEquipEvolutionChooseView)
  330. --打开升星装备选择界面
  331. local function openEquipEvolutionTipView(data)
  332. local evolution_view = EquipController.Instance:GetEquipViewClass(EquipModel.MainTab.Evolution)
  333. if not evolution_view then
  334. Message.show("未打开升星界面","fault")
  335. return
  336. end
  337. if self.EquipEvolutionTipView == nil then
  338. self.EquipEvolutionTipView = EquipEvolutionTipView.New()
  339. end
  340. if self.EquipEvolutionTipView:HasOpen() then
  341. self.EquipEvolutionTipView:UpdateView(data)
  342. else
  343. self.EquipEvolutionTipView:Open(data)
  344. end
  345. end
  346. self.model:Bind(EquipModel.OPEN_EVOLUSTION_TIP_VIEW, openEquipEvolutionTipView)
  347. --打开升星装备属性预览界面
  348. local function openEquipEvolutionAttrFindView(attr_list)
  349. local evolution_view = EquipController.Instance:GetEquipViewClass(EquipModel.MainTab.Evolution)
  350. if not evolution_view then
  351. Message.show("未打开升星界面","fault")
  352. return
  353. end
  354. if self.EquipEvolutionAttrFindView == nil then
  355. self.EquipEvolutionAttrFindView = EquipEvolutionAttrFindView.New()
  356. end
  357. if self.EquipEvolutionAttrFindView:HasOpen() then
  358. self.EquipEvolutionAttrFindView:UpdateView(attr_list)
  359. else
  360. self.EquipEvolutionAttrFindView:Open(attr_list)
  361. end
  362. end
  363. self.model:Bind(EquipModel.OPEN_EVOLUSTION_ATTR_FIND_VIEW, openEquipEvolutionAttrFindView)
  364. --关闭升星装备选择界面
  365. local function closeEquipEvolutionTipView()
  366. if self.EquipEvolutionTipView and self.EquipEvolutionTipView:HasOpen() then
  367. self.EquipEvolutionTipView:Close()
  368. end
  369. end
  370. self.model:Bind(EquipModel.CLOSE_EVOLUSTION_TIP_VIEW, closeEquipEvolutionTipView)
  371. --打开刻印切换界面
  372. local function openEquipDraconicChooseView(pos)
  373. if self.EquipDraconicChooseView == nil then
  374. self.EquipDraconicChooseView = EquipDraconicChooseView.New()
  375. end
  376. if self.EquipDraconicChooseView:HasOpen() then
  377. self.EquipDraconicChooseView:UpdateView(pos)
  378. else
  379. self.EquipDraconicChooseView:Open(pos)
  380. end
  381. end
  382. self.model:Bind(EquipModel.OPEN_DRACONIC_CHOOSE_VIEW, openEquipDraconicChooseView)
  383. --打开刻印总属性展示界面
  384. local function openEquipDraconicAttrShowView()
  385. local data = self.model:GetDraconicAttrData()
  386. if not data or TableSize(data) == 0 then
  387. Message.show("暂无刻印属性附加哦!","fault")
  388. return
  389. end
  390. if self.EquipDraconicAttrShowView == nil then
  391. self.EquipDraconicAttrShowView = EquipDraconicAttrShowView.New()
  392. end
  393. if self.EquipDraconicAttrShowView:HasOpen() then
  394. self.EquipDraconicAttrShowView:UpdateView(data)
  395. else
  396. self.EquipDraconicAttrShowView:Open(data)
  397. end
  398. end
  399. self.model:Bind(EquipModel.OPEN_DRACONIC_ATTR_SHOW_VIEW, openEquipDraconicAttrShowView)
  400. --打开装备继承预览界面
  401. local function openEquipInheritWearTipView(data)
  402. if self.EquipInheritWearTipView == nil then
  403. self.EquipInheritWearTipView = EquipInheritWearTipView.New()
  404. end
  405. if self.EquipInheritWearTipView:HasOpen() then
  406. self.EquipInheritWearTipView:UpdateView(data)
  407. else
  408. self.EquipInheritWearTipView:Open(data)
  409. end
  410. end
  411. self.model:Bind(EquipModel.OPEN_EQUIP_INHERIT_WEAR_TIP_VIEW, openEquipInheritWearTipView)
  412. --打开升星成功界面
  413. local function openEquipEvolutionSuccessViewNew()
  414. if self.EquipEvolutionSuccessViewNew == nil then
  415. self.EquipEvolutionSuccessViewNew = EquipEvolutionSuccessViewNew.New()
  416. end
  417. if self.EquipEvolutionSuccessViewNew:HasOpen() then
  418. self.EquipEvolutionSuccessViewNew:UpdateView()
  419. else
  420. self.EquipEvolutionSuccessViewNew:Open()
  421. end
  422. end
  423. self.model:Bind(EquipModel.OPEN_EVOLUTION_SCUCCESS_VIEW, openEquipEvolutionSuccessViewNew)
  424. --关闭升星成功界面
  425. local function closeEquipEvolutionSuccessViewNew()
  426. if self.EquipEvolutionSuccessViewNew and self.EquipEvolutionSuccessViewNew:HasOpen() then
  427. self.EquipEvolutionSuccessViewNew:Close()
  428. end
  429. end
  430. self.model:Bind(EquipModel.CLOSE_EVOLUTION_SCUCCESS_VIEW, closeEquipEvolutionSuccessViewNew)
  431. local onOpenEquipBaseTipsView = function (tip_data)--装备精炼升星基础提示界面
  432. do return end--2021.8.2鑫爷说屏蔽掉
  433. print("装备精炼升星基础提示界面 :")
  434. if self.EquipBaseTipsView == nil then
  435. self.EquipBaseTipsView = EquipBaseTipsView.New()
  436. end
  437. if self.EquipBaseTipsView:HasOpen() then
  438. self.EquipBaseTipsView:ResetViewInfo(tip_data)
  439. else
  440. self.EquipBaseTipsView:Open(tip_data)
  441. end
  442. end
  443. self.model:Bind(EquipModel.OPEN_EQUIP_BASE_TIPS_VIEW, onOpenEquipBaseTipsView)
  444. local update_red_func = function ()
  445. self.model.no_show_faker_evo = false--交易券变化了 就重置一下弱升星红点啦
  446. self:OnEvolutionUpdate()
  447. end
  448. self.change_tong_id = self.mainVo:BindOne("tong", update_red_func)
  449. end
  450. --获得装备界面类 有些界面内部数据复杂 直接调用内部数据的方法目前只有(EquipEvolutionTipView用到)
  451. function EquipController:GetEquipViewClass( id )
  452. if self.EquipBaseView then
  453. return self.EquipBaseView:GetEquipViewClass(id)
  454. end
  455. end
  456. --背包每次获得一件装备就要更新
  457. function EquipController:EquipGoodsUpdate( )
  458. -- GoodsModel:getInstance():UpdateEquipState()
  459. BagModel.Instance:Fire(BagModel.UPDATE_EQUIP_GOODS)
  460. self.model.no_show_faker_evo = false--来装备了 就重置一下弱升星红点啦
  461. self:OnEvolutionUpdate()
  462. local function delay_fun( ... )
  463. self.model:IsNeedRed(EquipModel.MainTab.Strengthen)
  464. self.model:IsNeedRed(EquipModel.MainTab.UpQuality)
  465. end
  466. TimeManager.GetInstance():StartTime("15017CheckEquipQualityUpdate",0.15,delay_fun)
  467. end
  468. --精炼道具变化更新要刷新红点
  469. function EquipController:OnStrengthGoodsUpdate( )
  470. local function delay_fun( ... )
  471. self.model:IsNeedRed(EquipModel.MainTab.Strengthen)
  472. self.model:IsNeedRed(EquipModel.MainTab.UpQuality)
  473. self.model:Fire(EquipModel.INFO_UPDATE)
  474. end
  475. TimeManager.GetInstance():StartTime("15017CheckEquipUpdate",0.35,delay_fun)
  476. end
  477. --升星道具变化更新要刷新红点
  478. function EquipController:OnEvolutionUpdate( )
  479. local delay_fun = function()
  480. self.model.no_show_faker_evo = false--来道具了 就重置一下弱升星红点啦
  481. self.model:IsNeedRed(EquipModel.MainTab.Evolution)
  482. self.model:Fire(EquipModel.INFO_UPDATE)
  483. end
  484. TimeManager.GetInstance():StartDalayTime("15017EvolutionUpdate",0.35,delay_fun)
  485. end
  486. --洗练道具变化更新要刷新红点
  487. function EquipController:OnWashGoodsUpdate( )
  488. end
  489. --红装道具变化更新
  490. function EquipController:OnRedEquipUpdate( )
  491. self.model:IsNeedRed(EquipModel.MainTab.RedEquip)
  492. end
  493. --刻印道具变化更新刻印红点
  494. function EquipController:OnDraconicUpdate( )
  495. self.model:IsNeedRed(EquipModel.MainTab.Draconic)
  496. end
  497. --宝石数量变化更新宝石红点
  498. function EquipController:OnGemstoneUpdate( )
  499. self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  500. end
  501. function EquipController:RegisterAllProtocals()
  502. self:RegisterProtocal(15200, "on15200")--装备信息
  503. self:RegisterProtocal(15201, "on15201")--穿
  504. self:RegisterProtocal(15202, "on15202")--卸
  505. self:RegisterProtocal(15203, "on15203")--精炼装备
  506. self:RegisterProtocal(15204, "on15204")--装备升星
  507. self:RegisterProtocal(15205, "on15205")--装备继承
  508. self:RegisterProtocal(15206, "on15206")--激活星级套装
  509. self:RegisterProtocal(15207, "on15207")--激活装备代数
  510. self:RegisterProtocal(15208, "on15208")--升品-升品信息
  511. self:RegisterProtocal(15209, "on15209")--刻印上阵
  512. self:RegisterProtocal(15210, "on15210")--红装升级 升品
  513. self:RegisterProtocal(15211, "on15211")--装备系统战力变更
  514. self:RegisterProtocal(15212, "on15212")--升星升星预览
  515. self:RegisterProtocal(15213, "on15213")--宝石镶嵌信息
  516. self:RegisterProtocal(15214, "on15214")--宝石镶嵌信息:单条更新
  517. self:RegisterProtocal(15215, "on15215")--宝石镶嵌
  518. self:RegisterProtocal(15216, "on15216")--宝石卸下
  519. self:RegisterProtocal(15217, "on15217")--宝石合成升级:镶嵌在身上的合成,其他合成走通用合成协议
  520. self:RegisterProtocal(15221, "on15221")--装备-跟随守护
  521. self:RegisterProtocal(15222, "on15222")--宝石一键镶嵌
  522. self:RegisterProtocal(15223, "on15223")--宝石套装:宝石套装信息
  523. self:RegisterProtocal(15224, "on15224")--激活宝石套装
  524. self:RegisterProtocal(15225, "on15225")--特殊装备成长属性信息
  525. self:RegisterProtocal(15226, "on15226")--总战力
  526. end
  527. -- ############## 装备信息 ##############
  528. -- protocol=15200
  529. -- {
  530. -- c2s{
  531. -- }
  532. -- s2c{
  533. -- stars:int16 // 当前激活的星级数
  534. -- series:int8 // 当前已经解锁的代数
  535. -- stars_info:array{
  536. -- id:int16 // 节点
  537. -- choice:int8 // 选择
  538. -- }
  539. -- }
  540. -- }
  541. function EquipController:on15200()
  542. local vo = SCMD15200.New(true)
  543. -- print("huangcong:EquipController [start:115] vo:", vo)
  544. -- PrintTable(vo)
  545. -- print("huangcong:EquipController [end]")
  546. self.model:SetEquipActiveStarNum(vo.stars)
  547. self.model.cur_max_series = vo.series
  548. EquipCollectModel:GetInstance():SetEquipExamSkillInfo(vo.stars_info)
  549. EquipCollectModel:GetInstance():Fire(EquipCollectConst.UPDATE_EQUIP_COLLECT_RED, EquipCollectConst.TAB_ID.UPGRADE)
  550. -- self.model.equip_sum_power = vo.power
  551. -- if vo and vo.pos_list then
  552. -- self.model:SetEquipPosInfoList(vo.pos_list)
  553. -- self.model:SetRedEquipPosList(vo.pos_list)
  554. -- self.model:Fire(EquipModel.UPDATE_RED_EQUIP_INFO)
  555. -- self:OnRedEquipUpdate( ) -- 最后一级升品道具协议发来在15200之前,所以红点会不起效
  556. -- self.model:IsNeedRed(EquipModel.MainTab.Draconic)
  557. -- end
  558. self.model:IsNeedRed(EquipModel.MainTab.Evolution)
  559. self.model:Fire(EquipModel.INFO_UPDATE)
  560. end
  561. -- ############## 穿 ##############
  562. -- protocol=15201
  563. -- {
  564. -- c2s{
  565. -- series :int8 // 第几套装备
  566. -- pos:int8 // 装备位置
  567. -- goods_id :int64 // 物品id
  568. -- }
  569. -- s2c{
  570. -- // 成功会推15017
  571. -- res :int32 // 错误码
  572. -- }
  573. -- }
  574. function EquipController:on15201()
  575. local scmd = SCMD15201.New(true)
  576. if scmd.res == 1 then
  577. Message.show("穿戴装备成功","success")
  578. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, scmd.goods_id) --再次请求该装备的动态属性
  579. if scmd.old_goods_id ~= 0 then
  580. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, scmd.old_goods_id) --请求卸下的装备的动态属性
  581. end
  582. local bag_cur_choose_suit = GoodsModel:getInstance():GetBagEquipChooseIndex()
  583. if bag_cur_choose_suit ~= scmd.series and scmd.series ~= 99 then
  584. GoodsModel:getInstance():SetBagEquipChooseIndex(scmd.series)
  585. GoodsModel:getInstance():Fire(GoodsModel.UPDATE_BAG_EQUIP_SUIT_CHOOSE)
  586. end
  587. else
  588. --需要提示玩家,能不能激活在穿装备
  589. -- if scmd.res == 1520052 then
  590. -- local goods_vo = GoodsModel.getInstance():GetBagGoodsInfoById(scmd.goods_id)
  591. -- local can_active_series = self.model:GetCanActiveMaxSeries()
  592. -- if goods_vo and can_active_series >= scmd.series then
  593. -- local ok = function ( )
  594. -- self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15207)
  595. -- self.model:WearEquip(goods_vo)
  596. -- end
  597. -- local s1 = HtmlColorTxt(string.format("%s代装备槽" , WordManager:getHanZiNumber(scmd.series)), ColorUtil.BLUE_DARK)
  598. -- local s2 = HtmlColorTxt("解锁" , ColorUtil.GREEN_DARK)
  599. -- local s3 = HtmlColorTxt("穿戴" , ColorUtil.GREEN_DARK)
  600. -- local str = string.format("您已经满足解锁%s条件,是否%s并%s?", s1,s2,s3)
  601. -- Alert.show(str, Alert.Type.Two, ok, invest_call_back, "确认", "取消")
  602. -- else
  603. -- ErrorCodeShow(scmd.res)
  604. -- end
  605. -- else
  606. ErrorCodeShow(scmd.res)
  607. --end
  608. end
  609. -- print("huangcong:EquipController [start:122] vo:", vo)
  610. -- PrintTable(scmd)
  611. -- print("huangcong:EquipController [end]")
  612. end
  613. -- ############## 卸 ##############
  614. -- protocol=15202
  615. -- {
  616. -- c2s{
  617. -- goods_id :int64 // 物品id
  618. -- }
  619. -- s2c{
  620. -- // 成功会推15018
  621. -- res :int32 // 错误码
  622. -- }
  623. -- }
  624. function EquipController:on15202()
  625. local scmd = SCMD15202.New(true)
  626. if scmd.res == 1 then
  627. Message.show("装备卸下成功","success")
  628. GoodsModel:getInstance():Fire(GoodsModel.REQUEST_GOODS_DYNAMIC, scmd.goods_id) --再次请求该装备的动态属性
  629. -- GoodsModel:getInstance():Fire(GoodsModel.FIGURE_ASK_EQUIPGOODS)
  630. -- GoodsModel:getInstance():Fire(GoodsModel.BROADCAST_EQUIP_USE,{goods_type_id = scmd.type_id,num = 1})
  631. else
  632. ErrorCodeShow(scmd.res)
  633. end
  634. -- print("huangcong:EquipController [start:197] vo:", vo)
  635. -- PrintTable(scmd)
  636. -- print("huangcong:EquipController [end]")
  637. end
  638. -- ############## 精炼装备 ##############
  639. -- protocol=15203
  640. -- {
  641. -- c2s{
  642. -- goods_id :int64 // 物品id
  643. -- location :int8 // 物品所在位置,1身上|4背包
  644. -- auto_buy :int8 // 是否自动购买
  645. -- }
  646. -- s2c{
  647. -- // 成功会推15017
  648. -- res :int32 // 错误码 1成功|2失败|其他
  649. -- lv :int16 // 新的精炼等级
  650. -- }
  651. -- }
  652. function EquipController:on15203()
  653. local scmd = SCMD15203.New(true)
  654. -- print("huangcong:EquipController [start:135] vo:", vo)
  655. -- PrintTable(vo)
  656. -- print("huangcong:EquipController [end]")
  657. if scmd.res == 1 then
  658. Message.show("精炼成功","success")
  659. self.model.equip_force_strength = false--升级成功取消继续升级
  660. elseif scmd.res == 2 then
  661. Message.show("精炼失败","fault")
  662. else
  663. self.model.equip_force_strength = false--其他原因取消继续升级
  664. ErrorCodeShow(scmd.res)
  665. end
  666. -- self.model:IsNeedRed(EquipModel.MainTab.Strengthen)--goodModel15017会刷的
  667. end
  668. -- ############## 装备升星 ##############
  669. -- protocol=15204
  670. -- {
  671. -- c2s{
  672. -- goods_id :int64 // 物品id
  673. -- location :int8 // 物品所在位置,1身上|2背包 背包位置,见后台配置
  674. -- extra_cost:array{
  675. -- cost_goods_id :int64 // 添加的物品id
  676. -- }
  677. -- market_buy:array{
  678. -- id :int64 // 市场id
  679. -- }
  680. -- auto:int8 //1自动购买/0
  681. -- }
  682. -- s2c{
  683. -- // 成功会推15017
  684. -- res :int32 // 错误码 1成功|2失败|其他
  685. -- attr_id :int16 // 生成的属性id
  686. -- goods_id :int64 // 物品id
  687. -- }
  688. -- }
  689. function EquipController:on15204()
  690. local scmd = SCMD15204.New(true)
  691. -- print("huangcong:EquipController [start:277] vo:", vo)
  692. -- PrintTable(vo)
  693. -- print("huangcong:EquipController [end]")
  694. if scmd.res == 1 then--成功
  695. self.model:Fire(EquipModel.EVOLUTION_SUCCUSCE,scmd)
  696. self.model:GetEquipCanStrength()
  697. elseif scmd.res == 2 then--失败
  698. self.model:Fire(EquipModel.EVOLUTION_SUCCUSCE,scmd)
  699. else
  700. ErrorCodeShow(scmd.res)
  701. self.model:Fire(EquipModel.EVOLUTION_SUCCUSCE,scmd)
  702. --自动购买下钱不够就去充钱
  703. if scmd.res == 10001 then
  704. local ok = function ( )
  705. self.model.equip_force_strength = false
  706. end
  707. local qc_data = {
  708. close_callback = ok,
  709. }
  710. GlobalEventSystem:Fire(EventName.OPEN_RECHARGE_TIP_VIEW, true, qc_data)
  711. return
  712. end
  713. end
  714. -- self.model:IsNeedRed(EquipModel.MainTab.Evolution)--goodModel15017会刷的
  715. end
  716. -- ############## 装备继承 ##############
  717. -- protocol=15205
  718. -- {
  719. -- c2s{
  720. -- from_goods_id :int64 // 被继承物品id
  721. -- from_location :int8 // 物品所在位置,1身上|2背包 背包位置,见后台配置
  722. -- to_goods_id :int64 // 继承装备id
  723. -- to_location :int8 // 物品所在位置,1身上|2背包 背包位置,见后台配置
  724. -- }
  725. -- s2c{
  726. -- // 成功会推15017
  727. -- res :int32 // 错误码
  728. -- }
  729. -- }
  730. function EquipController:on15205()
  731. local scmd = SCMD15205.New(true)
  732. if scmd.res == 1 then
  733. Message.show("继承成功","fault")
  734. else
  735. ErrorCodeShow(scmd.res)
  736. end
  737. -- print("huangcong:EquipController [start:150] vo:", scmd)
  738. -- PrintTable(scmd)
  739. -- print("huangcong:EquipController [end]")
  740. end
  741. -- ############## 激活星级套装 ##############
  742. -- protocol=15206
  743. -- {
  744. -- c2s{
  745. -- }
  746. -- s2c{
  747. -- res :int32 // 错误码
  748. -- stars :int16 // 当前激活的星级数
  749. -- }
  750. -- }
  751. function EquipController:on15206()
  752. local vo = SCMD15206.New(true)
  753. print("huangcong:EquipController [start:408] vo:", vo)
  754. PrintTable(vo)
  755. print("huangcong:EquipController [end]")
  756. if vo.res == 1 then
  757. self.model:SetEquipActiveStarNum(vo.stars)
  758. self.model:Fire(EquipModel.INFO_UPDATE)
  759. StrengthModel:getInstance():Fire(EventName.UPDATE_STRENGTH_MAIN_VIEW_SPECIAL)
  760. Message.show("共鸣属性激活成功")
  761. else
  762. ErrorCodeShow(vo.res)
  763. end
  764. end
  765. -- ############## 激活装备代数 ##############
  766. -- protocol=15207
  767. -- {
  768. -- c2s{
  769. -- }
  770. -- s2c{
  771. -- res :int32 // 错误码
  772. -- series :int16 // 激活装备代数
  773. -- }
  774. -- }
  775. function EquipController:on15207()
  776. local vo = SCMD15207.New(true)
  777. if vo.res == 1 then
  778. --self.model.cur_max_series = vo.series
  779. self.model:Fire(EquipModel.UPDATE_EQUIP_MAX_SERIES, vo.series)
  780. BagModel.getInstance():UpdateBagEquipSuitActiveRedDot()
  781. else
  782. ErrorCodeShow(vo.res)
  783. end
  784. end
  785. -- ############## 升品-升品信息 ##############
  786. -- protocol=15208
  787. -- {
  788. -- c2s{
  789. -- }
  790. -- s2c{
  791. -- series_list:array{
  792. -- series:int8 // 套数
  793. -- pos:int8 // 装备位置
  794. -- lv:int8 // 升品等级
  795. -- }
  796. -- }
  797. -- }
  798. function EquipController:on15208()
  799. local vo = SCMD15208.New(true)
  800. -- print("huangcong:EquipController [start:827] vo:", vo)
  801. -- PrintTable(vo)
  802. -- print("huangcong:EquipController [end]")
  803. self.model:SetRedEquipInfo(vo.series_list)
  804. self.model:IsNeedRed(EquipModel.MainTab.RedEquip)
  805. end
  806. -- ############## 印刻上阵 ##############
  807. -- protocol=15209
  808. -- {
  809. -- c2s{
  810. -- goods_type_id:int32 // 印刻物品类型id
  811. -- }
  812. -- s2c{
  813. -- res :int32 // 错误码
  814. -- // 成功推15200
  815. -- }
  816. -- }
  817. function EquipController:on15209()
  818. local vo = SCMD15209.New(true)
  819. -- print("huangcong:EquipController [start:584] vo:", vo)
  820. -- PrintTable(vo)
  821. -- print("huangcong:EquipController [end]")
  822. if vo.res == 1 then
  823. Message.show("激活成功","success")
  824. else
  825. ErrorCodeShow(vo.res)
  826. end
  827. end
  828. -- ############## 升品升级 升品 ##############
  829. -- protocol=15210
  830. -- {
  831. -- c2s{
  832. -- series :int8 // 第几套装备
  833. -- pos :int8 // 装备位置
  834. -- }
  835. -- s2c{
  836. -- res :int32 // 错误码
  837. -- lv :int8 // 新的等级
  838. -- // 成功会推15028 }
  839. -- }
  840. function EquipController:on15210()
  841. local vo = SCMD15210.New(true)
  842. -- print("huangcong:EquipController [start:366] vo:", vo)
  843. -- PrintTable(vo)
  844. -- print("huangcong:EquipController [end]")
  845. if vo.res == 1 then
  846. Message.show("升品成功","success")
  847. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15200)
  848. else
  849. ErrorCodeShow(vo.res)
  850. end
  851. end
  852. -- ############## 装备系统战力变更:变更推送 ##############
  853. -- protocol=15211
  854. -- {
  855. -- s2c{
  856. -- power:int32 // 装备系统总战力
  857. -- }
  858. -- }
  859. function EquipController:on15211()
  860. local vo = SCMD15211.New(true)
  861. -- print("huangcong:EquipController [start:420] vo:", vo)
  862. -- PrintTable(vo)
  863. -- print("huangcong:EquipController [end]")
  864. end
  865. -- ############## 升星升星 预览 ##############
  866. -- protocol=15212
  867. -- {
  868. -- c2s{
  869. -- goods_id :int32 // 装备物品类型id
  870. -- lv:int8 // 升星等级:目标等级
  871. -- now_ratio:int16 // 当前概率
  872. -- }
  873. -- s2c{
  874. -- res :int32 // 错误码
  875. -- lists:array{ // 装备增加的概率之和 >= need_ratio
  876. -- id:int64 // 商品id
  877. -- goods_id :int32 // 物品id
  878. -- price:int32 // 价格 -- 商品一口价
  879. -- }
  880. -- }
  881. -- }
  882. function EquipController:on15212()
  883. local scmd = SCMD15212.New(true)
  884. -- print("huangcong:EquipController [start:470] scmd:", scmd)
  885. -- PrintTable(scmd)
  886. -- print("huangcong:EquipController [end]")
  887. if scmd.res == 1 then
  888. local extra_cost = self.model.evolution_extra_cost or {}
  889. local market_buy = {}
  890. local goods_vo = self.model.evolution_goods_vo
  891. local market_price = 0
  892. for i,v in ipairs(scmd.lists) do
  893. if v.id ~= 0 then
  894. market_buy[#market_buy + 1] = {v.id,v.goods_id,v.price}
  895. market_price = market_price + v.price
  896. end
  897. end
  898. if #market_buy>1 then
  899. local sort_func = function ( a, b )
  900. return a[3] < b[3]
  901. end
  902. table.sort(market_buy, sort_func)
  903. end
  904. self.model:SetEvolutionMarketBuy(market_buy)
  905. -- --成功
  906. -- function ok_function( ... )
  907. -- self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15204,goods_vo.goods_id,goods_vo.pos,extra_cost,market_buy,1)
  908. -- end
  909. -- local cost_price = market_price + self.model.evolution_cost_price
  910. local cost_price = market_price
  911. self.model:Fire(EquipModel.EVOLUTION_UPDATE_EQUIP_MARKET_COST,cost_price)
  912. -- --需要显示购买提示界面
  913. -- local data = {
  914. -- titleText = "是否花费",
  915. -- price = cost_price,
  916. -- priceText = HtmlColorTxt(cost_price, "#ff6519").." 补全材料升星装备?",
  917. -- ok_callback = ok_function,
  918. -- awardList = scmd.lists,
  919. -- }
  920. -- GlobalEventSystem:Fire(EquipModel.OPEN_EQUIP_EVOLUTION_AWARD_TIP_VIEW, data)
  921. else
  922. print("huangcong:EquipController [start:980] :", scmd.res)
  923. if scmd.res == 1520045 and self.EquipEvolutionChooseView and self.EquipEvolutionChooseView:HasOpen() and not self.EquipEvolutionChooseView._use_delete_method then--市场商品不足
  924. else
  925. ErrorCodeShow(scmd.res)
  926. end
  927. self.model:Fire(EquipModel.EVOLUTION_UPDATE_EQUIP_MARKET_COST,nil,true)
  928. end
  929. end
  930. -- ############## 宝石镶嵌信息 ##############
  931. -- protocol=15213
  932. -- {
  933. -- c2s{
  934. -- }
  935. -- s2c{
  936. -- series_list:array{
  937. -- series:int8 // 套数
  938. -- pos:int8 // 装备位置
  939. -- gems:array{
  940. -- goods_id:int32
  941. -- }
  942. -- }
  943. -- }
  944. -- }
  945. function EquipController:on15213()
  946. local scmd = SCMD15213.New(true)
  947. -- print("15213", scmd)
  948. -- PrintTable(scmd)
  949. self.model:SetGemstoneInfo(scmd.series_list)
  950. self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  951. end
  952. -- ############## 宝石镶嵌信息:单条更新 ##############
  953. -- protocol=15214
  954. -- {
  955. -- c2s{
  956. -- series:int8 // 套数
  957. -- pos:int8 // 装备位置
  958. -- }
  959. -- s2c{
  960. -- series:int8 // 套数
  961. -- pos:int8 // 装备位置
  962. -- gems:array{
  963. -- goods_id:int32
  964. -- }
  965. -- }
  966. -- }
  967. function EquipController:on15214()
  968. local scmd = SCMD15214.New(true)
  969. print("15214", scmd)
  970. PrintTable(scmd)
  971. self.model:SetGemstoneOneInfo(scmd)
  972. self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  973. end
  974. -- ############## 宝石镶嵌 ##############
  975. -- protocol=15215
  976. -- {
  977. -- c2s{
  978. -- series :int8 // 第几套装备
  979. -- pos :int8 // 装备位置
  980. -- goods_type_id:int32 // 宝石id
  981. -- }
  982. -- s2c{
  983. -- res :int32 // 错误码
  984. -- // 成功推 15214
  985. -- }
  986. -- }
  987. function EquipController:on15215()
  988. local scmd = SCMD15215.New(true)
  989. print("15215", scmd)
  990. PrintTable(scmd)
  991. if scmd.res == 1 then
  992. Message.show("镶嵌成功","success")
  993. self.model.gems_can_tip = true
  994. self.model:Fire(EquipModel.PLAY_GEMSTONE_EFFECT)
  995. -- self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  996. else
  997. ErrorCodeShow(scmd.res)
  998. end
  999. end
  1000. -- ############## 宝石卸下 ##############
  1001. -- protocol=15216
  1002. -- {
  1003. -- c2s{
  1004. -- series :int8 // 第几套装备
  1005. -- pos :int8 // 装备位置
  1006. -- goods_type_id:int32 // 宝石id
  1007. -- }
  1008. -- s2c{
  1009. -- res :int32 // 错误码
  1010. -- // 成功推 15214
  1011. -- }
  1012. -- }
  1013. function EquipController:on15216()
  1014. local scmd = SCMD15216.New(true)
  1015. print("15216", scmd)
  1016. PrintTable(scmd)
  1017. if scmd.res == 1 then
  1018. Message.show("卸下成功","success")
  1019. -- self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  1020. else
  1021. ErrorCodeShow(scmd.res)
  1022. end
  1023. end
  1024. -- ############## 宝石合成升级:镶嵌在身上的合成,其他合成走通用合成协议 ##############
  1025. -- protocol=15217
  1026. -- {
  1027. -- c2s{
  1028. -- series :int8 // 第几套装备
  1029. -- pos :int8 // 装备位置
  1030. -- goods_type_id:int32 // 宝石id
  1031. -- }
  1032. -- s2c{
  1033. -- res :int32 // 错误码
  1034. -- // 成功推 15214
  1035. -- }
  1036. -- }
  1037. function EquipController:on15217()
  1038. local scmd = SCMD15217.New(true)
  1039. print("15217", scmd)
  1040. PrintTable(scmd)
  1041. if scmd.res == 1 then
  1042. Message.show("合成成功","success")
  1043. self.model.gems_can_tip = true
  1044. self.model:Fire(EquipModel.PLAY_GEMSTONE_EFFECT)
  1045. -- self.model:IsNeedRed(EquipModel.MainTab.Gemstone)
  1046. else
  1047. ErrorCodeShow(scmd.res)
  1048. end
  1049. end
  1050. function EquipController:on15221()
  1051. local scmd = SCMD15221.New(true)
  1052. if scmd.status == 0 then
  1053. Message.show("取消跟随")
  1054. RoleManager.Instance.mainRoleInfo.evil_type_id = 0
  1055. else
  1056. --跟随成功
  1057. Message.show("跟随成功")
  1058. local goods_vo = GoodsModel.getInstance():GetWearedEquipVo(scmd.id)
  1059. RoleManager.Instance.mainRoleInfo.evil_type_id = goods_vo.type_id
  1060. local role = Scene.Instance:GetMainRole()
  1061. if role then
  1062. role:CreateEvil()
  1063. end
  1064. end
  1065. end
  1066. -- ############## 宝石-一键镶嵌 ##############
  1067. -- protocol=15222
  1068. -- {
  1069. -- c2s{
  1070. -- series:int8 // 代数
  1071. -- }
  1072. -- s2c{
  1073. -- res :int32 //1成功 错误码
  1074. -- pos_list:array{ // 变化的位置
  1075. -- pos:int8
  1076. -- }
  1077. -- }
  1078. -- }
  1079. function EquipController:on15222()
  1080. local scmd = SCMD15222.New(true)
  1081. if scmd.res == 1 then
  1082. self.model.gems_can_tip = true
  1083. print("huangcong:EquipController [start:1108] 1111:", 1111)
  1084. -- self.model:Fire(EquipModel.OPEN_GEMSTONE_AUTO_VIEW)
  1085. local new_pos_list = {}
  1086. if scmd.pos_list then
  1087. for i,v in ipairs(scmd.pos_list) do
  1088. new_pos_list[v.pos] = true
  1089. end
  1090. end
  1091. self.model:Fire(EquipModel.PLAY_GEMSTONE_AUTO_EFFECT,new_pos_list)
  1092. else
  1093. ErrorCodeShow(scmd.res)
  1094. end
  1095. end
  1096. -- ############## 宝石套装:宝石套装信息 ##############
  1097. -- protocol=15223
  1098. -- {
  1099. -- c2s{
  1100. -- }
  1101. -- s2c{
  1102. -- gems_lv_list:array{// 当前激活的宝石等级列表
  1103. -- series:int8 // 代数
  1104. -- gems_lv:int16 // 当前代激活的宝石等级
  1105. -- }
  1106. -- }
  1107. -- }
  1108. function EquipController:on15223()
  1109. local vo = SCMD15223.New(true)
  1110. -- print("huangcong:EquipController [start:1113] vo:", vo)
  1111. -- PrintTable(vo)
  1112. -- print("huangcong:EquipController [end]")
  1113. self.model:SetEquipGemActiveList(vo)
  1114. end
  1115. -- ############## 宝石套装:激活 ##############
  1116. -- protocol=15224
  1117. -- {
  1118. -- c2s{
  1119. -- series:int8 // 代数
  1120. -- }
  1121. -- s2c{
  1122. -- res :int32 // 错误码
  1123. -- gems_lv:int16 // 当前代激活的宝石等级
  1124. -- // 成功刷新15223
  1125. -- }
  1126. -- }
  1127. function EquipController:on15224()
  1128. local vo = SCMD15224.New(true)
  1129. -- print("huangcong:EquipController [start:1133] vo:", vo)
  1130. -- PrintTable(vo)
  1131. -- print("huangcong:EquipController [end]")
  1132. if vo.res == 1 then
  1133. self.model:Fire(EquipModel.UPDATE_STAR_SUIT_EFFECT,vo.gems_lv)
  1134. Message.show("激活成功","success")
  1135. else
  1136. ErrorCodeShow(vo.res)
  1137. end
  1138. end
  1139. -- ############## 特殊装备成长属性信息 ##############
  1140. -- protocol=15225
  1141. -- {
  1142. -- c2s{
  1143. -- series :int8
  1144. -- pos :int8
  1145. -- }
  1146. -- s2c{
  1147. -- series :int8
  1148. -- pos :int8
  1149. -- lv :int16
  1150. -- exp :int32
  1151. -- }
  1152. -- }
  1153. function EquipController:on15225()
  1154. local vo = SCMD15225.New(true)
  1155. print("huangcong:特殊装备成长属性信息", vo)
  1156. PrintTable(vo)
  1157. self.model:Fire(EquipModel.UPDATE_EQUIP_TOOL_TIPS_EXP_LV,vo)
  1158. end
  1159. -- ############## 装备战力 ##############
  1160. -- protocol=15226
  1161. -- {
  1162. -- c2s{
  1163. -- }
  1164. -- s2c{
  1165. -- power :int64
  1166. -- }
  1167. -- }
  1168. function EquipController:on15226()
  1169. local vo = SCMD15226.New(true)
  1170. self.model.equip_sum_power = vo.power
  1171. self.model:Fire(EquipModel.UPDATE_EQUIP_POWER)
  1172. end