From 8653437ee1b09c479f7bb057b33467451814547c Mon Sep 17 00:00:00 2001 From: gaoxin Date: Wed, 1 Jul 2020 18:35:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=80=E5=87=BA=E6=88=98?= =?UTF-8?q?=E6=96=97=E7=95=8C=E9=9D=A2=E6=8C=81=E7=BB=AD=E4=BC=A4=E5=AE=B3?= =?UTF-8?q?=E7=89=B9=E6=95=88=E5=AF=BC=E8=87=B4=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BF=AE=E5=A4=8D2=E5=8F=B7?= =?UTF-8?q?=E4=BD=8D=E7=AB=8B=E7=BB=98=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=B7=A1=E5=87=BA=E6=95=88=E6=9E=9C=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PublicArtRes/Materials/UI_AlphaMask 2.mat | 2 +- .../~Lua/Modules/Battle/View/RoleView.lua | 53 +++++++++++++++++-- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/Assets/ManagedResources/PublicArtRes/Materials/UI_AlphaMask 2.mat b/Assets/ManagedResources/PublicArtRes/Materials/UI_AlphaMask 2.mat index 8b323eaefc..85758d1c64 100644 --- a/Assets/ManagedResources/PublicArtRes/Materials/UI_AlphaMask 2.mat +++ b/Assets/ManagedResources/PublicArtRes/Materials/UI_AlphaMask 2.mat @@ -74,7 +74,7 @@ Material: - _GlossMapScale: 1 - _Glossiness: 0.5 - _GlossyReflections: 1 - - _IsMask: 0 + - _IsMask: 1 - _Metallic: 0 - _Mode: 0 - _OcclusionStrength: 1 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua index 2625d8d200..dc8df1a69f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/RoleView.lua @@ -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 --立即回收延迟列表上的资源