Converted cooldownbar to miniwindow
This commit is contained in:
parent
053d29a64b
commit
7f864003d8
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,6 @@
|
|||
cooldownPanel = nil
|
||||
cooldownWindow = nil
|
||||
cooldownButton = nil
|
||||
contentsPanel = nil
|
||||
spellCooldownPanel = nil
|
||||
|
||||
function init()
|
||||
|
@ -7,10 +9,16 @@ function init()
|
|||
onSpellGroupCooldown = onSpellGroupCooldown,
|
||||
onSpellCooldown = onSpellCooldown })
|
||||
|
||||
cooldownPanel = g_ui.displayUI('cooldown.otui')
|
||||
cooldownPanel:hide()
|
||||
cooldownButton = TopMenu.addRightGameToggleButton('cooldownButton', tr('Cooldowns'), 'cooldown.png', toggle)
|
||||
cooldownButton:setOn(true)
|
||||
cooldownButton:hide()
|
||||
|
||||
spellCooldownPanel = cooldownPanel:getChildById('spellCooldownPanel')
|
||||
cooldownWindow = g_ui.loadUI('cooldown.otui', modules.game_interface.getRightPanel())
|
||||
cooldownWindow:disableResize()
|
||||
cooldownWindow:setup()
|
||||
|
||||
contentsPanel = cooldownWindow:getChildById('contentsPanel')
|
||||
spellCooldownPanel = contentsPanel:getChildById('spellCooldownPanel')
|
||||
|
||||
if g_game.isOnline() then
|
||||
show()
|
||||
|
@ -23,18 +31,34 @@ function terminate()
|
|||
onSpellGroupCooldown = onSpellGroupCooldown,
|
||||
onSpellCooldown = onSpellCooldown })
|
||||
|
||||
spellCooldownPanel:destroy()
|
||||
cooldownPanel:destroy()
|
||||
cooldownButton:destroy()
|
||||
cooldownWindow:destroy()
|
||||
end
|
||||
|
||||
function onMiniWindowClose()
|
||||
cooldownButton:setOn(false)
|
||||
end
|
||||
|
||||
function toggle()
|
||||
if cooldownButton:isOn() then
|
||||
cooldownWindow:close()
|
||||
cooldownButton:setOn(false)
|
||||
else
|
||||
cooldownWindow:open()
|
||||
cooldownButton:setOn(true)
|
||||
end
|
||||
end
|
||||
|
||||
function show()
|
||||
if g_game.getFeature(GameSpellList) then
|
||||
cooldownPanel:show()
|
||||
cooldownWindow:show()
|
||||
cooldownButton:show()
|
||||
end
|
||||
end
|
||||
|
||||
function hide()
|
||||
cooldownPanel:hide()
|
||||
cooldownWindow:hide()
|
||||
cooldownButton:hide()
|
||||
end
|
||||
|
||||
function updateProgressRect(progressRect, interval, init)
|
||||
|
@ -61,7 +85,7 @@ function onSpellCooldown(iconId, duration)
|
|||
|
||||
if not otcIconId then return end
|
||||
|
||||
local icon = cooldownPanel:getChildById(spellName)
|
||||
local icon = spellCooldownPanel:getChildById(spellName)
|
||||
if not icon then
|
||||
icon = g_ui.createWidget('SpellIcon', spellCooldownPanel)
|
||||
icon:setId(spellName)
|
||||
|
@ -78,8 +102,8 @@ end
|
|||
function onSpellGroupCooldown(groupId, duration)
|
||||
if not SpellGroups[groupId] then return end
|
||||
|
||||
local icon = cooldownPanel:getChildById('groupIcon' .. SpellGroups[groupId])
|
||||
local progressRect = cooldownPanel:getChildById('progressRect' .. SpellGroups[groupId])
|
||||
local icon = contentsPanel:getChildById('groupIcon' .. SpellGroups[groupId])
|
||||
local progressRect = contentsPanel:getChildById('progressRect' .. SpellGroups[groupId])
|
||||
if icon then
|
||||
icon:setOn(true)
|
||||
removeEvent(icon.event)
|
||||
|
|
|
@ -3,6 +3,7 @@ SpellGroupIcon < UIWidget
|
|||
image-size: 22 22
|
||||
image-source: /game_cooldown/icons/cooldownIcons.png
|
||||
focusable: false
|
||||
margin-top: 3
|
||||
|
||||
SpellIcon < UIWidget
|
||||
size: 22 22
|
||||
|
@ -18,32 +19,24 @@ SpellIcon < UIWidget
|
|||
anchors.left: parent.left
|
||||
|
||||
SpellProgressRect < UIProgressRect
|
||||
anchors.fill: parent
|
||||
background: #585858AA
|
||||
percent: 100
|
||||
focusable: false
|
||||
|
||||
Panel
|
||||
id: spellPanel
|
||||
layout:
|
||||
type: anchor
|
||||
height: 28
|
||||
width: 250
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
margin-top: 70
|
||||
margin-left: 10
|
||||
border-width: 1
|
||||
border-color: #00000077
|
||||
background-color: #ffffff11
|
||||
focusable: false
|
||||
MiniWindow
|
||||
id: cooldownWindow
|
||||
!text: tr('Spell Cooldowns')
|
||||
height: 85
|
||||
icon: cooldown.png
|
||||
@onClose: modules.game_cooldown.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
SpellGroupIcon
|
||||
id: groupIconAttack
|
||||
image-clip: 0 0 20 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
margin-top: 3
|
||||
margin-left: 3
|
||||
$on:
|
||||
image-clip: 0 20 20 20
|
||||
|
@ -58,7 +51,6 @@ Panel
|
|||
image-clip: 20 0 20 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: groupIconAttack.right
|
||||
margin-top: 3
|
||||
margin-left: 3
|
||||
$on:
|
||||
image-clip: 20 20 20 20
|
||||
|
@ -73,7 +65,6 @@ Panel
|
|||
image-clip: 40 0 20 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: groupIconHealing.right
|
||||
margin-top: 3
|
||||
margin-left: 3
|
||||
$on:
|
||||
image-clip: 40 20 20 20
|
||||
|
@ -88,7 +79,6 @@ Panel
|
|||
image-clip: 60 0 20 20
|
||||
anchors.top: parent.top
|
||||
anchors.left: groupIconSupport.right
|
||||
margin-top: 3
|
||||
margin-left: 3
|
||||
$on:
|
||||
image-clip: 60 20 20 20
|
||||
|
@ -100,5 +90,13 @@ Panel
|
|||
|
||||
Panel
|
||||
id: spellCooldownPanel
|
||||
anchors.fill: parent
|
||||
margin-left: 102
|
||||
margin-top: 5
|
||||
anchors.top: groupIconSpecial.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: 30
|
||||
padding: 1
|
||||
margin-left: 2
|
||||
margin-right: 2
|
||||
border: 1 #444444
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 675 B |
Loading…
Reference in New Issue