require("Base/BasePanel") require("Base/Stack") require("Modules.Battle.Config.PokemonEffectConfig") local BattleView = require("Modules/Battle/View/BattleView") BattlePanel = Inherit(BasePanel) local this = BattlePanel local battleTimeScaleKey = "battleTimeScaleKey" local timeCount local endFunc local isBack = false --是否为战斗回放 local fightType -- 1关卡 2副本 3限时怪, 5兽潮, 6新关卡, 7公会boss local orginLayer local boxList={}--新将来袭奖励盒子 -- 显示跳过战斗使用 local hadCounted = 0 --初始化组件(用于子类重写) function this:InitComponent() BattleView:InitComponent(self, self.gameObject) orginLayer = 0 this.BG = Util.GetGameObject(self.gameObject, "BG") this.UpRoot = Util.GetGameObject(self.gameObject, "UpRoot") this.Option = Util.GetGameObject(this.UpRoot, "option") this.DownRoot = Util.GetGameObject(self.gameObject, "DownRoot") this.roundText = Util.GetGameObject(this.Option, "timeCount"):GetComponent("Text") this.orderText = Util.GetGameObject(this.Option, "order/text"):GetComponent("Text") this.BtnTimeScale = Util.GetGameObject(this.DownRoot, "option/BtnTimeScale") this.BtnExit = Util.GetGameObject(this.DownRoot, "option/BtnExit") this.ButtonLock = Util.GetGameObject(this.DownRoot, "option/Button/lock") this.BtnGM = Util.GetGameObject(this.DownRoot, "option/Button") this.submit = Util.GetGameObject(this.DownRoot, "bg") this.DefResult = Util.GetGameObject(this.UpRoot, "result") this.AtkResult = Util.GetGameObject(this.DownRoot, "result") this.damagePanel = Util.GetGameObject(this.UpRoot, "damage")--公会boss的血条 this.damageBoxBg = Util.GetGameObject(this.damagePanel, "bg") this.damageBoxIcon = Util.GetGameObject(this.damagePanel, "bg/iconRoot/icon"):GetComponent("Image") this.damageBoxLevel = Util.GetGameObject(this.damagePanel, "lv"):GetComponent("Text") this.damageProgress = Util.GetGameObject(this.damagePanel, "progress/Fill") this.damageText = Util.GetGameObject(this.damagePanel, "progress/Text"):GetComponent("Text") this.dmg2 = Util.GetGameObject(this.UpRoot, "dmg2")--新将来袭的血条 for i = 1, 7 do boxList[i] = Util.GetGameObject(this.dmg2, "box"..i) boxList[i]:SetActive(false) local effect = Util.GetGameObject(boxList[i], "effect") effect:SetActive(false) end boxList[1]:SetActive(true) this.dmg2Progress = Util.GetGameObject(this.dmg2, "progress/Fill"):GetComponent("Image") this.dmg2Text = Util.GetGameObject(this.dmg2, "progress/Text"):GetComponent("Text") this.bar = Util.GetGameObject(this.dmg2, "bar") end --绑定事件(用于子类重写) function this:BindEvent() Util.AddLongPressClick(this.submit, function() BattleRecordManager.SubmitBattleRecord() end, 0.5) Util.AddClick(this.BtnTimeScale, function () if not BattleManager.IsCanOperate() then return end if not BattleManager.IsUnlockBattleSpeed() then PopupTipPanel.ShowTip(PrivilegeManager.GetPrivilegeOpenTip(PRIVILEGE_TYPE.DoubleTimesFight)) return end local scale = BattleManager.GetTimeScale() scale = math.floor(scale*10 + 0.5)/10 if scale == BATTLE_TIME_SCALE_ONE then BattleManager.SetTimeScale(BATTLE_TIME_SCALE_TWO) elseif scale == BATTLE_TIME_SCALE_TWO then BattleManager.SetTimeScale(BATTLE_TIME_SCALE_ONE) end end) Util.AddClick(this.ButtonLock, function () PopupTipPanel.ShowTip("30级后解锁") end) local pauseTime = 31 Util.AddClick(this.BtnExit, function () if not BattleManager.IsUnlockBattlePass() then PopupTipPanel.ShowTip(PrivilegeManager.GetPrivilegeOpenTip(PRIVILEGE_TYPE.SkipFight)) return end if BattleLogic.IsEnd or not BattleManager.IsCanOperate() then return end -- 战斗暂停 BattleManager.PauseBattle() local count = 0 local timer = Timer.New(function () if not UIManager.IsOpen(UIName.MsgPanel) then return end count = count + 1 if isBack then MsgPanel.tipLabel.text = string.format("确认跳过战斗吗(%d秒)", pauseTime - count) else MsgPanel.tipLabel.text = string.format("战斗已暂停,是否继续?(%d秒)", pauseTime - count) end if count == pauseTime then MsgPanel.OnRightBtnClick() return end end, 1, pauseTime, true) local cancelFunc = function () this.CastingPass = MsgPanel._toggle.isOn BattleManager.ResumeBattle() timer:Stop() end local sureFunc = function() this.CastingPass = MsgPanel._toggle.isOn BattleLogic.IsEnd = true BattleView.Clear() timer:Stop() -- 事先初始化 this.lastBattleResult = { result = 0, lastPos = 0, } if isBack then --战斗回放直接跳过 if not this.fightResult then LogError("这是回放战斗,请在战斗开始时调用 SetResult 方法预先设置战斗结果!") end BattleView.EndBattle(this.fightResult or 0) return end if fightType == BATTLE_TYPE.MAP_FIGHT then -- 必输的操作 NetManager.MapFightResultRequest(1, "", "", fightType, function (msg) this.lastBattleResult.result = msg.result if msg.lastXY then this.lastBattleResult.lastPos = msg.lastXY else this.lastBattleResult.lastPos = 0 end this.ShowBattleResult(msg.result) end) elseif fightType == BATTLE_TYPE.GUILD_BOSS and fightType == BATTLE_TYPE.GUILD_CAR_DELAY then this.lastBattleResult.result = -1 this:ClosePanel() else this.ShowBattleResult(0) end end MsgPanel.ShowTwo("战斗已暂停,是否继续?", sureFunc, cancelFunc, "退出", "继续",nil, false, "关闭技能动画") MsgPanel._toggle.isOn = this.CastingPass timer:Start() end) Util.AddClick(this.BtnGM, function () if BattleManager.IsCanOperate() and not BattleLogic.IsEnd then BattleView.EndBattle() BattleLogic.IsEnd = true end end) end function this:LoseJump(id) if not MapManager.Mapping then if JumpManager.CheckJump(id) then this:ClosePanel() JumpManager.GoJumpWithoutTip(id) end else PopupTipPanel.ShowTip("副本里不能前往!") end end --添加事件监听(用于子类重写) function this:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Battle.OnTimeScaleChanged, this.SwitchTimeScale) end --移除事件监听(用于子类重写) function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Battle.OnTimeScaleChanged, this.SwitchTimeScale) end function this:OnSortingOrderChange() Util.AddParticleSortLayer(this.gameObject, this.sortingOrder - orginLayer) orginLayer = this.sortingOrder BattleView:OnSortingOrderChange(this.sortingOrder) end --界面打开时调用(用于子类重写) function this:OnOpen(_fightData, _fightType, _endFunc) BattleView:OnOpen(_fightData) endFunc = _endFunc fightType = _fightType --判定战斗类型 isBack = _fightType == BATTLE_TYPE.BACK --判定是否是战斗回放 hadCounted = 0 LogPink(fightType) this.BG:GetComponent("Image").sprite = Util.LoadSprite(BattleManager.GetBattleBg(fightType)) -- this.BtnGM:SetActive(AppConst.isOpenGM) this.BtnExit:SetActive(false)--FightPointPassManager.GetStopBtnState()) SoundManager.PlayMusic(SoundConfig.BGM_Battle_1, true, function() SoundManager.PlayMusic(SoundConfig.BGM_Battle_2, false) end) this.fightResult = nil -- 清空名字数据 BattleView:SetNameStr(nil) this.DefResult:SetActive(false) this.AtkResult:SetActive(false) -- 开始战斗 BattleView:StartBattle() this.InitPanelData() end -- 设置战斗结果 function this:SetResult(result) this.fightResult = result end -- 外部调用 function this:ShowNameShow(result, str) this.fightResult = result if true then return end if str then local nameList = string.split(str, "|") BattleView:SetNameStr(str) this.DefResult:SetActive(true) this.AtkResult:SetActive(true) Util.GetGameObject(this.AtkResult, "win"):SetActive(result == 1) Util.GetGameObject(this.AtkResult, "lose"):SetActive(result == 0) Util.GetGameObject(this.DefResult, "win"):SetActive(result == 0) Util.GetGameObject(this.DefResult, "lose"):SetActive(result == 1) Util.GetGameObject(this.AtkResult, "win/Text"):GetComponent("Text").text = nameList[1] Util.GetGameObject(this.AtkResult, "lose/Text"):GetComponent("Text").text = nameList[1] Util.GetGameObject(this.DefResult, "win/Text"):GetComponent("Text").text = nameList[2] Util.GetGameObject(this.DefResult, "lose/Text"):GetComponent("Text").text = nameList[2] else this.DefResult:SetActive(false) this.AtkResult:SetActive(false) end end -- 初始化 function this.InitPanelData() this.dmg2:SetActive(fightType == BATTLE_TYPE.XINJIANG) if fightType == BATTLE_TYPE.GUILD_BOSS and fightType == BATTLE_TYPE.GUILD_CAR_DELAY then this.myDamage = 0 this.myDamageLevel = 0 this.RefreshMyDamageShow() local list = RoleManager.Query(function (r) return r.camp == 1 end) if list[1] then list[1].Event:AddEvent(BattleEventName.RoleBeDamaged, function (atkRole, damage, bCrit, finalDmg, damageType, dotType) --Log("damage:"..damage) this.myDamage = this.myDamage + damage this.RefreshMyDamageShow() end) end elseif fightType == BATTLE_TYPE.XINJIANG then boxList[1]:SetActive(true) this.myDamage = 0 this.myDamageLevel = 0 this.dmg2Text.text = "0%" this.dmg2Progress.fillAmount = 0 this.RefreshMyDamageShow() local list = RoleManager.Query(function (r) return r.camp == 1 end) if list[1] then list[1].Event:AddEvent(BattleEventName.RoleBeDamaged, function (atkRole, damage, bCrit, finalDmg, damageType, dotType) --Log("damage:"..damage) this.myDamage = this.myDamage + damage this.RefreshMyDamageShow(list[1].data) end) end end this.InitOption() end function this.InitOption() --显示倒计时 local curRound, maxRound = BattleLogic.GetCurRound() curRound = curRound <= 0 and 1 or curRound -- 最小显示第一回合 this.roundText.text = string.format("第%d/%d回合", curRound, maxRound) hadCounted = 0 this.Option:SetActive(true) Util.GetGameObject(this.BtnTimeScale, "lock"):SetActive(not BattleManager.IsUnlockBattleSpeed()) local IsUnLockBattlePass = BattleManager.IsUnlockBattlePass() or (fightType == BATTLE_TYPE.BACK) or (fightType == BATTLE_TYPE.BACK_BATTLE)--or AppConst.isOpenGM Util.GetGameObject(this.BtnExit, "lock"):SetActive(not IsUnLockBattlePass) if AppConst.isOpenGM then Util.GetGameObject(this.BtnGM, "lock"):SetActive(false) else Util.GetGameObject(this.BtnGM, "lock"):SetActive(not IsUnLockBattlePass) this.BtnGM:GetComponent("Button").interactable = IsUnLockBattlePass end -- 初始化战斗时间,刷新前端显示 BattleManager.InitTimeScale() this.SwitchTimeScale() end function this.SwitchTimeScale() local _scale = BattleManager.GetTimeScale() local child = this.BtnTimeScale.transform.childCount - 3 -- 3倍速时-2 local s = "x".. math.floor(_scale) for i=1, child do local g = this.BtnTimeScale.transform:GetChild(i-1).gameObject g:SetActive(g.name == s) end end function this.BattleEnd(result) BattleManager.PauseBattle() -- 强制停止倍速 Time.timeScale = 1 -- 设置音效播放的速度 SoundManager.SetAudioSpeed(1) --用一个变量接收最近的战斗结果 this.lastBattleResult = { result = result, hpList = {}, drop = {}, } -- 需要和服务器确认结果 if fightType == BATTLE_TYPE.MAP_FIGHT or fightType == BATTLE_TYPE.MONSTER_CAMP or fightType == BATTLE_TYPE.STORY_FIGHT or fightType == BATTLE_TYPE.GUILD_BOSS then local levelId = FightPointPassManager.GetCurFightId() NetManager.MapFightResultRequest(10000, "", levelId, fightType, function (msg) -- 结果检测 if msg.result ~= this.lastBattleResult.result then BattleRecordManager.SubmitCheckFight(this.lastBattleResult.result, msg.result) end for i=1, #msg.remainHpList do Log("服务器剩余血量 : "..msg.remainHpList[i]) this.lastBattleResult.hpList[i] = msg.remainHpList[i] end this.lastBattleResult.drop = msg.enventDrop this.lastBattleResult.missionDrop = msg.missionDrop this.lastBattleResult.result = msg.result this.lastBattleResult.mission = msg.mission this.lastBattleResult.eventId = msg.eventId this.lastBattleResult.lastTowerTime = msg.lastTowerTime if msg.lastXY then this.lastBattleResult.lastPos = msg.lastXY else this.lastBattleResult.lastPos = 0 end BattleManager.SetLastBattleResult(this.lastBattleResult,fightType) this.ShowBattleResult(msg.result, msg) end) elseif fightType == BATTLE_TYPE.EXECUTE_FIGHT then--远征处理 if ExpeditionManager.ExpeditionState == 1 then local GetCurNodeInfo = ExpeditionManager.curAttackNodeInfo NetManager.EndExpeditionBattleRequest(GetCurNodeInfo.sortId, "", function (msg) --ExpeditionManager.UpdateHeroHpValue(msg.heroInfo) --ExpeditionManager.UpdateNodeValue(msg) --nodeInfo if msg.result ~= this.lastBattleResult.result then BattleRecordManager.SubmitCheckFight(this.lastBattleResult.result, msg.result) end this.lastBattleResult.result = msg.result this.lastBattleResult.drop = msg.drop BattleManager.SetLastBattleResult(this.lastBattleResult,fightType) this.ShowBattleResult(msg.result, msg) end) else -- this:ClosePanel() ExpeditionManager.RefreshPanelShowByState() end elseif fightType == BATTLE_TYPE.XINJIANG then--新将来袭 Timer.New(function () this:ClosePanel() for i = 1, #boxList do boxList[i].transform:SetParent(this.dmg2.transform) boxList[i].transform:DOLocalMove(Vector3.New(414,16,0), 0) boxList[i]:SetActive(false) Util.GetGameObject(boxList[i], "effect"):SetActive(false) end end,1.3):Start() else -- 判断是否需要进行结果检测 if this.fightResult then if result ~= this.fightResult then BattleRecordManager.SubmitCheckFight(this.fightResult, result) end end -- 直接显示结果 if fightType ~= BATTLE_TYPE.BACK_BATTLE then BattleManager.SetLastBattleResult(this.lastBattleResult,fightType) end this.ShowBattleResult(result) end end function this.ShowBattleResult(result, msg) SoundManager.StopMusic() -- 战斗结束时,如果元素光环面板还开着,则先关闭 if UIManager.IsOpen(UIName.ElementPopup) then UIManager.ClosePanel(UIName.ElementPopup) end -- 回放直接关闭界面 if fightType == BATTLE_TYPE.BACK or fightType == BATTLE_TYPE.ARENA then this:ClosePanel() return end -- 播放结算音效 if result == 0 then this.resultSoundAudio = SoundManager.PlaySound(SoundConfig.Sound_BattleLose) else this.resultSoundAudio = SoundManager.PlaySound(SoundConfig.Sound_BattleWin) end -- 公会boss结算界面 if fightType == BATTLE_TYPE.GUILD_BOSS then UIManager.OpenPanel(UIName.GuildBossFightResultPopup, msg.enventDrop, msg.missionDrop, msg.essenceValue, function() this:ClosePanel() end) -- 车迟斗法结算界面特殊显示 elseif fightType == BATTLE_TYPE.GUILD_CAR_DELAY and GuildCarDelayManager.progress == 1 then this.ShowBattleResultByCarDeleayType() -- 十绝阵结算界面特殊显示 elseif fightType == BATTLE_TYPE.DEATH_POS then this.ShowBattleResultByDeathPos() --公会副本 elseif fightType == BATTLE_TYPE.GuildTranscript then this.ShowBattleResultByGuildTranscript() --无尽副本 elseif fightType == BATTLE_TYPE.MAP_FIGHT and CarbonManager.difficulty == CARBON_TYPE.ENDLESS then this.ShowBattleResultByMapFight() --新回放功能(判断上次战斗是什么类型并做什么内容 逻辑和正常战斗处理一样) elseif fightType == BATTLE_TYPE.BACK_BATTLE then if BattleManager.GetLastBattleType() == BATTLE_TYPE.GuildTranscript then-- 公会副本结算界面特殊显示 this.ShowBattleResultByGuildTranscript() elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.GUILD_CAR_DELAY and GuildCarDelayManager.progress == 1 then-- 车迟结算界面特殊显示 this.ShowBattleResultByCarDeleayType() elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.DEATH_POS then-- 十绝阵结算界面特殊显示 this.ShowBattleResultByDeathPos() elseif BattleManager.GetLastBattleType() == BATTLE_TYPE.BACK or BattleManager.GetLastBattleType() == BATTLE_TYPE.ARENA then this:ClosePanel() else if result == 0 then -- 失败 local haveRecord = BattleRecordManager.isHaveRecord() UIManager.OpenPanel(UIName.BattleFailPopup, this, haveRecord,nil,fightType) else -- 胜利 UIManager.OpenPanel(UIName.BattleWinPopup, this, isBack, fightType, this.lastBattleResult) end end else if result == 0 then -- 失败 local haveRecord = BattleRecordManager.isHaveRecord() UIManager.OpenPanel(UIName.BattleFailPopup, this, haveRecord,nil,fightType) else -- 胜利 UIManager.OpenPanel(UIName.BattleWinPopup, this, isBack, fightType, this.lastBattleResult) end end end -- 车迟斗法结算界面特殊显示 function this.ShowBattleResultByCarDeleayType() -- 延时执行避免事件冲突 Timer.New(function() local bestData, allDamage= BattleRecordManager.GetBattleBestData() if bestData then -- 胜利显示本场比赛的表现最好的英雄 UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup,nil, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then --车迟挑战cd计时 GuildCarDelayManager.SetCdTime(GuildCarDelayProType.Challenge) if _BattleBestPopup then _BattleBestPopup:ClosePanel() end this:ClosePanel() end end, 3,true,true) end) end end, 0.1):Start() end -- 十绝阵结算界面特殊显示 function this.ShowBattleResultByDeathPos() -- 延时执行避免事件冲突 Timer.New(function() local bestData, allDamage= BattleRecordManager.GetBattleBestData() if bestData then -- 胜利显示本场比赛的表现最好的英雄 UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup, DeathPosManager.drop, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then if _BattleBestPopup then _BattleBestPopup:ClosePanel() end this:ClosePanel() end end, 4,true,true) end) end end, 0.1):Start() end --公会副本结算界面特殊显示 function this.ShowBattleResultByGuildTranscript() -- 延时执行避免事件冲突 Timer.New(function() local bestData, allDamage= BattleRecordManager.GetBattleBestData() if bestData then -- 胜利显示本场比赛的表现最好的英雄 UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup,GuildTranscriptManager.drop, 1,function(isBackBattle)--isBackBattle true时 为回放不走回调 LogPink("isBackBattle "..tostring(isBackBattle)) if not isBackBattle then if _BattleBestPopup then _BattleBestPopup:ClosePanel() end this:ClosePanel() Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscripQuickBtn) Game.GlobalEvent:DispatchEvent(GameEvent.Guild.RefreshGuildTranscript) GuildTranscriptManager.IsKillShowTip() end end, 6,true,true) end) end end, 0.1):Start() end --无尽结算界面特殊显示 function this.ShowBattleResultByMapFight() Timer.New(function() local bestData, allDamage= BattleRecordManager.GetBattleBestData() FightPointPassManager.oldLevel = PlayerManager.level if bestData then UIManager.OpenPanel(UIName.BattleBestPopup, bestData.roleId,bestData.skinId, bestData.damage, allDamage, function(_BattleBestPopup) -- 打开关卡奖励界面 UIManager.OpenPanel(UIName.RewardItemPopup, this.lastBattleResult.drop, 1,function() if _BattleBestPopup then _BattleBestPopup:ClosePanel() end -- if m_battlePanel then -- m_battlePanel:ClosePanel() -- end this:ClosePanel() Game.GlobalEvent:DispatchEvent(GameEvent.Bag.BagGold) end, nil, true, true) end) end end, 0.1):Start() end -- 战斗波次变化回调 function this.OnOrderChanged(order) -- body --显示波次 this.orderText.text = string.format("%d/%d", order, BattleLogic.TotalOrder) end -- 战斗回合变化回调 function this.OnRoundChanged(round) -- body --显示波次 local curRound, maxRound = BattleLogic.GetCurRound() curRound = curRound <= 0 and 1 or curRound -- 最小显示第一回合 this.roundText.text = string.format("第%d/%d回合", curRound, maxRound) end -- 由BattleView驱动 function this.OnUpdate() end -- 刷新我的伤害显示 function this.RefreshMyDamageShow(data) if fightType == 7 or fightType == 10 then local myDamage = this.myDamage-- *10 local bossRewardConfig = ConfigManager.GetConfig(ConfigName.GuildBossRewardConfig) local curLevel, curLevelData, nextLevelData for level, data in ConfigPairs(bossRewardConfig) do if data.Damage > myDamage then nextLevelData = data break end curLevel = level curLevelData = data end if not nextLevelData then nextLevelData = curLevelData end -- 有等级变化 if curLevel ~= this.myDamageLevel then this.myDamageLevel = curLevel -- 播放升级特效 this.damageBoxBg:SetActive(false) this.damageBoxBg:SetActive(true) end this.damageBoxLevel.text = curLevel or 0 this.damageBoxIcon.sprite = GuildBossManager.GetBoxSpriteByLevel(curLevel or 0) -- this.damageText.text = myDamage.."/"..nextLevelData.Damage -- 显示总伤害 local curLevelDamage = not curLevelData and 0 or curLevelData.Damage local deltaDamage = nextLevelData.Damage - curLevelDamage local myDeltaDamage = myDamage - curLevelDamage local rate = deltaDamage == 0 and 1 or myDeltaDamage/deltaDamage this.damageText.text = myDeltaDamage.."/"..deltaDamage -- 显示当前等级伤害 this.damageProgress.transform.localScale = Vector3.New(rate, 1, 1) elseif fightType == BATTLE_TYPE.XINJIANG and data then local myDamage = this.myDamage-- *10 local curLevel = 0 local boxs={} local newHeroConfig = ConfigManager.GetConfig(ConfigName.NewHeroConfig) local bossData = data local curBossHp = data:GetData(RoleDataName.Hp) local maxBossHp = data:GetData(RoleDataName.MaxHp) local curPercent = (maxBossHp-curBossHp)*100/maxBossHp curPercent = curPercent > 0.01 and curPercent or 0.01 this.dmg2Text.text = string.format("%.2f",curPercent).."%" local num = 0 local d = ConfigManager.GetConfigDataByKey(ConfigName.NewHeroConfig,"HeroId",10012)--data.roleId) boxs = d.BoxList for i = 1, #boxs do local ex = boxs[i-1] and boxs[i-1][1] or 0 if (boxs[i][1]/boxs[#boxs][1])*100 > curPercent and (ex/boxs[#boxs][1])*100 < curPercent then num = (curPercent*100-ex)/(boxs[i][1]-ex) curLevel = i break end end this.dmg2Progress.fillAmount = num for i = 1, #boxs do if curPercent >= (boxs[i][1]/boxs[#boxs][1])*100 then if boxList[i+1] then boxList[i+1]:SetActive(true) end boxList[i].transform:SetParent(this.bar.transform) local t = i%5 == 0 and 5 or i%5 boxList[i].transform:DOLocalMove(Vector3.New(math.floor(i/6)*-120,-329+t*100,0), 1.5) Util.GetGameObject(boxList[i], "effect"):SetActive(true) end end end end --界面关闭时调用(用于子类重写) function this:OnClose() BattleView:OnClose() -- 停止音效 --if this.resultSoundAudio then -- SoundManager.StopSound(this.resultSoundAudio) --end -- -- BattleManager.SetTimeScale(1) -- 真正生效的敌方 Time.timeScale = 1 -- 设置音效播放的速度 SoundManager.SetAudioSpeed(1) if endFunc then endFunc(this.lastBattleResult) end --检测是否需要弹每日任务飘窗 TaskManager.RefreshShowDailyMissionTipPanel() end --界面销毁时调用(用于子类重写) function this:OnDestroy() BattleView:OnDestroy() end return BattlePanel