背景颜色根据星级变化

zhangqiang 2020-07-31 15:40:43 +08:00
parent b63e9b7e81
commit 565d0392fc
7 changed files with 99 additions and 88 deletions

View File

@ -407,7 +407,7 @@ end
function SetHeroBg(bg,cardBg,star,quality)
if star <= 5 then
bg:GetComponent("Image").sprite = Util.LoadSprite(GetHeroCardStarImage[1])
cardBg:GetComponent("Image").sprite = Util.LoadSprite(GetHeroCardQuantityImage[quality])
cardBg:GetComponent("Image").sprite = Util.LoadSprite(GetHeroCardQuantityImage[star])
elseif star <= 10 then
bg:GetComponent("Image").sprite = Util.LoadSprite(GetHeroCardStarImage[2])
cardBg:GetComponent("Image").sprite = Util.LoadSprite(GetHeroCardQuantityImage[10])
@ -682,25 +682,39 @@ end
--通过item稀有度读取背景框
function GetQuantityImageByquality(quality,star)
if star and star > 5 then
return "r_characterbg_gules"
elseif quality == 1 then
return "r_characterbg_gray"
elseif quality == 2 then
return "r_characterbg_green"
elseif quality == 3 then
return "r_characterbg_blue"
elseif quality == 4 then
return "r_characterbg_purple"
elseif quality == 5 then
return "r_characterbg_goden"
elseif quality == 6 then
return "r_characterbg_gules"
elseif quality == 7 then
return "t_tongyong_topkaung"
else
return "t_tongyong_topkaung"
end
if star then--and star > 5
if star == 1 then
return "r_characterbg_gray"
elseif star == 2 then
return "r_characterbg_green"
elseif star == 3 then
return "r_characterbg_blue"
elseif star == 4 then
return "r_characterbg_purple"
elseif star == 5 then
return "r_characterbg_goden"
elseif star == 6 then
return "r_characterbg_gules"
elseif star >= 7 then
return "t_tongyong_topkaung"
end
else
if quality == 0 or quality == 1 then
return "r_characterbg_gray"
elseif quality == 2 then
return "r_characterbg_green"
elseif quality == 3 then
return "r_characterbg_blue"
elseif quality == 4 then
return "r_characterbg_purple"
elseif quality == 5 then
return "r_characterbg_goden"
elseif quality == 6 then
return "r_characterbg_gules"
elseif quality >= 7 then
return "t_tongyong_topkaung"
end
end
end
@ -763,22 +777,38 @@ function GetHeroChipQuantityImageByquality(quality)
end
--通过Hero稀有度读取背景框(小)
function GetHeroQuantityImageByquality(quality,star)
if star and star > 5 then
return "r_characterbg_gules"
elseif quality == 0 or quality == 1 then
return "r_characterbg_gray"
elseif quality == 2 then
return "r_characterbg_green"
elseif quality == 3 then
return "r_characterbg_blue"
elseif quality == 4 then
return "r_characterbg_purple"
elseif quality == 5 then
return "r_characterbg_goden"
elseif quality == 6 then
return "r_characterbg_gules"
elseif quality >= 7 then
return "t_tongyong_topkaung"
if star then--and star > 5
if star == 1 then
return "r_characterbg_gray"
elseif star == 2 then
return "r_characterbg_green"
elseif star == 3 then
return "r_characterbg_blue"
elseif star == 4 then
return "r_characterbg_purple"
elseif star == 5 then
return "r_characterbg_goden"
elseif star == 6 then
return "r_characterbg_gules"
elseif star >= 7 then
return "t_tongyong_topkaung"
end
else
if quality == 0 or quality == 1 then
return "r_characterbg_gray"
elseif quality == 2 then
return "r_characterbg_green"
elseif quality == 3 then
return "r_characterbg_blue"
elseif quality == 4 then
return "r_characterbg_purple"
elseif quality == 5 then
return "r_characterbg_goden"
elseif quality == 6 then
return "r_characterbg_gules"
elseif quality >= 7 then
return "t_tongyong_topkaung"
end
end
end
--通过Hero稀有度读取背景框(卡库)外框

View File

