Now Soul Points are shown in the bottom of the HealthBar widget.
This commit is contained in:
parent
d2bdab42b5
commit
104785818b
|
@ -27,11 +27,15 @@ local manaBar
|
|||
local healthLabel
|
||||
local manaLabel
|
||||
|
||||
local soulLabel
|
||||
local soulPoints
|
||||
|
||||
-- public functions
|
||||
function HealthBar.init()
|
||||
connect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange,
|
||||
onManaChange = HealthBar.onManaChange,
|
||||
onStatesChange = HealthBar.onStatesChange })
|
||||
onStatesChange = HealthBar.onStatesChange,
|
||||
onSoulChange = HealthBar.onSoulChange })
|
||||
|
||||
connect(g_game, { onGameEnd = HealthBar.offline })
|
||||
|
||||
|
@ -43,18 +47,22 @@ function HealthBar.init()
|
|||
healthLabel = healthBarWindow:recursiveGetChildById('healthLabel')
|
||||
manaLabel = healthBarWindow:recursiveGetChildById('manaLabel')
|
||||
|
||||
soulLabel = healthBarWindow:recursiveGetChildById('soulLabel')
|
||||
|
||||
if g_game.isOnline() then
|
||||
local localPlayer = g_game.getLocalPlayer()
|
||||
HealthBar.onHealthChange(localPlayer, localPlayer:getHealth(), localPlayer:getMaxHealth())
|
||||
HealthBar.onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana())
|
||||
HealthBar.onStatesChange(localPlayer, localPlayer:getStates(), 0)
|
||||
HealthBar.onSoulChange(localPlayer, localPlayer:getSoul())
|
||||
end
|
||||
end
|
||||
|
||||
function HealthBar.terminate()
|
||||
disconnect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange,
|
||||
onManaChange = HealthBar.onManaChange,
|
||||
onStatesChange = HealthBar.onStatesChange })
|
||||
onStatesChange = HealthBar.onStatesChange,
|
||||
onSoulChange = HealthBar.onSoulChange })
|
||||
|
||||
disconnect(g_game, { onGameEnd = HealthBar.offline })
|
||||
|
||||
|
@ -67,6 +75,8 @@ function HealthBar.terminate()
|
|||
healthLabel = nil
|
||||
manaLabel = nil
|
||||
|
||||
soulLabel = nil
|
||||
|
||||
HealthBar = nil
|
||||
end
|
||||
|
||||
|
@ -120,6 +130,10 @@ function HealthBar.onStatesChange(localPlayer, now, old)
|
|||
end
|
||||
end
|
||||
|
||||
function HealthBar.onSoulChange(localPlayer, soul)
|
||||
soulLabel:setText('Soul: '.. soul)
|
||||
end
|
||||
|
||||
function HealthBar.toggleIcon(bitChanged)
|
||||
local content = healthBarWindow:recursiveGetChildById('conditionPanel')
|
||||
|
||||
|
|
|
@ -34,6 +34,17 @@ ManaLabel < GameLabel
|
|||
margin-top: 2
|
||||
text: 0 / 0
|
||||
|
||||
SoulLabel < GameLabel
|
||||
id: soulLabel
|
||||
color: white
|
||||
text-align: center
|
||||
font: verdana-11px-rounded
|
||||
anchors.top: prev.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
margin-top: 5
|
||||
text: Soul:
|
||||
|
||||
ConditionWidget < UIWidget
|
||||
size: 18 18
|
||||
|
||||
|
@ -44,7 +55,7 @@ MiniWindow
|
|||
icon: healthbar.png
|
||||
id: healthBarWindow
|
||||
!text: tr('Health Bar')
|
||||
height: 86
|
||||
height: 102
|
||||
@onClose: HealthBar.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
|
@ -62,3 +73,4 @@ MiniWindow
|
|||
margin-top: 5
|
||||
anchors.top: prev.bottom
|
||||
anchors.horizontalcenter: parent.horizontalcenter
|
||||
SoulLabel
|
||||
|
|
Loading…
Reference in New Issue