parent
17a9550df8
commit
be28abd54c
|
@ -263,41 +263,38 @@ function BuffManager:Update()
|
|||
buffList = self.buffDic.kvList[buff.type]
|
||||
end
|
||||
|
||||
-- 是覆盖类型的buff且有老buff buff表现层修改所有cover 字段没用了 注释 by:王振兴 2021/03/11 20:40
|
||||
-- if buff.cover and buffList.size > 0 then
|
||||
-- local isCovered = false
|
||||
-- for i=1, buffList.size do
|
||||
-- local oldBuff = buffList.buffer[i]
|
||||
-- if oldBuff.cover and oldBuff.target == buff.target and oldBuff.clear == buff.clear and oldBuff:OnCover(buff) then --判定该效果能否被覆盖
|
||||
-- -- 结束并回收老buff
|
||||
-- oldBuff:OnEnd()
|
||||
-- oldBuff.target.Event:DispatchEvent(BattleEventName.BuffEnd, oldBuff)
|
||||
-- putBuff(oldBuff)
|
||||
-- -- 覆盖老buff
|
||||
-- buffList.buffer[i] = buff
|
||||
-- buff:OnStart()
|
||||
-- buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
-- buff.target.Event:DispatchEvent(BattleEventName.BuffCover, buff)
|
||||
-- isCovered = true
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
-- -- 没有覆盖,新buff
|
||||
-- if not isCovered then
|
||||
-- buffList:Add(buff)
|
||||
-- buff:OnStart()
|
||||
-- buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
-- end
|
||||
-- else
|
||||
-- -- 新buff
|
||||
-- buffList:Add(buff)
|
||||
-- buff:OnStart()
|
||||
-- buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
-- end
|
||||
-- 是覆盖类型的buff且有老buff
|
||||
if buff.cover and buffList.size > 0 then
|
||||
local isCovered = false
|
||||
for i=1, buffList.size do
|
||||
local oldBuff = buffList.buffer[i]
|
||||
if oldBuff.cover and oldBuff.target == buff.target and oldBuff.clear == buff.clear and oldBuff:OnCover(buff) then --判定该效果能否被覆盖
|
||||
-- 结束并回收老buff
|
||||
oldBuff:OnEnd()
|
||||
oldBuff.target.Event:DispatchEvent(BattleEventName.BuffEnd, oldBuff)
|
||||
putBuff(oldBuff)
|
||||
-- 覆盖老buff
|
||||
buffList.buffer[i] = buff
|
||||
buff:OnStart()
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffCover, buff)
|
||||
isCovered = true
|
||||
break
|
||||
end
|
||||
end
|
||||
-- 没有覆盖,新buff
|
||||
if not isCovered then
|
||||
buffList:Add(buff)
|
||||
buff:OnStart()
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
end
|
||||
else
|
||||
-- 新buff
|
||||
buffList:Add(buff)
|
||||
buff:OnStart()
|
||||
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
|
||||
end
|
||||
end
|
||||
|
||||
-- 清除过期buff
|
||||
for i=1, self.buffDic.size do
|
||||
|
|
|
@ -159,66 +159,23 @@ end
|
|||
|
||||
--
|
||||
function BuffCtrl:AddBuffIcon(buff, icon)
|
||||
local currBuff=buff
|
||||
if not currBuff or not icon or icon == "" then
|
||||
if not buff or not icon or icon == "" then
|
||||
return
|
||||
end
|
||||
|
||||
if not self.BuffIconList then
|
||||
self.BuffIconList = {}
|
||||
end
|
||||
-- if not self.BuffIconList[buff.id] then
|
||||
-- local buffGO = BattlePool.GetItem(self.buffRoot.transform, BATTLE_POOL_TYPE.BUFF_VIEW)
|
||||
-- buffGO.transform.localScale = Vector3.one
|
||||
-- buffGO.transform.localPosition = Vector3.zero
|
||||
-- buffGO:SetActive(true)
|
||||
-- self.BuffIconList[buff.id] = BuffView.New(buffGO, buff, icon)
|
||||
-- else
|
||||
-- self.BuffIconList[buff.id].count = self.BuffIconList[buff.id].count + 1
|
||||
-- self.BuffIconList[buff.id]:SetCount()
|
||||
-- end
|
||||
|
||||
LogRed(buff.id)
|
||||
if not self.BuffIconList[currBuff.id] then
|
||||
--便利所有之前存在的buff图标,有同类型,同数值的叠加,否则新建
|
||||
for key, value in pairs(self.BuffIconList) do
|
||||
local buffType=self.BuffIconList[key].buff.type
|
||||
if currBuff.type == self.BuffIconList[key].buff.type then
|
||||
if buffType == BuffName.PropertyChange then
|
||||
--属性 判断属性类型,属性值,属性修改类型
|
||||
local b = self.BuffIconList[key].buff
|
||||
if self.BuffIconList[key].buffPropertyName == currBuff.propertyName and self.BuffIconList[key].buffCt == currBuff.changeType and self.BuffIconList[key].buffValue == currBuff.Value then
|
||||
self.BuffIconList[key]:SetCount(self.BuffIconList[key].count+1)
|
||||
return
|
||||
end
|
||||
--持续伤害类型,伤害系数
|
||||
elseif buffType==BuffName.DOT then
|
||||
if self.BuffIconList[key].buffDamageType==currBuff.damageType and self.BuffIconList[key].buffDamageFactor==currBuff.damageFactor then
|
||||
self.BuffIconList[key]:SetCount(self.BuffIconList[key].count+1)
|
||||
return
|
||||
end
|
||||
--控制类型
|
||||
elseif buffType == BuffName.Control then
|
||||
if self.BuffIconList[key].buffCtrlType==currBuff.ctrlType then
|
||||
self.BuffIconList[key]:SetCount(self.BuffIconList[key].count+1)
|
||||
return
|
||||
end
|
||||
elseif buffType == BuffName.HOT then
|
||||
if self.BuffIconList[key].healValue==currBuff.healValue then
|
||||
self.BuffIconList[key]:SetCount(self.BuffIconList[key].count+1)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if not self.BuffIconList[buff.id] then
|
||||
local buffGO = BattlePool.GetItem(self.buffRoot.transform, BATTLE_POOL_TYPE.BUFF_VIEW)
|
||||
buffGO.transform.localScale = Vector3.one
|
||||
buffGO.transform.localPosition = Vector3.zero
|
||||
buffGO:SetActive(true)
|
||||
self.BuffIconList[currBuff.id] = BuffView.New(buffGO, buff, icon)
|
||||
self.BuffIconList[buff.id] = BuffView.New(buffGO, buff, icon)
|
||||
else
|
||||
self.BuffIconList[buff.id].count = self.BuffIconList[buff.id].count + 1
|
||||
self.BuffIconList[buff.id]:SetCount()
|
||||
end
|
||||
|
||||
end
|
||||
function BuffCtrl:RemoveBuffIcon(buff)
|
||||
if not buff then
|
||||
|
@ -227,68 +184,9 @@ function BuffCtrl:RemoveBuffIcon(buff)
|
|||
if not self.BuffIconList then
|
||||
return
|
||||
end
|
||||
-- if self.BuffIconList[buff.id] then
|
||||
-- local count=self.BuffIconList[buff.id].count
|
||||
-- if count==1 then
|
||||
-- self.BuffIconList[buff.id]:Dispose()
|
||||
-- self.BuffIconList[buff.id] = nil
|
||||
-- else
|
||||
-- self.BuffIconList[buff.id]:SetCount(count-1)
|
||||
-- end
|
||||
-- return
|
||||
-- end
|
||||
|
||||
--便利所有之前存在的buff图标,有同类型,同数值的叠加,否则新建
|
||||
for key, value in pairs(self.BuffIconList) do
|
||||
local buffType = self.BuffIconList[key].buff.type
|
||||
local floor = self.BuffIconList[key].count
|
||||
|
||||
if buff.type == buffType then
|
||||
if buffType == BuffName.PropertyChange then
|
||||
--属性 判断属性类型,属性值,属性修改类型
|
||||
if self.BuffIconList[key].buffPropertyName==buff.propertyName and self.BuffIconList[key].buffValue==buff.Value and self.BuffIconList[key].buffCt==buff.changeType then
|
||||
if floor==1 then
|
||||
self.BuffIconList[key]:Dispose()
|
||||
self.BuffIconList[key] = nil
|
||||
else
|
||||
self.BuffIconList[key]:SetCount(floor-1)
|
||||
end
|
||||
return
|
||||
end
|
||||
--持续伤害类型,伤害系数
|
||||
elseif buffType == BuffName.DOT then
|
||||
if self.BuffIconList[key].buffDamageType==buff.damageType and self.BuffIconList[key].buffDamageFactor==buff.damageFactor then
|
||||
if floor==1 then
|
||||
self.BuffIconList[key]:Dispose()
|
||||
self.BuffIconList[key] = nil
|
||||
else
|
||||
self.BuffIconList[key]:SetCount(floor-1)
|
||||
end
|
||||
return
|
||||
end
|
||||
--控制类型
|
||||
elseif buffType == BuffName.Control then
|
||||
if self.BuffIconList[key].buffCtrlType==buff.ctrlType then
|
||||
if floor==1 then
|
||||
self.BuffIconList[key]:Dispose()
|
||||
self.BuffIconList[key] = nil
|
||||
else
|
||||
self.BuffIconList[key]:SetCount(floor-1)
|
||||
end
|
||||
return
|
||||
end
|
||||
elseif buffType == BuffName.HOT then
|
||||
if self.BuffIconList[key].healValue==buff.healValue then
|
||||
if floor==1 then
|
||||
self.BuffIconList[key]:Dispose()
|
||||
self.BuffIconList[key] = nil
|
||||
else
|
||||
self.BuffIconList[key]:SetCount(floor-1)
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.BuffIconList[buff.id] then
|
||||
self.BuffIconList[buff.id]:Dispose()
|
||||
self.BuffIconList[buff.id] = nil
|
||||
end
|
||||
end
|
||||
-- 卸载所有动画
|
||||
|
|
|
@ -7,14 +7,6 @@ function BuffView.New(go, buff, icon)
|
|||
|
||||
instance.go = go
|
||||
instance.buff = buff
|
||||
instance.buffPropertyName = buff.propertyName
|
||||
instance.buffValue = buff.Value
|
||||
instance.buffCt = buff.changeType
|
||||
instance.buffDamageType = buff.damageType
|
||||
instance.buffDamageFactor = buff.damageFactor
|
||||
instance.buffCtrlType = buff.ctrlType
|
||||
instance.healValue = buff.healValue
|
||||
|
||||
instance.levelText = Util.GetGameObject(go, "level"):GetComponent("Text")
|
||||
instance.layerText = Util.GetGameObject(go, "layer"):GetComponent("Text")
|
||||
instance.roundText = Util.GetGameObject(go, "round"):GetComponent("Text")
|
||||
|
@ -24,15 +16,13 @@ function BuffView.New(go, buff, icon)
|
|||
instance.icon.sprite = Util.LoadSprite(icon)
|
||||
instance.icon.color = Color.New(1,1,1,1)
|
||||
|
||||
-- if buff.layer and buff.cover then
|
||||
-- instance.levelText.text = tostring(buff.layer)
|
||||
-- instance.count = buff.layer
|
||||
-- else
|
||||
-- instance.levelText.text = ""
|
||||
-- instance.count = 1
|
||||
-- end
|
||||
if buff.layer and buff.cover then
|
||||
instance.levelText.text = tostring(buff.layer)
|
||||
instance.count = buff.layer
|
||||
else
|
||||
instance.levelText.text = ""
|
||||
instance.count = 1
|
||||
end
|
||||
instance.layerText.text = ""
|
||||
instance.roundText.text = ""
|
||||
instance.hideFlag = false
|
||||
|
@ -53,7 +43,7 @@ function BuffView:SetCount(count)
|
|||
count = self.count
|
||||
end
|
||||
|
||||
--if not self.buff.cover then
|
||||
if not self.buff.cover then
|
||||
if count == 1 then --只有1个独立buff,不显示数字
|
||||
self.layerText.text = ""
|
||||
self.count = 1
|
||||
|
@ -61,7 +51,7 @@ function BuffView:SetCount(count)
|
|||
self.layerText.text = tostring(count)
|
||||
self.count = count
|
||||
end
|
||||
--end
|
||||
end
|
||||
end
|
||||
|
||||
function BuffView:SetLayer(buff)
|
||||
|
|
Loading…
Reference in New Issue