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.

1163 lines
51 KiB

  1. local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer")
  2. local LayerBottom = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerBottom")
  3. local LayerBindPhone = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerBindPhone")
  4. local LayerEnd = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerEnd")
  5. local LayerFree = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerFree")
  6. local LayerMatch = require("luaScript.ModuleEapSdk.ModuleLayers.LayerScore.LayerMatch")
  7. local LayerRank = require("luaScript.ModuleEapSdk.ModuleLayers.LayerScore.LayerRank")
  8. local LayerRule = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerRule")
  9. local LayerSupport = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerSupport")
  10. local LayerDailyGame = require("luaScript.ModuleEapSdk.ModuleLayers.LayerScore.LayerDailyGame")
  11. local LayerUserInfo = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerUserInfo")
  12. local LayerAcntCode = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerAcntCode")
  13. local LayerHistory = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerHistory")
  14. local LayerStore = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStore")
  15. local LayerStoreConfirmOrder = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreConfirmOrder")
  16. local LayerStoreAddress = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreAddress")
  17. local LayerStoreNewAddr = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreNewAddr")
  18. local LayerStoreCheckPhone = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreCheckPhone")
  19. local LayerStoreBuyRecord = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreBuyRecord")
  20. local LayerStoreExResult = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreExResult")
  21. local LayerStoreCheckIDCard = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreCheckIDCard")
  22. local LayerTeam = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeam")
  23. local LayerTeamInfo = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamInfo")
  24. local LayerTeamCode = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamCode")
  25. local LayerTeamCreate = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamCreate")
  26. local LayerTeamBind = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamBind")
  27. local LayerTeamRank = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamRank")
  28. local LayerTeamDaily = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamDaily")
  29. local LayerTeamDetail = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamDetail")
  30. local LayerTeamEnd = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamEnd")
  31. local LayerPlatformReady = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformReady")
  32. local LayerPlatformMatch = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformMatch")
  33. local LayerPlatformTeamDes = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformTeamDes") --队伍详情
  34. local LayerPlatformCode = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformCode") --信息吗
  35. local LayerPlatformFree = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformFree") --无赛事
  36. local LayerBoard = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerBoard")
  37. local LayerFloat = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerFloat")
  38. local LayerMain = EapClass("LayerMain", BaseLayer)
  39. function LayerMain:myShow()
  40. self:addListener(true)
  41. self:fixWinSize()
  42. self:initData()
  43. self:initUI()
  44. end
  45. function LayerMain:myClose()
  46. end
  47. function LayerMain:refreshData()
  48. self.m_needRefreshMatch = true --需要刷新自己赛事排行
  49. self.m_needRefreshRank = true --需要刷新所有玩家赛事排行
  50. self.m_needRefreshDaily = true --需要刷新自己的当日对局战绩
  51. self.m_needRefreshFriend = true --需要刷新好友排行榜
  52. self.node_base:setPosition(cc.p(-self.fix_w, -self.fix_h/2))
  53. end
  54. function LayerMain:fixWinSize()
  55. self.node_base = cc.Node:create()
  56. local layerH = 600
  57. local layer_designR = DESIGN_HEIGHT/layerH
  58. local design_winR = display.height/DESIGN_HEIGHT
  59. local total_r = layer_designR*design_winR
  60. local fix_w = display.width*total_r - display.width
  61. local fix_h = display.height*total_r - display.height
  62. self.fix_w = fix_w
  63. self.fix_h = fix_h
  64. self.node_base:setScale(total_r)
  65. self.node_base:setPosition(cc.p(-fix_w, -fix_h/2))
  66. self:addChild(self.node_base, 2)
  67. end
  68. function LayerMain:initData()
  69. self.m_curSel = 0 --当前一级界面
  70. self.m_curSubSel = 0 --当前二级界面
  71. self.m_isShowBoard = false
  72. self.m_needRefreshMatch = true --需要刷新自己赛事排行
  73. self.m_needRefreshRank = true --需要刷新所有玩家赛事排行
  74. self.m_needRefreshDaily = true --需要刷新自己的当日对局战绩
  75. self.m_needRefreshFriend = true --需要刷新好友排行榜
  76. self.m_layerArr = {}
  77. -- self:getTimeConfig()
  78. -- G_EapSocketLogin.request_SDKConfig(function(__status, __data)
  79. -- print("request_SDKConfig = ", __data)
  80. -- if __status and __data then
  81. -- __data = G_EapSdkJson.decode(__data)
  82. -- for i=1, #__data.result do
  83. -- local info = __data.result[i]
  84. -- G_EapSdkMgr.MatchIcons[info.categoryId] = info
  85. -- end
  86. -- if self.m_layerBoard then
  87. -- self.m_layerBoard:refreshIcon()
  88. -- end
  89. -- if self.m_layerFree then
  90. -- self.m_layerFree:refreshIcon()
  91. -- end
  92. -- if self.m_layerRule then
  93. -- self.m_layerRule:refreshIcon()
  94. -- end
  95. -- if self.m_layerSupport then
  96. -- self.m_layerSupport:refreshIcon()
  97. -- end
  98. -- if self.m_layerRank then
  99. -- self.m_layerRank:refreshIcon()
  100. -- end
  101. -- if self.m_layerStore then
  102. -- self.m_layerStore:refreshIcon()
  103. -- end
  104. -- end
  105. -- end)
  106. end
  107. function LayerMain:getTimeConfig()
  108. G_EapSocketLogin.request_TimeConfig(function(__status, __data)
  109. if __status and __data then
  110. __data = G_EapSdkJson.decode(__data)
  111. if __data and __data.result then
  112. G_EapSdkMgr.m_timeConfig = __data.result
  113. end
  114. end
  115. end)
  116. end
  117. function LayerMain:initUI()
  118. print("LayerMain:initUI = ")
  119. self.m_layerFloat = LayerFloat.createWithData(self, 0)
  120. self.m_layerBoard = LayerBoard.createWithData(self.node_base, 1) --1000
  121. self.m_layerBottom = LayerBottom.createWithData(self.m_layerBoard, 100)
  122. self.m_layerArr = {}
  123. self.m_subLayers = {} --二级界面:排行榜,规则,当日战绩
  124. -- for i=1, #self.m_layerArr do
  125. -- self.m_layerArr[i]:setVisible(false)
  126. -- end
  127. -- for i=1, #self.m_subLayers do
  128. -- self.m_subLayers[i]:setVisible(false)
  129. -- end
  130. self:showBoard(false)
  131. self:showFloat(false)
  132. self:showBottom(true)
  133. -- self:showLayer(LAYER_ENUM.LAYER_MATCH)
  134. end
  135. function LayerMain:showBoard(__state)
  136. self.m_isShowBoard = __state
  137. self.m_layerBoard:setVisible(__state)
  138. self.m_layerBoard._listener:setSwallowTouches(__state)
  139. if __state then
  140. self.m_layerFloat:setWarnVisible(false)
  141. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  142. --每次去获取战队排行列表
  143. if G_EapSdkMgr.m_myMatchInfo then
  144. local roundMax = G_EapSdkMgr.m_myMatchInfo.RoundMax
  145. local matchID = G_EapSdkMgr.m_myMatchInfo.MatchID
  146. for i=1, roundMax do
  147. G_EapSocketLogin.request_teamMatchRankGet(matchID, i-1)
  148. end
  149. end
  150. end
  151. end
  152. end
  153. function LayerMain:showBottom(__state)
  154. self.m_layerBottom:setVisible(__state)
  155. end
  156. function LayerMain:showFloat(__state)
  157. self.m_layerFloat:setVisible(__state)
  158. self.m_layerFloat:setListenerEnable(__state)
  159. end
  160. function LayerMain:isFloatShow()
  161. return self.m_layerFloat:isVisible()
  162. end
  163. --当前页面
  164. function LayerMain:getCurLayer()
  165. return self.m_curSel
  166. end
  167. function LayerMain:showLayer(index)
  168. local oldLayer = self.m_layerArr[self.m_curSel]
  169. if oldLayer then
  170. oldLayer:setVisible(false)
  171. if oldLayer.closeReset then
  172. oldLayer:closeReset()
  173. end
  174. end
  175. self:closeSubLayer()
  176. if self.m_layerArr[index] then
  177. self.m_layerArr[index]:setVisible(true)
  178. else
  179. if index == LAYER_ENUM.LAYER_MATCH then
  180. self.m_layerMatch = LayerMatch.createWithData(self.m_layerBoard, 3) --2000
  181. self.m_layerArr[index] = self.m_layerMatch
  182. -- elseif index == LAYER_ENUM.LAYER_RANK then
  183. -- self.m_layerRank = LayerRank.createWithData(self.m_layerBoard, 4) --3000
  184. -- self.m_layerArr[index] = self.m_layerRank
  185. -- elseif index == LAYER_ENUM.LAYER_RULE then
  186. -- self.m_layerRule = LayerRule.createWithData(self.m_layerBoard, 5)
  187. -- self.m_layerArr[index] = self.m_layerRule
  188. elseif index == LAYER_ENUM.LAYER_INFO then
  189. self.m_layerInfo = LayerUserInfo.createWithData(self.m_layerBoard, 7)
  190. self.m_layerArr[index] = self.m_layerInfo
  191. elseif index == LAYER_ENUM.LAYER_ACNT_CODE then
  192. self.m_layerAcntCode = LayerAcntCode.createWithData(self.m_layerBoard, 7)
  193. self.m_layerArr[index] = self.m_layerAcntCode
  194. elseif index == LAYER_ENUM.LAYER_HISTORY then
  195. self.m_layerHistory = LayerHistory.createWithData(self.m_layerBoard, 7)
  196. self.m_layerArr[index] = self.m_layerHistory
  197. elseif index == LAYER_ENUM.LAYER_END then
  198. self.m_layerEnd = LayerEnd.createWithData(self.m_layerBoard, 6)
  199. self.m_layerArr[index] = self.m_layerEnd
  200. elseif index == LAYER_ENUM.LAYER_FREE then
  201. self.m_layerFree = LayerFree.createWithData(self.m_layerBoard, 6)
  202. self.m_layerArr[index] = self.m_layerFree
  203. elseif index == LAYER_ENUM.LAYER_BINDPHONE then
  204. self.m_layerBindPhone = LayerBindPhone.createWithData(self.m_layerBoard, 6)
  205. self.m_layerArr[index] = self.m_layerBindPhone
  206. elseif index == LAYER_ENUM.LAYER_STORE then
  207. self.m_layerStore = LayerStore.createWithData(self.m_layerBoard, 6)
  208. self.m_layerArr[index] = self.m_layerStore
  209. elseif index == LAYER_ENUM.LAYER_CONFIRM_ORDER then
  210. self.m_layerStoreConfirmOrder = LayerStoreConfirmOrder.createWithData(self.m_layerBoard, 6)
  211. self.m_layerArr[index] = self.m_layerStoreConfirmOrder
  212. elseif index == LAYER_ENUM.LAYER_ADDRESS then
  213. self.m_layerStoreAddress = LayerStoreAddress.createWithData(self.m_layerBoard, 6)
  214. self.m_layerArr[index] = self.m_layerStoreAddress
  215. elseif index == LAYER_ENUM.LAYER_NEW_ADDR then
  216. self.m_layerStoreNewAddr = LayerStoreNewAddr.createWithData(self.m_layerBoard, 6)
  217. self.m_layerArr[index] = self.m_layerStoreNewAddr
  218. elseif index == LAYER_ENUM.LAYER_CHECK_PHONE then
  219. self.m_layerStoreCheckPhone = LayerStoreCheckPhone.createWithData(self.m_layerBoard, 6)
  220. self.m_layerArr[index] = self.m_layerStoreCheckPhone
  221. elseif index == LAYER_ENUM.LAYER_BUY_RECORD then
  222. self.m_layerStoreBuyRecord = LayerStoreBuyRecord.createWithData(self.m_layerBoard, 6)
  223. self.m_layerArr[index] = self.m_layerStoreBuyRecord
  224. elseif index == LAYER_ENUM.LAYER_EX_RESULT then
  225. self.m_layerStoreExResult = LayerStoreExResult.createWithData(self.m_layerBoard, 6)
  226. self.m_layerArr[index] = self.m_layerStoreExResult
  227. elseif index == LAYER_ENUM.LAYER_CHECK_IDCARD then
  228. self.m_layerStoreCheckIDCard = LayerStoreCheckIDCard.createWithData(self.m_layerBoard, 6)
  229. self.m_layerArr[index] = self.m_layerStoreCheckIDCard
  230. elseif index == LAYER_ENUM.LAYER_TEAM then
  231. self.m_layerTeam = LayerTeam.createWithData(self.m_layerBoard, 8)
  232. self.m_layerArr[index] = self.m_layerTeam
  233. elseif index == LAYER_ENUM.LAYER_TEAM_INFO then
  234. self.m_layerTeamInfo = LayerTeamInfo.createWithData(self.m_layerBoard, 8)
  235. self.m_layerArr[index] = self.m_layerTeamInfo
  236. elseif index == LAYER_ENUM.LAYER_TEAM_CODE then
  237. self.m_layerTeamCode = LayerTeamCode.createWithData(self.m_layerBoard, 8)
  238. self.m_layerArr[index] = self.m_layerTeamCode
  239. elseif index == LAYER_ENUM.LAYER_TEAM_CREATE then
  240. self.m_layerTeamCreate = LayerTeamCreate.createWithData(self.m_layerBoard, 8)
  241. self.m_layerArr[index] = self.m_layerTeamCreate
  242. elseif index == LAYER_ENUM.LAYER_TEAM_BIND then
  243. self.m_layerTeamBind = LayerTeamBind.createWithData(self.m_layerBoard, 8)
  244. self.m_layerArr[index] = self.m_layerTeamBind
  245. elseif index == LAYER_ENUM.LAYER_TEAM_END then
  246. self.m_layerTeamEnd = LayerTeamEnd.createWithData(self.m_layerBoard, 8)
  247. self.m_layerArr[index] = self.m_layerTeamEnd
  248. elseif index == LAYER_ENUM.LAYER_PLATFORM_READY then --平台赛事准备
  249. self.m_layerPlatformReady = LayerPlatformReady.createWithData(self.m_layerBoard, 8)
  250. self.m_layerArr[index] = self.m_layerPlatformReady
  251. elseif index == LAYER_ENUM.LAYER_PLATFORM_MATCH then --平台赛事开赛
  252. self.m_layerPlatformMatch = LayerPlatformMatch.createWithData(self.m_layerBoard, 8)
  253. self.m_layerArr[index] = self.m_layerPlatformMatch
  254. elseif index == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES then --平台赛事队伍详情
  255. self.m_layerPlatformTeamDes = LayerPlatformTeamDes.createWithData(self.m_layerBoard, 8)
  256. self.m_layerArr[index] = self.m_layerPlatformTeamDes
  257. elseif index == LAYER_ENUM.LAYER_PLATFORM_CODE then --平台赛事通过信息码绑定
  258. self.m_layerPlatformCode = LayerPlatformCode.createWithData(self.m_layerBoard, 8)
  259. self.m_layerArr[index] = self.m_layerPlatformCode
  260. elseif index == LAYER_ENUM.LAYER_PLATFORM_FREE then --无赛事
  261. self.m_layerPlatformFree = LayerPlatformFree.createWithData(self.m_layerBoard, 8)
  262. self.m_layerArr[index] = self.m_layerPlatformFree
  263. end
  264. end
  265. --top条显示
  266. if index == LAYER_ENUM.LAYER_MATCH or
  267. index == LAYER_ENUM.LAYER_END or
  268. index == LAYER_ENUM.LAYER_FREE or
  269. index == LAYER_ENUM.LAYER_TEAM or
  270. index == LAYER_ENUM.LAYER_TEAM_END or
  271. index == LAYER_ENUM.LAYER_PLATFORM_FREE then
  272. self.m_layerBoard:showTop(true)
  273. else
  274. self.m_layerBoard:showTop(false)
  275. end
  276. --底部页签显示
  277. if index == LAYER_ENUM.LAYER_PLATFORM_READY or
  278. index == LAYER_ENUM.LAYER_PLATFORM_MATCH or
  279. index == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES or
  280. index == LAYER_ENUM.LAYER_BINDPHONE or
  281. index == LAYER_ENUM.LAYER_CONFIRM_ORDER or
  282. index == LAYER_ENUM.LAYER_ADDRESS or
  283. index == LAYER_ENUM.LAYER_NEW_ADDR or
  284. index == LAYER_ENUM.LAYER_CHECK_PHONE or
  285. index == LAYER_ENUM.LAYER_CHECK_IDCARD or
  286. index == LAYER_ENUM.LAYER_BUY_RECORD or
  287. index == LAYER_ENUM.LAYER_EX_RESULT or
  288. index == LAYER_ENUM.LAYER_PLATFORM_CODE then
  289. self:showBottom(false)
  290. elseif index == LAYER_ENUM.LAYER_PLATFORM_FREE or
  291. index == LAYER_ENUM.LAYER_STORE or
  292. index == LAYER_ENUM.LAYER_INFO or
  293. index == LAYER_ENUM.LAYER_ACNT_CODE or
  294. index == LAYER_ENUM.LAYER_HISTORY or
  295. index == LAYER_ENUM.LAYER_TEAM or
  296. index == LAYER_ENUM.LAYER_TEAM_INFO or
  297. index == LAYER_ENUM.LAYER_TEAM_CODE or
  298. index == LAYER_ENUM.LAYER_TEAM_CREATE or
  299. index == LAYER_ENUM.LAYER_TEAM_BIND or
  300. index == LAYER_ENUM.LAYER_MATCH then
  301. self:showBottom(true)
  302. end
  303. if index == LAYER_ENUM.LAYER_MATCH then
  304. if self.m_needRefreshMatch then
  305. self.m_needRefreshMatch = false
  306. for k,v in pairs(G_EapSdkMgr.m_matchInfos) do
  307. G_EapSocketLogin.request_userMatchInfoGet(k)
  308. end
  309. end
  310. end
  311. if index == LAYER_ENUM.LAYER_TEAM then
  312. if self.m_needRefreshMatch then
  313. self.m_needRefreshMatch = false
  314. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  315. local teamInfo = G_EapSdkMgr.m_selTeamInfos[1]
  316. G_EapSocketLogin.request_teamMatchRankGet(teamInfo.matchId, teamInfo.id, 0, 0, 1)
  317. end
  318. end
  319. end
  320. if index == LAYER_ENUM.LAYER_STORE then
  321. self.m_layerStore:getGoodsList()
  322. end
  323. if index == LAYER_ENUM.LAYER_INFO then
  324. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  325. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  326. local teamInfo = G_EapSdkMgr.m_selTeamInfos[1]
  327. G_EapSocketLogin.request_CheckTaskReq(teamInfo.matchId)
  328. self.m_layerInfo:showSignNode(true)
  329. else
  330. self.m_layerInfo:showSignNode(false)
  331. end
  332. end
  333. end
  334. self.m_curSel = index
  335. if index == LAYER_ENUM.LAYER_MATCH then
  336. G_EapSocketLogin.request_markLog(MARK_LOG10002)
  337. elseif index == LAYER_ENUM.LAYER_STORE then
  338. G_EapSocketLogin.request_markLog(MARK_LOG10003)
  339. elseif index == LAYER_ENUM.LAYER_INFO then
  340. G_EapSocketLogin.request_markLog(MARK_LOG10004)
  341. elseif index == LAYER_ENUM.LAYER_BINDPHONE then
  342. G_EapSocketLogin.request_markLog(MARK_LOG11004)
  343. elseif index == LAYER_ENUM.LAYER_TEAM then
  344. G_EapSocketLogin.request_markLog(MARK_LOG10002)
  345. elseif index == LAYER_ENUM.LAYER_TEAM_INFO then
  346. G_EapSocketLogin.request_markLog(MARK_LOG11015)
  347. elseif index == LAYER_ENUM.LAYER_TEAM_BIND then
  348. G_EapSocketLogin.request_markLog(MARK_LOG11004)
  349. elseif index == LAYER_ENUM.LAYER_FREE then
  350. G_EapSocketLogin.request_markLog(MARK_LOG10018)
  351. end
  352. return self.m_layerArr[index]
  353. end
  354. function LayerMain:isSubLayerVis(index)
  355. local tmpIndex = index or self.m_curSubSel
  356. local oldLayer = self.m_subLayers[tmpIndex]
  357. if oldLayer then
  358. return oldLayer:isVisible()
  359. end
  360. return false
  361. end
  362. --关闭二级界面
  363. function LayerMain:closeSubLayer(index)
  364. local tmpIndex = index or self.m_curSubSel
  365. local oldLayer = self.m_subLayers[tmpIndex]
  366. if oldLayer then
  367. oldLayer:setVisible(false)
  368. end
  369. self.m_layerBoard:showBack(true)
  370. self.m_curSubSel = 0
  371. end
  372. function LayerMain:showSubLayer(index)
  373. local oldLayer = self.m_subLayers[self.m_curSubSel]
  374. if oldLayer then
  375. oldLayer:setVisible(false)
  376. end
  377. self.m_layerBoard:showBack(false)
  378. if self.m_subLayers[index] then
  379. self.m_subLayers[index]:setVisible(true)
  380. else
  381. if index == LAYER_ENUM.LAYER_RANK then
  382. self.m_layerRank = LayerRank.createWithData(self.m_layerBoard, 2) --3000
  383. self.m_subLayers[index] = self.m_layerRank
  384. elseif index == LAYER_ENUM.LAYER_RULE then
  385. self.m_layerRule = LayerRule.createWithData(self.m_layerBoard, 2)
  386. self.m_subLayers[index] = self.m_layerRule
  387. elseif index == LAYER_ENUM.LAYER_DAILY_GAME then
  388. self.m_layerDailyGame = LayerDailyGame.createWithData(self.m_layerBoard, 2)
  389. self.m_subLayers[index] = self.m_layerDailyGame
  390. elseif index == LAYER_ENUM.LAYER_SUPPORT then
  391. self.m_layerSupport = LayerSupport.createWithData(self.m_layerBoard, 2)
  392. self.m_subLayers[index] = self.m_layerSupport
  393. elseif index == LAYER_ENUM.LAYER_TEAM_RANK then
  394. self.m_layerTeamRank = LayerTeamRank.createWithData(self.m_layerBoard, 2)
  395. self.m_subLayers[index] = self.m_layerTeamRank
  396. elseif index == LAYER_ENUM.LAYER_TEAM_DAILY then
  397. self.m_layerTeamDaily = LayerTeamDaily.createWithData(self.m_layerBoard, 2)
  398. self.m_subLayers[index] = self.m_layerTeamDaily
  399. elseif index == LAYER_ENUM.LAYER_TEAM_DETAIL then
  400. self.m_layerTeamDetail = LayerTeamDetail.createWithData(self.m_layerBoard, 2)
  401. self.m_subLayers[index] = self.m_layerTeamDetail
  402. end
  403. end
  404. if index == LAYER_ENUM.LAYER_RANK then
  405. local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
  406. if self.m_needRefreshRank then
  407. self.m_needRefreshRank = false
  408. for i=1, 2 do
  409. G_EapSocketLogin.request_UserMatchRankGet(matchIDs[1], 0, i-1, 50)
  410. end
  411. end
  412. if self.m_needRefreshFriend then
  413. self.m_needRefreshFriend = false
  414. G_EapSocketLogin.request_FriendListGet()
  415. end
  416. end
  417. if index == LAYER_ENUM.LAYER_DAILY_GAME then
  418. if self.m_needRefreshDaily then
  419. self.m_needRefreshDaily = false
  420. for k,v in pairs(G_EapSdkMgr.m_matchInfos) do
  421. G_EapSocketLogin.request_MatchRoundGet(k)
  422. end
  423. end
  424. end
  425. if index == LAYER_ENUM.LAYER_TEAM_RANK then
  426. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  427. local matchID = G_EapSdkMgr.m_selTeamInfos[1].matchId
  428. local teamID = G_EapSdkMgr.m_selTeamInfos[1].id
  429. if self.m_needRefreshRank then
  430. self.m_needRefreshRank = false
  431. for i=1, 2 do
  432. G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, i-1, 2, 50)
  433. end
  434. end
  435. else
  436. local matchInfo = G_EapSdkMgr:getSelfTeamRank()
  437. if matchInfo then
  438. local matchID = matchInfo.MatchID
  439. local teamID = matchInfo.TeamID
  440. if self.m_needRefreshRank then
  441. self.m_needRefreshRank = false
  442. for i=1, 2 do
  443. G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, i-1, 3, 50)
  444. end
  445. end
  446. end
  447. end
  448. end
  449. if index == LAYER_ENUM.LAYER_TEAM_DAILY then
  450. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  451. local matchID = G_EapSdkMgr.m_selTeamInfos[1].matchId
  452. local teamID = G_EapSdkMgr.m_selTeamInfos[1].id
  453. if self.m_needRefreshDaily then
  454. self.m_needRefreshDaily = false
  455. for i=1,3 do
  456. G_EapSocketLogin.request_PointTeamDayGet(teamID, matchID, i-1, 10)
  457. end
  458. end
  459. else
  460. local matchInfo = G_EapSdkMgr:getSelfTeamRank()
  461. if matchInfo then
  462. local matchID = matchInfo.MatchID
  463. local teamID = matchInfo.TeamID
  464. if self.m_needRefreshDaily then
  465. self.m_needRefreshDaily = false
  466. for i=1,3 do
  467. G_EapSocketLogin.request_PointTeamDayGet(teamID, matchID, i-1, 10)
  468. end
  469. end
  470. end
  471. end
  472. end
  473. self.m_curSubSel = index
  474. if index == LAYER_ENUM.LAYER_RULE then
  475. G_EapSocketLogin.request_markLog(MARK_LOG10007)
  476. elseif index == LAYER_ENUM.LAYER_DAILY_GAME then
  477. G_EapSocketLogin.request_markLog(MARK_LOG10008)
  478. elseif index == LAYER_ENUM.LAYER_SUPPORT then
  479. G_EapSocketLogin.request_markLog(MARK_LOG10009)
  480. elseif index == LAYER_ENUM.LAYER_RANK then
  481. G_EapSocketLogin.request_markLog(MARK_LOG10006)
  482. elseif index == LAYER_ENUM.LAYER_TEAM_RANK then
  483. G_EapSocketLogin.request_markLog(MARK_LOG10006)
  484. elseif index == LAYER_ENUM.LAYER_TEAM_DAILY then
  485. G_EapSocketLogin.request_markLog(MARK_LOG10008)
  486. end
  487. return self.m_subLayers[index]
  488. end
  489. function LayerMain:OnHandleMsg(__opcode, __data, __params)
  490. if (OpcodeWebSdkConfigAck == __opcode) then --sdk配置查询
  491. if __data.nRet == 0 then
  492. if self.m_layerBoard then
  493. self.m_layerBoard:refreshIcon()
  494. end
  495. if self.m_layerFree then
  496. self.m_layerFree:refreshIcon()
  497. end
  498. if self.m_layerRule then
  499. self.m_layerRule:refreshIcon()
  500. end
  501. if self.m_layerSupport then
  502. self.m_layerSupport:refreshIcon()
  503. end
  504. if self.m_layerRank then
  505. self.m_layerRank:refreshIcon()
  506. end
  507. if self.m_layerStore then
  508. self.m_layerStore:refreshIcon()
  509. end
  510. end
  511. elseif (OpcodeMatchAppIDsAck == __opcode) then --获取所有的平台
  512. if __data.nRet == 0 then
  513. end
  514. elseif (OpcodeVerifyAccountAck == __opcode) then --注册帐号
  515. if __data.nRet == 0 then
  516. end
  517. elseif (OpcodeQueryByCPAccountAck == __opcode) then --通过三方帐号查询pid
  518. if __data.nRet == 0 then
  519. else
  520. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  521. self:showFloat(true)
  522. self:dealFirstLogin()
  523. self:showLayer(LAYER_ENUM.LAYER_PLATFORM_CODE)
  524. end
  525. end
  526. elseif (OpcodeBindCPAccountAck == __opcode) then --绑定三方帐号
  527. if __data.nRet == 0 then
  528. end
  529. elseif (OpcodeGetCodeAck == __opcode) then --获取验证码
  530. if self.m_curSel == LAYER_ENUM.LAYER_BINDPHONE then
  531. if self.m_layerBindPhone then
  532. self.m_layerBindPhone:refreshErrMsg(__params.info, __data.nRet)
  533. end
  534. end
  535. if self.m_curSel == LAYER_ENUM.LAYER_TEAM_BIND then
  536. if self.m_layerTeamBind then
  537. self.m_layerTeamBind:refreshErrMsg(__params.info, __data.nRet)
  538. end
  539. end
  540. elseif (OpcodeBindPhoneAck == __opcode) then --绑定手机
  541. if self.m_curSel == LAYER_ENUM.LAYER_BINDPHONE then
  542. self.m_layerBindPhone:refreshErrMsg(__params.info, __data.nRet)
  543. if __data.nRet == 0 then
  544. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  545. self.m_needRefreshRank = true --需要刷新所有玩家赛事排行
  546. self.m_needRefreshDaily = true
  547. local curSelMatch = G_EapSdkMgr.getSelMatchID()
  548. local selMatchInfo = G_EapSdkMgr.m_allMatchs[curSelMatch]
  549. if selMatchInfo then
  550. G_EapSdkMgr.m_matchInfos = {}
  551. G_EapSdkMgr.m_matchInfos[curSelMatch] = clone(selMatchInfo)
  552. G_EapSocketLogin.request_userMatchInfoGet(curSelMatch)
  553. end
  554. if self.m_layerMatch then
  555. self.m_layerMatch:checkBindPhone(true)
  556. end
  557. end
  558. local bottomSel = self.m_layerBottom:getCurSel()
  559. if bottomSel == 1 then
  560. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  561. G_LayerMain:showLayer(LAYER_ENUM.LAYER_MATCH)
  562. end
  563. elseif bottomSel == 4 then
  564. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  565. G_LayerMain:showLayer(LAYER_ENUM.LAYER_TEAM_CODE)
  566. end
  567. elseif bottomSel == 2 then
  568. if G_EapSdkMgr.EapPhone then
  569. G_LayerMain:showLayer(LAYER_ENUM.LAYER_STORE)
  570. end
  571. end
  572. if self.m_layerMatch then
  573. self.m_layerMatch:refreshRedInfo()
  574. end
  575. end
  576. elseif self.m_curSel == LAYER_ENUM.LAYER_TEAM_BIND then
  577. if self.m_layerTeamBind then
  578. self.m_layerTeamBind:refreshErrMsg(__params.info, __data.nRet)
  579. end
  580. if __data.nRet == 0 then
  581. local bottomSel = self.m_layerBottom:getCurSel()
  582. if bottomSel == 4 then
  583. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  584. G_LayerMain:showLayer(LAYER_ENUM.LAYER_TEAM_CODE)
  585. end
  586. elseif bottomSel == 2 then
  587. G_LayerMain:showLayer(LAYER_ENUM.LAYER_STORE)
  588. end
  589. end
  590. end
  591. elseif (OpcodeLoginInfoCodeAck == __opcode) then --信息码返回错误
  592. if self.m_layerPlatformCode then
  593. self.m_layerPlatformCode:refreshErrMsg(__params.success)
  594. end
  595. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  596. if self.m_layerAcntCode then
  597. self.m_layerAcntCode:refreshErrMsg(__params.success)
  598. end
  599. if __params.success then
  600. self:showLayer(LAYER_ENUM.LAYER_INFO)
  601. if self.m_layerInfo then
  602. self.m_layerInfo:refreshMyInfo(true)
  603. end
  604. end
  605. end
  606. elseif (OpcodePointGameSelectAck == __opcode) then --玩家选择赛区
  607. if __data.nRet == 0 and __data.Type == 2 then
  608. if self.m_layerMatch then
  609. self.m_layerMatch:setInfoItem()
  610. end
  611. end
  612. elseif (OpcodeMatchListAck == __opcode) then --查询赛事信息
  613. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  614. self:showFloat(true)
  615. self:dealFirstLogin()
  616. if G_EapSdkMgr.m_isMatching then
  617. -- local isClick = G_EapSdkMgr:getClickEnter()
  618. -- if isClick ~= 1 and not G_EapSdkMgr.EapPhone then
  619. -- self:showLayer(LAYER_ENUM.LAYER_FREE)
  620. -- else
  621. self:showLayer(LAYER_ENUM.LAYER_MATCH)
  622. -- end
  623. else
  624. local selMatchID = G_EapSdkMgr:getSelMatchID()
  625. if selMatchID ~= "" then
  626. G_EapSocketLogin.request_UserRedCashGet(selMatchID)
  627. end
  628. G_EapSocketLogin.request_PointHistoryGet()
  629. self:showLayer(LAYER_ENUM.LAYER_END)
  630. end
  631. elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  632. self:showFloat(true)
  633. self:dealFirstLogin()
  634. if G_EapSdkMgr.m_isMatching then
  635. local isClick = G_EapSdkMgr:getClickEnter()
  636. -- if G_EapSdkMgr.m_firstLogin then
  637. if isClick ~= 1 then
  638. self:showLayer(LAYER_ENUM.LAYER_FREE)
  639. else
  640. -- if not G_EapSdkMgr.EapPhone then
  641. -- self:showLayer(LAYER_ENUM.LAYER_TEAM_BIND)
  642. -- else
  643. self:showLayer(LAYER_ENUM.LAYER_TEAM)
  644. -- end
  645. self.m_layerBottom:setTabSel(1)
  646. end
  647. else
  648. G_EapSocketLogin.request_PointHistoryGet()
  649. self:showLayer(LAYER_ENUM.LAYER_END)
  650. end
  651. end
  652. elseif (OpcodeMatchRuleAck == __opcode) then --查询赛事规则
  653. if G_EapSdkMgr.m_matchRule then
  654. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  655. if self.m_layerPlatformMatch then
  656. self.m_layerPlatformMatch:refreshMatchRule()
  657. end
  658. elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE or
  659. EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  660. if self.m_layerRule then
  661. self.m_layerRule:refreshRuleInfo()
  662. end
  663. end
  664. end
  665. elseif (OpcodeHistoryDetailAck == __opcode) then --历史赛事详情
  666. if G_EapSdkMgr.m_matchRule then
  667. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  668. if self.m_layerPlatformMatch then
  669. self.m_layerPlatformMatch:refreshMatchRule()
  670. end
  671. elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE or
  672. EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  673. if self.m_layerRule then
  674. self.m_layerRule:refreshRuleInfo()
  675. end
  676. end
  677. end
  678. if self.m_layerHistory then
  679. self.m_layerHistory:refreshUserInfo(__data.MatchInfo)
  680. end
  681. elseif (OpcodeUserMatchInfoAck == __opcode) then --获取进行中的赛事玩家详情,可用于赛事列表获取后,某个赛事玩家对应的信息
  682. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  683. self:showFloat(true)
  684. self:dealFirstLogin()
  685. if G_EapSdkMgr.m_myUserMatchInfo then
  686. if G_EapSdkMgr.m_isMatching then
  687. self:showLayer(LAYER_ENUM.LAYER_PLATFORM_MATCH)
  688. self.m_layerPlatformMatch:refreshMatchInfo()
  689. else
  690. self:showLayer(LAYER_ENUM.LAYER_PLATFORM_READY)
  691. self.m_layerPlatformReady:refreshMatchInfo()
  692. end
  693. if G_EapSdkMgr.m_myMatchInfo and G_EapSdkMgr.m_myMatchInfo.Status == MATCH_STATUS.End then
  694. if self.m_layerPlatformMatch then
  695. self.m_layerPlatformMatch:refreshMatchEnd()
  696. end
  697. end
  698. else
  699. self:showLayer(LAYER_ENUM.LAYER_PLATFORM_FREE)
  700. end
  701. elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  702. if self.m_layerMatch then
  703. if __params.isSelf then
  704. self.m_layerMatch:setInfoItem()
  705. else
  706. self.m_layerMatch:refreshSearchRes()
  707. end
  708. end
  709. end
  710. elseif (OpcodeUserConfirmMatchAck == __opcode) then --赛事匹配阶段确认参加赛事,由sdk发送确认消息
  711. if __data.nRet == 0 then
  712. end
  713. elseif (OpcodeTeamMatchRankAck == __opcode) then --获取战队排行榜
  714. if __data.nRet == 0 then
  715. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  716. if self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_READY then
  717. self.m_layerPlatformReady:refreshRankList()
  718. self.m_layerPlatformReady:refreshSelfInfo()
  719. elseif self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_MATCH then
  720. if __data.PageNum == 0 then
  721. self.m_layerPlatformMatch:refreshRankList(__params.dataEnd)
  722. else
  723. self.m_layerPlatformMatch:expandRankList(__params.dataEnd)
  724. end
  725. elseif self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES then
  726. self.m_layerPlatformTeamDes:resetAllInfo()
  727. end
  728. elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  729. if __data.AckType == 1 then --自己
  730. self.m_needRefreshMatch = false
  731. if self.m_layerTeam then
  732. self.m_layerTeam:setInfoItem()
  733. end
  734. if self.m_layerTeamRank then
  735. self.m_layerTeamRank:refreshSelfRank()
  736. end
  737. elseif __data.AckType == 2 then --总排行榜
  738. if __data.PageNum == 1 and self.m_layerTeamRank then
  739. self.m_layerTeamRank:refreshRankList(__data.MatchID)
  740. end
  741. elseif __data.AckType == 3 then --所有
  742. if __data.PageNum == 1 and self.m_layerTeamRank then
  743. self.m_layerTeamRank:refreshSelfRank()
  744. self.m_layerTeamRank:refreshRankList(__data.MatchID)
  745. end
  746. end
  747. end
  748. end
  749. elseif (OpcodeUserSelectTeamAck == __opcode) then --获取自己的战队信息
  750. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  751. if self.m_layerTeamInfo then
  752. self.m_layerTeamInfo:setMembers()
  753. else
  754. if self.m_layerBottom:getCurSel() == 4 then
  755. self:showLayer(LAYER_ENUM.LAYER_TEAM_INFO)
  756. end
  757. end
  758. end
  759. if self.m_layerTeam then
  760. self.m_layerTeam:refreshTeamInfo()
  761. self.m_layerTeam:setInfoItem()
  762. end
  763. elseif (OpcodeJoinSelectTeamAck == __opcode) then --获取自己的战队信息
  764. if self.m_curSel == LAYER_ENUM.LAYER_TEAM_CODE then
  765. if self.m_layerTeamCode then
  766. self.m_layerTeamCode:refreshErrMsg(__data.retCode)
  767. end
  768. end
  769. elseif (OpcodeQuitSelectTeamAck == __opcode) then --退出选拔赛战队回应
  770. if __data.retCode == 0 then
  771. if self.m_layerTeam then
  772. self.m_layerTeam:refreshTeamInfo()
  773. end
  774. end
  775. elseif (OpcodeSelectTeamDetailAck == __opcode) then --查看选拔赛战队明细回应
  776. if __data.retCode == 0 then
  777. if self.m_layerTeamRank then
  778. self.m_layerTeamRank:refreshUserInfo(__data.result)
  779. end
  780. end
  781. elseif (OpcodeUserMatchRankAck == __opcode) then --获取个人排行榜
  782. if __data.nRet == 0 then
  783. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  784. if __data.PageNum == 1 then
  785. self.m_layerRank:refreshRankList(__data.MatchID)
  786. end
  787. end
  788. end
  789. elseif (OpcodeMatchRoundAck == __opcode) then --玩家每局对局详情
  790. if __data.nRet == 0 then
  791. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  792. if __params.isRoundFinish then
  793. self.m_layerDailyGame:refreshRankList(__data.MatchID)
  794. end
  795. end
  796. end
  797. elseif (OpcodeVerifyRealNameAck == __opcode) then --实名认证
  798. -- if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  799. if self.m_layerStoreCheckIDCard then
  800. self.m_layerStoreCheckIDCard:onVerifyRealName(__data)
  801. end
  802. -- end
  803. elseif (OpcodeGetBaseInfoAck == __opcode) then --获取个人基础信息
  804. if __data.nRet == 0 then
  805. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  806. -- self.m_layerRank:refreshUserInfo(__data.user.nPID)
  807. end
  808. end
  809. elseif (OpcodeGetMultiUserInfoAck == __opcode) then -- 批量查询玩家基础信息
  810. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  811. if self.m_layerRank then
  812. self.m_layerRank:refreshUserInfo()
  813. end
  814. if self.m_layerMatch then
  815. self.m_layerMatch:refreshSearchRes()
  816. self.m_layerMatch:refreshFriendListItems()
  817. end
  818. end
  819. elseif (OpcodePointHistoryAck == __opcode) then --获取历史战绩
  820. if self.m_layerEnd then
  821. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  822. self.m_layerEnd:refreshRank()
  823. elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  824. self.m_layerEnd:refreshRedInfo()
  825. end
  826. end
  827. if self.m_layerHistory then
  828. self.m_layerHistory:refreshHistoryList()
  829. end
  830. elseif (OpcodeFriendListAck == __opcode) then --获取好友列表
  831. if __data.nRet == 0 then
  832. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  833. end
  834. end
  835. elseif (OpcodeFriendFollowAck == __opcode) then --关注、取消关注好友
  836. if __data.nRet == 0 then
  837. self.m_needRefreshFriend = true
  838. if self.m_layerMatch then
  839. self.m_layerMatch:refreshFollowState()
  840. self.m_layerMatch:refreshFriendList()
  841. end
  842. end
  843. elseif (OpcodePointRankListAck == __opcode) then --积分赛获取好友排行
  844. if __data.nRet == 0 then
  845. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  846. if self.m_layerRank then
  847. self.m_layerRank:refreshRankList(__data.MatchID)
  848. end
  849. if self.m_layerMatch then
  850. self.m_layerMatch:refreshFriendList(__data.MatchID)
  851. end
  852. end
  853. end
  854. elseif (OpcodeUserInfoNoti == __opcode) then --玩家赛事对局详情通知
  855. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  856. if G_EapSdkMgr.m_isMatching then
  857. self:showLayer(LAYER_ENUM.LAYER_PLATFORM_MATCH)
  858. self.m_layerPlatformMatch:refreshMatchInfo()
  859. self.m_layerPlatformMatch:refreshMatchRule()
  860. end
  861. end
  862. elseif (OpcodeMatchBaseNoti == __opcode) then --比赛状态更新通知
  863. if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then
  864. if G_EapSdkMgr.m_myMatchInfo and G_EapSdkMgr.m_myMatchInfo.Status == MATCH_STATUS.End then
  865. self:showLayer(LAYER_ENUM.LAYER_PLATFORM_MATCH)
  866. --获取玩家所有参赛赛事
  867. -- G_EapSocketLogin.request_userMatchInfoGet()
  868. if self.m_layerPlatformMatch then
  869. self.m_layerPlatformMatch:refreshMatchEnd()
  870. end
  871. end
  872. elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE or
  873. EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  874. if G_EapSdkMgr:checkAllMatchEnd() then
  875. G_EapSocketLogin.request_PointHistoryGet()
  876. self:showLayer(LAYER_ENUM.LAYER_END)
  877. end
  878. end
  879. elseif (OpcodeUserScoreNoti == __opcode) then --算分服务器通知
  880. if not self.m_isShowBoard then
  881. self.m_layerFloat:setWarnVisible(true)
  882. self.m_layerFloat:setFloatOut(true)
  883. end
  884. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  885. local selMatchID = G_EapSdkMgr:getSelMatchID()
  886. if selMatchID == "" then
  887. for k,v in pairs(G_EapSdkMgr.m_matchInfos) do
  888. selMatchID = k
  889. break
  890. end
  891. end
  892. if selMatchID == __data.MatchID then
  893. if self.m_curSel == LAYER_ENUM.LAYER_MATCH then
  894. G_EapSocketLogin.request_userMatchInfoGet(__data.MatchID)
  895. else
  896. self.m_needRefreshMatch = true --需要刷新自己赛事排行
  897. end
  898. if self.m_curSubSel == LAYER_ENUM.LAYER_RANK then
  899. for i=1, 2 do
  900. G_EapSocketLogin.request_UserMatchRankGet(matchIDs[1], 0, i-1, 50)
  901. end
  902. self.m_needRefreshDaily = true
  903. elseif self.m_curSubSel == LAYER_ENUM.LAYER_DAILY_GAME then
  904. G_EapSocketLogin.request_MatchRoundGet(__data.MatchID)
  905. self.m_needRefreshRank = true
  906. else
  907. self.m_needRefreshRank = true --需要刷新所有玩家赛事排行
  908. self.m_needRefreshDaily = true
  909. end
  910. G_EapSocketLogin.request_UserRedCashGet(selMatchID)
  911. end
  912. elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  913. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  914. local matchID = G_EapSdkMgr.m_selTeamInfos[1].matchId
  915. local teamID = G_EapSdkMgr.m_selTeamInfos[1].id
  916. if matchID == __data.MatchID then
  917. if self.m_curSel == LAYER_ENUM.LAYER_TEAM then
  918. G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, 0, 1)
  919. else
  920. self.m_needRefreshMatch = true --需要刷新自己赛事排行
  921. end
  922. if self.m_curSubSel == LAYER_ENUM.LAYER_TEAM_RANK then
  923. for i=1, 2 do
  924. G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, i-1, 2, 50)
  925. end
  926. self.m_needRefreshDaily = true
  927. elseif self.m_curSubSel == LAYER_ENUM.LAYER_TEAM_DAILY then
  928. for i=1,3 do
  929. G_EapSocketLogin.request_PointTeamDayGet(teamID, matchID, i-1, 10)
  930. end
  931. self.m_needRefreshRank = true
  932. else
  933. self.m_needRefreshRank = true --需要刷新所有玩家赛事排行
  934. self.m_needRefreshDaily = true
  935. end
  936. end
  937. end
  938. end
  939. elseif (OpcodeMatchItemNoti == __opcode) then --赛事道具改变通知
  940. if not self.m_isShowBoard then
  941. self.m_layerFloat:setWarnVisible(true)
  942. self.m_layerFloat:setFloatOut(true)
  943. end
  944. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  945. local selMatchID = G_EapSdkMgr:getSelMatchID()
  946. if selMatchID == "" then
  947. for k,v in pairs(G_EapSdkMgr.m_matchInfos) do
  948. selMatchID = k
  949. break
  950. end
  951. end
  952. if selMatchID == __data.MatchID then
  953. if self.m_curSubSel == LAYER_ENUM.LAYER_DAILY_GAME then
  954. G_EapSocketLogin.request_MatchRoundGet(__data.MatchID)
  955. else
  956. self.m_needRefreshDaily = true
  957. end
  958. if self.m_curSel == LAYER_ENUM.LAYER_MATCH then
  959. G_EapSocketLogin.request_userMatchInfoGet(__data.MatchID)
  960. else
  961. self.m_needRefreshMatch = true --需要刷新自己赛事排行
  962. end
  963. G_EapSocketLogin.request_UserRedCashGet(selMatchID)
  964. end
  965. elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  966. if #G_EapSdkMgr.m_selTeamInfos > 0 then
  967. local selMatchID = G_EapSdkMgr.m_selTeamInfos[1].matchId
  968. local teamID = G_EapSdkMgr.m_selTeamInfos[1].id
  969. if selMatchID == __data.MatchID then
  970. if self.m_curSubSel == LAYER_ENUM.LAYER_TEAM_DAILY then
  971. for i=1,3 do
  972. G_EapSocketLogin.request_PointTeamDayGet(teamID, selMatchID, i-1, 10)
  973. end
  974. else
  975. self.m_needRefreshDaily = true
  976. end
  977. if self.m_curSel == LAYER_ENUM.LAYER_TEAM then
  978. G_EapSocketLogin.request_teamMatchRankGet(selMatchID, teamID, 0, 0, 1)
  979. else
  980. self.m_needRefreshMatch = true --需要刷新自己战队的赛事信息
  981. end
  982. end
  983. end
  984. end
  985. elseif (OpcodeUserItemChangeNotify == __opcode) then --玩家道具变化通知
  986. if self.m_layerInfo then
  987. self.m_layerInfo:refreshBattleScore()
  988. end
  989. if self.m_layerStore then
  990. self.m_layerStore:refreshBattleScore()
  991. end
  992. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  993. if self.m_layerMatch then
  994. self.m_layerMatch:refreshBattleScore()
  995. end
  996. elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  997. if self.m_layerTeam then
  998. self.m_layerTeam:refreshBattleScore()
  999. end
  1000. end
  1001. elseif (OpcodeNotifyHookAck == __opcode) then --战队通知
  1002. if __data.type == "SelectTeamChange" then --战队成员变化
  1003. G_EapSocketLogin.request_UserSelectTeamReq()
  1004. elseif __data.type == "TaskCompleted" then --任务完成通知
  1005. if self.m_layerTeam then
  1006. self.m_layerTeam:refreshTaskTip(true)
  1007. end
  1008. end
  1009. elseif (OpcodeGetUserDescAck == __opcode) then --玩家道具信息
  1010. if EAP_MATCH_STAGE == EAP_STAGE_SCORE then
  1011. if self.m_layerMatch then
  1012. self.m_layerMatch:refreshBattleScore()
  1013. end
  1014. elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  1015. if self.m_layerTeam then
  1016. self.m_layerTeam:refreshBattleScore()
  1017. end
  1018. end
  1019. elseif (OpcodeTeamDetailAck == __opcode) then --战队详情
  1020. if __data.retCode == 0 then
  1021. if self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_READY then
  1022. self.m_layerPlatformReady:refreshTeamInfo(__data.TeamID)
  1023. self.m_layerPlatformReady:refreshSelfInfo()
  1024. elseif self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_MATCH then
  1025. self.m_layerPlatformMatch:refreshTeamInfo(__data.TeamID)
  1026. end
  1027. end
  1028. elseif (OpcodeTeamMemberAck == __opcode) then --战队成员
  1029. if __data.retCode == 0 then
  1030. if self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES then
  1031. self.m_layerPlatformTeamDes:refreshMemInfo()
  1032. end
  1033. end
  1034. elseif (OpcodePointTeamDayAck == __opcode) then --战队积分赛当天数据获取
  1035. if __data.nRet == 0 then
  1036. if __data.PageNum == 2 then
  1037. if self.m_layerTeamDaily then
  1038. self.m_layerTeamDaily:refreshRankList()
  1039. end
  1040. end
  1041. end
  1042. elseif (OpcodeUserRedCashAck == __opcode) then --获取自己的红包
  1043. if __data.nRet == 0 then
  1044. if self.m_layerMatch then
  1045. self.m_layerMatch:refreshRedInfo()
  1046. end
  1047. if self.m_layerEnd then
  1048. self.m_layerEnd:refreshRedInfo()
  1049. end
  1050. if self.m_layerInfo then
  1051. self.m_layerInfo:refreshRedInfo()
  1052. end
  1053. end
  1054. elseif (OpcodeUserRedChangeAck == __opcode) then --获取红包记录
  1055. if __data.nRet == 0 and __data.Type == 2 then
  1056. if self.m_layerMatch then
  1057. self.m_layerMatch:refreshRedList()
  1058. end
  1059. end
  1060. elseif (OpcodeItemExChangeAck == __opcode) then --红包兑换
  1061. if __data.nRet == 0 then
  1062. local selMatchID = G_EapSdkMgr:getSelMatchID()
  1063. if selMatchID ~= "" then
  1064. G_EapSocketLogin.request_UserRedCashGet(selMatchID)
  1065. end
  1066. end
  1067. elseif (OpcodeCheckTaskAck == __opcode) then --查询任务列表
  1068. if __data.nRet == 0 then
  1069. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  1070. if G_EapSdkMgr.m_isMatching then
  1071. if self.m_layerInfo then
  1072. self.m_layerInfo:refreshPerAwardList()
  1073. self.m_layerInfo:refreshTeamAward()
  1074. end
  1075. if self.m_layerTeam then
  1076. self.m_layerTeam:refreshTaskTip()
  1077. end
  1078. end
  1079. end
  1080. end
  1081. elseif (OpcodeGetAwardAck == __opcode) then --领取任务奖励
  1082. if __data.nRet == 0 then
  1083. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  1084. if self.m_layerInfo then
  1085. self.m_layerInfo:showGetAward(__data.result)
  1086. end
  1087. end
  1088. end
  1089. end
  1090. end
  1091. function LayerMain:dealFirstLogin()
  1092. -- if G_EapSdkMgr.m_firstLogin then
  1093. if G_EapSdkMgr:checkDailyFirst() then
  1094. self:showBoard(true)
  1095. self.m_layerFloat:setFloatOut(false)
  1096. self.m_layerFloat:setWarnVisible(false)
  1097. G_EapSocketLogin.request_markLog(MARK_LOG11001)
  1098. else
  1099. self:showBoard(false)
  1100. self.m_layerFloat:setFloatOut(true)
  1101. self.m_layerFloat:setWarnVisible(true)
  1102. end
  1103. end
  1104. return LayerMain