local BaseLayer = require("luaScript.ModuleEapSdk.BaseLayers.BaseLayer") local LayerBottom = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerBottom") local LayerBindPhone = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerBindPhone") local LayerEnd = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerEnd") local LayerFree = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerFree") local LayerMatch = require("luaScript.ModuleEapSdk.ModuleLayers.LayerScore.LayerMatch") local LayerRank = require("luaScript.ModuleEapSdk.ModuleLayers.LayerScore.LayerRank") local LayerRule = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerRule") local LayerSupport = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerSupport") local LayerDailyGame = require("luaScript.ModuleEapSdk.ModuleLayers.LayerScore.LayerDailyGame") local LayerUserInfo = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerUserInfo") local LayerAcntCode = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerAcntCode") local LayerHistory = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerHistory") local LayerStore = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStore") local LayerStoreConfirmOrder = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreConfirmOrder") local LayerStoreAddress = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreAddress") local LayerStoreNewAddr = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreNewAddr") local LayerStoreCheckPhone = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreCheckPhone") local LayerStoreBuyRecord = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreBuyRecord") local LayerStoreExResult = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreExResult") local LayerStoreCheckIDCard = require("luaScript.ModuleEapSdk.ModuleLayers.LayerStore.LayerStoreCheckIDCard") local LayerTeam = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeam") local LayerTeamInfo = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamInfo") local LayerTeamCode = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamCode") local LayerTeamCreate = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamCreate") local LayerTeamBind = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamBind") local LayerTeamRank = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamRank") local LayerTeamDaily = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamDaily") local LayerTeamDetail = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamDetail") local LayerTeamEnd = require("luaScript.ModuleEapSdk.ModuleLayers.LayerTeam.LayerTeamEnd") local LayerPlatformReady = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformReady") local LayerPlatformMatch = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformMatch") local LayerPlatformTeamDes = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformTeamDes") --队伍详情 local LayerPlatformCode = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformCode") --信息吗 local LayerPlatformFree = require("luaScript.ModuleEapSdk.ModuleLayers.LayerPlatform.LayerPlatformFree") --无赛事 local LayerBoard = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerBoard") local LayerFloat = require("luaScript.ModuleEapSdk.ModuleLayers.LayerCommon.LayerFloat") local LayerMain = EapClass("LayerMain", BaseLayer) function LayerMain:myShow() self:addListener(true) self:fixWinSize() self:initData() self:initUI() end function LayerMain:myClose() end function LayerMain:refreshData() self.m_needRefreshMatch = true --需要刷新自己赛事排行 self.m_needRefreshRank = true --需要刷新所有玩家赛事排行 self.m_needRefreshDaily = true --需要刷新自己的当日对局战绩 self.m_needRefreshFriend = true --需要刷新好友排行榜 self.node_base:setPosition(cc.p(-self.fix_w, -self.fix_h/2)) end function LayerMain:fixWinSize() self.node_base = cc.Node:create() local layerH = 600 local layer_designR = DESIGN_HEIGHT/layerH local design_winR = display.height/DESIGN_HEIGHT local total_r = layer_designR*design_winR local fix_w = display.width*total_r - display.width local fix_h = display.height*total_r - display.height self.fix_w = fix_w self.fix_h = fix_h self.node_base:setScale(total_r) self.node_base:setPosition(cc.p(-fix_w, -fix_h/2)) self:addChild(self.node_base, 2) end function LayerMain:initData() self.m_curSel = 0 --当前一级界面 self.m_curSubSel = 0 --当前二级界面 self.m_isShowBoard = false self.m_needRefreshMatch = true --需要刷新自己赛事排行 self.m_needRefreshRank = true --需要刷新所有玩家赛事排行 self.m_needRefreshDaily = true --需要刷新自己的当日对局战绩 self.m_needRefreshFriend = true --需要刷新好友排行榜 self.m_layerArr = {} -- self:getTimeConfig() -- G_EapSocketLogin.request_SDKConfig(function(__status, __data) -- print("request_SDKConfig = ", __data) -- if __status and __data then -- __data = G_EapSdkJson.decode(__data) -- for i=1, #__data.result do -- local info = __data.result[i] -- G_EapSdkMgr.MatchIcons[info.categoryId] = info -- end -- if self.m_layerBoard then -- self.m_layerBoard:refreshIcon() -- end -- if self.m_layerFree then -- self.m_layerFree:refreshIcon() -- end -- if self.m_layerRule then -- self.m_layerRule:refreshIcon() -- end -- if self.m_layerSupport then -- self.m_layerSupport:refreshIcon() -- end -- if self.m_layerRank then -- self.m_layerRank:refreshIcon() -- end -- if self.m_layerStore then -- self.m_layerStore:refreshIcon() -- end -- end -- end) end function LayerMain:getTimeConfig() G_EapSocketLogin.request_TimeConfig(function(__status, __data) if __status and __data then __data = G_EapSdkJson.decode(__data) if __data and __data.result then G_EapSdkMgr.m_timeConfig = __data.result end end end) end function LayerMain:initUI() print("LayerMain:initUI = ") self.m_layerFloat = LayerFloat.createWithData(self, 0) self.m_layerBoard = LayerBoard.createWithData(self.node_base, 1) --1000 self.m_layerBottom = LayerBottom.createWithData(self.m_layerBoard, 100) self.m_layerArr = {} self.m_subLayers = {} --二级界面:排行榜,规则,当日战绩 -- for i=1, #self.m_layerArr do -- self.m_layerArr[i]:setVisible(false) -- end -- for i=1, #self.m_subLayers do -- self.m_subLayers[i]:setVisible(false) -- end self:showBoard(false) self:showFloat(false) self:showBottom(true) -- self:showLayer(LAYER_ENUM.LAYER_MATCH) end function LayerMain:showBoard(__state) self.m_isShowBoard = __state self.m_layerBoard:setVisible(__state) self.m_layerBoard._listener:setSwallowTouches(__state) if __state then self.m_layerFloat:setWarnVisible(false) if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then --每次去获取战队排行列表 if G_EapSdkMgr.m_myMatchInfo then local roundMax = G_EapSdkMgr.m_myMatchInfo.RoundMax local matchID = G_EapSdkMgr.m_myMatchInfo.MatchID for i=1, roundMax do G_EapSocketLogin.request_teamMatchRankGet(matchID, i-1) end end end end end function LayerMain:showBottom(__state) self.m_layerBottom:setVisible(__state) end function LayerMain:showFloat(__state) self.m_layerFloat:setVisible(__state) self.m_layerFloat:setListenerEnable(__state) end function LayerMain:isFloatShow() return self.m_layerFloat:isVisible() end --当前页面 function LayerMain:getCurLayer() return self.m_curSel end function LayerMain:showLayer(index) local oldLayer = self.m_layerArr[self.m_curSel] if oldLayer then oldLayer:setVisible(false) if oldLayer.closeReset then oldLayer:closeReset() end end self:closeSubLayer() if self.m_layerArr[index] then self.m_layerArr[index]:setVisible(true) else if index == LAYER_ENUM.LAYER_MATCH then self.m_layerMatch = LayerMatch.createWithData(self.m_layerBoard, 3) --2000 self.m_layerArr[index] = self.m_layerMatch -- elseif index == LAYER_ENUM.LAYER_RANK then -- self.m_layerRank = LayerRank.createWithData(self.m_layerBoard, 4) --3000 -- self.m_layerArr[index] = self.m_layerRank -- elseif index == LAYER_ENUM.LAYER_RULE then -- self.m_layerRule = LayerRule.createWithData(self.m_layerBoard, 5) -- self.m_layerArr[index] = self.m_layerRule elseif index == LAYER_ENUM.LAYER_INFO then self.m_layerInfo = LayerUserInfo.createWithData(self.m_layerBoard, 7) self.m_layerArr[index] = self.m_layerInfo elseif index == LAYER_ENUM.LAYER_ACNT_CODE then self.m_layerAcntCode = LayerAcntCode.createWithData(self.m_layerBoard, 7) self.m_layerArr[index] = self.m_layerAcntCode elseif index == LAYER_ENUM.LAYER_HISTORY then self.m_layerHistory = LayerHistory.createWithData(self.m_layerBoard, 7) self.m_layerArr[index] = self.m_layerHistory elseif index == LAYER_ENUM.LAYER_END then self.m_layerEnd = LayerEnd.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerEnd elseif index == LAYER_ENUM.LAYER_FREE then self.m_layerFree = LayerFree.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerFree elseif index == LAYER_ENUM.LAYER_BINDPHONE then self.m_layerBindPhone = LayerBindPhone.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerBindPhone elseif index == LAYER_ENUM.LAYER_STORE then self.m_layerStore = LayerStore.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStore elseif index == LAYER_ENUM.LAYER_CONFIRM_ORDER then self.m_layerStoreConfirmOrder = LayerStoreConfirmOrder.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreConfirmOrder elseif index == LAYER_ENUM.LAYER_ADDRESS then self.m_layerStoreAddress = LayerStoreAddress.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreAddress elseif index == LAYER_ENUM.LAYER_NEW_ADDR then self.m_layerStoreNewAddr = LayerStoreNewAddr.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreNewAddr elseif index == LAYER_ENUM.LAYER_CHECK_PHONE then self.m_layerStoreCheckPhone = LayerStoreCheckPhone.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreCheckPhone elseif index == LAYER_ENUM.LAYER_BUY_RECORD then self.m_layerStoreBuyRecord = LayerStoreBuyRecord.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreBuyRecord elseif index == LAYER_ENUM.LAYER_EX_RESULT then self.m_layerStoreExResult = LayerStoreExResult.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreExResult elseif index == LAYER_ENUM.LAYER_CHECK_IDCARD then self.m_layerStoreCheckIDCard = LayerStoreCheckIDCard.createWithData(self.m_layerBoard, 6) self.m_layerArr[index] = self.m_layerStoreCheckIDCard elseif index == LAYER_ENUM.LAYER_TEAM then self.m_layerTeam = LayerTeam.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerTeam elseif index == LAYER_ENUM.LAYER_TEAM_INFO then self.m_layerTeamInfo = LayerTeamInfo.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerTeamInfo elseif index == LAYER_ENUM.LAYER_TEAM_CODE then self.m_layerTeamCode = LayerTeamCode.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerTeamCode elseif index == LAYER_ENUM.LAYER_TEAM_CREATE then self.m_layerTeamCreate = LayerTeamCreate.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerTeamCreate elseif index == LAYER_ENUM.LAYER_TEAM_BIND then self.m_layerTeamBind = LayerTeamBind.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerTeamBind elseif index == LAYER_ENUM.LAYER_TEAM_END then self.m_layerTeamEnd = LayerTeamEnd.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerTeamEnd elseif index == LAYER_ENUM.LAYER_PLATFORM_READY then --平台赛事准备 self.m_layerPlatformReady = LayerPlatformReady.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerPlatformReady elseif index == LAYER_ENUM.LAYER_PLATFORM_MATCH then --平台赛事开赛 self.m_layerPlatformMatch = LayerPlatformMatch.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerPlatformMatch elseif index == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES then --平台赛事队伍详情 self.m_layerPlatformTeamDes = LayerPlatformTeamDes.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerPlatformTeamDes elseif index == LAYER_ENUM.LAYER_PLATFORM_CODE then --平台赛事通过信息码绑定 self.m_layerPlatformCode = LayerPlatformCode.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerPlatformCode elseif index == LAYER_ENUM.LAYER_PLATFORM_FREE then --无赛事 self.m_layerPlatformFree = LayerPlatformFree.createWithData(self.m_layerBoard, 8) self.m_layerArr[index] = self.m_layerPlatformFree end end --top条显示 if index == LAYER_ENUM.LAYER_MATCH or index == LAYER_ENUM.LAYER_END or index == LAYER_ENUM.LAYER_FREE or index == LAYER_ENUM.LAYER_TEAM or index == LAYER_ENUM.LAYER_TEAM_END or index == LAYER_ENUM.LAYER_PLATFORM_FREE then self.m_layerBoard:showTop(true) else self.m_layerBoard:showTop(false) end --底部页签显示 if index == LAYER_ENUM.LAYER_PLATFORM_READY or index == LAYER_ENUM.LAYER_PLATFORM_MATCH or index == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES or index == LAYER_ENUM.LAYER_BINDPHONE or index == LAYER_ENUM.LAYER_CONFIRM_ORDER or index == LAYER_ENUM.LAYER_ADDRESS or index == LAYER_ENUM.LAYER_NEW_ADDR or index == LAYER_ENUM.LAYER_CHECK_PHONE or index == LAYER_ENUM.LAYER_CHECK_IDCARD or index == LAYER_ENUM.LAYER_BUY_RECORD or index == LAYER_ENUM.LAYER_EX_RESULT or index == LAYER_ENUM.LAYER_PLATFORM_CODE then self:showBottom(false) elseif index == LAYER_ENUM.LAYER_PLATFORM_FREE or index == LAYER_ENUM.LAYER_STORE or index == LAYER_ENUM.LAYER_INFO or index == LAYER_ENUM.LAYER_ACNT_CODE or index == LAYER_ENUM.LAYER_HISTORY or index == LAYER_ENUM.LAYER_TEAM or index == LAYER_ENUM.LAYER_TEAM_INFO or index == LAYER_ENUM.LAYER_TEAM_CODE or index == LAYER_ENUM.LAYER_TEAM_CREATE or index == LAYER_ENUM.LAYER_TEAM_BIND or index == LAYER_ENUM.LAYER_MATCH then self:showBottom(true) end if index == LAYER_ENUM.LAYER_MATCH then if self.m_needRefreshMatch then self.m_needRefreshMatch = false for k,v in pairs(G_EapSdkMgr.m_matchInfos) do G_EapSocketLogin.request_userMatchInfoGet(k) end end end if index == LAYER_ENUM.LAYER_TEAM then if self.m_needRefreshMatch then self.m_needRefreshMatch = false if #G_EapSdkMgr.m_selTeamInfos > 0 then local teamInfo = G_EapSdkMgr.m_selTeamInfos[1] G_EapSocketLogin.request_teamMatchRankGet(teamInfo.matchId, teamInfo.id, 0, 0, 1) end end end if index == LAYER_ENUM.LAYER_STORE then self.m_layerStore:getGoodsList() end if index == LAYER_ENUM.LAYER_INFO then if EAP_MATCH_STAGE == EAP_STAGE_TEAM then if #G_EapSdkMgr.m_selTeamInfos > 0 then local teamInfo = G_EapSdkMgr.m_selTeamInfos[1] G_EapSocketLogin.request_CheckTaskReq(teamInfo.matchId) self.m_layerInfo:showSignNode(true) else self.m_layerInfo:showSignNode(false) end end end self.m_curSel = index if index == LAYER_ENUM.LAYER_MATCH then G_EapSocketLogin.request_markLog(MARK_LOG10002) elseif index == LAYER_ENUM.LAYER_STORE then G_EapSocketLogin.request_markLog(MARK_LOG10003) elseif index == LAYER_ENUM.LAYER_INFO then G_EapSocketLogin.request_markLog(MARK_LOG10004) elseif index == LAYER_ENUM.LAYER_BINDPHONE then G_EapSocketLogin.request_markLog(MARK_LOG11004) elseif index == LAYER_ENUM.LAYER_TEAM then G_EapSocketLogin.request_markLog(MARK_LOG10002) elseif index == LAYER_ENUM.LAYER_TEAM_INFO then G_EapSocketLogin.request_markLog(MARK_LOG11015) elseif index == LAYER_ENUM.LAYER_TEAM_BIND then G_EapSocketLogin.request_markLog(MARK_LOG11004) elseif index == LAYER_ENUM.LAYER_FREE then G_EapSocketLogin.request_markLog(MARK_LOG10018) end return self.m_layerArr[index] end function LayerMain:isSubLayerVis(index) local tmpIndex = index or self.m_curSubSel local oldLayer = self.m_subLayers[tmpIndex] if oldLayer then return oldLayer:isVisible() end return false end --关闭二级界面 function LayerMain:closeSubLayer(index) local tmpIndex = index or self.m_curSubSel local oldLayer = self.m_subLayers[tmpIndex] if oldLayer then oldLayer:setVisible(false) end self.m_layerBoard:showBack(true) self.m_curSubSel = 0 end function LayerMain:showSubLayer(index) local oldLayer = self.m_subLayers[self.m_curSubSel] if oldLayer then oldLayer:setVisible(false) end self.m_layerBoard:showBack(false) if self.m_subLayers[index] then self.m_subLayers[index]:setVisible(true) else if index == LAYER_ENUM.LAYER_RANK then self.m_layerRank = LayerRank.createWithData(self.m_layerBoard, 2) --3000 self.m_subLayers[index] = self.m_layerRank elseif index == LAYER_ENUM.LAYER_RULE then self.m_layerRule = LayerRule.createWithData(self.m_layerBoard, 2) self.m_subLayers[index] = self.m_layerRule elseif index == LAYER_ENUM.LAYER_DAILY_GAME then self.m_layerDailyGame = LayerDailyGame.createWithData(self.m_layerBoard, 2) self.m_subLayers[index] = self.m_layerDailyGame elseif index == LAYER_ENUM.LAYER_SUPPORT then self.m_layerSupport = LayerSupport.createWithData(self.m_layerBoard, 2) self.m_subLayers[index] = self.m_layerSupport elseif index == LAYER_ENUM.LAYER_TEAM_RANK then self.m_layerTeamRank = LayerTeamRank.createWithData(self.m_layerBoard, 2) self.m_subLayers[index] = self.m_layerTeamRank elseif index == LAYER_ENUM.LAYER_TEAM_DAILY then self.m_layerTeamDaily = LayerTeamDaily.createWithData(self.m_layerBoard, 2) self.m_subLayers[index] = self.m_layerTeamDaily elseif index == LAYER_ENUM.LAYER_TEAM_DETAIL then self.m_layerTeamDetail = LayerTeamDetail.createWithData(self.m_layerBoard, 2) self.m_subLayers[index] = self.m_layerTeamDetail end end if index == LAYER_ENUM.LAYER_RANK then local matchIDs = table.keys(G_EapSdkMgr.m_matchInfos) if self.m_needRefreshRank then self.m_needRefreshRank = false for i=1, 2 do G_EapSocketLogin.request_UserMatchRankGet(matchIDs[1], 0, i-1, 50) end end if self.m_needRefreshFriend then self.m_needRefreshFriend = false G_EapSocketLogin.request_FriendListGet() end end if index == LAYER_ENUM.LAYER_DAILY_GAME then if self.m_needRefreshDaily then self.m_needRefreshDaily = false for k,v in pairs(G_EapSdkMgr.m_matchInfos) do G_EapSocketLogin.request_MatchRoundGet(k) end end end if index == LAYER_ENUM.LAYER_TEAM_RANK then if #G_EapSdkMgr.m_selTeamInfos > 0 then local matchID = G_EapSdkMgr.m_selTeamInfos[1].matchId local teamID = G_EapSdkMgr.m_selTeamInfos[1].id if self.m_needRefreshRank then self.m_needRefreshRank = false for i=1, 2 do G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, i-1, 2, 50) end end else local matchInfo = G_EapSdkMgr:getSelfTeamRank() if matchInfo then local matchID = matchInfo.MatchID local teamID = matchInfo.TeamID if self.m_needRefreshRank then self.m_needRefreshRank = false for i=1, 2 do G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, i-1, 3, 50) end end end end end if index == LAYER_ENUM.LAYER_TEAM_DAILY then if #G_EapSdkMgr.m_selTeamInfos > 0 then local matchID = G_EapSdkMgr.m_selTeamInfos[1].matchId local teamID = G_EapSdkMgr.m_selTeamInfos[1].id if self.m_needRefreshDaily then self.m_needRefreshDaily = false for i=1,3 do G_EapSocketLogin.request_PointTeamDayGet(teamID, matchID, i-1, 10) end end else local matchInfo = G_EapSdkMgr:getSelfTeamRank() if matchInfo then local matchID = matchInfo.MatchID local teamID = matchInfo.TeamID if self.m_needRefreshDaily then self.m_needRefreshDaily = false for i=1,3 do G_EapSocketLogin.request_PointTeamDayGet(teamID, matchID, i-1, 10) end end end end end self.m_curSubSel = index if index == LAYER_ENUM.LAYER_RULE then G_EapSocketLogin.request_markLog(MARK_LOG10007) elseif index == LAYER_ENUM.LAYER_DAILY_GAME then G_EapSocketLogin.request_markLog(MARK_LOG10008) elseif index == LAYER_ENUM.LAYER_SUPPORT then G_EapSocketLogin.request_markLog(MARK_LOG10009) elseif index == LAYER_ENUM.LAYER_RANK then G_EapSocketLogin.request_markLog(MARK_LOG10006) elseif index == LAYER_ENUM.LAYER_TEAM_RANK then G_EapSocketLogin.request_markLog(MARK_LOG10006) elseif index == LAYER_ENUM.LAYER_TEAM_DAILY then G_EapSocketLogin.request_markLog(MARK_LOG10008) end return self.m_subLayers[index] end function LayerMain:OnHandleMsg(__opcode, __data, __params) if (OpcodeWebSdkConfigAck == __opcode) then --sdk配置查询 if __data.nRet == 0 then if self.m_layerBoard then self.m_layerBoard:refreshIcon() end if self.m_layerFree then self.m_layerFree:refreshIcon() end if self.m_layerRule then self.m_layerRule:refreshIcon() end if self.m_layerSupport then self.m_layerSupport:refreshIcon() end if self.m_layerRank then self.m_layerRank:refreshIcon() end if self.m_layerStore then self.m_layerStore:refreshIcon() end end elseif (OpcodeMatchAppIDsAck == __opcode) then --获取所有的平台 if __data.nRet == 0 then end elseif (OpcodeVerifyAccountAck == __opcode) then --注册帐号 if __data.nRet == 0 then end elseif (OpcodeQueryByCPAccountAck == __opcode) then --通过三方帐号查询pid if __data.nRet == 0 then else if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then self:showFloat(true) self:dealFirstLogin() self:showLayer(LAYER_ENUM.LAYER_PLATFORM_CODE) end end elseif (OpcodeBindCPAccountAck == __opcode) then --绑定三方帐号 if __data.nRet == 0 then end elseif (OpcodeGetCodeAck == __opcode) then --获取验证码 if self.m_curSel == LAYER_ENUM.LAYER_BINDPHONE then if self.m_layerBindPhone then self.m_layerBindPhone:refreshErrMsg(__params.info, __data.nRet) end end if self.m_curSel == LAYER_ENUM.LAYER_TEAM_BIND then if self.m_layerTeamBind then self.m_layerTeamBind:refreshErrMsg(__params.info, __data.nRet) end end elseif (OpcodeBindPhoneAck == __opcode) then --绑定手机 if self.m_curSel == LAYER_ENUM.LAYER_BINDPHONE then self.m_layerBindPhone:refreshErrMsg(__params.info, __data.nRet) if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then self.m_needRefreshRank = true --需要刷新所有玩家赛事排行 self.m_needRefreshDaily = true local curSelMatch = G_EapSdkMgr.getSelMatchID() local selMatchInfo = G_EapSdkMgr.m_allMatchs[curSelMatch] if selMatchInfo then G_EapSdkMgr.m_matchInfos = {} G_EapSdkMgr.m_matchInfos[curSelMatch] = clone(selMatchInfo) G_EapSocketLogin.request_userMatchInfoGet(curSelMatch) end if self.m_layerMatch then self.m_layerMatch:checkBindPhone(true) end end local bottomSel = self.m_layerBottom:getCurSel() if bottomSel == 1 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then G_LayerMain:showLayer(LAYER_ENUM.LAYER_MATCH) end elseif bottomSel == 4 then if EAP_MATCH_STAGE == EAP_STAGE_TEAM then G_LayerMain:showLayer(LAYER_ENUM.LAYER_TEAM_CODE) end elseif bottomSel == 2 then if G_EapSdkMgr.EapPhone then G_LayerMain:showLayer(LAYER_ENUM.LAYER_STORE) end end if self.m_layerMatch then self.m_layerMatch:refreshRedInfo() end end elseif self.m_curSel == LAYER_ENUM.LAYER_TEAM_BIND then if self.m_layerTeamBind then self.m_layerTeamBind:refreshErrMsg(__params.info, __data.nRet) end if __data.nRet == 0 then local bottomSel = self.m_layerBottom:getCurSel() if bottomSel == 4 then if EAP_MATCH_STAGE == EAP_STAGE_TEAM then G_LayerMain:showLayer(LAYER_ENUM.LAYER_TEAM_CODE) end elseif bottomSel == 2 then G_LayerMain:showLayer(LAYER_ENUM.LAYER_STORE) end end end elseif (OpcodeLoginInfoCodeAck == __opcode) then --信息码返回错误 if self.m_layerPlatformCode then self.m_layerPlatformCode:refreshErrMsg(__params.success) end if EAP_MATCH_STAGE == EAP_STAGE_TEAM then if self.m_layerAcntCode then self.m_layerAcntCode:refreshErrMsg(__params.success) end if __params.success then self:showLayer(LAYER_ENUM.LAYER_INFO) if self.m_layerInfo then self.m_layerInfo:refreshMyInfo(true) end end end elseif (OpcodePointGameSelectAck == __opcode) then --玩家选择赛区 if __data.nRet == 0 and __data.Type == 2 then if self.m_layerMatch then self.m_layerMatch:setInfoItem() end end elseif (OpcodeMatchListAck == __opcode) then --查询赛事信息 if EAP_MATCH_STAGE == EAP_STAGE_SCORE then self:showFloat(true) self:dealFirstLogin() if G_EapSdkMgr.m_isMatching then -- local isClick = G_EapSdkMgr:getClickEnter() -- if isClick ~= 1 and not G_EapSdkMgr.EapPhone then -- self:showLayer(LAYER_ENUM.LAYER_FREE) -- else self:showLayer(LAYER_ENUM.LAYER_MATCH) -- end else local selMatchID = G_EapSdkMgr:getSelMatchID() if selMatchID ~= "" then G_EapSocketLogin.request_UserRedCashGet(selMatchID) end G_EapSocketLogin.request_PointHistoryGet() self:showLayer(LAYER_ENUM.LAYER_END) end elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then self:showFloat(true) self:dealFirstLogin() if G_EapSdkMgr.m_isMatching then local isClick = G_EapSdkMgr:getClickEnter() -- if G_EapSdkMgr.m_firstLogin then if isClick ~= 1 then self:showLayer(LAYER_ENUM.LAYER_FREE) else -- if not G_EapSdkMgr.EapPhone then -- self:showLayer(LAYER_ENUM.LAYER_TEAM_BIND) -- else self:showLayer(LAYER_ENUM.LAYER_TEAM) -- end self.m_layerBottom:setTabSel(1) end else G_EapSocketLogin.request_PointHistoryGet() self:showLayer(LAYER_ENUM.LAYER_END) end end elseif (OpcodeMatchRuleAck == __opcode) then --查询赛事规则 if G_EapSdkMgr.m_matchRule then if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then if self.m_layerPlatformMatch then self.m_layerPlatformMatch:refreshMatchRule() end elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE or EAP_MATCH_STAGE == EAP_STAGE_TEAM then if self.m_layerRule then self.m_layerRule:refreshRuleInfo() end end end elseif (OpcodeHistoryDetailAck == __opcode) then --历史赛事详情 if G_EapSdkMgr.m_matchRule then if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then if self.m_layerPlatformMatch then self.m_layerPlatformMatch:refreshMatchRule() end elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE or EAP_MATCH_STAGE == EAP_STAGE_TEAM then if self.m_layerRule then self.m_layerRule:refreshRuleInfo() end end end if self.m_layerHistory then self.m_layerHistory:refreshUserInfo(__data.MatchInfo) end elseif (OpcodeUserMatchInfoAck == __opcode) then --获取进行中的赛事玩家详情,可用于赛事列表获取后,某个赛事玩家对应的信息 if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then self:showFloat(true) self:dealFirstLogin() if G_EapSdkMgr.m_myUserMatchInfo then if G_EapSdkMgr.m_isMatching then self:showLayer(LAYER_ENUM.LAYER_PLATFORM_MATCH) self.m_layerPlatformMatch:refreshMatchInfo() else self:showLayer(LAYER_ENUM.LAYER_PLATFORM_READY) self.m_layerPlatformReady:refreshMatchInfo() end if G_EapSdkMgr.m_myMatchInfo and G_EapSdkMgr.m_myMatchInfo.Status == MATCH_STATUS.End then if self.m_layerPlatformMatch then self.m_layerPlatformMatch:refreshMatchEnd() end end else self:showLayer(LAYER_ENUM.LAYER_PLATFORM_FREE) end elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE then if self.m_layerMatch then if __params.isSelf then self.m_layerMatch:setInfoItem() else self.m_layerMatch:refreshSearchRes() end end end elseif (OpcodeUserConfirmMatchAck == __opcode) then --赛事匹配阶段确认参加赛事,由sdk发送确认消息 if __data.nRet == 0 then end elseif (OpcodeTeamMatchRankAck == __opcode) then --获取战队排行榜 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then if self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_READY then self.m_layerPlatformReady:refreshRankList() self.m_layerPlatformReady:refreshSelfInfo() elseif self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_MATCH then if __data.PageNum == 0 then self.m_layerPlatformMatch:refreshRankList(__params.dataEnd) else self.m_layerPlatformMatch:expandRankList(__params.dataEnd) end elseif self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES then self.m_layerPlatformTeamDes:resetAllInfo() end elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then if __data.AckType == 1 then --自己 self.m_needRefreshMatch = false if self.m_layerTeam then self.m_layerTeam:setInfoItem() end if self.m_layerTeamRank then self.m_layerTeamRank:refreshSelfRank() end elseif __data.AckType == 2 then --总排行榜 if __data.PageNum == 1 and self.m_layerTeamRank then self.m_layerTeamRank:refreshRankList(__data.MatchID) end elseif __data.AckType == 3 then --所有 if __data.PageNum == 1 and self.m_layerTeamRank then self.m_layerTeamRank:refreshSelfRank() self.m_layerTeamRank:refreshRankList(__data.MatchID) end end end end elseif (OpcodeUserSelectTeamAck == __opcode) then --获取自己的战队信息 if #G_EapSdkMgr.m_selTeamInfos > 0 then if self.m_layerTeamInfo then self.m_layerTeamInfo:setMembers() else if self.m_layerBottom:getCurSel() == 4 then self:showLayer(LAYER_ENUM.LAYER_TEAM_INFO) end end end if self.m_layerTeam then self.m_layerTeam:refreshTeamInfo() self.m_layerTeam:setInfoItem() end elseif (OpcodeJoinSelectTeamAck == __opcode) then --获取自己的战队信息 if self.m_curSel == LAYER_ENUM.LAYER_TEAM_CODE then if self.m_layerTeamCode then self.m_layerTeamCode:refreshErrMsg(__data.retCode) end end elseif (OpcodeQuitSelectTeamAck == __opcode) then --退出选拔赛战队回应 if __data.retCode == 0 then if self.m_layerTeam then self.m_layerTeam:refreshTeamInfo() end end elseif (OpcodeSelectTeamDetailAck == __opcode) then --查看选拔赛战队明细回应 if __data.retCode == 0 then if self.m_layerTeamRank then self.m_layerTeamRank:refreshUserInfo(__data.result) end end elseif (OpcodeUserMatchRankAck == __opcode) then --获取个人排行榜 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if __data.PageNum == 1 then self.m_layerRank:refreshRankList(__data.MatchID) end end end elseif (OpcodeMatchRoundAck == __opcode) then --玩家每局对局详情 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if __params.isRoundFinish then self.m_layerDailyGame:refreshRankList(__data.MatchID) end end end elseif (OpcodeVerifyRealNameAck == __opcode) then --实名认证 -- if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if self.m_layerStoreCheckIDCard then self.m_layerStoreCheckIDCard:onVerifyRealName(__data) end -- end elseif (OpcodeGetBaseInfoAck == __opcode) then --获取个人基础信息 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then -- self.m_layerRank:refreshUserInfo(__data.user.nPID) end end elseif (OpcodeGetMultiUserInfoAck == __opcode) then -- 批量查询玩家基础信息 if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if self.m_layerRank then self.m_layerRank:refreshUserInfo() end if self.m_layerMatch then self.m_layerMatch:refreshSearchRes() self.m_layerMatch:refreshFriendListItems() end end elseif (OpcodePointHistoryAck == __opcode) then --获取历史战绩 if self.m_layerEnd then if EAP_MATCH_STAGE == EAP_STAGE_TEAM then self.m_layerEnd:refreshRank() elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE then self.m_layerEnd:refreshRedInfo() end end if self.m_layerHistory then self.m_layerHistory:refreshHistoryList() end elseif (OpcodeFriendListAck == __opcode) then --获取好友列表 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then end end elseif (OpcodeFriendFollowAck == __opcode) then --关注、取消关注好友 if __data.nRet == 0 then self.m_needRefreshFriend = true if self.m_layerMatch then self.m_layerMatch:refreshFollowState() self.m_layerMatch:refreshFriendList() end end elseif (OpcodePointRankListAck == __opcode) then --积分赛获取好友排行 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if self.m_layerRank then self.m_layerRank:refreshRankList(__data.MatchID) end if self.m_layerMatch then self.m_layerMatch:refreshFriendList(__data.MatchID) end end end elseif (OpcodeUserInfoNoti == __opcode) then --玩家赛事对局详情通知 if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then if G_EapSdkMgr.m_isMatching then self:showLayer(LAYER_ENUM.LAYER_PLATFORM_MATCH) self.m_layerPlatformMatch:refreshMatchInfo() self.m_layerPlatformMatch:refreshMatchRule() end end elseif (OpcodeMatchBaseNoti == __opcode) then --比赛状态更新通知 if EAP_MATCH_STAGE == EAP_STAGE_PLATFORM then if G_EapSdkMgr.m_myMatchInfo and G_EapSdkMgr.m_myMatchInfo.Status == MATCH_STATUS.End then self:showLayer(LAYER_ENUM.LAYER_PLATFORM_MATCH) --获取玩家所有参赛赛事 -- G_EapSocketLogin.request_userMatchInfoGet() if self.m_layerPlatformMatch then self.m_layerPlatformMatch:refreshMatchEnd() end end elseif EAP_MATCH_STAGE == EAP_STAGE_SCORE or EAP_MATCH_STAGE == EAP_STAGE_TEAM then if G_EapSdkMgr:checkAllMatchEnd() then G_EapSocketLogin.request_PointHistoryGet() self:showLayer(LAYER_ENUM.LAYER_END) end end elseif (OpcodeUserScoreNoti == __opcode) then --算分服务器通知 if not self.m_isShowBoard then self.m_layerFloat:setWarnVisible(true) self.m_layerFloat:setFloatOut(true) end if EAP_MATCH_STAGE == EAP_STAGE_SCORE then local selMatchID = G_EapSdkMgr:getSelMatchID() if selMatchID == "" then for k,v in pairs(G_EapSdkMgr.m_matchInfos) do selMatchID = k break end end if selMatchID == __data.MatchID then if self.m_curSel == LAYER_ENUM.LAYER_MATCH then G_EapSocketLogin.request_userMatchInfoGet(__data.MatchID) else self.m_needRefreshMatch = true --需要刷新自己赛事排行 end if self.m_curSubSel == LAYER_ENUM.LAYER_RANK then for i=1, 2 do G_EapSocketLogin.request_UserMatchRankGet(matchIDs[1], 0, i-1, 50) end self.m_needRefreshDaily = true elseif self.m_curSubSel == LAYER_ENUM.LAYER_DAILY_GAME then G_EapSocketLogin.request_MatchRoundGet(__data.MatchID) self.m_needRefreshRank = true else self.m_needRefreshRank = true --需要刷新所有玩家赛事排行 self.m_needRefreshDaily = true end G_EapSocketLogin.request_UserRedCashGet(selMatchID) end elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then if #G_EapSdkMgr.m_selTeamInfos > 0 then local matchID = G_EapSdkMgr.m_selTeamInfos[1].matchId local teamID = G_EapSdkMgr.m_selTeamInfos[1].id if matchID == __data.MatchID then if self.m_curSel == LAYER_ENUM.LAYER_TEAM then G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, 0, 1) else self.m_needRefreshMatch = true --需要刷新自己赛事排行 end if self.m_curSubSel == LAYER_ENUM.LAYER_TEAM_RANK then for i=1, 2 do G_EapSocketLogin.request_teamMatchRankGet(matchID, teamID, 0, i-1, 2, 50) end self.m_needRefreshDaily = true elseif self.m_curSubSel == LAYER_ENUM.LAYER_TEAM_DAILY then for i=1,3 do G_EapSocketLogin.request_PointTeamDayGet(teamID, matchID, i-1, 10) end self.m_needRefreshRank = true else self.m_needRefreshRank = true --需要刷新所有玩家赛事排行 self.m_needRefreshDaily = true end end end end elseif (OpcodeMatchItemNoti == __opcode) then --赛事道具改变通知 if not self.m_isShowBoard then self.m_layerFloat:setWarnVisible(true) self.m_layerFloat:setFloatOut(true) end if EAP_MATCH_STAGE == EAP_STAGE_SCORE then local selMatchID = G_EapSdkMgr:getSelMatchID() if selMatchID == "" then for k,v in pairs(G_EapSdkMgr.m_matchInfos) do selMatchID = k break end end if selMatchID == __data.MatchID then if self.m_curSubSel == LAYER_ENUM.LAYER_DAILY_GAME then G_EapSocketLogin.request_MatchRoundGet(__data.MatchID) else self.m_needRefreshDaily = true end if self.m_curSel == LAYER_ENUM.LAYER_MATCH then G_EapSocketLogin.request_userMatchInfoGet(__data.MatchID) else self.m_needRefreshMatch = true --需要刷新自己赛事排行 end G_EapSocketLogin.request_UserRedCashGet(selMatchID) end elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then if #G_EapSdkMgr.m_selTeamInfos > 0 then local selMatchID = G_EapSdkMgr.m_selTeamInfos[1].matchId local teamID = G_EapSdkMgr.m_selTeamInfos[1].id if selMatchID == __data.MatchID then if self.m_curSubSel == LAYER_ENUM.LAYER_TEAM_DAILY then for i=1,3 do G_EapSocketLogin.request_PointTeamDayGet(teamID, selMatchID, i-1, 10) end else self.m_needRefreshDaily = true end if self.m_curSel == LAYER_ENUM.LAYER_TEAM then G_EapSocketLogin.request_teamMatchRankGet(selMatchID, teamID, 0, 0, 1) else self.m_needRefreshMatch = true --需要刷新自己战队的赛事信息 end end end end elseif (OpcodeUserItemChangeNotify == __opcode) then --玩家道具变化通知 if self.m_layerInfo then self.m_layerInfo:refreshBattleScore() end if self.m_layerStore then self.m_layerStore:refreshBattleScore() end if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if self.m_layerMatch then self.m_layerMatch:refreshBattleScore() end elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then if self.m_layerTeam then self.m_layerTeam:refreshBattleScore() end end elseif (OpcodeNotifyHookAck == __opcode) then --战队通知 if __data.type == "SelectTeamChange" then --战队成员变化 G_EapSocketLogin.request_UserSelectTeamReq() elseif __data.type == "TaskCompleted" then --任务完成通知 if self.m_layerTeam then self.m_layerTeam:refreshTaskTip(true) end end elseif (OpcodeGetUserDescAck == __opcode) then --玩家道具信息 if EAP_MATCH_STAGE == EAP_STAGE_SCORE then if self.m_layerMatch then self.m_layerMatch:refreshBattleScore() end elseif EAP_MATCH_STAGE == EAP_STAGE_TEAM then if self.m_layerTeam then self.m_layerTeam:refreshBattleScore() end end elseif (OpcodeTeamDetailAck == __opcode) then --战队详情 if __data.retCode == 0 then if self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_READY then self.m_layerPlatformReady:refreshTeamInfo(__data.TeamID) self.m_layerPlatformReady:refreshSelfInfo() elseif self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_MATCH then self.m_layerPlatformMatch:refreshTeamInfo(__data.TeamID) end end elseif (OpcodeTeamMemberAck == __opcode) then --战队成员 if __data.retCode == 0 then if self.m_curSel == LAYER_ENUM.LAYER_PLATFORM_TEAM_DES then self.m_layerPlatformTeamDes:refreshMemInfo() end end elseif (OpcodePointTeamDayAck == __opcode) then --战队积分赛当天数据获取 if __data.nRet == 0 then if __data.PageNum == 2 then if self.m_layerTeamDaily then self.m_layerTeamDaily:refreshRankList() end end end elseif (OpcodeUserRedCashAck == __opcode) then --获取自己的红包 if __data.nRet == 0 then if self.m_layerMatch then self.m_layerMatch:refreshRedInfo() end if self.m_layerEnd then self.m_layerEnd:refreshRedInfo() end if self.m_layerInfo then self.m_layerInfo:refreshRedInfo() end end elseif (OpcodeUserRedChangeAck == __opcode) then --获取红包记录 if __data.nRet == 0 and __data.Type == 2 then if self.m_layerMatch then self.m_layerMatch:refreshRedList() end end elseif (OpcodeItemExChangeAck == __opcode) then --红包兑换 if __data.nRet == 0 then local selMatchID = G_EapSdkMgr:getSelMatchID() if selMatchID ~= "" then G_EapSocketLogin.request_UserRedCashGet(selMatchID) end end elseif (OpcodeCheckTaskAck == __opcode) then --查询任务列表 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_TEAM then if G_EapSdkMgr.m_isMatching then if self.m_layerInfo then self.m_layerInfo:refreshPerAwardList() self.m_layerInfo:refreshTeamAward() end if self.m_layerTeam then self.m_layerTeam:refreshTaskTip() end end end end elseif (OpcodeGetAwardAck == __opcode) then --领取任务奖励 if __data.nRet == 0 then if EAP_MATCH_STAGE == EAP_STAGE_TEAM then if self.m_layerInfo then self.m_layerInfo:showGetAward(__data.result) end end end end end function LayerMain:dealFirstLogin() -- if G_EapSdkMgr.m_firstLogin then if G_EapSdkMgr:checkDailyFirst() then self:showBoard(true) self.m_layerFloat:setFloatOut(false) self.m_layerFloat:setWarnVisible(false) G_EapSocketLogin.request_markLog(MARK_LOG11001) else self:showBoard(false) self.m_layerFloat:setFloatOut(true) self.m_layerFloat:setWarnVisible(true) end end return LayerMain