|
|
|
@ -30,7 +30,7 @@ function HealthBar.init()
|
|
|
|
|
connect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange,
|
|
|
|
|
onManaChange = HealthBar.onManaChange,
|
|
|
|
|
onStatesChange = HealthBar.onStatesChange })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(g_game, { onGameEnd = HealthBar.offline })
|
|
|
|
|
|
|
|
|
|
healthBarWindow = displayUI('healthbar.otui', GameInterface.getLeftPanel())
|
|
|
|
@ -52,7 +52,7 @@ function HealthBar.terminate()
|
|
|
|
|
disconnect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange,
|
|
|
|
|
onManaChange = HealthBar.onManaChange,
|
|
|
|
|
onStatesChange = HealthBar.onStatesChange })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disconnect(g_game, { onGameEnd = HealthBar.offline })
|
|
|
|
|
|
|
|
|
|
healthBarWindow:destroy()
|
|
|
|
@ -71,6 +71,10 @@ function HealthBar.toggle()
|
|
|
|
|
healthBarButton:setOn(visible)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function HealthBar.offline()
|
|
|
|
|
healthBarWindow:recursiveGetChildById('conditions_content'):destroyChildren()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- hooked events
|
|
|
|
|
function HealthBar.onHealthChange(localPlayer, health, maxHealth)
|
|
|
|
|
healthLabel:setText(health .. ' / ' .. maxHealth)
|
|
|
|
@ -115,9 +119,3 @@ function HealthBar.toggleIcon(bitChanged)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function HealthBar.offline()
|
|
|
|
|
local conditionsContent = healthBarWindow:recursiveGetChildById('conditions_content')
|
|
|
|
|
local count = conditionsContent:getChildCount()
|
|
|
|
|
for i = count, 1, -1 do conditionsContent:getChildByIndex(i):destroy() end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|