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