@ -239,7 +239,6 @@ end
function this.RequestBetBaseInfo(func,isPlayBattle)
-- 未开启
if not this.IsTopMatchActive() then
LogGreen("this.isCanBet = false ")
this.isCanBet = false
if func then func() end
return
@ -248,22 +247,22 @@ function this.RequestBetBaseInfo(func,isPlayBattle)
NetManager.GetBetMatchInfo(0, function(msg)
this.betBattleInfo = msg.championBattleInfo
isChange = false
LogGreen("竞猜双方uid "..msg.championBattleInfo.myInfo.uid.." "..msg.championBattleInfo.enemyInfo.uid)
-- LogGreen("竞猜双方uid "..msg.championBattleInfo.myInfo.uid.." "..msg.championBattleInfo.enemyInfo.uid)
this.betRateInfo = msg.championBetInfo
this.myBetTarget = msg.winUid
this.myBetCoins = msg.myBetCoins
LogGreen("this.myBetTarget = msg.winUid "..this.myBetTarget.." "..msg.winUid)
-- LogGreen("this.myBetTarget = msg.winUid "..this.myBetTarget.." "..msg.winUid)
this.process = msg.process
LogGreen("竞猜msg.process "..msg.process)
-- LogGreen("竞猜msg.process "..msg.process)
Log(string.format(Language[10114], msg.winUid, msg.championBetInfo.id, msg.championBetInfo.redCoins, msg.championBetInfo.blueCoins))
-- 可以竞猜了
this.isCanBet = true
LogGreen("this.isCanBet = true ")
-- LogGreen("this.isCanBet = true ")
Game.GlobalEvent:DispatchEvent(GameEvent.TopMatch.OnGuessDataUpdate)
Game.GlobalEvent:DispatchEvent(GameEvent.TopMatch.OnGuessRateUpdate)
LogGreen("this.baseInfo.battleState "..this.baseInfo.battleState)
-- LogGreen("this.baseInfo.battleState "..this.baseInfo.battleState)
if this.baseInfo.battleState == TOP_MATCH_TIME_STATE.OPEN_IN_END and isPlayBattle then
LogGreen("this.baseInfo.battleState "..this.baseInfo.battleState)
-- LogGreen("this.baseInfo.battleState "..this.baseInfo.battleState)
--当历史战斗记录以决出胜负 说明此时是第三场 不需要自动播放战斗动画
if not ArenaTopMatchManager.GetIsBattleEndState(this.CurTabIndex) then
--推送信息的not时候判断是否需要播放动画
@ -350,12 +349,12 @@ function this.RequestBetHistory(func)
end
-- 竞猜成功回调
function this.OnGuessSuccess(msg)
-- function this.OnGuessSuccess(msg)
-- LogGreen("竞猜成功回调")
-- if this.isLogin then return end--上来就弹新关卡界面 所以不弹
-- if MapManager.isInMap or UIManager.IsOpen(UIName.BattlePanel) or UIManager.IsOpen(UIName.ArenaTopMatchPanel) then return end--在关卡里 副本里不弹 新加巅峰赛界面不弹
-- UIManager.OpenPanel(UIName.GuessCoinDropPopup, msg.roundTimes, msg.itemId, msg.itemNum)
end
-- end
-- 判断是否可以竞猜
function this.IsCanBet()
@ -409,11 +408,11 @@ 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)
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
.." attackInfo.uid ".. msg.championBattlePairInfo[i].attackInfo.uid.." defInfo.uid ".. msg.championBattlePairInfo[i].defInfo.uid.." fightResult ".. msg.championBattlePairInfo[i].fightResult)
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
-- .." attackInfo.uid ".. msg.championBattlePairInfo[i].attackInfo.uid.." defInfo.uid ".. msg.championBattlePairInfo[i].defInfo.uid.." fightResult ".. msg.championBattlePairInfo[i].fightResult)
-- end
this.EliminationData_32 = this.RequestEliminationDataMerge(msg.championBattlePairInfo)
-- this.EliminationData_32 = msg.championBattlePairInfo
if func then func() end
@ -429,12 +428,12 @@ function this.Request_4_EliminationData(func)
NetManager.GetTopMatchEliminationInfo(2, function(msg)
-- this.EliminationData_4 = msg.championBattlePairInfo
LogPink("获取4强数据成功, 数据长度 = "..#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("获取4强数据成功, 数据长度 = "..#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_4 = this.RequestEliminationDataMerge(msg.championBattlePairInfo)
LogPink("获取4强数据成功, 数据长度 = "..#this.EliminationData_4)
-- LogPink("获取4强数据成功, 数据长度 = "..#this.EliminationData_4)
if func then func() end
end)
end
@ -451,7 +450,7 @@ function this.RequestEliminationDataMerge(EliminationData)
table.insert(newEliminationData[curKey],EliminationDataV)
end
end
LogPink("newEliminationData, 数据长度 = "..LengthOfTable(newEliminationData))
-- LogPink("newEliminationData, 数据长度 = "..LengthOfTable(newEliminationData))
local datas = {}
for newEliminationDataI, newEliminationDataV in pairs(newEliminationData) do
-- LogPink("newEliminationDataI "..newEliminationDataI)
@ -560,7 +559,7 @@ end
-- 获取当前阶段名称
function this.GetCurTopMatchName()
LogPink("```````````````````````````````````````````````````")
-- LogPink("```````````````````````````````````````````````````")
LogPink("this.baseInfo.progress "..this.baseInfo.progress)
local titleName = Language[10121]--逐胜之巅
local stageName = ""
@ -676,15 +675,15 @@ function this.GetRankNameByRank(rank)
end
--- 判断淘汰赛阶段的轮数
local maxTurn = this.GetEliminationMaxRound()
LogPink("maxTurn "..maxTurn)
-- LogPink("maxTurn "..maxTurn)
if curTurn <= 0 then curTurn = maxTurn end
local opTurn = maxTurn - curTurn + 1 --- 将服务器发过来的轮数倒序,方便计算
--- 如果是结算状态,按下一轮处理
LogPink("opTurn "..opTurn)
-- LogPink("opTurn "..opTurn)
if curState == TOP_MATCH_TIME_STATE.OPEN_IN_END or curState == TOP_MATCH_TIME_STATE.OVER then
opTurn = opTurn - 1
end
LogPink("opTurn "..opTurn)
-- LogPink("opTurn "..opTurn)
--- 轮数为0表示决赛的结算阶段
if opTurn == 0 then
if rank == 1 then
@ -777,7 +776,7 @@ function this.RequestRankData(page,func)
local length=#this.rankData
for i, v in ipairs(msg.rankInfos) do
if v.personInfo.rank<=8 then
LogGreen("前八名数据 "..length+i.." uid "..v.personInfo.uid)
-- LogGreen("前八名数据 "..length+i.." uid "..v.personInfo.uid)
this.rankData[length+i]=v.personInfo
end
end
@ -926,8 +925,8 @@ function this.GetIsBattleEndState(type)
oldTwoOutOfThreeIndex = this.GetBaseData().process
elseif type == 2 then--竞猜
oldTwoOutOfThreeIndex = this.GetProcess()
LogPink("oldTwoOutOfThreeIndex "..oldTwoOutOfThreeIndex)
end
-- LogPink("oldTwoOutOfThreeIndex "..oldTwoOutOfThreeIndex)
local baseData = ArenaTopMatchManager.GetBaseData()
-- 没开启或者开启没参赛都属于未参赛
local isJoin = baseData.joinState == 1
@ -947,7 +946,7 @@ function this.GetCurTabIndex()
end
--是否显示竞猜结果
function this.SetcurIsShowDoGuessPopup(isShow)
LogRed("SetcurIsShowDoGuessPopup "..tostring(isShow))
-- LogRed("SetcurIsShowDoGuessPopup "..tostring(isShow))
this.curIsShowDoGuessPopup = isShow
end
function this.GetcurIsShowDoGuessPopup()
@ -973,7 +972,7 @@ function this.ChangeData(type)
oldTwoOutOfThreeIndex = this.GetProcess()
end
if oldTwoOutOfThreeIndex == 0 or oldTwoOutOfThreeIndex == 1 then
LogPink("isChange "..tostring(isChange))
-- LogPink("isChange "..tostring(isChange))
if not isChange then
old_baseInfo_battleState = this.baseInfo.battleState
old_baseInfo_endTime = this.baseInfo.endTime
@ -1058,11 +1057,11 @@ function this.RefreshGuessTipView()
local myBetTarget = ArenaTopMatchManager.GetMyBetTarget()
local IsBeted = myBetTarget and myBetTarget ~= 0
local isShow = ArenaTopMatchManager.GetcurIsShowDoGuessPopup()
LogGreen("isShow "..tostring(isShow))
-- LogGreen("isShow "..tostring(isShow))
-- if
local upWinNum,downWinNum = ArenaTopMatchManager.GetTwoOutOfThreeInfo(2)
local isBattleEnd = (upWinNum >= 2 or downWinNum >= 2)
LogRed("三局两胜是否结束 "..tostring(isBattleEnd))
-- LogRed("三局两胜是否结束 "..tostring(isBattleEnd))
--打开竞猜提示(处于秋后算账)
if IsBeted and isShow and (isBattleEnd and this.baseInfo.battleStage == TOP_MATCH_STAGE.ELIMINATION or this.baseInfo. battleStage == TOP_MATCH_STAGE.CHOOSE) then
if this.baseInfo.battleState == TOP_MATCH_TIME_STATE.OPEN_IN_END then

View File

@ -90,7 +90,6 @@ function ArenaTopMatchPanel:OnOpen(...)
local args = {...}
this._CurTabIndex = args[1] or 1
ArenaTopMatchManager.SetCurTabIndex(this._CurTabIndex)
LogGreen("``````````````````````````````````````this._CurTabIndex "..this._CurTabIndex)
ArenaTopMatchManager.RequestTopMatchBaseInfo()
end
@ -98,12 +97,10 @@ end
function ArenaTopMatchPanel:OnShow()
commonTitle:OnShow()
if this.TabCtrl then
LogBlue("this._CurTabIndex1 "..this._CurTabIndex)
if this._CurTabIndex > 5 then
ArenaTopMatchManager.SetCurTabIndex(2)
end
this._CurTabIndex = ArenaTopMatchManager.GetCurTabIndex()
LogBlue("this._CurTabIndex2 "..this._CurTabIndex)
this.TabCtrl:ChangeTab(this._CurTabIndex)
end
SoundManager.PlayMusic(SoundConfig.BGM_Arena)
@ -166,7 +163,6 @@ end
--
function this.OpenView(index)
this._CurLogicIndex = index
LogGreen("``````````````````````````````````````index "..index)
ArenaTopMatchManager.SetCurTabIndex(index)
this._CurTabIndex = index
@ -206,7 +202,6 @@ function this.OpenView(index)
end
function this.CloseView(index)
LogGreen(this._CurLogicIndex.." "..index)
-- if this._CurLogicIndex ~= index then return end
local logic = this.ViewLogicList[index]
if logic then

View File

@ -100,7 +100,6 @@ function ATM_EliminationView:OnOpen(...)
this.empty:SetActive(not _IsShowData)
this.middle:SetActive(_IsShowData)
GroupIndex=1
LogRed("battleState "..battleState)
-- if battleState==1 then return end
if this.tabCtrl then
this.tabCtrl:ChangeTab(1)

View File

@ -51,7 +51,7 @@ local function _CheckGuess()
PopupTipPanel.ShowTip(Language[10166])
return false
end
LogRed("isCanGuessByBattleEndState "..tostring(isCanGuessByBattleEndState))
-- LogRed("isCanGuessByBattleEndState "..tostring(isCanGuessByBattleEndState))
if baseInfo.battleState == TOP_MATCH_TIME_STATE.OPEN_IN_GUESS and isCanGuessByBattleEndState then
return true
end
@ -204,7 +204,6 @@ function this.RefreshBaseShow()
if IsCanBet then -- 判断是否有竞猜信息
local betBattleInfo = ArenaTopMatchManager.GetBetBattleInfo()
this.emptyPanel:SetActive(false)
LogGreen("sssssssssssss "..tostring(IsCanBet))
this.guessPanel:SetActive(true)
commonInfo.SetActive(true)
commonInfo.SetInfoData(2, betBattleInfo.myInfo, betBattleInfo.enemyInfo, betBattleInfo.result, false,true)
@ -213,21 +212,15 @@ function this.RefreshBaseShow()
-- 刷新赔率显示
this.RefreshBetRateShow()
-- 有战斗结果了就显示查看详细按钮
LogGreen("betBattleInfo.result "..betBattleInfo.result)
this.battleDetailBtn:SetActive(betBattleInfo.result ~= -1)
local myBetTarget = ArenaTopMatchManager.GetMyBetTarget()
LogGreen(" 本地保存的竞猜uid myBetTarget "..myBetTarget)
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(2)
isCanGuessByBattleEndState = true
LogRed("isCanGuessByBattleEndState "..tostring(isCanGuessByBattleEndState))
if battleStage == TOP_MATCH_STAGE.ELIMINATION then
if upWinNum ~= 0 or downWinNum ~= 0 then
isCanGuessByBattleEndState = false
LogRed("isCanGuessByBattleEndState "..tostring(isCanGuessByBattleEndState))
end
end
if IsBeted or not isCanGuessByBattleEndState then
@ -247,7 +240,6 @@ function this.RefreshBaseShow()
this.blueGuess:SetActive(false)
end
else
LogGreen("sssssssssssss "..tostring(IsCanBet))
this.emptyPanel:SetActive(true)
this.guessPanel:SetActive(false)
commonInfo.SetActive(false)
@ -283,7 +275,6 @@ function this.RefreshBetRateShow()
local myBetTarget = ArenaTopMatchManager.GetMyBetTarget()
if battleState == TOP_MATCH_TIME_STATE.OPEN_IN_GUESS and myBetTarget and myBetTarget ~= 0 then
ArenaTopMatchManager.SetCoinNum(BagManager.GetItemCountById(GUESS_COIN))
Log("<color=yellow>处于战斗时 存储的临时竞猜币数量 "..BagManager.GetItemCountById(GUESS_COIN).."</color>")
end
end

View File

@ -160,9 +160,9 @@ function this.SetPlayerInfo()
local myResult = -1
local blueInfo = nil
local redInfo = nil
LogPink("battleInfo.result "..battleInfo.result)
-- LogPink("battleInfo.result "..battleInfo.result)
local battleEndResultSortState = true --true 战斗最终直接赋值 false 颠倒赋值
LogRed("PlayerManager.uid "..PlayerManager.uid.." "..attInfo.uid.." "..defInfo.uid)
-- LogRed("PlayerManager.uid "..PlayerManager.uid.." "..attInfo.uid.." "..defInfo.uid)
if attInfo.uid == PlayerManager.uid then
blueInfo = attInfo
redInfo = defInfo
@ -176,7 +176,6 @@ function this.SetPlayerInfo()
end
battleEndResultSortState = false
end
LogPink("myResult "..myResult)
--if battleInfo.result == 0 then -- 如果进攻方失败,则如果我是进攻方则我失败,反之胜利
-- myResult = attInfo.uid == PlayerManager.uid and 0 or 1
--elseif battleInfo.result == 1 then -- 如果进攻方胜利,则如果我是进攻方则我胜利
@ -185,7 +184,6 @@ function this.SetPlayerInfo()
local baseData = ArenaTopMatchManager.GetBaseData()
commonInfo.SetActive(true)
LogRed("battleEndResultSortState "..tostring(battleEndResultSortState))
commonInfo.SetInfoData(1, blueInfo, redInfo, myResult, baseData == TOP_MATCH_STAGE.CHOOSE,battleEndResultSortState)
end
@ -229,7 +227,6 @@ function this.FreshTeam()
end
local formation = FormationManager.GetFormationByID(FormationTypeDef.ARENA_TOM_MATCH)
for i, hero in ipairs(formation.teamHeroInfos) do
LogGreen("hero.position "..hero.position)
local heroData = HeroManager.GetSingleHeroData(hero.heroId)
local heroGo = Util.GetGameObject(this.myBaby[hero.position], "hero")
heroGo:SetActive(true)

View File

@ -664,7 +664,7 @@ function this.TopMatchGuessSuccess(buffer)
local data = buffer:DataByte()
local msg = ArenaInfoProto_pb.ChampionGuessSuccessIndication()
msg:ParseFromString(data)
ArenaTopMatchManager.OnGuessSuccess(msg)
-- ArenaTopMatchManager.OnGuessSuccess(msg)
end
-- 巅峰战竞猜成功