From 94b3c3ddc508e727a44cbd1e0944ed21a726ee5e Mon Sep 17 00:00:00 2001 From: chenxi Date: Thu, 20 Apr 2023 20:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A4=E5=AE=B3=E6=95=B0=E5=AD=97=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/helper/battle_helper.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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