伤害数字对象池
This commit is contained in:
parent
d52e92b6b0
commit
94b3c3ddc5
@ -90,7 +90,11 @@ function BattleHelper:setEffectTextCache(cache1, cache2, cache3, cache4)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleHelper:getEffectText(parent, colorType)
|
function BattleHelper:getEffectText(parent, colorType)
|
||||||
local pool = self.battleEffectTextPool[colorType] or {}
|
local pool = self.battleEffectTextPool[colorType]
|
||||||
|
if pool == nil then
|
||||||
|
pool = {}
|
||||||
|
self.battleEffectTextPool[colorType] = {}
|
||||||
|
end
|
||||||
if #pool <= 0 then
|
if #pool <= 0 then
|
||||||
local prefab = CS.UnityEngine.Object.Instantiate(self.effectTextCacheList[colorType]:getGameObject())
|
local prefab = CS.UnityEngine.Object.Instantiate(self.effectTextCacheList[colorType]:getGameObject())
|
||||||
local prefabObject = UIPrefabObject:create()
|
local prefabObject = UIPrefabObject:create()
|
||||||
@ -117,7 +121,11 @@ function BattleHelper:recycleEffectText(comp)
|
|||||||
end
|
end
|
||||||
comp:setEnabled(false)
|
comp:setEnabled(false)
|
||||||
local colorType = comp:getColorType()
|
local colorType = comp:getColorType()
|
||||||
local pool = self.battleEffectTextPool[colorType] or {}
|
local pool = self.battleEffectTextPool[colorType]
|
||||||
|
if pool == nil then
|
||||||
|
pool = {}
|
||||||
|
self.battleEffectTextPool[colorType] = {}
|
||||||
|
end
|
||||||
table.insert(pool, comp)
|
table.insert(pool, comp)
|
||||||
if self.battleEffectTextMap then
|
if self.battleEffectTextMap then
|
||||||
self.battleEffectTextMap[comp.baseObject:getInstanceID()] = nil
|
self.battleEffectTextMap[comp.baseObject:getInstanceID()] = nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user