修复退出战斗界面持续伤害特效导致报错的问题,修复2号位立绘第一次没有淡出效果的问题

dev_chengFeng
gaoxin 2020-07-01 18:35:45 +08:00
parent 78b6a988d2
commit 8653437ee1
2 changed files with 50 additions and 5 deletions

View File

@ -74,7 +74,7 @@ Material:
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _IsMask: 0
- _IsMask: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1

View File

@ -297,9 +297,53 @@ function RoleView:ClearDelayFunc(t)
end
self._DelayFuncList = {}
end
end
--
function RoleView:LoopFunc(time, count, func)
if count <= 0 then
LogError("无法用于无限循环的方法")
return
end
if not self._LoopFuncList then
self._LoopFuncList = {}
end
local timer = nil
local ctr = 0
timer = Timer.New(function ()
if func then func() end
ctr = ctr + 1
if ctr >= count then
self:ClearDelayFunc(timer)
end
end, time, count)
timer:Start()
table.insert(self._LoopFuncList, timer)
end
function RoleView:ClearLoopFunc(t)
if not self._LoopFuncList then return end
if t then
local rIndex
for index, timer in ipairs(self._LoopFuncList) do
if timer == t then
rIndex = index
break
end
end
if rIndex then
self._LoopFuncList[rIndex]:Stop()
table.remove(self._LoopFuncList, rIndex)
end
else
for _, timer in ipairs(self._LoopFuncList) do
timer:Stop()
end
self._LoopFuncList = {}
end
end
local TextFloatingColor = {
Blue = 1,
Red = 2,
@ -1086,9 +1130,9 @@ function RoleView:OnDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType,
end
if count ~= 1 then
-- 后续伤害延迟打出
Timer.New(function()
self:LoopFunc(space, count - 1, function()
self:OnceDamaged(atkRole, d, bCrit, finalDmg, damageType, dotType, skill)
end, space, count - 1):Start()
end)
-- 立刻打出第一次伤害
local fd = dmg - d *(count - 1)
self:OnceDamaged(atkRole, fd, bCrit, finalDmg, damageType, dotType, skill)
@ -1101,7 +1145,7 @@ function RoleView:OnDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType,
end
--
function RoleView:OnceDamaged(atkRole, dmg, bCrit, finalDmg, damageType, dotType, skill)
if atkRole:IsDead() then return end
if self.isDead then return end
if dotType then
if dotType == DotType.Poison then
self:ArtFloating(ArtFloatingType.PoisonDamage, ArtFloatingColor.Poison, dmg)
@ -1614,6 +1658,7 @@ function RoleView:Dispose()
-- end
-- 清空所有延迟方法
self:ClearDelayFunc()
self:ClearLoopFunc()
self.GameObject.transform.parent.localScale = Vector3.one
--立即回收延迟列表上的资源