|
- local DEEP_COL1 = cc.c3b(0xff, 0xff, 0xff)
- local WEAK_COL1 = cc.c3b(0xeb, 0xda, 0xa9)
- local RED_COL1 = cc.c3b(0xd5, 0x31, 0x2f)
- local BG_W = 564
- local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer")
- local LayerEnd = EapClass("LayerEnd", BaseLayer)
-
- function LayerEnd.createWithData(__node, __zorder)
- local layer = LayerEnd.new()
- layer.m_parent = __node
- __node:addChild(layer, __zorder)
- return layer
- end
-
- function LayerEnd:myShow()
- -- self:addListener(true)
- self:initData()
- self:initUI()
- end
-
- function LayerEnd:myClose()
-
- end
-
- function LayerEnd:initData()
- self.m_sel = true
- end
-
- function LayerEnd:initUI()
- self.imgPath = {
- "res/ModuleEapSdk/eapsdk_img_null.png",
- "res/ModuleEapSdk/eapsdk_public_back_bg2.png",
- "res/ModuleEapSdk/eapsdk_public_back_bg3.png",
- "res/ModuleEapSdk/eapsdk_bg_bj_sp1.png",
- "res/ModuleEapSdk/eapsdk_bt_xb_sp.png", --5
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_title.png",
- "res/ModuleEapSdk/eapsdk_wj_icon_question.png",
- "res/ModuleEapSdk/eapsdk_wj_btn_lingjiang.png",
- "res/ModuleEapSdk/eapsdk_wj_icon_question_off.png", --赛事规则off
- "res/ModuleEapSdk/Eap_Red/eapsdk_redpack_bj02.png", --10
- "res/ModuleEapSdk/eapsdk_store_btnDeal_off.png",
- "res/ModuleEapSdk/eapsdk_store_btnDeal_on.png",
- "res/ModuleEapSdk/eapsdk_img_icon.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_arrow.png",
- }
-
- local fix_x = display.width
- local fix_y = display.cy
- local imgBack2 = G_EapAbbreviation.createImageView(self.imgPath[1], self, cc.p(fix_x, fix_y+45), true, 2, 2101, cc.p(1, 0.5))
- imgBack2:setSize(cc.size(BG_W, 510))
- self.imgBack2 = imgBack2
-
- self.lblCDTime = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(BG_W/2, 350), "", 22, DEEP_COL1)
-
- self.btnDes = ccui.ImageView:create(self.imgPath[9])
- self.btnDes:setPosition(cc.p(62, 410))
- self.btnDes:setScale(0.6)
- imgBack2:addChild(self.btnDes)
- addButtonListener(self.btnDes, function()
- print("LayerMatch btnDes clicked === ")
-
- if G_LayerMain:isSubLayerVis(LAYER_ENUM.LAYER_RULE) then
- G_LayerMain:closeSubLayer(LAYER_ENUM.LAYER_RULE)
- self.btnDes:loadTexture(self.imgPath[9])
- else
- for k,v in pairs(G_EapSdkMgr.m_matchInfos) do
- local matchID = k
- if not G_EapSdkMgr.m_matchRule and matchID then
- G_EapSocketLogin.request_matchRuleGet(matchID)
- end
- break
- end
- G_LayerMain:showSubLayer(LAYER_ENUM.LAYER_RULE)
- self.btnDes:loadTexture(self.imgPath[7])
- end
- end)
-
- local title = "赛事结束,线下赛即将开启"
- G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(BG_W/2, 300+30), title, 26, DEEP_COL1, true)
-
- self.btnGo = ccui.Button:create(self.imgPath[8])
- self.btnGo:setPosition(cc.p(BG_W/2, 45))
- self.btnGo:setScale(0.6)
- self.btnGo:setVisible(false)
- imgBack2:addChild(self.btnGo)
-
- addButtonListener(self.btnGo, function()
- local saveMatchID = G_EapSdkMgr:getSelMatchID()
- local maxMatch = G_EapSdkMgr:getSelfRankByID(saveMatchID)
- local rank = maxMatch and maxMatch.Rank or 1200
-
- if rank > 32 then
- G_EapSocketLogin.request_markLog(MARK_LOG11014)
- G_EapSocketLogin.request_ItemExChangeGet(saveMatchID)
- elseif rank >= 1 then
- G_EapSocketLogin.request_markLog(MARK_LOG11013, tostring(self.m_sel))
- local redNum = self.lblRedNumIn32:getString()
- G_EapSdkMgr:setRedAward(redNum)
- self:refreshRedInfo()
- end
- end)
-
- self:initSignNode()
- end
-
- --已报名排名处理
- function LayerEnd:initSignNode()
- local redInfo = G_EapSdkMgr.m_redInfo
- local saveMatchID = G_EapSdkMgr:getSelMatchID()
- local maxMatch = G_EapSdkMgr:getSelfRankByID(saveMatchID)
- local rank = maxMatch and maxMatch.Rank or 1200
-
- self.node_in32 = cc.Node:create()
- self.imgBack2:addChild(self.node_in32) --32强
- self.node_out32 = cc.Node:create()
- self.imgBack2:addChild(self.node_out32)
-
- -----------------------------------------------------------------------------------------
- self.imgRedIn32 = G_EapAbbreviation.createImageView(self.imgPath[10], self.node_in32, cc.p(BG_W/2, 115+90))
- self.imgRedIn32:setScale(0.6)
- local title11 = self:getAwardByRank(rank)
- if self.m_sel then
- title11 = title11 + 300
- end
- self.lblRedNumIn32 = G_EapAbbreviation.createSystemLabel(self.imgRedIn32, cc.p(60, 130), title11, 25, RED_COL1, true)
-
- self.btnSel = ccui.ImageView:create(self.imgPath[12])
- self.btnSel:setPosition(cc.p(BG_W/2 - 160, 75+20))
- self.btnSel:setScale(0.6)
- self.node_in32:addChild(self.btnSel)
-
- addButtonListener(self.btnSel, function()
- local money = self:getAwardByRank(rank)
- if self.m_sel then
- self.btnSel:loadTexture(self.imgPath[11])
- else
- money = money + 300
- self.btnSel:loadTexture(self.imgPath[12])
- end
- self.lblRedNumIn32:setString(money)
- self.m_sel = not self.m_sel
- end)
- -----------------------------------------------------------------------------------------
- self.imgRedOut32 = G_EapAbbreviation.createImageView(self.imgPath[10], self.node_out32, cc.p(BG_W/2-150, 115+50))
- self.imgRedOut32:setScale(0.6)
- local money1 = redInfo and redInfo.Money or 0
- local title21 = string.format("%.2f", money1)
- self.lblRedNumOut32 = G_EapAbbreviation.createSystemLabel(self.imgRedOut32, cc.p(60, 130), title21, 25, RED_COL1, true)
-
- self.imgArrow = G_EapAbbreviation.createImageView(self.imgPath[14], self.node_out32, cc.p(BG_W/2, 115+50))
- self.imgArrow:setScale(0.6)
-
- self.imgJZ = G_EapAbbreviation.createImageView(self.imgPath[13], self.node_out32, cc.p(BG_W/2+100, 115+50))
- local jzNum = math.floor(money1) * 10
- self.lblJZNum = G_EapAbbreviation.createSystemLabel(self.node_out32, cc.p(BG_W/2+130, 115+50), jzNum, 30, RED_COL1, true, display.LEFT)
- self.lblJZNum:setAnchorPoint(cc.p(0, 0.5))
- -----------------------------------------------------------------------------------------
-
- local title1 = "最终排名第"..rank.."名"
- self.lblRank = G_EapAbbreviation.createSystemLabel(self.imgBack2, cc.p(BG_W/2, 215+70), title1, 30, WEAK_COL1, true)
-
- local title2 = "您将获得 赛事奖金"
- self.lblAward1 = G_EapAbbreviation.createSystemLabel(self.imgBack2, cc.p(BG_W/2, 115+90), title2, 30, WEAK_COL1, true)
-
- local title3 = "同意参加,其中300元为线下参赛补贴"
- self.lblAward2 = G_EapAbbreviation.createSystemLabel(self.imgBack2, cc.p(BG_W/2, 75+20), title3, 16, DEEP_COL1)
-
- local title4 = "未获得线下赛资格,关注后续赛事取得好成绩!"
- self.lblAward3 = G_EapAbbreviation.createSystemLabel(self.imgBack2, cc.p(BG_W/2, 115+130), title4, 18, WEAK_COL1)
-
- self:refreshRedInfo()
- end
-
- function LayerEnd:refreshRedInfo()
- local redInfo = G_EapSdkMgr.m_redInfo
- local saveMatchID = G_EapSdkMgr:getSelMatchID()
- local maxMatch = G_EapSdkMgr:getSelfRankByID(saveMatchID)
- local rank = maxMatch and maxMatch.Rank or 1200
- local title1 = "最终排名第"..rank.."名"
- self.lblRank:setString(title1)
-
- local title11 = self:getAwardByRank(rank)
- if self.m_sel then
- title11 = title11 + 300
- end
- self.lblRedNumIn32:setString(title11)
-
- local money1 = redInfo and redInfo.Money or 0
- local title21 = string.format("%.2f", money1)
- self.lblRedNumOut32:setString(title21)
-
- local jzNum = math.floor(money1) * 10
- self.lblJZNum:setString(jzNum)
-
- local title3 = "同意参加,其中300元为线下参赛补贴"
- local title5 = "将会有工作人员电话联系您沟通奖金发放事宜,请确保电话畅通!"
- local title6 = "赛事红包转换为奖章可在商城中兑换商品"
-
- if not G_EapSdkMgr.m_pointSelGameID then
- self.node_in32:setVisible(false)
- self.node_out32:setVisible(false)
- self.btnGo:setVisible(false)
-
- self.lblRank:setVisible(false)
- self.lblAward2:setVisible(false)
- self.lblAward1:setVisible(false)
- self.lblAward3:setVisible(true)
- else
- self.lblRank:setVisible(true)
- self.lblAward2:setVisible(true)
- self.btnGo:setVisible(true)
- if rank > 32 then
- self.node_in32:setVisible(false)
- self.node_out32:setVisible(true)
- self.lblAward1:setVisible(false)
- self.lblAward3:setVisible(true)
- self.lblAward2:setString(title6)
-
- if not redInfo or (redInfo and redInfo.ExchangeTime) then --已领取
- self.node_out32:setVisible(false)
- self.btnGo:setVisible(false)
- self.lblAward2:setVisible(false)
- end
- elseif rank >=1 then
- self.node_in32:setVisible(true)
- self.node_out32:setVisible(false)
- self.lblAward1:setVisible(true)
- self.lblAward3:setVisible(false)
- local redAward = G_EapSdkMgr:getRedAward()
- if redAward ~= "" then
- self.btnSel:setVisible(false)
- self.lblAward2:setString(title5)
- self.btnGo:setVisible(false)
- end
- end
- end
- end
-
- function LayerEnd:refreshRank()
- local saveMatchID = G_EapSdkMgr:getSelMatchID()
- local maxMatch = G_EapSdkMgr:getSelfRankByID(saveMatchID)
-
- local rank = maxMatch and maxMatch.Rank or 1200
- local title1 = ""
- if rank > 32 then
- title1 = "您尚未获得线下赛资格,可关注后续更多赛事取得好成绩!"
- elseif rank >=1 then
- title1 = "最终排名第"..rank.."名,您已获得线下赛资格,我们将通过电话联系您!"
- end
- if not G_EapSdkMgr.m_pointSelGameID then
- title1 = "您尚未获得线下赛资格,可关注后续更多赛事取得好成绩!"
- end
- self.lblRank:setString(title1)
- end
-
- function LayerEnd:getAwardByRank(__rank)
- local resNum = 0
- if __rank == 1 then
- resNum = 1000
- elseif __rank == 2 then
- resNum = 700
- elseif __rank == 3 then
- resNum = 600
- elseif __rank == 4 then
- resNum = 500
- elseif __rank == 5 then
- resNum = 400
- elseif __rank == 6 then
- resNum = 300
- elseif __rank >= 7 and __rank <= 32 then
- resNum = 200
- end
- return resNum
- end
-
- return LayerEnd
|