local DEEP_COL1 = cc.c3b(0x0b, 0x2d, 0x67) local WEAK_COL1 = cc.c3b(0x91, 0x00, 0x00) local BG_W = 332 local BG_H = 600 local scheduler = require("luaScript.ModuleEapSdk.SdkSocket.scheduler") local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer") local LayerDailyGame = EapClass("LayerDailyGame", BaseLayer) function LayerDailyGame.createWithData(__node, __zorder) local layer = LayerDailyGame.new() layer.m_parent = __node __node:addChild(layer, __zorder) return layer end function LayerDailyGame:myShow() -- self:addListener(true) self:initData() self:initUI() end function LayerDailyGame:myClose() end function LayerDailyGame:initData() self.scrollView = nil end function LayerDailyGame:initUI() self.imgPath = { "res/ModuleEapSdk/eapsdk_img_null.png", "res/ModuleEapSdk/eapsdk_public_back_bg6.png", "res/ModuleEapSdk/eapsdk_public_back_bg4.png", "res/ModuleEapSdk/eapsdk_bg_bj_sp1.png", "res/ModuleEapSdk/eapsdk_img_matchIcon.png", --5 "res/ModuleEapSdk/eapsdk_rule_img_title.png", "res/ModuleEapSdk/eapsdk_img_leftBG.png", "res/ModuleEapSdk/eapsdk_rule_img_title2.png", "res/ModuleEapSdk/Eap_Score/eapsdk_img_dailylistTitle.png", "res/ModuleEapSdk/Eap_Score/eapsdk_img_dailylistBG.png", --10 } local fix_x = display.width local fix_y = display.cy local imgBack2 = G_EapAbbreviation.createImageView(self.imgPath[1], self, cc.p(fix_x-896, fix_y), true, 0, 4101, cc.p(0, 0.5)) imgBack2:setSize(cc.size(BG_W, BG_H)) self.imgBack2 = imgBack2 local imgBack3 = G_EapAbbreviation.createImageView(self.imgPath[7], imgBack2, cc.p(0, 0), false, 0, 4101, cc.p(0, 0)) imgBack3:setScale(0.6) 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)) imgTitle:setScale(0.4) 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)) self.imgTitleRule:setScale(0.6) local title = "今日比赛详情" local lblTitle = G_EapAbbreviation.createSystemLabel(imgBack2, cc.p(3*BG_W/4-5, BG_H-40), title, 24, WEAK_COL1, true) lblTitle:setAnchorPoint(cc.p(0.5, 1)) 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)) imgBack4:setScale(0.6) self:refreshIcon() end function LayerDailyGame:refreshRankList(__matchID) local __datas = G_EapSdkMgr.m_matchRound[__matchID] if __datas then table.sort(__datas, function(a,b) local rank_a = a.UpTime or 0 --赛程积分 local rank_b = b.UpTime or 0 return rank_a > rank_b end) end if self.scrollView then self.scrollView:destroySelf() self.scrollView = nil end if not __datas then return end local EapListView = require("luaScript.ModuleEapSdk.GameTools.EapListView") self.scrollView = EapListView.createWithData(self.imgBack2, self) local params = { scrl_h = 350+60, -- 外框高度 scrl_w = 288, -- 外框宽度 inner_h = 350+60, -- 内容器高度 item_h = 40, -- 元素高度 } self.scrollView:setScrlParam(params) self.scrollView:setPosition(cc.p(22, 5)) self.scrollView:refreshRankList(__datas) end function LayerDailyGame:initItemInfo(itemNode, info) local item_h = 40 info = info or {} local init_x = 48 info = info or {} itemNode.m_id = info.PID --排名 local upTime = info.UpTime or 0 local curScore = info.Score or 0 local imgItemBG = G_EapAbbreviation.createImageView(self.imgPath[10], itemNode, cc.p(288/2, item_h/2)) imgItemBG:setScale(0.6) local timeArr = string.split(upTime, " ") --时间 itemNode.lblTime1 = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x, 20), "", 15, DEEP_COL1) itemNode.lblTime2 = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2, 20), "", 16, DEEP_COL1) if upTime ~= 0 then upTime = EapFormatTime(upTime, 1) local timeArr = string.split(upTime, " ") local title2 = timeArr[1] itemNode.lblTime1:setString(title2) local title4 = timeArr[2] itemNode.lblTime2:setString(title4) end --赛程分 local title3 = curScore itemNode.lblScore = G_EapAbbreviation.createSystemLabel(itemNode, cc.p(init_x+init_x*2*2, 20), title3, 16, DEEP_COL1) end function LayerDailyGame: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 upTime = info.UpTime or 0 local curScore = info.Score or 0 if upTime ~= 0 then upTime = EapFormatTime(upTime, 1) end local timeArr = string.split(upTime, " ") --时间 local title2 = timeArr[1] itemNode.lblTime1:setString(title2) local title4 = timeArr[2] itemNode.lblTime2:setString(title4) --赛程分 local title3 = curScore itemNode.lblScore:setString(title3) end function LayerDailyGame:refreshIcon() local iconInfo1006 = G_EapSdkMgr:getIconInfo(CONFIG_IMG_1006) --赛事规则 if iconInfo1006 then local url = iconInfo1006.paths[1] local saveName = iconInfo1006.categoryId..tostring(iconInfo1006.updateTime) getUserImage(url, saveName, self.imgTitleRule, cc.size(184, 24)) end end return LayerDailyGame