巅峰赛修改提交

dev_chengFeng
zhangqiang 2020-07-16 14:13:27 +08:00
parent 2c744690bc
commit 6fbed83b28
4 changed files with 60 additions and 36 deletions

View File

@ -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

View File

@ -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
-- 设置显隐

View File

@ -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))
--打开竞猜提示(处于秋后算账)

View File

@ -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 -- 如果进攻方胜利,则如果我是进攻方则我胜利