|
- local DEEP_COL1 = cc.c3b(0xf8, 0xee, 0xc1)
- local WEAK_COL1 = cc.c3b(0x0b, 0x2d, 0x67)
- local BG_W = 564
-
- local scheduler = require("luaScript.ModuleEapSdk.SdkSocket.scheduler")
- local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer")
- local LayerMatch = EapClass("LayerMatch", BaseLayer)
-
- function LayerMatch.createWithData(__node, __zorder)
- local layer = LayerMatch.new()
- layer.m_parent = __node
- __node:addChild(layer, __zorder)
- return layer
- end
-
- function LayerMatch:myShow()
- -- self:addListener(true)
- self:initData()
- self:initUI()
- end
-
- function LayerMatch:myClose()
- if self.m_schIDCDTime then
- scheduler.unscheduleGlobal(self.m_schIDCDTime)
- end
- end
-
- function LayerMatch:initData()
- self.m_itemArr = {}
- self.m_redItems = {} --红包记录
- self.m_awardState = 0 --报名按钮是否点击
- self.m_tips = {
- {
- pos = cc.p(180, 170),
- des = "赛程分数:赛程综合排名积分"
- },
- {
- pos = cc.p(260, 170),
- des = "平均成绩:赛事期间的平均局数成绩"
- },
- {
- pos = cc.p(340, 170),
- des = "比赛局数:赛事期间的累积比赛局数"
- },
- {
- pos = cc.p(420, 170),
- des = "热力局数:在热力时间段内打的对局数 (每天12:30~14:30)"
- },
- {
- pos = cc.p(500, 330),
- des = "获得方式:每局结束奖励。用途:可在商城兑换商品。"
- },
- }
- end
-
- function LayerMatch: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_img_icon.png", --奖章
- "res/ModuleEapSdk/eapsdk_img_tip.png", --5
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_title.png",
- "res/ModuleEapSdk/eapsdk_wj_icon_question.png",
- "res/ModuleEapSdk/eapsdk_wj_btn_rank.png",
- "res/ModuleEapSdk/eapsdk_bg_bj_sp2.png",
- "res/ModuleEapSdk/eapsdk_public_back_bg4.png", --10
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_btn_signin.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_award.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_dailyGame.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_matchlistItemBG.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_myScore_off.png", --15
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_myScore_on.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_FriendScore_off.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_FriendScore_on.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_search_off.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_search_on.png", --20
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_search.png",
- "res/ModuleEapSdk/eapsdk_img_search.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_searchBG.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_follow.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_followed.png", --25
- "res/ModuleEapSdk/eapsdk_public_back_bg6.png",
- "res/ModuleEapSdk/eapsdk_public_back_bg12.png",
-
- "res/ModuleEapSdk/eapsdk_wj_icon_question_off.png", --赛事规则off
- "res/ModuleEapSdk/eapsdk_wj_btn_rank_off.png", --排行榜off
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_dailyGame_off.png", --当日详情off --30
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_kefu_on.png", --客服on
- "res/ModuleEapSdk/Eap_Score/eapsdk_btn_kefu_off.png", --客服off
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_match_title.png",
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_mylist_title.png", --我的赛事排行榜
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_friendlist_title.png", --好友赛事排行榜 --35
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_frilistItemBG_on.png", --好友赛事排行元素底图
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_frilistItemBG_off.png", --好友赛事排行元素底图
- "res/ModuleEapSdk/Eap_Score/eapsdk_img_searchEditBG.png", --搜索框地图
- "res/ModuleEapSdk/eapsdk_public_back_bg11.png",
- "res/ModuleEapSdk/eapsdk_img_tipsBG.png", --提示框背景图 --40
- "res/ModuleEapSdk/eapsdk_img_timeBG.png",
-
- "res/ModuleEapSdk/Eap_Red/eapsdk_redpack_bj01.png", --红包
- "res/ModuleEapSdk/Eap_Red/eapsdk_wj_btn_redpack.png", --红包按钮
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_title.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_txt1.png", --45
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_txt2.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_btn_signin1.png", --激活成绩按钮
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_btnRedDesBG.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_btn_open.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_btn_rule.png", --50
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_btnRedTitle.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_hand.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_line.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_rankBG.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_ruleBG.png", --55
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_titleBG.png",
- "res/ModuleEapSdk/Eap_Red/eapsdk_red_img_ruleDes.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.imgCover = G_EapAbbreviation.createImageView(self.imgPath[39], self, cc.p(fix_x, fix_y+45-130), true, 5, 2102, cc.p(1, 0.5))
- self.imgCover:setSize(cc.size(BG_W, 300))
- self.imgCover:setVisible(false)
-
- -- local imgLine = G_EapAbbreviation.createImageView(self.imgPath[10], imgBack2, cc.p(-1, -90), false, 2, 2101, cc.p(0.5, 0))
- -- imgLine:setScale(0.5, 300)
-
- self.imgTime = G_EapAbbreviation.createImageView(self.imgPath[41], imgBack2, cc.p(BG_W/2, 340))
- self.imgTime:setScale(0.6)
- self.lblCDTime1 = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(BG_W/2-27, 340), "00", 22, DEEP_COL1)
- self.lblCDTime2 = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(BG_W/2+27, 340), "00", 22, DEEP_COL1)
- self.lblCDTime3 = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(BG_W/2+100, 340), "00", 22, WEAK_COL1)
-
- --奖章
- local imgJZ = G_EapAbbreviation.createImageView(self.imgPath[4], imgBack2, cc.p(460, 340))
- imgJZ:setScale(0.6)
- local myItem = G_EapSdkMgr:getItem(ITEM_TYPE.INTEGRAL)
- local scoreNum = myItem and myItem.nNum or 0
- local score = scoreNum
- self.lblScore = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(475, 340), score, 18, DEEP_COL1, false, display.RIGHT)
- self.lblScore:setAnchorPoint(cc.p(0, 0.5))
- local imgTip = G_EapAbbreviation.createImageView(self.imgPath[5], imgBack2, cc.p(545, 340))
- imgTip:setScale(0.6)
-
- --天梯赛img
- local imgMatchTitle = G_EapAbbreviation.createImageView(self.imgPath[33], imgBack2, cc.p(BG_W/2, 290))
- imgMatchTitle:setScale(0.6)
-
- --客服
- self.btnKefu = ccui.ImageView:create(self.imgPath[32])
- self.btnKefu:setPosition(cc.p(62, 450))
- self.btnKefu:setScale(0.6)
- imgBack2:addChild(self.btnKefu)
- addButtonListener(self.btnKefu, function()
- print("LayerMatch btnKefu clicked === ")
- if G_LayerMain:isSubLayerVis(LAYER_ENUM.LAYER_SUPPORT) then
- G_LayerMain:closeSubLayer(LAYER_ENUM.LAYER_SUPPORT)
- self.btnKefu:loadTexture(self.imgPath[32])
- else
- G_LayerMain:showSubLayer(LAYER_ENUM.LAYER_SUPPORT)
- self.btnKefu:loadTexture(self.imgPath[31])
- self.btnDes:loadTexture(self.imgPath[28])
- self.btnRank:loadTexture(self.imgPath[29])
- self.btnDailyResult:loadTexture(self.imgPath[30])
- end
- end)
-
- --赛事规则
- self.btnDes = ccui.ImageView:create(self.imgPath[28])
- 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[28])
- 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])
- self.btnRank:loadTexture(self.imgPath[29])
- self.btnDailyResult:loadTexture(self.imgPath[30])
- self.btnKefu:loadTexture(self.imgPath[32])
- end
- end)
-
- --排行榜
- self.btnRank = ccui.ImageView:create(self.imgPath[29])
- self.btnRank:setPosition(cc.p(62, 370))
- self.btnRank:setScale(0.6)
- imgBack2:addChild(self.btnRank)
- addButtonListener(self.btnRank, function()
- print("LayerMatch btnRank clicked === ")
- if G_LayerMain:isSubLayerVis(LAYER_ENUM.LAYER_RANK) then
- G_LayerMain:closeSubLayer(LAYER_ENUM.LAYER_RANK)
- self.btnRank:loadTexture(self.imgPath[29])
- else
- G_LayerMain:showSubLayer(LAYER_ENUM.LAYER_RANK)
- self.btnRank:loadTexture(self.imgPath[8])
- self.btnDailyResult:loadTexture(self.imgPath[30])
- self.btnKefu:loadTexture(self.imgPath[32])
- self.btnDes:loadTexture(self.imgPath[28])
- end
- end)
-
- --当日成绩按钮
- self.btnDailyResult = ccui.ImageView:create(self.imgPath[30])
- self.btnDailyResult:setPosition(cc.p(62, 300))
- self.btnDailyResult:setScale(0.6)
- imgBack2:addChild(self.btnDailyResult)
- addButtonListener(self.btnDailyResult, function()
- print("LayerMatch btnDailyResult clicked === ")
- if G_LayerMain:isSubLayerVis(LAYER_ENUM.LAYER_DAILY_GAME) then
- G_LayerMain:closeSubLayer(LAYER_ENUM.LAYER_DAILY_GAME)
- self.btnDailyResult:loadTexture(self.imgPath[30])
- else
- G_LayerMain:showSubLayer(LAYER_ENUM.LAYER_DAILY_GAME)
- self.btnDailyResult:loadTexture(self.imgPath[13])
- self.btnKefu:loadTexture(self.imgPath[32])
- self.btnDes:loadTexture(self.imgPath[28])
- self.btnRank:loadTexture(self.imgPath[29])
- end
- end)
-
- --切换
- local rankMenus = cc.Node:create()
- rankMenus:setPosition(cc.p(BG_W/2, 240))
- imgBack2:addChild(rankMenus)
-
- self.btnMyScore = ccui.ImageView:create(self.imgPath[16])
- self.btnMyScore:setPosition(cc.p(-80, 0))
- rankMenus:addChild(self.btnMyScore)
- addButtonListener(self.btnMyScore, function()
- print("self.btnMyScore clicked ========= ")
- self.btnMyScore:setTouchEnabled(false)
- self.btnFriend:setTouchEnabled(true)
- self.btnMyScore:loadTexture(self.imgPath[16])
- self.btnFriend:loadTexture(self.imgPath[17])
- self.node_myScore:setVisible(true)
- self.node_Friend:setVisible(false)
- self.btnRed:setVisible(true)
- end)
- self.btnFriend = ccui.ImageView:create(self.imgPath[17])
- self.btnFriend:setPosition(cc.p(80, 0))
- rankMenus:addChild(self.btnFriend)
- addButtonListener(self.btnFriend, function()
- print("self.btnFriend clicked ========= ")
- G_EapSocketLogin.request_markLog(MARK_LOG11012)
- if G_LayerMain.m_needRefreshFriend then
- G_LayerMain.m_needRefreshFriend = false
- G_EapSocketLogin.request_FriendListGet()
- end
- self.btnMyScore:setTouchEnabled(true)
- self.btnFriend:setTouchEnabled(false)
- self.btnMyScore:loadTexture(self.imgPath[15])
- self.btnFriend:loadTexture(self.imgPath[18])
- self.node_myScore:setVisible(false)
- self.node_Friend:setVisible(true)
- self.node_friList:setVisible(true)
- self.node_search:setVisible(false)
- self.btnRed:setVisible(false)
- end)
- self.btnMyScore:setScale(0.6)
- self.btnFriend:setScale(0.6)
- self.btnMyScore:setTouchEnabled(false)
- self.btnFriend:setTouchEnabled(true)
-
- --我的成绩
- self.node_myScore = cc.Node:create()
- imgBack2:addChild(self.node_myScore)
- --好友成绩
- self.node_Friend = cc.Node:create()
- imgBack2:addChild(self.node_Friend)
-
- --好友成绩列表
- self.node_friList = cc.Node:create()
- self.node_friList:setPosition(cc.p(0, -5))
- self.node_Friend:addChild(self.node_friList)
- --搜索好友
- self.node_search = cc.Node:create()
- self.node_search:setPosition(cc.p(0, -5))
- self.node_Friend:addChild(self.node_search)
-
- self.node_myScore:setVisible(true)
- self.node_Friend:setVisible(false)
- -------------------------------------------- 我的成绩 -------------------------------------------
- local imgMyScoreTitle = G_EapAbbreviation.createImageView(self.imgPath[34], self.node_myScore, cc.p(BG_W/2, 210), false, 1, 3103, cc.p(0.5, 1))
- imgMyScoreTitle:setScale(0.6)
-
- self.scrollView = ccui.ScrollView:create()
- self.inner_h = 110
- self.scrlContent = self.scrollView:getInnerContainer()
- self.scrollView:setAnchorPoint(cc.p(0.5, 1))
- self.scrollView:setTouchEnabled(true)
- self.scrollView:setBounceEnabled(false)
- if self.scrollView.hideAllBar then
- self.scrollView:hideAllBar()
- end
- if self.scrollView.setScrollBarEnabled and type(self.scrollView.setScrollBarEnabled) == "function" then
- self.scrollView:setScrollBarEnabled(false)
- end
-
- self.scrollView:setSize(cc.size(414, self.inner_h))
- self.scrollView:setPosition(cc.p(BG_W/2, 150))
-
- self.scrollView:setInnerContainerSize(cc.size(414, self.inner_h))
- self.node_myScore:addChild(self.scrollView)
-
- -- 报名领奖
- -- self.btnAward = ccui.Button:create(self.imgPath[11])
- -- self.btnAward:setPosition(cc.p(BG_W/2, 55))
- -- self.btnAward:setScale(0.6)
- -- self.imgCover:addChild(self.btnAward, 3)
- -- addButtonListener(self.btnAward, function()
- -- print("LayerMatch btnAward clicked === ")
- -- G_EapSocketLogin.request_markLog(MARK_LOG10014)
- -- G_LayerMain:showLayer(LAYER_ENUM.LAYER_BINDPHONE)
- -- end)
-
- -------------------------------------------- 好友成绩 -------------------------------------------
- local imgFriListTitle = G_EapAbbreviation.createImageView(self.imgPath[35], self.node_Friend, cc.p(BG_W/2-30, 155), false, 0, 3103, cc.p(0.5, 1))
- imgFriListTitle:setScale(0.6)
-
- local imgSearchBG = G_EapAbbreviation.createImageView(self.imgPath[38], self.node_Friend, cc.p(10, 210), false, 0, 2101, cc.p(0, 1))
- imgSearchBG:setScale(0.6)
- local imgSearch = G_EapAbbreviation.createImageView(self.imgPath[22], self.node_Friend, cc.p(30, 185))
- imgSearch:setScale(0.6)
- local showStr = "输入好友赛事ID可关注好友成绩排行"
- self.editPhone = G_EapLabelTool.getEditBox(self.imgPath[1], cc.size(340, 48), showStr, nil, nil, 20)
- self.editPhone:setAnchorPoint(cc.p(0, 0.5))
- self.editPhone:setPosition(cc.p(50, 185))
- self.node_Friend:addChild(self.editPhone)
-
- --搜索按钮
- self.btnSearchGo = ccui.Button:create(self.imgPath[21])
- self.btnSearchGo:setPosition(cc.p(485, 185))
- self.btnSearchGo:setScale(0.6)
- self.node_Friend:addChild(self.btnSearchGo)
- addButtonListener(self.btnSearchGo, function()
- G_EapSocketLogin.request_markLog(MARK_LOG10010)
- print("LayerMatch btnSearchGo clicked === ")
- self.btnSearchGo:setTouchEnabled(false)
- scheduler.performWithDelayGlobal(function()
- self.btnSearchGo:setTouchEnabled(true)
- end, 1)
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- if matchIDs[1] then
- local pid = tonumber(self.editPhone:getText()) or 0
- G_EapSocketLogin.request_userMatchInfoGet(matchIDs[1], pid)
- if not G_EapSdkMgr.m_userBaseInfos[pid] then
- local idArr = {
- pid
- }
- G_EapSocketLogin.request_GetMultiUserInfoReq(idArr)
- end
- end
- self.node_search:setVisible(true)
- self.node_friList:setVisible(false)
- end)
-
- -------------------------------------------- 搜索结果 -------------------------------------------
- local imgSearchRes = G_EapAbbreviation.createImageView(self.imgPath[37], self.node_search, cc.p(10, 100), false, 0, 2101, cc.p(0, 1))
- imgSearchRes:setScale(0.6)
-
- local node_searcRes = cc.Node:create()
- node_searcRes:setPosition(cc.p(10, 100-33))
- self.node_search:addChild(node_searcRes)
-
- local title = "-"
- self.lblSrchMatchName = G_EapAbbreviation.createSystemLabel(node_searcRes, cc.p(45, 16), title, 18, DEEP_COL1)
- self.lblSrchName = G_EapAbbreviation.createSystemLabel(node_searcRes, cc.p(40+80, 16), title, 16, DEEP_COL1)
- self.lblSrchScore = G_EapAbbreviation.createSystemLabel(node_searcRes, cc.p(40+80*2, 16), title, 16, DEEP_COL1)
- self.lblSrchBlScore = G_EapAbbreviation.createSystemLabel(node_searcRes, cc.p(40+80*3, 16), title, 16, DEEP_COL1)
- self.lblSrchAllNum = G_EapAbbreviation.createSystemLabel(node_searcRes, cc.p(40+80*4, 16), title, 16, DEEP_COL1)
- self.lblSrchReNum = G_EapAbbreviation.createSystemLabel(node_searcRes, cc.p(40+80*5, 16), title, 16, DEEP_COL1)
-
- self.lblSrchErr = G_EapAbbreviation.createSystemLabel(self.node_search, cc.p(BG_W/2, 45), "", 22, cc.c3b(220, 0, 0))
-
- self.btnFollow = ccui.ImageView:create(self.imgPath[24])
- self.btnFollow:setScale(0.6)
- self.btnFollow:setPosition(cc.p(515, 80))
- self.node_search:addChild(self.btnFollow)
- self.btnFollow:setVisible(false)
- addButtonListener(self.btnFollow, function()
- self.btnFollow:setTouchEnabled(false)
- scheduler.performWithDelayGlobal(function()
- self.btnFollow:setTouchEnabled(true)
- end, 1)
- local srchPID = tonumber(self.editPhone:getText()) or 0
- if G_EapSdkMgr:isFriend(srchPID) then
- G_EapSocketLogin.request_markLog(MARK_LOG10012)
- G_EapSocketLogin.request_FriendFollowReq(srchPID, 2)
- else
- G_EapSocketLogin.request_markLog(MARK_LOG10011)
- G_EapSocketLogin.request_FriendFollowReq(srchPID, 1)
- end
- end)
-
- self:initRedPack()
- self:initCDTime()
- self:setInfoItem()
- self:initTips()
- self:refreshBattleScore()
- end
-
- function LayerMatch:initRedPack()
- local redCol = cc.c3b(0xd5, 0x31, 0x2f)
- local fix_x = display.width
- local fix_y = display.cy
- self.imgRedBG = G_EapAbbreviation.createImageView(self.imgPath[27], self, cc.p(fix_x, fix_y+45), true, 6, 2102, cc.p(1, 0.5))
- self.imgRedBG:setSize(cc.size(BG_W, 510))
- self.imgRedBG:setVisible(false)
- addButtonListener(self.imgRedBG, function()
- if G_EapSdkMgr.EapPhone then
- self.imgRedBG:setVisible(false)
- end
- end)
-
- local act1 = cc.ScaleTo:create(2, 1.2)
- local act2 = cc.DelayTime:create(0.5)
- local act3 = cc.ScaleTo:create(1, 0.9)
- local seq1 = cc.Sequence:create(act1, act2, act3)
- local rep1 = cc.RepeatForever:create(seq1)
-
- -- 红包按钮
- self.btnRed = ccui.Button:create(self.imgPath[43])
- self.btnRed:setPosition(cc.p(BG_W/2, 55))
- self.btnRed:setScale(0.6)
- self.imgBack2:addChild(self.btnRed)
- addButtonListener(self.btnRed, function()
- print("LayerMatch btnRed clicked === ")
- G_EapSocketLogin.request_markLog(MARK_LOG11003)
- self.imgRedBG:setVisible(true)
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- if matchIDs[1] then
- G_EapSocketLogin.request_UserRedChangeGet(matchIDs[1], 1)
- G_EapSocketLogin.request_UserRedChangeGet(matchIDs[1], 2)
- end
- end)
- self.lblBtnRedNum = G_EapAbbreviation.createSystemLabel(self.btnRed, cc.p(79, 120), "0", 40, redCol, true)
- self.imgRedBtnBG = G_EapAbbreviation.createImageView(self.imgPath[48], self.btnRed, cc.p(162, 90))
-
- self.imgRedBtnBG:setAnchorPoint(cc.p(0, 0))
- self.imgRedBtnBG:setScale(1.5)
-
- local gameName = ""
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- local matchInfo = G_EapSdkMgr.m_matchInfos[matchIDs[1]]
- if matchInfo then
- local gameInfo = G_EapSdkMgr:getGameInfo(matchInfo.GameID)
- gameName = gameInfo and gameInfo.name or "麻将"
- end
- local redDesStr = "参与"..gameName.."对局(4人)可增加红包金额"
- -- self.lblRedBtnDes = G_EapAbbreviation.createSystemLabel(self.imgRedBtnBG, cc.p(15, 15), redDesStr, 16, display.COLOR_WHITE, true)
- -- self.lblRedBtnDes:setWidth(160)
- -- self.lblRedBtnDes:setAnchorPoint(cc.p(0, 0))
- self.lblRedBtnDes = cc.Text:createNode();
- self.lblRedBtnDes:setDefaults();
- local config = self.lblRedBtnDes:getFontConfig();
- config.fontSize = 16;
- self.lblRedBtnDes:setFontConfig(config);
- self.lblRedBtnDes:setColor(display.COLOR_WHITE)
- self.lblRedBtnDes:setTextAreaSize(cc.size(165, 0))
- self.lblRedBtnDes:setLinePadding(2)
- self.lblRedBtnDes:setAnchorPoint(cc.p(0, 0))
- self.lblRedBtnDes:setPosition(cc.p(15, 15))
- self.lblRedBtnDes:setText(redDesStr)
- self.imgRedBtnBG:addChild(self.lblRedBtnDes)
-
- self.imgRedOpen = G_EapAbbreviation.createImageView(self.imgPath[49], self.btnRed, cc.p(79, 55))
- self.imgRedOpen:runAction(rep1:clone())
-
- self.imgRed = G_EapAbbreviation.createImageView(self.imgPath[42], self.imgRedBG, cc.p(BG_W/2, 170))
- self.imgRed:setScale(0.6)
- self.imgRed:setTouchEnabled(true)
- self.node_redNoSign = cc.Node:create() --未报名
- self.imgRed:addChild(self.node_redNoSign)
- self.node_redSign = cc.Node:create() --已报名
- self.imgRed:addChild(self.node_redSign)
-
- self.imgRedRule = G_EapAbbreviation.createImageView(self.imgPath[55], self.imgRedBG, cc.p(BG_W/2, 230))
- self.imgRedRule:setScale(0.6)
- self.imgRedRule:setVisible(false)
- addButtonListener(self.imgRedRule, function()
- self.imgRedRule:setVisible(false)
- end)
- self:initRedRule()
-
- -- 报名领奖
- self.btnAward = ccui.ImageView:create(self.imgPath[11])
- self.btnAward:setPosition(cc.p(177, 55))
- self.node_redNoSign:addChild(self.btnAward, 3)
- addButtonListener(self.btnAward, function()
- print("LayerMatch btnAward clicked === ")
- G_EapSocketLogin.request_markLog(MARK_LOG10014)
- G_LayerMain:showLayer(LAYER_ENUM.LAYER_BINDPHONE)
- end)
- self.btnAward:runAction(rep1)
-
- self.lblNoSignRedNum = G_EapAbbreviation.createSystemLabel(self.node_redNoSign, cc.p(137, 330), "0", 75, redCol, true)
- self.imgRedTitle = G_EapAbbreviation.createImageView(self.imgPath[44], self.node_redNoSign, cc.p(177, 455))
- self.imgRedTitle2 = G_EapAbbreviation.createImageView(self.imgPath[45], self.node_redNoSign, cc.p(177, 160))
- self.imgRedTitle3 = G_EapAbbreviation.createImageView(self.imgPath[56], self.node_redNoSign, cc.p(177, 530))
- self.imgRedTitle3:setVisible(false)
-
- --已报名
- local title1 = "当前红包"
- self.lblRedTitle1 = G_EapAbbreviation.createSystemLabel(self.node_redSign, cc.p(177-85, 395), title1, 32, cc.c3b(0xd6, 0x8d, 0x52), true)
- local title2 = "满300元可领"
- self.lblRedTitle2 = G_EapAbbreviation.createSystemLabel(self.node_redSign, cc.p(177, 260), title2, 22, cc.c3b(0xe4, 0x55, 0x53))
- local title3 = "0"
- self.lblRedNum = G_EapAbbreviation.createSystemLabel(self.node_redSign, cc.p(137, 325), title3, 68, redCol, true)
- -- 红包规则
- self.btnRedRule = ccui.ImageView:create(self.imgPath[50])
- self.btnRedRule:setPosition(cc.p(310, 25))
- self.node_redSign:addChild(self.btnRedRule, 3)
- addButtonListener(self.btnRedRule, function()
- print("LayerMatch btnRedRule clicked === ")
- self.imgRedRule:setVisible(true)
- end)
-
- local imgTimeBG = G_EapAbbreviation.createImageView(self.imgPath[2], self.node_redSign, cc.p(245, 395), true)
- imgTimeBG:setSize(cc.size(165, 36))
- self.lblRedTime = G_EapAbbreviation.createSystemLabel(imgTimeBG, cc.p(82, 18), "", 18, redCol)
-
- local imgRedLine = G_EapAbbreviation.createImageView(self.imgPath[53], self.node_redSign, cc.p(177, 153))
- local imgRedRankBG = G_EapAbbreviation.createImageView(self.imgPath[54], self.node_redSign, cc.p(177, 150), false, 0, 2101, cc.p(0.5, 1))
-
- self:initRedList()
- end
-
- --红包规则界面
- function LayerMatch:initRedRule()
- self.scrlRedRule = ccui.ScrollView:create()
- local inner_h = 630
-
- self.scrlRedRule:setTouchEnabled(true)
- self.scrlRedRule:setBounceEnabled(false)
- if self.scrlRedRule.setScrollBarEnabled and type(self.scrlRedRule.setScrollBarEnabled) == "function" then
- self.scrlRedRule:setScrollBarEnabled(false)
- end
-
- self.scrlRedRule:setSize(cc.size(588, inner_h))
- self.scrlRedRule:setPosition(cc.p(0, 10))
-
- self.scrlRedRule:setInnerContainerSize(cc.size(588, 1408))
- self.imgRedRule:addChild(self.scrlRedRule)
-
- local imgRedRuleDes = G_EapAbbreviation.createImageView(self.imgPath[57], self.scrlRedRule, cc.p(30, 0))
- imgRedRuleDes:setAnchorPoint(cc.p(0, 0))
- end
-
- --红包奖励记录
- function LayerMatch:initRedList()
- self.scrlRed = ccui.ScrollView:create()
- local inner_h = 110
- self.scrlContent = self.scrlRed:getInnerContainer()
- self.scrlRed:setAnchorPoint(cc.p(0.5, 1))
- self.scrlRed:setBounceEnabled(false)
- if self.scrlRed.setScrollBarEnabled and type(self.scrlRed.setScrollBarEnabled) == "function" then
- self.scrlRed:setScrollBarEnabled(false)
- end
-
- self.scrlRed:setSize(cc.size(354, inner_h))
- self.scrlRed:setPosition(cc.p(177, 150))
-
- self.scrlRed:setInnerContainerSize(cc.size(354, inner_h))
- self.node_redSign:addChild(self.scrlRed)
- end
-
- --红包奖励记录
- function LayerMatch:refreshRedList()
- local __datas = {}
- local index = 1
- for k,v in pairs(G_EapSdkMgr.m_redRecords) do
- for i=1, #v do
- __datas[index] = v[i]
- index = index + 1
- end
- end
- if #__datas <= 0 then
- return
- end
-
- local gameName = ""
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- local matchInfo = G_EapSdkMgr.m_matchInfos[matchIDs[1]]
- if matchInfo then
- local gameInfo = G_EapSdkMgr:getGameInfo(matchInfo.GameID)
- gameName = gameInfo and gameInfo.name or tostring(matchInfo.GameID)
- end
-
- local item_h = 55
- local dataLen = table.nums(__datas)
- local data_h = item_h*dataLen
- local inner_h = 110
- inner_h = data_h > inner_h and data_h or inner_h
- self.scrlRed:setInnerContainerSize(cc.size(354, inner_h))
-
- for i=1, dataLen do
- local recordInfo = __datas[i]
- if recordInfo then
- local recTime = EapFormatTime(recordInfo.ChangeTime, 9)
- local redNum = recordInfo.ChangeMoney or 0
- local redNumStr = string.format("%.2f", redNum)
- redNumStr = redNumStr.."红包"
- if redNum > 0 then
- redNumStr = "+"..redNumStr
- end
- local type = recordInfo.Type or 0
- local typeStr = ""
- if type == 1 then
- typeStr = gameName.."对局奖励"
- elseif type == 2 then
- typeStr = gameName.."排名奖励"
- end
-
- local itemNode = self.m_redItems[i]
- if itemNode then
- itemNode:setPosition(cc.p(177, inner_h-(i-1)*item_h))
- itemNode.lblTime:setString(recTime)
- itemNode.lblRedNum:setString(redNumStr)
- itemNode.lblType:setString(typeStr)
- else
- local itemNode = ccui.Layout:create()
- itemNode:setAnchorPoint(cc.p(0.5, 1))
- itemNode:setSize(cc.size(354, item_h))
- itemNode:setPosition(cc.p(177, inner_h-(i-1)*item_h))
- self.scrlRed:addChild(itemNode)
-
- itemNode.lblTime = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(88-10, 40), recTime, 20, cc.c3b(0xff, 0xf6, 0xaa))
- itemNode.lblRedNum = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(88-10, 15), redNumStr, 30, cc.c3b(0xe6, 0x65, 0x60))
- itemNode.lblType = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(88+157, 13), typeStr, 24, cc.c3b(0xff, 0xf6, 0xaa))
-
- self.m_redItems[#self.m_redItems + 1] = itemNode
- end
- end
- end
- end
-
- --刷新红包数据
- function LayerMatch:refreshRedInfo()
- local redInfo = G_EapSdkMgr.m_redInfo or {}
- if redInfo then
- local money = redInfo.Money or 0
- if money ~= 0 then
- if G_EapSdkMgr.EapPhone then
- money = string.format("%.2f", money)
- else
- money = string.format("%.2f", money-100)
- end
- else
- if G_EapSdkMgr.EapPhone then
- money = 188
- else
- money = 88
- end
- end
- local moneyStr = money
- self.lblBtnRedNum:setString(moneyStr)
- self.lblRedNum:setString(moneyStr)
- self.lblNoSignRedNum:setString(moneyStr)
-
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- if matchIDs[1] then
- local gameName = ""
- local matchInfo = G_EapSdkMgr.m_matchInfos[matchIDs[1]]
- if matchInfo then
- local gameInfo = G_EapSdkMgr:getGameInfo(matchInfo.GameID)
- gameName = gameInfo and gameInfo.name or "麻将"
- end
- local redDesStr = "参与"..gameName.."对局(4人)可增加红包金额"
- self.lblRedBtnDes:setString(redDesStr)
-
- local selfRank = G_EapSdkMgr:getSelfRankByID(matchIDs[1])
- if selfRank then
- selfRank.Rank = selfRank.Rank or 0
- if selfRank.Rank >=1 and selfRank.Rank < 33 then --32强
- self.btnAward:loadTexture(self.imgPath[47])
- self.imgRedTitle2:loadTexture(self.imgPath[46])
- self.imgRedTitle3:setVisible(true)
- elseif selfRank.Rank >= 33 then
- self.btnAward:loadTexture(self.imgPath[11])
- self.imgRedTitle2:loadTexture(self.imgPath[45])
- self.imgRedTitle3:setVisible(false)
- end
- end
- end
-
- end
- end
-
- function LayerMatch:initTips()
- --提示框所在层
- self.imgTipsBG = G_EapAbbreviation.createImageView(self.imgPath[1], self.imgBack2, cc.p(0, 0), true, 10, 2102, cc.p(0, 0))
- self.imgTipsBG:setSize(cc.size(BG_W, 510))
- self.imgTipsBG:setVisible(false)
- addButtonListener(self.imgTipsBG, function()
- self.imgTipsBG:setVisible(false)
- end)
- self.imgTips = G_EapAbbreviation.createImageView(self.imgPath[40], self.imgTipsBG, cc.p(BG_W/2, 0), false, 1, 2102, cc.p(1, 0))
- -- self.lblTips = G_EapAbbreviation.createSystemLabel(self.imgTips, cc.p(5, 40), "", 12, WEAK_COL1)
- -- self.lblTips:setWidth(192)
- -- self.lblTips:setLineBreakWithoutSpace(true) --自动换行
- self.lblTips = cc.Text:createNode();
- self.lblTips:setDefaults();
- local config = self.lblTips:getFontConfig();
- config.fontSize = 20;
- self.lblTips:setFontConfig(config);
- self.lblTips:setColor(WEAK_COL1)
- self.lblTips:setTextAreaSize(cc.size(290, 0))
- self.lblTips:setLinePadding(2)
- self.lblTips:setAnchorPoint(cc.p(0, 0.5))
- self.lblTips:setPosition(cc.p(5, 55))
- self.imgTips:addChild(self.lblTips)
-
- self.node_tips = cc.Node:create()
- self.imgBack2:addChild(self.node_tips)
- for i=1, #self.m_tips do
- local node_parent = self.node_myScore
- if i == #self.m_tips then
- node_parent = self.imgBack2
- end
- local tipInfo = self.m_tips[i]
- local btnTip = G_EapAbbreviation.createImageView(self.imgPath[1], node_parent, tipInfo.pos, true, 1, 2102, cc.p(0, 0))
- btnTip:setSize(cc.size(60, 30))
- addButtonListener(btnTip, function()
- self.imgTips:setPosition(cc.p(tipInfo.pos.x+50, tipInfo.pos.y+35))
- local des = tipInfo.des
- -- if i == 4 then
- -- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- -- local matchInfo = G_EapSdkMgr.m_matchInfos[matchIDs[1]]
- -- local timeStr = ""
- -- if matchInfo then
- -- if matchInfo.VecReLi then
- -- local reLen = #matchInfo.VecReLi
- -- for i=1, reLen do
- -- local time1 = matchInfo.VecReLi[i]
- -- timeStr = timeStr..EapFormatTime(time1.TimeStart, 4).."~"..EapFormatTime(time1.TimeEnd, 4)
- -- if i ~= reLen then
- -- timeStr = timeStr.." "
- -- end
- -- end
- -- end
- -- end
- -- if timeStr ~= "" then
- -- timeStr = "(每天"..timeStr..")"
- -- end
- -- des = tipInfo.des.." "..timeStr
- -- end
- self.lblTips:setText(des)
- self.imgTipsBG:setVisible(true)
- end)
- end
- end
-
- function LayerMatch:initCDTime()
- local endTime = 0
- local startTime = 0
- for k,v in pairs(G_EapSdkMgr.m_allMatchs) do
- local matchtime = v.MatchTime
- endTime = matchtime.TimeEnd
- startTime = matchtime.TimeStart
- break
- end
- local cdStr = ""
- local curTime = os.time()
- if curTime < startTime then
- cdStr = cdStr..GetCountDownTime(startTime)
- else
- cdStr = cdStr..GetCountDownTime(endTime)
- end
- local timeArr = string.split(cdStr, ":")
- for i=1, 3 do
- self["lblCDTime"..i]:setString(timeArr[i])
- end
- local hour = tonumber(timeArr[1])*24 + tonumber(timeArr[2])
- local redTimeStr = hour.."小时"..timeArr[3].."分后清零"
- self.lblRedTime:setString(redTimeStr)
-
- self.m_schIDCDTime = scheduler.scheduleGlobal(function()
- local curTime = os.time()
- if curTime >= endTime and self.m_schIDCDTime then
- scheduler.unscheduleGlobal(self.m_schIDCDTime)
- return
- end
- local cdStr = ""
- local curTime = os.time()
- if curTime < startTime then
- cdStr = cdStr..GetCountDownTime(startTime)
- else
- cdStr = cdStr..GetCountDownTime(endTime)
- end
- local timeArr = string.split(cdStr, ":")
- for i=1, 3 do
- self["lblCDTime"..i]:setString(timeArr[i])
- end
- local hour = tonumber(timeArr[1])*24 + tonumber(timeArr[2])
- local redTimeStr = hour.."小时"..timeArr[3].."分后清零"
- self.lblRedTime:setString(redTimeStr)
- end, 60)
- end
-
- function LayerMatch:setInfoItem()
- local item_h = 42
- local dataLen = table.nums(G_EapSdkMgr.m_matchInfos)
- local data_h = item_h*dataLen
- self.inner_h = data_h > self.inner_h and data_h or self.inner_h
- self.scrollView:setInnerContainerSize(cc.size(414, self.inner_h))
-
- local index = 1
- for k,v in pairs(G_EapSdkMgr.m_matchInfos) do
- local gameInfo = G_EapSdkMgr:getGameInfo(v.GameID)
- local gameName = gameInfo and gameInfo.name or tostring(v.GameID)
- if G_EapLabelTool.GetUTF8StrNums( gameName ) > 9 then
- gameName = G_EapLabelTool.GetUTF8StrByIdxNumEx(gameName, 9)
- gameName = gameName..".."
- end
-
- local selfData = G_EapSdkMgr:getSelfRankByID(k)
- local tmpData = selfData or {
- Calcu = "0",
- BlScore = "0",
- AllNum = "0",
- ReNum = "0",
- }
- if not G_EapSdkMgr.m_pointSelGameID then
- local maxMatch = G_EapSdkMgr:getMaxNumMatch()
- if maxMatch and maxMatch.GameNum > 0 then
-
- else
- tmpData = {
- Calcu = "0",
- BlScore = "0",
- AllNum = "0",
- ReNum = "0",
- }
- gameName = "--"
- end
- end
-
- curScore = tmpData.Calcu or 0
- blScore = tmpData.BlScore or 0
- tmpData.AllNum = tmpData.AllNum or 0
- tmpData.ReNum = tmpData.ReNum or 0
-
- if curScore ~= 0 then
- curScore = string.format("%.2f", curScore)
- end
- if blScore ~= 0 then
- blScore = string.format("%.2f", blScore)
- end
-
- local itemNode = self.m_itemArr[index]
- if itemNode then
- itemNode.lblCoreName:setString(gameName)
- itemNode.lblRank:setString(curScore)
- itemNode.lblBlRank:setString(blScore)
- itemNode.lblAcRank:setString(tmpData.AllNum)
- itemNode.lblReRank:setString(tmpData.ReNum)
- else
- local itemNode = ccui.Layout:create()
- itemNode:setAnchorPoint(cc.p(0.5, 1))
- itemNode:setSize(cc.size(414, item_h))
- itemNode:setPosition(cc.p(414/2, self.inner_h-(index-1)*item_h))
- self.scrollView:addChild(itemNode)
-
- local imgBack3 = G_EapAbbreviation.createImageView(self.imgPath[14], itemNode, cc.p(414/2, item_h), false, 0, 2102, cc.p(0.5, 1))
- imgBack3:setScale(0.6)
- itemNode.lblCoreName = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(41.5, 25), gameName, 18, DEEP_COL1, true)
- --热力时间
- -- local timeStr = ""
- -- if v.VecReLi then
- -- local reLen = #v.VecReLi
- -- for i=1, reLen do
- -- local time1 = v.VecReLi[i]
- -- timeStr = timeStr..EapFormatTime(time1.TimeStart, 4).."~"..EapFormatTime(time1.TimeEnd, 4)
- -- if i ~= reLen then
- -- timeStr = timeStr.."\r\n"
- -- end
- -- end
- -- end
- -- local hotStr = timeStr
- -- itemNode.lblHotDur = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(10, item_h-50), hotStr, 18, WEAK_COL1)
- -- itemNode.lblHotDur:setAnchorPoint(cc.p(0, 1))
-
- local rankStr = curScore
- itemNode.lblRank = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(41.5+83, 25), rankStr, 18, DEEP_COL1)
- local blRankStr = blScore
- itemNode.lblBlRank = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(41.5+83*2, 25), blRankStr, 18, DEEP_COL1)
- local acRankStr = tmpData.AllNum
- itemNode.lblAcRank = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(41.5+83*3, 25), acRankStr, 18, DEEP_COL1)
- local reRankStr = tmpData.ReNum
- itemNode.lblReRank = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(41.5+83*4, 25), reRankStr, 18, DEEP_COL1)
-
- self.m_itemArr[#self.m_itemArr + 1] = itemNode
- end
- index = index + 1
- end
- self.scrollView:jumpToTop()
-
- if not G_EapSdkMgr.EapPhone then --是否绑定手机号
- self:checkBindPhone(false)
- else
- self:checkBindPhone(true)
- end
- end
-
- function LayerMatch:refreshFollowState()
-
- local srchPID = tonumber(self.editPhone:getText()) or 0
- print("LayerMatch:refreshFollowState( ", srchPID)
- if G_EapSdkMgr:isFriend(srchPID) then
- self.btnFollow:loadTexture(self.imgPath[25])
- else
- self.btnFollow:loadTexture(self.imgPath[24])
- end
- end
-
- function LayerMatch:refreshSearchRes()
- --搜索昵称
- local srchPID = tonumber(self.editPhone:getText()) or 0
- local userInfo = G_EapSdkMgr.m_userBaseInfos[srchPID]
- if userInfo then
- local nickname = userInfo and userInfo.strNickname
- local title1 = nickname or tostring(srchPID)
- if G_EapLabelTool.GetUTF8StrNums( title1 ) > 6 then
- title1 = G_EapLabelTool.GetUTF8StrByIdxNumEx(title1, 6)
- title1 = title1..".."
- end
- self.lblSrchName:setString(title1)
- else
- self.lblSrchName:setString("-")
- end
-
- self:refreshFollowState()
-
- local matchInfo = G_EapSdkMgr.m_otherMatchInfos[srchPID]
- if G_EapSdkMgr:isFriend(srchPID) then
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- matchInfo = G_EapSdkMgr:getFriendMatchInfo(matchIDs[1], srchPID)
- end
- if matchInfo then
- local curScore = matchInfo.Calcu or 0
- local blScore = matchInfo.BlScore or 0
- local allNum = matchInfo.AllNum or 0
- local gameCount = matchInfo.ReNum or 0
-
- if curScore ~= 0 then
- curScore = string.format("%.2f", curScore)
- end
- if blScore ~= 0 then
- blScore = string.format("%.2f", blScore)
- end
-
- local tmpMatch = G_EapSdkMgr.m_matchInfos[matchInfo.MatchID]
- if tmpMatch then
- local gameInfo = G_EapSdkMgr:getGameInfo(tmpMatch.GameID)
- local gameName = gameInfo and gameInfo.name or tostring(tmpMatch.GameID)
- if G_EapLabelTool.GetUTF8StrNums( gameName ) > 9 then
- gameName = G_EapLabelTool.GetUTF8StrByIdxNumEx(gameName, 9)
- gameName = gameName..".."
- end
- self.lblSrchMatchName:setString(gameName)
- end
-
- self.lblSrchScore:setString(curScore)
- self.lblSrchBlScore:setString(blScore)
- self.lblSrchAllNum:setString(allNum)
- self.lblSrchReNum:setString(gameCount)
- else
- self.lblSrchMatchName:setString("-")
- self.lblSrchScore:setString("-")
- self.lblSrchBlScore:setString("-")
- self.lblSrchAllNum:setString("-")
- self.lblSrchReNum:setString("-")
- end
- if userInfo or matchInfo then
- self.btnFollow:setVisible(true)
- else
- self.btnFollow:setVisible(false)
- end
- --不可关注自己
- if srchPID == G_EapSdkMgr.UserId then
- self.btnFollow:setVisible(false)
- end
- end
-
- function LayerMatch:refreshFriendList(__matchID)
- local __datas = G_EapSdkMgr.m_friendMatchInfos[__matchID]
- if self.scrlViewFriends then
- self.scrlViewFriends:destroySelf()
- self.scrlViewFriends = nil
- end
- if not __datas then
- return
- end
-
- local EapListView = require("luaScript.ModuleEapSdk.GameTools.EapListView")
- self.scrlViewFriends = EapListView.createWithData(self.node_friList, self)
- local params = {
- scrl_h = 105, -- 外框高度
- scrl_w = 480, -- 外框宽度
- inner_h = 105, -- 内容器高度
- item_h = 50, -- 元素高度
- }
- self.scrlViewFriends:setScrlParam(params)
- self.scrlViewFriends:setPosition(cc.p(12, 0))
- self.scrlViewFriends:refreshRankList(__datas)
- end
-
- function LayerMatch:initItemInfo(itemNode, info)
- info = info or {}
- local init_x = 40
- info = info or {}
- itemNode.m_id = info.PID
-
- itemNode.imgBG = G_EapAbbreviation.createImageView(self.imgPath[36], itemNode, cc.p(240, 25))
- itemNode.imgBG:setScale(0.6)
-
- local curScore = info.Calcu or 0
- local blScore = info.BlScore or 0
- local allNum = info.AllNum or 0
- local gameCount = info.ReNum or 0
-
- if curScore ~= 0 then
- curScore = string.format("%.2f", curScore)
- end
- if blScore ~= 0 then
- blScore = string.format("%.2f", blScore)
- end
-
- --赛事名称
- itemNode.lblMatchName = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(43, 25), "", 18, WEAK_COL1)
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- local matchInfo = G_EapSdkMgr.m_matchInfos[matchIDs[1]]
- if matchInfo then
- local gameInfo = G_EapSdkMgr:getGameInfo(matchInfo.GameID)
- local gameName = gameInfo and gameInfo.name or tostring(matchInfo.GameID)
- if G_EapLabelTool.GetUTF8StrNums( gameName ) > 9 then
- gameName = G_EapLabelTool.GetUTF8StrByIdxNumEx(gameName, 9)
- gameName = gameName..".."
- end
- itemNode.lblMatchName:setString(gameName)
- end
-
- --昵称
- local userInfo = G_EapSdkMgr.m_userBaseInfos[itemNode.m_id]
- local nickname = userInfo and userInfo.strNickname
- local title1 = nickname or tostring(itemNode.m_id)
- if G_EapLabelTool.GetUTF8StrNums( title1 ) > 6 then
- title1 = G_EapLabelTool.GetUTF8StrByIdxNumEx(title1, 6)
- title1 = title1..".."
- end
- itemNode.lblName = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2, 25), title1, 16, WEAK_COL1)
-
- --赛程分
- local title3 = curScore
- itemNode.lblScore = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2*2, 25), title3, 16, WEAK_COL1)
-
- --平均局数
- local title4 = blScore
- itemNode.lblCount = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2*3, 25), title4, 16, WEAK_COL1)
-
- --比赛局数
- local title5 = allNum
- itemNode.lblAllNum = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2*4, 25), title5, 16, WEAK_COL1)
-
- --热力局数
- local title6 = gameCount
- itemNode.lblReNum = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2*5, 25), title6, 16, WEAK_COL1)
- end
-
-
- function LayerMatch:refreshItemInfo(itemNode, info, index)
- if not itemNode or not index or not info then
- return
- end
-
- itemNode.m_id = info.PID
- itemNode.infoIndex = index --数据索引
- itemNode.m_info = info
-
- local curScore = info.Calcu or 0
- local blScore = info.BlScore or 0
- local allNum = info.AllNum or 0
- local gameCount = info.ReNum or 0
-
- if curScore ~= 0 then
- curScore = string.format("%.2f", curScore)
- end
- if blScore ~= 0 then
- blScore = string.format("%.2f", blScore)
- end
-
- --赛事名称
- local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos)
- local matchInfo = G_EapSdkMgr.m_matchInfos[matchIDs[1]]
- if matchInfo then
- local gameInfo = G_EapSdkMgr:getGameInfo(matchInfo.GameID)
- local gameName = gameInfo and gameInfo.name or tostring(matchInfo.GameID)
- if G_EapLabelTool.GetUTF8StrNums( gameName ) > 9 then
- gameName = G_EapLabelTool.GetUTF8StrByIdxNumEx(gameName, 9)
- gameName = gameName..".."
- end
- itemNode.lblMatchName:setString(gameName)
- end
-
- --昵称
- local userInfo = G_EapSdkMgr.m_userBaseInfos[itemNode.m_id]
- local nickname = userInfo and userInfo.strNickname
- local title1 = nickname or tostring(itemNode.m_id)
- if G_EapLabelTool.GetUTF8StrNums( title1 ) > 6 then
- title1 = G_EapLabelTool.GetUTF8StrByIdxNumEx(title1, 6)
- title1 = title1..".."
- end
- itemNode.lblName:setString(title1)
-
- --赛程分
- local title3 = curScore
- itemNode.lblScore:setString(title3)
-
- --平均局数
- local title4 = blScore
- itemNode.lblCount:setString(title4)
-
- --比赛局数
- local title5 = allNum
- itemNode.lblAllNum:setString(title5)
-
- --热力局数
- local title6 = gameCount
- itemNode.lblReNum:setString(title6)
- end
-
- function LayerMatch:refreshFriendListItems(__id)
- if self.scrlViewFriends then
- self.scrlViewFriends:refreshAllItems(__id)
- end
- end
-
- function LayerMatch:checkBindPhone(__state)
- self.imgCover:setVisible(not __state)
- self.imgRedBG:setVisible(not __state)
- self.node_redNoSign:setVisible(not __state)
- self.node_redSign:setVisible(__state)
- end
-
- function LayerMatch:refreshBattleScore()
- local myItem = G_EapSdkMgr:getItem(ITEM_TYPE.INTEGRAL)
- local scoreNum = myItem and myItem.nNum or 0
- local score = scoreNum
- self.lblScore:setString(score)
- end
-
- return LayerMatch
|