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.

144 lines
5.7 KiB

  1. local DEEP_COL1 = cc.c3b(0xff, 0xff, 0xff)
  2. local WEAK_COL1 = cc.c3b(0xd9, 0xf6, 0xff)
  3. local BG_W = 564
  4. local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer")
  5. local LayerUserInfo = EapClass("LayerUserInfo", BaseLayer)
  6. function LayerUserInfo.createWithData(__node, __zorder)
  7. local layer = LayerUserInfo.new()
  8. layer.m_parent = __node
  9. __node:addChild(layer, __zorder)
  10. return layer
  11. end
  12. function LayerUserInfo:myShow()
  13. -- self:addListener(true)
  14. self:initData()
  15. self:initUI()
  16. end
  17. function LayerUserInfo:myClose()
  18. end
  19. function LayerUserInfo:initData()
  20. self.m_needRefresh = true
  21. end
  22. function LayerUserInfo:initUI()
  23. self.imgPath = {
  24. "res/ModuleEapSdk/eapsdk_public_back_bg1.png",
  25. "res/ModuleEapSdk/eapsdk_public_back_bg6.png",
  26. "res/ModuleEapSdk/eapsdk_public_back_bg8.png",
  27. "res/ModuleEapSdk/eapsdk_wj_default_head.png",
  28. "res/ModuleEapSdk/eapsdk_public_back_bg9.png", --5
  29. "res/ModuleEapSdk/eapsdk_img_kefu.png",
  30. "res/ModuleEapSdk/eapsdk_img_mail.png",
  31. "res/ModuleEapSdk/eapsdk_img_icon.png", --奖章
  32. "res/ModuleEapSdk/Eap_Team/eapsdk_team_changeAccount.png", --切换账号
  33. }
  34. local fix_x = display.width
  35. local fix_y = display.cy
  36. local imgBack2 = G_EapAbbreviation.createImageView(self.imgPath[2], self, cc.p(fix_x-15, fix_y), true, 2, 3101, cc.p(1, 0.5))
  37. imgBack2:setSize(cc.size(BG_W-30, 580))
  38. -- local imgBack3 = G_EapAbbreviation.createImageView(self.imgPath[5], imgBack2, cc.p(0, 400), true, 2, 3101, cc.p(0, 1))
  39. -- imgBack3:setSize(cc.size(BG_W-30, 55))
  40. -- local imgBack5 = G_EapAbbreviation.createImageView(self.imgPath[5], imgBack2, cc.p(0, 300), true, 2, 3101, cc.p(0, 1))
  41. -- imgBack5:setSize(cc.size(BG_W-30, 55))
  42. local imgBack4 = G_EapAbbreviation.createImageView(self.imgPath[3], imgBack2, cc.p(0, 580), true, 2, 3101, cc.p(0, 1))
  43. imgBack4:setSize(cc.size(BG_W-30, 139))
  44. self.imgHead = ccui.ImageView:create(self.imgPath[4])
  45. self.imgHead:setScale(0.9)
  46. self.imgHead:setPosition(cc.p(90, 71))
  47. imgBack4:addChild(self.imgHead)
  48. local deepCol = cc.c3b(0x1e, 0x23, 0x36)
  49. local normCol = cc.c3b(0x7a, 0x7a, 0x7a)
  50. local title = G_EapSdkMgr.NickName or "游戏昵称"
  51. if G_EapLabelTool.GetUTF8StrNums( title ) > 22 then
  52. title = G_EapLabelTool.GetUTF8StrByIdxNumEx(title, 22)
  53. title = title..".."
  54. end
  55. self.lblName = G_EapAbbreviation.createSystemLabel(imgBack4, cc.p(180, 90), title, 25, WEAK_COL1, true, display.LEFT)
  56. self.lblName:setAnchorPoint(cc.p(0, 0.5))
  57. local id = G_EapSdkMgr.UserId and "赛事ID:"..G_EapSdkMgr.UserId or "赛事ID:"
  58. self.lblID = G_EapAbbreviation.createSystemLabel(imgBack4, cc.p(180, 42), id, 22, DEEP_COL1, true, display.LEFT)
  59. self.lblID:setAnchorPoint(cc.p(0, 0.5))
  60. --奖章
  61. local imgJZ = G_EapAbbreviation.createSprite(self.imgPath[8], imgBack4, cc.p(350, 42))
  62. imgJZ:setScale(0.6)
  63. local myItem = G_EapSdkMgr:getItem(ITEM_TYPE.INTEGRAL)
  64. local scoreNum = myItem and myItem.nNum or 0
  65. local score = scoreNum
  66. self.lblScore = G_EapAbbreviation.createSystemLabel(imgBack4, cc.p(370, 42), score, 22, DEEP_COL1, false, display.LEFT)
  67. self.lblScore:setAnchorPoint(cc.p(0, 0.5))
  68. if EAP_MATCH_STAGE == EAP_STAGE_TEAM then
  69. -- --切换账号
  70. -- local tip1 = "若此赛事ID和第一电竞app账号不一致,请切换账号。"
  71. -- local lblTips = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(BG_W/2, 162), tip1, 18, DEEP_COL1)
  72. -- self.btnAccount = ccui.Button:create(self.imgPath[9])
  73. -- self.btnAccount:setPosition(cc.p(BG_W/2, 120))
  74. -- self.btnAccount:setScale(0.6)
  75. -- imgBack2:addChild(self.btnAccount)
  76. -- addButtonListener(self.btnAccount, function()
  77. -- G_LayerMain:showLayer(LAYER_ENUM.LAYER_ACNT_CODE)
  78. -- end)
  79. end
  80. -- local imgKefu = ccui.ImageView:create(self.imgPath[6])
  81. -- imgKefu:setScale(0.6)
  82. -- imgKefu:setPosition(cc.p(50, 25))
  83. -- imgBack3:addChild(imgKefu)
  84. -- local qqID = "客服QQ:553016356"
  85. -- local lblKefu = G_EapAbbreviation.createSystemLabel(imgBack3, cc.p(100, 25), qqID, 22, DEEP_COL1, true, display.LEFT)
  86. -- lblKefu:setAnchorPoint(cc.p(0, 0.5))
  87. -- local imgMail = ccui.ImageView:create(self.imgPath[7])
  88. -- imgMail:setScale(0.6)
  89. -- imgMail:setPosition(cc.p(50, 25))
  90. -- imgBack5:addChild(imgMail)
  91. -- local mailID = "邮箱:cscest@microbeam.cn"
  92. -- local lblMail = G_EapAbbreviation.createSystemLabel(imgBack5, cc.p(100, 25), mailID, 22, DEEP_COL1, true, display.LEFT)
  93. -- lblMail:setAnchorPoint(cc.p(0, 0.5))
  94. if G_EapSdkMgr.UserId then
  95. self.m_needRefresh = false
  96. getUserImage(G_EapSdkMgr.HeadImgUrl, G_EapSdkMgr.UserId, self.imgHead, cc.size(130, 130), true)
  97. end
  98. end
  99. function LayerUserInfo:refreshBattleScore()
  100. local myItem = G_EapSdkMgr:getItem(ITEM_TYPE.INTEGRAL)
  101. local scoreNum = myItem and myItem.nNum or 0
  102. local score = scoreNum
  103. self.lblScore:setString(score)
  104. end
  105. function LayerUserInfo:refreshMyInfo(__force)
  106. if __force or self.m_needRefresh then
  107. local title = G_EapSdkMgr.NickName or "游戏昵称"
  108. if G_EapLabelTool.GetUTF8StrNums( title ) > 22 then
  109. title = G_EapLabelTool.GetUTF8StrByIdxNumEx(title, 22)
  110. title = title..".."
  111. end
  112. self.lblName:setString(title)
  113. local id = G_EapSdkMgr.UserId and "赛事ID:"..G_EapSdkMgr.UserId or "赛事ID:"
  114. self.lblID:setString(id)
  115. if G_EapSdkMgr.UserId then
  116. self.m_needRefresh = false
  117. getUserImage(G_EapSdkMgr.HeadImgUrl, G_EapSdkMgr.UserId, self.imgHead, cc.size(130, 130), true)
  118. end
  119. end
  120. end
  121. return LayerUserInfo