diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index b6999c04..5327415a 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -15,6 +15,10 @@ function BattleUI:getPrefabPath() return "assets/prefabs/ui/battle/battle_ui.prefab" end +function BattleUI:onClose() + self:clear() +end + function BattleUI:onLoadRootComplete() self:_display() self:_addListeners() @@ -407,4 +411,14 @@ function BattleUI:doCachePopAni(skillInfo, callback) end) end +function BattleUI:clear() + if self.alreadyClear then + return + end + self.alreadyClear = true + if self.battleNode then + self.battleNode:removeAllChildren() + end +end + return BattleUI \ No newline at end of file