|
- local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer")
- local LayerTeamRule = class("LayerTeamRule", BaseLayer)
-
- function LayerTeamRule.createWithData(__node, __zorder)
- local layer = LayerTeamRule.new()
- layer.m_parent = __node
- __node:addChild(layer, __zorder)
- return layer
- end
-
- function LayerTeamRule:myShow()
- -- self:addListener(true)
- self:initUI()
- end
-
- function LayerTeamRule:myClose()
-
- end
-
- function LayerTeamRule:initUI()
- self.imgPath = {
- "res/ModuleEapSdk/eapsdk_public_back_bg1.png",
- "res/ModuleEapSdk/eapsdk_public_back_bg2.png",
- "res/ModuleEapSdk/eapsdk_public_back_bg3.png",
- "res/ModuleEapSdk/eapsdk_bt_xb_sp.png",
- "res/ModuleEapSdk/eapsdk_wj_icon_decor.png",
- "res/ModuleEapSdk/eapsdk_wj_btn_back.png",
- "res/ModuleEapSdk/eapsdk_button_dx.png",
- "res/ModuleEapSdk/eapsdk_bg_bj_sp1.png",
- "res/ModuleEapSdk/eapsdk_btn_rule1.png",
- "res/ModuleEapSdk/eapsdk_btn_rule2.png",
- "res/ModuleEapSdk/eapsdk_btn_award1.png",
- "res/ModuleEapSdk/eapsdk_btn_award2.png",
- }
-
- local fix_x = display.width
- local fix_y = display.cy
- local imgBack2 = G_EapAbbreviation.createImageView(self.imgPath[2], self, cc.p(fix_x-10, fix_y+40), true, 2, 4101, cc.p(1, 0.5))
- imgBack2:setSize(cc.size(530, 500))
- self.imgBack2 = imgBack2
-
- local imgArrow1 = G_EapAbbreviation.createImageView(self.imgPath[5], imgBack2, cc.p(132, 468), false)
- local imgArrow2 = G_EapAbbreviation.createImageView(self.imgPath[4], imgBack2, cc.p(398, 468), false)
- imgArrow1:setScale(0.585)
- imgArrow2:setScale(0.585)
-
- local title = "规则和奖励"
- G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(265, 468), title, 28, cc.c3b(0xc8, 0xa8, 0x88), true)
-
- self.btnBack = ccui.Button:create(self.imgPath[6])
- self.btnBack:setPosition(cc.p(30, 470))
- imgBack2:addChild(self.btnBack)
-
- addButtonListener(self.btnBack, function()
- print("LayerTeamRule btnBack clicked === ")
- if G_EapSdkMgr.m_isMatching then
- self.m_parent.m_parent:showLayer(LAYER_ENUM.LAYER_TEAM)
- else
- self.m_parent.m_parent:showLayer(LAYER_ENUM.LAYER_TEAM_END)
- end
- end)
-
- self.node_rule = cc.Node:create()
- self.node_award = cc.Node:create()
- self.node_rule:setPosition(cc.p(265, 400))
- self.node_award:setPosition(cc.p(265, 400))
- imgBack2:addChild(self.node_award)
- imgBack2:addChild(self.node_rule)
-
- local btnMenus = G_EapAbbreviation.createMenu(imgBack2, 1, 1200, cc.p(265, 428))
- local params1 = {self.imgPath[9], self.imgPath[10]}
- self.btnRule = G_EapAbbreviation.createItemAll(params1, btnMenus, cc.p(-137.5, 0), function()
- print("self.btnRule clicked ========= ")
- self.btnRule:setEnabled(false)
- self.btnAward:setEnabled(true)
- self:showNode(1)
-
- end)
- local params2 = {self.imgPath[11], self.imgPath[12]}
- self.btnAward = G_EapAbbreviation.createItemAll(params2, btnMenus, cc.p(137.5, 0), function()
- print("self.btnAward clicked ========= ")
- self.btnRule:setEnabled(true)
- self.btnAward:setEnabled(false)
- self:showNode(2)
- end)
- self.btnRule:setEnabled(false)
- self.btnAward:setEnabled(true)
-
- self:showNode(1)
- self:refreshRuleInfo()
- end
-
- function LayerTeamRule:showNode(__index)
- if __index == 1 then
- self.node_rule:setVisible(true)
- self.node_award:setVisible(false)
- elseif __index == 2 then
- self.node_rule:setVisible(false)
- self.node_award:setVisible(true)
- end
- end
-
- function LayerTeamRule:refreshRuleInfo(__datas)
- __datas = __datas or {["result"]={
- ["prizeRegulars"]={
- {["top"]="1",["prizeList"]={"SCORE","SPORT"},["prizeMap"]={["regular"]="10积分+5竞技分"},["startNo"]="1",["topName"]="第一名",["endNo"]="1"},
- {["top"]="2",["prizeList"]={"SCORE"},["prizeMap"]={["regular"]="5积分"},["startNo"]="2",["topName"]="第二名",["endNo"]="3"},
- {["top"]="3",["prizeList"]={"SCORE"},["prizeMap"]={["regular"]="1积分"},["startNo"]="4",["topName"]="第三名",["endNo"]="5"},
- },
- -- ["desc"]="<p style=\"white-space: normal;\"><span style=\"color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Arial; text-indent: 32px; background-color: rgb(255, 255, 255);\">2021 CEST四川麻将赛季锦标赛,分为积分赛、海选赛、决赛三个阶段。积分赛规则如下:</span></p><p style=\"white-space: normal;\"><span style=\"color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Arial; text-indent: 32px; background-color: rgb(255, 255, 255);\">1.积分赛采用线上赛形式,玩家只需对局指定游戏即算参赛;</span></p><p style=\"white-space: normal;\"><span style=\"color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Arial; text-indent: 32px; background-color: rgb(255, 255, 255);\">2.每局小局结算分均会按照CEST专业算法进行换算得出对应排名积分;</span></p><p style=\"white-space: normal;\"><span style=\"color: rgb(51, 51, 51); font-family: "Microsoft YaHei", Arial; text-indent: 32px; background-color: rgb(255, 255, 255);\">3.排名积分每3小时更新1次。</span></p><p><br/></p>"},
- ["desc"]={"1.凡在《第一电竞app》内创建的战队均可参与到战队选拔赛中;",
- "2.比赛期间内对局的xx麻将均统计进赛事积分中;",
- "3.统计规则为:每小局结算分均会按照CEST专业算法进行换算得出对应排名积分。",
- "4.排名积分每3小时更新一次。"},
- ["retcode"]=0,
- ["success"]=true}
- }
-
- --规则
- local resStr = ""
- for i=1, #__datas.result.desc do
- resStr = resStr..__datas.result.desc[i].."\n\n"
- end
-
- local sysFont = G_EapAbbreviation.getSystemFont()
- local tmpLabel = cc.Label:createWithSystemFont(resStr, sysFont, 22)
- tmpLabel:setColor(cc.c3b(0x1e, 0x23, 0x36))
- tmpLabel:setWidth(470)
- tmpLabel:setLineBreakWithoutSpace(true) --自动换行
- tmpLabel:updateContent()
- tmpLabel:setAnchorPoint(cc.p(0.5, 1))
- tmpLabel:setPosition(cc.p(0, 0))
- self.node_rule:addChild(tmpLabel)
-
- --奖励
- local imgBack_y = 0
- self.imgBack3 = G_EapAbbreviation.createImageView(self.imgPath[8], self.node_award, cc.p(0, imgBack_y), true, 2, 2102, cc.p(0.5, 1))
- self.imgBack3:setSize(cc.size(500, 50))
- local imgLine = G_EapAbbreviation.createImageView(self.imgPath[3], self.imgBack3, cc.p(166.7, 25))
- imgLine:setScaleX(0.04)
- -- imgLine:setScaleY(0.5)
- local title1 = "名次"
- G_EapAbbreviation.createSystemLabel(self.imgBack3, cc.p(83.3, 25), title1, 25, nil, true)
- local title2 = "奖励"
- G_EapAbbreviation.createSystemLabel(self.imgBack3, cc.p(2*166.7, 25), title2, 25, nil, true)
-
- local list_y = imgBack_y - 50
- local awardsDes = __datas.result.prizeRegulars
- for i=1, #awardsDes do
- local itemNode = ccui.Layout:create()
- itemNode:setAnchorPoint(cc.p(0.5, 1))
- itemNode:setSize(cc.size(530, 50))
- itemNode:setPosition(cc.p(0, list_y-(i-1)*50))
- self.node_award:addChild(itemNode)
-
- local title1 = "第"..awardsDes[i].startNo.."名"
- if awardsDes[i].startNo ~= awardsDes[i].endNo then
- title1 = "第"..awardsDes[i].startNo.."-"..awardsDes[i].endNo.."名"
- end
- G_EapAbbreviation.createSystemLabel(itemNode, cc.p(83.3+20, 25), title1, 25, cc.c3b(0x1e, 0x23, 0x36))
- local title2 = awardsDes[i].prizeMap.regular
- G_EapAbbreviation.createSystemLabel(itemNode, cc.p(2*166.7+20, 25), title2, 25, cc.c3b(0x1e, 0x23, 0x36))
- end
- end
-
- return LayerTeamRule
|