Fixed 'widget destroyed but still have 1 reference left' related to console module
This commit is contained in:
parent
900ebbd985
commit
64e9406488
|
@ -17,19 +17,19 @@ local function updateMargins(tabBar, ignored)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function updateNavigation(tabBar)
|
local function updateNavigation(tabBar)
|
||||||
if prevNavigation then
|
if tabBar.prevNavigation then
|
||||||
if #tabBar.preTabs > 0 or table.find(tabBar.tabs, tabBar.currentTab) ~= 1 then
|
if #tabBar.preTabs > 0 or table.find(tabBar.tabs, tabBar.currentTab) ~= 1 then
|
||||||
prevNavigation:enable()
|
tabBar.prevNavigation:enable()
|
||||||
else
|
else
|
||||||
prevNavigation:disable()
|
tabBar.prevNavigation:disable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if nextNavigation then
|
if tabBar.nextNavigation then
|
||||||
if #tabBar.postTabs > 0 or table.find(tabBar.tabs, tabBar.currentTab) ~= #tabBar.tabs then
|
if #tabBar.postTabs > 0 or table.find(tabBar.tabs, tabBar.currentTab) ~= #tabBar.tabs then
|
||||||
nextNavigation:enable()
|
tabBar.nextNavigation:enable()
|
||||||
else
|
else
|
||||||
nextNavigation:disable()
|
tabBar.nextNavigation:disable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -218,6 +218,19 @@ function UIMoveableTabBar.create()
|
||||||
return tabbar
|
return tabbar
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function UIMoveableTabBar:onDestroy()
|
||||||
|
if self.prevNavigation then
|
||||||
|
self.prevNavigation:disable()
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.nextNavigation then
|
||||||
|
self.nextNavigation:disable()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.nextNavigation = nil
|
||||||
|
self.prevNavigation = nil
|
||||||
|
end
|
||||||
|
|
||||||
function UIMoveableTabBar:setContentWidget(widget)
|
function UIMoveableTabBar:setContentWidget(widget)
|
||||||
self.contentWidget = widget
|
self.contentWidget = widget
|
||||||
if #self.tabs > 0 then
|
if #self.tabs > 0 then
|
||||||
|
@ -467,14 +480,14 @@ function UIMoveableTabBar:getCurrentTab()
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIMoveableTabBar:setNavigation(prevButton, nextButton)
|
function UIMoveableTabBar:setNavigation(prevButton, nextButton)
|
||||||
prevNavigation = prevButton
|
self.prevNavigation = prevButton
|
||||||
nextNavigation = nextButton
|
self.nextNavigation = nextButton
|
||||||
|
|
||||||
if prevNavigation then
|
if self.prevNavigation then
|
||||||
prevNavigation.onClick = function() self:selectPrevTab() end
|
self.prevNavigation.onClick = function() self:selectPrevTab() end
|
||||||
end
|
end
|
||||||
if nextNavigation then
|
if self.nextNavigation then
|
||||||
nextNavigation.onClick = function() self:selectNextTab() end
|
self.nextNavigation.onClick = function() self:selectNextTab() end
|
||||||
end
|
end
|
||||||
updateNavigation(self)
|
updateNavigation(self)
|
||||||
end
|
end
|
||||||
|
|
|
@ -170,7 +170,7 @@ function enableChat()
|
||||||
gameInterface.unbindWalkKey("D")
|
gameInterface.unbindWalkKey("D")
|
||||||
gameInterface.unbindWalkKey("S")
|
gameInterface.unbindWalkKey("S")
|
||||||
gameInterface.unbindWalkKey("A")
|
gameInterface.unbindWalkKey("A")
|
||||||
|
|
||||||
gameInterface.unbindWalkKey("E")
|
gameInterface.unbindWalkKey("E")
|
||||||
gameInterface.unbindWalkKey("Q")
|
gameInterface.unbindWalkKey("Q")
|
||||||
gameInterface.unbindWalkKey("C")
|
gameInterface.unbindWalkKey("C")
|
||||||
|
@ -199,7 +199,7 @@ function disableChat()
|
||||||
gameInterface.bindWalkKey("D", East)
|
gameInterface.bindWalkKey("D", East)
|
||||||
gameInterface.bindWalkKey("S", South)
|
gameInterface.bindWalkKey("S", South)
|
||||||
gameInterface.bindWalkKey("A", West)
|
gameInterface.bindWalkKey("A", West)
|
||||||
|
|
||||||
gameInterface.bindWalkKey("E", NorthEast)
|
gameInterface.bindWalkKey("E", NorthEast)
|
||||||
gameInterface.bindWalkKey("Q", NorthWest)
|
gameInterface.bindWalkKey("Q", NorthWest)
|
||||||
gameInterface.bindWalkKey("C", SouthEast)
|
gameInterface.bindWalkKey("C", SouthEast)
|
||||||
|
@ -245,7 +245,13 @@ function terminate()
|
||||||
violationWindow:destroy()
|
violationWindow:destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
consoleTabBar = nil
|
||||||
|
consoleContentPanel = nil
|
||||||
|
consoleToggleChat = nil
|
||||||
|
consoleTextEdit = nil
|
||||||
|
|
||||||
consolePanel:destroy()
|
consolePanel:destroy()
|
||||||
|
consolePanel = nil
|
||||||
ownPrivateName = nil
|
ownPrivateName = nil
|
||||||
|
|
||||||
Console = nil
|
Console = nil
|
||||||
|
@ -300,11 +306,14 @@ function clear()
|
||||||
channels = {}
|
channels = {}
|
||||||
|
|
||||||
consoleTabBar:removeTab(defaultTab)
|
consoleTabBar:removeTab(defaultTab)
|
||||||
|
defaultTab = nil
|
||||||
consoleTabBar:removeTab(serverTab)
|
consoleTabBar:removeTab(serverTab)
|
||||||
|
serverTab = nil
|
||||||
|
|
||||||
local npcTab = consoleTabBar:getTab('NPCs')
|
local npcTab = consoleTabBar:getTab('NPCs')
|
||||||
if npcTab then
|
if npcTab then
|
||||||
consoleTabBar:removeTab(npcTab)
|
consoleTabBar:removeTab(npcTab)
|
||||||
|
npcTab = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if violationReportTab then
|
if violationReportTab then
|
||||||
|
|
Loading…
Reference in New Issue