From 6fbed83b2824678ba6739a60b58f0fce9ba96c9c Mon Sep 17 00:00:00 2001 From: zhangqiang <657634622@qq.com> Date: Thu, 16 Jul 2020 14:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=85=E5=B3=B0=E8=B5=9B=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArenaTopMatch/ArenaTopMatchManager.lua | 84 ++++++++++++------- .../ArenaTopMatch/View/ATM_CommonInfo.lua | 4 +- .../ArenaTopMatch/View/ATM_GuessView.lua | 4 +- .../ArenaTopMatch/View/ATM_MainMatchView.lua | 4 +- 4 files changed, 60 insertions(+), 36 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/ArenaTopMatchManager.lua b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/ArenaTopMatchManager.lua index 18b526ae00..f84b84cde2 100644 --- a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/ArenaTopMatchManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/ArenaTopMatchManager.lua @@ -87,10 +87,8 @@ function this.RequestTopMatchBaseInfo(func) this.baseInfo.loser = msg.loser--是否被淘汰 this.myBattleInfo = msg.championBattleInfo - LogGreen("我的战斗双方uid "..this.myBattleInfo.myInfo.uid.." "..this.myBattleInfo.enemyInfo.uid) this.RefreshBaseInfo() -- 发送更新事件 - LogRed("GameEvent.TopMatch.OnTopMatchDataUpdate 93") Game.GlobalEvent:DispatchEvent(GameEvent.TopMatch.OnTopMatchDataUpdate) Log(string.format(Language[10108], msg.joinState, msg.progress, msg.endTime, msg.myrank)) if func then func() end @@ -113,7 +111,6 @@ function this.UpdateTopMatchStage(msg) -- 刷新基础信息 this.RefreshBaseInfo() - LogRed("GameEvent.TopMatch.OnTopMatchDataUpdate 115") Game.GlobalEvent:DispatchEvent(GameEvent.TopMatch.OnTopMatchDataUpdate) --刷新排行信息 Game.GlobalEvent:DispatchEvent(GameEvent.ATM_RankView.OnRankChange) @@ -409,10 +406,10 @@ function this.Request_32_EliminationData(func) if this.baseInfo.battleStage ~= TOP_MATCH_STAGE.ELIMINATION and this.baseInfo.battleStage~= TOP_MATCH_STAGE.OVER then return end NetManager.GetTopMatchEliminationInfo(1, function(msg) - -- LogRed("获取32强数据成功, 数据长度 = "..#msg.championBattlePairInfo) - -- for i = 1, #msg.championBattlePairInfo do - -- LogPink("roundTImes "..msg.championBattlePairInfo[i].roundTImes.." .teamId "..msg.championBattlePairInfo[i].teamId.." .position ".. msg.championBattlePairInfo[i].position) - -- end + LogPink("获取32强数据成功, 数据长度 = "..#msg.championBattlePairInfo) + for i = 1, #msg.championBattlePairInfo do + LogPink("roundTImes "..msg.championBattlePairInfo[i].roundTImes.." .teamId "..msg.championBattlePairInfo[i].teamId.." .position ".. msg.championBattlePairInfo[i].position) + end this.EliminationData_32 = this.RequestEliminationDataMerge(msg.championBattlePairInfo) -- this.EliminationData_32 = msg.championBattlePairInfo if func then func() end @@ -428,8 +425,9 @@ function this.Request_4_EliminationData(func) NetManager.GetTopMatchEliminationInfo(2, function(msg) -- this.EliminationData_4 = msg.championBattlePairInfo + LogPink("获取4强数据成功, 数据长度 = "..#msg.championBattlePairInfo) this.EliminationData_4 = this.RequestEliminationDataMerge(msg.championBattlePairInfo) - -- Log("获取4强数据成功, 数据长度 = "..#this.EliminationData_4) + LogPink("获取4强数据成功, 数据长度 = "..#this.EliminationData_4) if func then func() end end) end @@ -446,28 +444,50 @@ function this.RequestEliminationDataMerge(EliminationData) table.insert(newEliminationData[curKey],EliminationDataV) end end - -- LogRed("newEliminationData, 数据长度 = "..LengthOfTable(newEliminationData)) + LogPink("newEliminationData, 数据长度 = "..LengthOfTable(newEliminationData)) local datas = {} for newEliminationDataI, newEliminationDataV in pairs(newEliminationData) do -- LogPink("newEliminationDataI "..newEliminationDataI) if newEliminationDataV and #newEliminationDataV > 0 then local singledata = newEliminationDataV[1] - local fightResult = 0 + local fightResult = 0 ---1 无记录 0前两场负 1 前两场胜 2 胜 3 负 4 胜负 5 负胜 for i = 1, #newEliminationDataV do - fightResult = fightResult + newEliminationDataV[i].fightResult - if fightResult < 0 then - singledata.fightResult = -1 - elseif fightResult == 0 then - singledata.fightResult = 0 - elseif fightResult > 0 and fightResult < 2 then - singledata.fightResult = 1 - elseif fightResult >= 2 then - singledata.fightResult = 1 + if i == 1 and newEliminationDataV[i].fightResult == 0 then + fightResult = 3 + elseif i == 1 and newEliminationDataV[i].fightResult == 1 then + fightResult = 2 + elseif i == 1 and newEliminationDataV[i].fightResult == -1 then + LogPink("没考虑1 -1") + end + if i == 2 and newEliminationDataV[i].fightResult == 0 then + if fightResult == 3 then + fightResult = 0 + elseif fightResult == 2 then + fightResult = 4 end - if newEliminationDataV[i].isGUess > 0 then - singledata.isGUess = newEliminationDataV[i].isGUess + elseif i == 2 and newEliminationDataV[i].fightResult == 1 then + if fightResult == 3 then + fightResult = 5 + elseif fightResult == 2 then + fightResult = 1 end + elseif i == 2 and newEliminationDataV[i].fightResult == -1 then + LogPink("没考虑2 -1") + end + if i == 3 then + if fightResult == 4 then + fightResult = newEliminationDataV[i].fightResult + elseif fightResult == 5 then + fightResult = newEliminationDataV[i].fightResult + end + elseif i == 3 and newEliminationDataV[i].fightResult == -1 then + LogPink("没考虑3 -1") + end + if newEliminationDataV[i].isGUess <= 0 then + singledata.isGUess = newEliminationDataV[i].isGUess + end end + singledata.fightResult = fightResult -- LogPink("fightResult "..singledata.fightResult) -- LogPink("isGUess "..singledata.isGUess) -- newEliminationData_32V = singledata @@ -780,12 +800,12 @@ function this.GetRewardData() end --三局两胜获取显示数据 function this.GetTwoOutOfThreeInfo(type) - local oldTwoOutOfThreeIndex = nil---历史记录(上次的结果 当前胜负根据战斗结果判断) 1 无记录 0前两场负 1 前两场胜 2 胜 3 负 4 胜负 5 负胜 + local oldTwoOutOfThreeIndex = nil---历史记录(上次的结果 当前胜负根据战斗结果判断) -1 无记录 0前两场负 1 前两场胜 2 胜 3 负 4 胜负 5 负胜 local curBattleResult = nil--当前胜负 -1 未开始 0 负 1 胜 - if type == TOP_MATCH_STAGE.CHOOSE then--我的 + if type == 1 then--我的 oldTwoOutOfThreeIndex = this.GetBaseData().process curBattleResult = this.GetBattleInfo().result - elseif type == TOP_MATCH_STAGE.ELIMINATION then--竞猜 + elseif type == 2 then--竞猜 oldTwoOutOfThreeIndex = this.GetProcess() curBattleResult = this.GetBetBattleInfo().result end @@ -881,15 +901,19 @@ function this.GetTwoOutOfThreeInfo(type) return 2,0 end end ---获取当前三局两胜是够结束 -function this.GetIsBattleEndState() - local oldTwoOutOfThreeIndex = nil---历史记录(上次的结果 当前胜负根据战斗结果判断) 1 无记录 0前两场负 1 前两场胜 2 胜 3 负 4 胜负 5 负胜 - if type == TOP_MATCH_STAGE.CHOOSE then--我的 +--获取当前三局两胜是否结束 +function this.GetIsBattleEndState(type) + local oldTwoOutOfThreeIndex = nil---历史记录(上次的结果 当前胜负根据战斗结果判断) -1 无记录 0前两场负 1 前两场胜 2 胜 3 负 4 胜负 5 负胜 + if type == 1 then--我的 oldTwoOutOfThreeIndex = this.GetBaseData().process - elseif type == TOP_MATCH_STAGE.ELIMINATION then--竞猜 + elseif type == 2 then--竞猜 oldTwoOutOfThreeIndex = this.GetProcess() end - if oldTwoOutOfThreeIndex == 0 or oldTwoOutOfThreeIndex == 1 then + local baseData = ArenaTopMatchManager.GetBaseData() + -- 没开启或者开启没参赛都属于未参赛 + local isJoin = baseData.joinState == 1 + local isOver = baseData.progress == -2 + if oldTwoOutOfThreeIndex == 0 or oldTwoOutOfThreeIndex == 1 and isJoin and not isOver then return true else return false diff --git a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_CommonInfo.lua b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_CommonInfo.lua index 5c86464d6c..7203d3ccf8 100644 --- a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_CommonInfo.lua +++ b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_CommonInfo.lua @@ -116,8 +116,8 @@ function this.SetInfoData(panelType, blueData, redData, textType, showScore,batt this.FreshTeam(blueData.team, true) this.FreshTeam(redData.team, false) this.RefreshTwoOutOfThreeData() - LogGreen("ArenaTopMatchManager.GetIsBattleEndState() "..tostring( ArenaTopMatchManager.GetIsBattleEndState())) - this.awaitText:SetActive(ArenaTopMatchManager.GetIsBattleEndState()) + + this.awaitText:SetActive(ArenaTopMatchManager.GetIsBattleEndState(this.panelType)) end -- 设置显隐 diff --git a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_GuessView.lua b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_GuessView.lua index baebbf4059..14ab03134b 100644 --- a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_GuessView.lua +++ b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_GuessView.lua @@ -213,7 +213,7 @@ function this.RefreshBaseShow() LogGreen("betBattleInfo.enemyInfo.uid "..betBattleInfo.enemyInfo.uid) LogGreen("betBattleInfo.myInfo.uid "..betBattleInfo.myInfo.uid) local IsBeted = myBetTarget and myBetTarget ~= 0 - local upWinNum,downWinNum = ArenaTopMatchManager.GetTwoOutOfThreeInfo(battleStage) + local upWinNum,downWinNum = ArenaTopMatchManager.GetTwoOutOfThreeInfo(2) isCanGuessByBattleEndState = true LogRed("isCanGuessByBattleEndState "..tostring(isCanGuessByBattleEndState)) if battleStage == TOP_MATCH_STAGE.ELIMINATION then @@ -287,7 +287,7 @@ function this.RefreshGuessTipView() local isShow = ArenaTopMatchManager.GetcurIsShowDoGuessPopup() LogGreen("isShow "..tostring(isShow)) -- if - local upWinNum,downWinNum = ArenaTopMatchManager.GetTwoOutOfThreeInfo(TOP_MATCH_STAGE.ELIMINATION) + local upWinNum,downWinNum = ArenaTopMatchManager.GetTwoOutOfThreeInfo(2) local isBattleEnd = (upWinNum >= 2 or downWinNum >= 2) LogRed("三局两胜是否结束 "..tostring(isBattleEnd)) --打开竞猜提示(处于秋后算账) diff --git a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_MainMatchView.lua b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_MainMatchView.lua index 2b92d8c745..0004b0aa85 100644 --- a/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_MainMatchView.lua +++ b/Assets/ManagedResources/~Lua/Modules/ArenaTopMatch/View/ATM_MainMatchView.lua @@ -158,7 +158,7 @@ function this.SetPlayerInfo() local myResult = -1 local blueInfo = nil local redInfo = nil - LogRed("battleInfo.result "..battleInfo.result) + LogPink("battleInfo.result "..battleInfo.result) local battleEndResultSortState = true --true 战斗最终直接赋值 false 颠倒赋值 if attInfo.uid == PlayerManager.uid then blueInfo = attInfo @@ -173,7 +173,7 @@ function this.SetPlayerInfo() end battleEndResultSortState = false end - LogRed("myResult "..myResult) + LogPink("myResult "..myResult) --if battleInfo.result == 0 then -- 如果进攻方失败,则如果我是进攻方则我失败,反之胜利 -- myResult = attInfo.uid == PlayerManager.uid and 0 or 1 --elseif battleInfo.result == 1 then -- 如果进攻方胜利,则如果我是进攻方则我胜利