From dc66b8833a823b61834357591093fee3e3b2b567 Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 12 Apr 2023 18:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E6=88=98=E6=96=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_ui.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 9adeea41..1fe811ce 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() @@ -264,4 +268,15 @@ function BattleUI:fallGrid(listInfo, 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