local BG_W = 564 local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer") local LayerBoard = EapClass("LayerBoard", BaseLayer) function LayerBoard.createWithData(__node, __zorder) local layer = LayerBoard.new() layer.m_parent = __node __node:addChild(layer, __zorder) return layer end function LayerBoard:myShow() self:addListener(true) self:initData() self:initUI() end function LayerBoard:myClose() end function LayerBoard:initData() self.m_logos = {} end function LayerBoard:initUI() self.imgPath = { "res/ModuleEapSdk/eapsdk_img_bg.png", "res/ModuleEapSdk/Eap_Score/eapsdk_wj_banner_score.png", "res/ModuleEapSdk/Eap_Score/eapsdk_wj_img_matchSchl.png", "res/ModuleEapSdk/Eap_Score/eapsdk_img_title.png", "res/ModuleEapSdk/Eap_Score/eapsdk_wj_img_matchLogo.png", "res/ModuleEapSdk/eapsdk_wj_btn_close.png", } G_EapAbbreviation.addBackLayer(self, 150) local fix_x = display.width local fix_y = display.cy local imgBack = G_EapAbbreviation.createImageView(self.imgPath[1], self, cc.p(fix_x, fix_y), false, 0, 1101, cc.p(1, 0.5)) imgBack:setScale(0.6) self.btnBack = ccui.Button:create(self.imgPath[6]) self.btnBack:setPosition(cc.p(fix_x-915, fix_y+280)) self:addChild(self.btnBack, 1000) addButtonListener(self.btnBack, function() G_LayerMain:showBoard(false) G_EapSocketLogin.request_markLog(MARK_LOG11002) end) local bannerName = self.imgPath[2] self.imgBanner = G_EapAbbreviation.createImageView(bannerName, self, cc.p(fix_x-BG_W, fix_y), false, 0, 1101, cc.p(1, 0.5)) self.imgSchl = G_EapAbbreviation.createImageView(self.imgPath[3], self, cc.p(fix_x-BG_W-45, fix_y-150), false, 0, 1101, cc.p(1, 0.5)) self.imgBanner:setScale(0.6) self.imgSchl:setScale(0.6) self.node_top = cc.Node:create() self.node_top:setPosition(cc.p(fix_x-BG_W/2, fix_y+230)) self:addChild(self.node_top, 1) self.imgTitle = G_EapAbbreviation.createImageView(self.imgPath[4], self.node_top, cc.p(0, 0)) self.imgTitle:setScale(0.6) for i=1, 4 do local imgLogo = G_EapAbbreviation.createImageView(self.imgPath[5], self.node_top, cc.p(0, 0)) imgLogo:setScale(0.6) imgLogo:setVisible(false) if i==1 then imgLogo:setPosition(cc.p(180, -20)) end if i==2 then imgLogo:setPosition(cc.p(240, -20)) end if i==3 then imgLogo:setPosition(cc.p(180, -60)) end if i==4 then imgLogo:setPosition(cc.p(240, -60)) end self.m_logos[i] = imgLogo end self:refreshIcon() end function LayerBoard:showBack(__state) self.imgBanner:setVisible(__state) end function LayerBoard:showTop(__state) self.node_top:setVisible(__state) end function LayerBoard:onTouchEnd(__touch) local touchPos = __touch:getLocation() if touchPos.x < 250+FIX_WIDTH-G_LayerMain.fix_w/2 then if self:isVisible() then G_EapSocketLogin.request_markLog(MARK_LOG11002) end G_LayerMain:showBoard(false) end end function LayerBoard:refreshIcon() local iconInfo1001 = G_EapSdkMgr:getIconInfo(CONFIG_IMG_1001) local iconInfo1002 = G_EapSdkMgr:getIconInfo(CONFIG_IMG_1002) local iconInfo1003 = G_EapSdkMgr:getIconInfo(CONFIG_IMG_1003) local iconInfo1004 = G_EapSdkMgr:getIconInfo(CONFIG_IMG_1004) if iconInfo1001 then local url = iconInfo1001.paths[1] local saveName = iconInfo1001.categoryId..tostring(iconInfo1001.updateTime) getUserImage(url, saveName, self.imgBanner, cc.size(332, 600)) end if iconInfo1002 then local url = iconInfo1002.paths[1] local saveName = iconInfo1002.categoryId..tostring(iconInfo1002.updateTime) getUserImage(url, saveName, self.imgSchl, cc.size(241, 231)) end if iconInfo1003 then local url = iconInfo1003.paths[1] local saveName = iconInfo1003.categoryId..tostring(iconInfo1003.updateTime) getUserImage(url, saveName, self.imgTitle, cc.size(493, 144)) end if iconInfo1004 then for i=1, 4 do local url = iconInfo1004.paths[i] if url then local saveName = tostring(iconInfo1004.categoryId).."_"..i..tostring(iconInfo1004.updateTime) getUserImage(url, saveName, self.m_logos[i], cc.size(50, 25)) else self.m_logos[i]:setVisible(false) end end end end return LayerBoard