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.

168 lines
5.6 KiB

  1. local DEEP_COL1 = cc.c3b(0x0b, 0x2d, 0x67)
  2. local WEAK_COL1 = cc.c3b(0x91, 0x00, 0x00)
  3. local BG_W = 332
  4. local BG_H = 600
  5. local scheduler = require("luaScript.ModuleEapSdk.SdkSocket.scheduler")
  6. local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer")
  7. local LayerDailyGame = EapClass("LayerDailyGame", BaseLayer)
  8. function LayerDailyGame.createWithData(__node, __zorder)
  9. local layer = LayerDailyGame.new()
  10. layer.m_parent = __node
  11. __node:addChild(layer, __zorder)
  12. return layer
  13. end
  14. function LayerDailyGame:myShow()
  15. -- self:addListener(true)
  16. self:initData()
  17. self:initUI()
  18. end
  19. function LayerDailyGame:myClose()
  20. end
  21. function LayerDailyGame:initData()
  22. self.scrollView = nil
  23. end
  24. function LayerDailyGame:initUI()
  25. self.imgPath = {
  26. "res/ModuleEapSdk/eapsdk_img_null.png",
  27. "res/ModuleEapSdk/eapsdk_public_back_bg6.png",
  28. "res/ModuleEapSdk/eapsdk_public_back_bg4.png",
  29. "res/ModuleEapSdk/eapsdk_bg_bj_sp1.png",
  30. "res/ModuleEapSdk/eapsdk_img_matchIcon.png", --5
  31. "res/ModuleEapSdk/eapsdk_rule_img_title.png",
  32. "res/ModuleEapSdk/eapsdk_img_leftBG.png",
  33. "res/ModuleEapSdk/eapsdk_rule_img_title2.png",
  34. "res/ModuleEapSdk/Eap_Score/eapsdk_img_dailylistTitle.png",
  35. "res/ModuleEapSdk/Eap_Score/eapsdk_img_dailylistBG.png", --10
  36. }
  37. local fix_x = display.width
  38. local fix_y = display.cy
  39. local imgBack2 = G_EapAbbreviation.createImageView(self.imgPath[1], self, cc.p(fix_x-896, fix_y), true, 0, 4101, cc.p(0, 0.5))
  40. imgBack2:setSize(cc.size(BG_W, BG_H))
  41. self.imgBack2 = imgBack2
  42. local imgBack3 = G_EapAbbreviation.createImageView(self.imgPath[7], imgBack2, cc.p(0, 0), false, 0, 4101, cc.p(0, 0))
  43. imgBack3:setScale(0.6)
  44. local imgTitle = G_EapAbbreviation.createImageView(self.imgPath[5], imgBack2, cc.p(BG_W/4+10, BG_H-30), false, 3, 4101, cc.p(0.5, 1))
  45. imgTitle:setScale(0.4)
  46. self.imgTitleRule = G_EapAbbreviation.createImageView(self.imgPath[8], imgBack2, cc.p(3*BG_W/4-10, BG_H-70), false, 3, 4101, cc.p(0.5, 1))
  47. self.imgTitleRule:setScale(0.6)
  48. local title = "今日比赛详情"
  49. local lblTitle = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(3*BG_W/4-5, BG_H-40), title, 24, WEAK_COL1, true)
  50. lblTitle:setAnchorPoint(cc.p(0.5, 1))
  51. local imgBack4 = G_EapAbbreviation.createImageView(self.imgPath[9], imgBack2, cc.p(BG_W/2, BG_H-130), false, 4, 3103, cc.p(0.5, 1))
  52. imgBack4:setScale(0.6)
  53. self:refreshIcon()
  54. end
  55. function LayerDailyGame:refreshRankList(__matchID)
  56. local __datas = G_EapSdkMgr.m_matchRound[__matchID]
  57. if __datas then
  58. table.sort(__datas, function(a,b)
  59. local rank_a = a.UpTime or 0 --赛程积分
  60. local rank_b = b.UpTime or 0
  61. return rank_a > rank_b
  62. end)
  63. end
  64. if self.scrollView then
  65. self.scrollView:destroySelf()
  66. self.scrollView = nil
  67. end
  68. if not __datas then
  69. return
  70. end
  71. local EapListView = require("luaScript.ModuleEapSdk.GameTools.EapListView")
  72. self.scrollView = EapListView.createWithData(self.imgBack2, self)
  73. local params = {
  74. scrl_h = 350+60, -- 外框高度
  75. scrl_w = 288, -- 外框宽度
  76. inner_h = 350+60, -- 内容器高度
  77. item_h = 40, -- 元素高度
  78. }
  79. self.scrollView:setScrlParam(params)
  80. self.scrollView:setPosition(cc.p(22, 5))
  81. self.scrollView:refreshRankList(__datas)
  82. end
  83. function LayerDailyGame:initItemInfo(itemNode, info)
  84. local item_h = 40
  85. info = info or {}
  86. local init_x = 48
  87. info = info or {}
  88. itemNode.m_id = info.PID
  89. --排名
  90. local upTime = info.UpTime or 0
  91. local curScore = info.Score or 0
  92. local imgItemBG = G_EapAbbreviation.createImageView(self.imgPath[10], itemNode, cc.p(288/2, item_h/2))
  93. imgItemBG:setScale(0.6)
  94. local timeArr = string.split(upTime, " ")
  95. --时间
  96. itemNode.lblTime1 = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x, 20), "", 15, DEEP_COL1)
  97. itemNode.lblTime2 = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2, 20), "", 16, DEEP_COL1)
  98. if upTime ~= 0 then
  99. upTime = EapFormatTime(upTime, 1)
  100. local timeArr = string.split(upTime, " ")
  101. local title2 = timeArr[1]
  102. itemNode.lblTime1:setString(title2)
  103. local title4 = timeArr[2]
  104. itemNode.lblTime2:setString(title4)
  105. end
  106. --赛程分
  107. local title3 = curScore
  108. itemNode.lblScore = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2*2, 20), title3, 16, DEEP_COL1)
  109. end
  110. function LayerDailyGame:refreshItemInfo(itemNode, info, index)
  111. if not itemNode or not index or not info then
  112. return
  113. end
  114. itemNode.m_id = info.PID
  115. itemNode.infoIndex = index --数据索引
  116. itemNode.m_info = info
  117. --排名
  118. local upTime = info.UpTime or 0
  119. local curScore = info.Score or 0
  120. if upTime ~= 0 then
  121. upTime = EapFormatTime(upTime, 1)
  122. end
  123. local timeArr = string.split(upTime, " ")
  124. --时间
  125. local title2 = timeArr[1]
  126. itemNode.lblTime1:setString(title2)
  127. local title4 = timeArr[2]
  128. itemNode.lblTime2:setString(title4)
  129. --赛程分
  130. local title3 = curScore
  131. itemNode.lblScore:setString(title3)
  132. end
  133. function LayerDailyGame:refreshIcon()
  134. local iconInfo1006 = G_EapSdkMgr:getIconInfo(CONFIG_IMG_1006) --赛事规则
  135. if iconInfo1006 then
  136. local url = iconInfo1006.paths[1]
  137. local saveName = iconInfo1006.categoryId..tostring(iconInfo1006.updateTime)
  138. getUserImage(url, saveName, self.imgTitleRule, cc.size(184, 24))
  139. end
  140. end
  141. return LayerDailyGame