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
|
spellCooldownPanel = nil
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
|
@ -7,11 +9,17 @@ function init()
|
||||||
onSpellGroupCooldown = onSpellGroupCooldown,
|
onSpellGroupCooldown = onSpellGroupCooldown,
|
||||||
onSpellCooldown = onSpellCooldown })
|
onSpellCooldown = onSpellCooldown })
|
||||||
|
|
||||||
cooldownPanel = g_ui.displayUI('cooldown.otui')
|
cooldownButton = TopMenu.addRightGameToggleButton('cooldownButton', tr('Cooldowns'), 'cooldown.png', toggle)
|
||||||
cooldownPanel:hide()
|
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
|
if g_game.isOnline() then
|
||||||
show()
|
show()
|
||||||
end
|
end
|
||||||
|
@ -23,18 +31,34 @@ function terminate()
|
||||||
onSpellGroupCooldown = onSpellGroupCooldown,
|
onSpellGroupCooldown = onSpellGroupCooldown,
|
||||||
onSpellCooldown = onSpellCooldown })
|
onSpellCooldown = onSpellCooldown })
|
||||||
|
|
||||||
spellCooldownPanel:destroy()
|
cooldownButton:destroy()
|
||||||
cooldownPanel: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
|
end
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
if g_game.getFeature(GameSpellList) then
|
if g_game.getFeature(GameSpellList) then
|
||||||
cooldownPanel:show()
|
cooldownWindow:show()
|
||||||
|
cooldownButton:show()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function hide()
|
function hide()
|
||||||
cooldownPanel:hide()
|
cooldownWindow:hide()
|
||||||
|
cooldownButton:hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateProgressRect(progressRect, interval, init)
|
function updateProgressRect(progressRect, interval, init)
|
||||||
|
@ -61,7 +85,7 @@ function onSpellCooldown(iconId, duration)
|
||||||
|
|
||||||
if not otcIconId then return end
|
if not otcIconId then return end
|
||||||
|
|
||||||
local icon = cooldownPanel:getChildById(spellName)
|
local icon = spellCooldownPanel:getChildById(spellName)
|
||||||
if not icon then
|
if not icon then
|
||||||
icon = g_ui.createWidget('SpellIcon', spellCooldownPanel)
|
icon = g_ui.createWidget('SpellIcon', spellCooldownPanel)
|
||||||
icon:setId(spellName)
|
icon:setId(spellName)
|
||||||
|
@ -78,8 +102,8 @@ end
|
||||||
function onSpellGroupCooldown(groupId, duration)
|
function onSpellGroupCooldown(groupId, duration)
|
||||||
if not SpellGroups[groupId] then return end
|
if not SpellGroups[groupId] then return end
|
||||||
|
|
||||||
local icon = cooldownPanel:getChildById('groupIcon' .. SpellGroups[groupId])
|
local icon = contentsPanel:getChildById('groupIcon' .. SpellGroups[groupId])
|
||||||
local progressRect = cooldownPanel:getChildById('progressRect' .. SpellGroups[groupId])
|
local progressRect = contentsPanel:getChildById('progressRect' .. SpellGroups[groupId])
|
||||||
if icon then
|
if icon then
|
||||||
icon:setOn(true)
|
icon:setOn(true)
|
||||||
removeEvent(icon.event)
|
removeEvent(icon.event)
|
||||||
|
|
|
@ -3,6 +3,7 @@ SpellGroupIcon < UIWidget
|
||||||
image-size: 22 22
|
image-size: 22 22
|
||||||
image-source: /game_cooldown/icons/cooldownIcons.png
|
image-source: /game_cooldown/icons/cooldownIcons.png
|
||||||
focusable: false
|
focusable: false
|
||||||
|
margin-top: 3
|
||||||
|
|
||||||
SpellIcon < UIWidget
|
SpellIcon < UIWidget
|
||||||
size: 22 22
|
size: 22 22
|
||||||
|
@ -18,87 +19,84 @@ SpellIcon < UIWidget
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
|
||||||
SpellProgressRect < UIProgressRect
|
SpellProgressRect < UIProgressRect
|
||||||
anchors.fill: parent
|
|
||||||
background: #585858AA
|
background: #585858AA
|
||||||
percent: 100
|
percent: 100
|
||||||
focusable: false
|
focusable: false
|
||||||
|
|
||||||
Panel
|
MiniWindow
|
||||||
id: spellPanel
|
id: cooldownWindow
|
||||||
layout:
|
!text: tr('Spell Cooldowns')
|
||||||
type: anchor
|
height: 85
|
||||||
height: 28
|
icon: cooldown.png
|
||||||
width: 250
|
@onClose: modules.game_cooldown.onMiniWindowClose()
|
||||||
anchors.top: parent.top
|
&save: true
|
||||||
anchors.left: parent.left
|
|
||||||
margin-top: 70
|
MiniWindowContents
|
||||||
margin-left: 10
|
SpellGroupIcon
|
||||||
border-width: 1
|
id: groupIconAttack
|
||||||
border-color: #00000077
|
image-clip: 0 0 20 20
|
||||||
background-color: #ffffff11
|
anchors.top: parent.top
|
||||||
focusable: false
|
anchors.left: parent.left
|
||||||
|
margin-left: 3
|
||||||
|
$on:
|
||||||
|
image-clip: 0 20 20 20
|
||||||
|
|
||||||
SpellGroupIcon
|
SpellProgressRect
|
||||||
id: groupIconAttack
|
id: progressRectAttack
|
||||||
image-clip: 0 0 20 20
|
anchors.fill: groupIconAttack
|
||||||
anchors.top: parent.top
|
!tooltip: tr('Attack')
|
||||||
anchors.left: parent.left
|
|
||||||
margin-top: 3
|
|
||||||
margin-left: 3
|
|
||||||
$on:
|
|
||||||
image-clip: 0 20 20 20
|
|
||||||
|
|
||||||
SpellProgressRect
|
SpellGroupIcon
|
||||||
id: progressRectAttack
|
id: groupIconHealing
|
||||||
anchors.fill: groupIconAttack
|
image-clip: 20 0 20 20
|
||||||
!tooltip: tr('Attack')
|
anchors.top: parent.top
|
||||||
|
anchors.left: groupIconAttack.right
|
||||||
|
margin-left: 3
|
||||||
|
$on:
|
||||||
|
image-clip: 20 20 20 20
|
||||||
|
|
||||||
SpellGroupIcon
|
SpellProgressRect
|
||||||
id: groupIconHealing
|
id: progressRectHealing
|
||||||
image-clip: 20 0 20 20
|
anchors.fill: groupIconHealing
|
||||||
anchors.top: parent.top
|
!tooltip: tr('Healing')
|
||||||
anchors.left: groupIconAttack.right
|
|
||||||
margin-top: 3
|
|
||||||
margin-left: 3
|
|
||||||
$on:
|
|
||||||
image-clip: 20 20 20 20
|
|
||||||
|
|
||||||
SpellProgressRect
|
SpellGroupIcon
|
||||||
id: progressRectHealing
|
id: groupIconSupport
|
||||||
anchors.fill: groupIconHealing
|
image-clip: 40 0 20 20
|
||||||
!tooltip: tr('Healing')
|
anchors.top: parent.top
|
||||||
|
anchors.left: groupIconHealing.right
|
||||||
|
margin-left: 3
|
||||||
|
$on:
|
||||||
|
image-clip: 40 20 20 20
|
||||||
|
|
||||||
SpellGroupIcon
|
SpellProgressRect
|
||||||
id: groupIconSupport
|
id: progressRectSupport
|
||||||
image-clip: 40 0 20 20
|
anchors.fill: groupIconSupport
|
||||||
anchors.top: parent.top
|
!tooltip: tr('Support')
|
||||||
anchors.left: groupIconHealing.right
|
|
||||||
margin-top: 3
|
|
||||||
margin-left: 3
|
|
||||||
$on:
|
|
||||||
image-clip: 40 20 20 20
|
|
||||||
|
|
||||||
SpellProgressRect
|
SpellGroupIcon
|
||||||
id: progressRectSupport
|
id: groupIconSpecial
|
||||||
anchors.fill: groupIconSupport
|
image-clip: 60 0 20 20
|
||||||
!tooltip: tr('Support')
|
anchors.top: parent.top
|
||||||
|
anchors.left: groupIconSupport.right
|
||||||
|
margin-left: 3
|
||||||
|
$on:
|
||||||
|
image-clip: 60 20 20 20
|
||||||
|
|
||||||
SpellGroupIcon
|
SpellProgressRect
|
||||||
id: groupIconSpecial
|
id: progressRectSpecial
|
||||||
image-clip: 60 0 20 20
|
anchors.fill: groupIconSpecial
|
||||||
anchors.top: parent.top
|
!tooltip: tr('Special')
|
||||||
anchors.left: groupIconSupport.right
|
|
||||||
margin-top: 3
|
|
||||||
margin-left: 3
|
|
||||||
$on:
|
|
||||||
image-clip: 60 20 20 20
|
|
||||||
|
|
||||||
SpellProgressRect
|
Panel
|
||||||
id: progressRectSpecial
|
id: spellCooldownPanel
|
||||||
anchors.fill: groupIconSpecial
|
margin-top: 5
|
||||||
!tooltip: tr('Special')
|
anchors.top: groupIconSpecial.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
Panel
|
anchors.right: parent.right
|
||||||
id: spellCooldownPanel
|
height: 30
|
||||||
anchors.fill: parent
|
padding: 1
|
||||||
margin-left: 102
|
margin-left: 2
|
||||||
|
margin-right: 2
|
||||||
|
border: 1 #444444
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 675 B |
Loading…
Reference in New Issue