mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
optimize widget destruction
This commit is contained in:
@@ -7,9 +7,10 @@ function RadioGroup.create()
|
||||
end
|
||||
|
||||
function RadioGroup:destroy()
|
||||
while #self.widgets ~= 0 do
|
||||
self:removeWidget(self.widgets[1])
|
||||
for k,widget in pairs(self.widgets) do
|
||||
widget.onMousePress = nil
|
||||
end
|
||||
self.widgets = {}
|
||||
end
|
||||
|
||||
function RadioGroup:addWidget(widget)
|
||||
@@ -25,6 +26,13 @@ function RadioGroup:removeWidget(widget)
|
||||
table.removevalue(self.widgets, widget)
|
||||
end
|
||||
|
||||
function RadioGroup:destroy()
|
||||
for k,widget in pairs(self.widgets) do
|
||||
widget.onMousePress = nil
|
||||
end
|
||||
self.widgets = {}
|
||||
end
|
||||
|
||||
function RadioGroup:selectWidget(selectedWidget)
|
||||
if selectedWidget == self.selectedWidget then return end
|
||||
|
||||
|
@@ -59,7 +59,7 @@ function NPCTrade.init()
|
||||
end
|
||||
|
||||
function NPCTrade.terminate()
|
||||
radioTabs:destroy()
|
||||
--radioTabs:destroy()
|
||||
radioTabs = nil
|
||||
npcWindow:destroy()
|
||||
npcWindow = nil
|
||||
@@ -229,7 +229,10 @@ function NPCTrade.createItemsOnPanel()
|
||||
|
||||
offerSelected = nil
|
||||
itemsPanel:destroyChildren()
|
||||
|
||||
|
||||
if radioItems then
|
||||
radioItems:destroy()
|
||||
end
|
||||
radioItems = RadioGroup.create()
|
||||
|
||||
for i, v in pairs(cacheItems) do
|
||||
|
Reference in New Issue
Block a user