diff --git a/lua/app/module/battle/helper/battle_helper.lua b/lua/app/module/battle/helper/battle_helper.lua index 4866d96e..9716ea56 100644 --- a/lua/app/module/battle/helper/battle_helper.lua +++ b/lua/app/module/battle/helper/battle_helper.lua @@ -90,7 +90,11 @@ function BattleHelper:setEffectTextCache(cache1, cache2, cache3, cache4) end 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 local prefab = CS.UnityEngine.Object.Instantiate(self.effectTextCacheList[colorType]:getGameObject()) local prefabObject = UIPrefabObject:create() @@ -117,7 +121,11 @@ function BattleHelper:recycleEffectText(comp) end comp:setEnabled(false) 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) if self.battleEffectTextMap then self.battleEffectTextMap[comp.baseObject:getInstanceID()] = nil