fix viplist issues
This commit is contained in:
parent
09e831ddc0
commit
f3e9fc7cd4
|
@ -7,18 +7,32 @@ local addVipWindow
|
|||
|
||||
-- public functions
|
||||
function VipList.init()
|
||||
connect(g_game, { onGameEnd = VipList.clear,
|
||||
onAddVip = VipList.onAddVip,
|
||||
onVipStateChange = VipList.onVipStateChange })
|
||||
|
||||
|
||||
vipWindow = displayUI('viplist.otui', GameInterface.getLeftPanel())
|
||||
vipButton = TopMenu.addGameToggleButton('vipListButton', 'VIP list', 'viplist.png', VipList.toggle)
|
||||
vipButton:setOn(true)
|
||||
end
|
||||
|
||||
function VipList.terminate()
|
||||
disconnect(g_game, { onGameEnd = VipList.clear,
|
||||
onAddVip = VipList.onAddVip,
|
||||
onVipStateChange = VipList.onVipStateChange })
|
||||
|
||||
vipWindow:destroy()
|
||||
vipWindow = nil
|
||||
vipButton:destroy()
|
||||
vipButton = nil
|
||||
end
|
||||
|
||||
function VipList.clear()
|
||||
local vipList = vipWindow:getChildById('contentsPanel')
|
||||
vipList:destroyChildren()
|
||||
end
|
||||
|
||||
function VipList.toggle()
|
||||
local visible = not vipWindow:isExplicitlyVisible()
|
||||
vipWindow:setVisible(visible)
|
||||
|
@ -98,7 +112,7 @@ end
|
|||
function VipList.onVipListMousePress(widget, mousePos, mouseButton)
|
||||
if mouseButton ~= MouseRightButton then return end
|
||||
|
||||
local vipList = vipWindow:getChildById('vipList')
|
||||
local vipList = vipWindow:getChildById('contentsPanel')
|
||||
|
||||
local menu = createWidget('PopupMenu')
|
||||
menu:addOption('Add new VIP', function() VipList.createAddWindow() end)
|
||||
|
@ -110,7 +124,7 @@ end
|
|||
function VipList.onVipListLabelMousePress(widget, mousePos, mouseButton)
|
||||
if mouseButton ~= MouseRightButton then return end
|
||||
|
||||
local vipList = vipWindow:getChildById('vipList')
|
||||
local vipList = vipWindow:getChildById('contentsPanel')
|
||||
|
||||
local menu = createWidget('PopupMenu')
|
||||
menu:addOption('Add new VIP', function() VipList.createAddWindow() end)
|
||||
|
@ -121,9 +135,3 @@ function VipList.onVipListLabelMousePress(widget, mousePos, mouseButton)
|
|||
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
connect(g_game, { onGameStart = VipList.create,
|
||||
onGameEnd = VipList.destroy,
|
||||
onAddVip = VipList.onAddVip,
|
||||
onVipStateChange = VipList.onVipStateChange })
|
||||
|
|
Loading…
Reference in New Issue