Tweak modules interface

Minimize miniwindows space usage
Implement easier minimap navigation
Redesign inventory, minimap and healthinfo layout
This commit is contained in:
Eduardo Bart
2012-07-12 20:40:55 -03:00
parent c0c2411854
commit ebc88b8354
14 changed files with 149 additions and 175 deletions

View File

@@ -28,18 +28,21 @@ local soulBar
local healthLabel
local manaLabel
local soulLabel
local capLabel
-- public functions
function HealthInfo.init()
connect(LocalPlayer, { onHealthChange = HealthInfo.onHealthChange,
onManaChange = HealthInfo.onManaChange,
onStatesChange = HealthInfo.onStatesChange,
onSoulChange = HealthInfo.onSoulChange })
onSoulChange = HealthInfo.onSoulChange,
onFreeCapacityChange = HealthInfo.onFreeCapacityChange })
connect(g_game, { onGameEnd = HealthInfo.offline })
healthInfoWindow = g_ui.loadUI('healthinfo.otui', GameInterface.getRightPanel())
healthInfoButton = TopMenu.addRightGameToggleButton('healthInfoButton', tr('Health Information'), 'healthinfo.png', HealthInfo.toggle)
healthInfoWindow:disableResize()
healthInfoButton:setOn(true)
healthBar = healthInfoWindow:recursiveGetChildById('healthBar')
manaBar = healthInfoWindow:recursiveGetChildById('manaBar')
@@ -47,6 +50,7 @@ function HealthInfo.init()
manaLabel = healthInfoWindow:recursiveGetChildById('manaLabel')
soulBar = healthInfoWindow:recursiveGetChildById('soulBar')
soulLabel = healthInfoWindow:recursiveGetChildById('soulLabel')
capLabel = healthInfoWindow:recursiveGetChildById('capLabel')
if g_game.isOnline() then
local localPlayer = g_game.getLocalPlayer()
@@ -54,6 +58,7 @@ function HealthInfo.init()
HealthInfo.onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana())
HealthInfo.onStatesChange(localPlayer, localPlayer:getStates(), 0)
HealthInfo.onSoulChange(localPlayer, localPlayer:getSoul())
HealthInfo.onFreeCapacityChange(localPlayer, localPlayer:getFreeCapacity())
end
end
@@ -61,7 +66,8 @@ function HealthInfo.terminate()
disconnect(LocalPlayer, { onHealthChange = HealthInfo.onHealthChange,
onManaChange = HealthInfo.onManaChange,
onStatesChange = HealthInfo.onStatesChange,
onSoulChange = HealthInfo.onSoulChange })
onSoulChange = HealthInfo.onSoulChange,
onFreeCapacityChange = HealthInfo.onFreeCapacityChange })
disconnect(g_game, { onGameEnd = HealthInfo.offline })
@@ -69,14 +75,15 @@ function HealthInfo.terminate()
healthInfoButton:destroy()
healthInfoWindow = nil
healthInfoButton = nil
healthBar = nil
manaBar = nil
soulBar = nil
healthLabel = nil
manaLabel = nil
soulLabel = nil
capLabel = nil
HealthInfo = nil
end
@@ -118,9 +125,14 @@ function HealthInfo.onManaChange(localPlayer, mana, maxMana)
end
function HealthInfo.onSoulChange(localPlayer, soul)
soulLabel:setText('Soul: ' .. soul)
soulLabel:setText(tr('Soul') .. ': ' .. soul)
end
function HealthInfo.onFreeCapacityChange(player, freeCapacity)
capLabel:setText(tr('Cap') .. ': ' .. freeCapacity)
end
function HealthInfo.onStatesChange(localPlayer, now, old)
if now == old then return end

View File

@@ -5,7 +5,6 @@ HealthBar < ProgressBar
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
margin-top: 3
ManaBar < ProgressBar
id: manaBar
@@ -33,23 +32,33 @@ ManaLabel < GameLabel
anchors.fill: manaBar
margin-top: 2
text: 0 / 0
SoulLabel < GameLabel
id: soulLabel
text-align: right
color: white
text-align: center
font: verdana-11px-rounded
anchors.top: prev.bottom
anchors.left: parent.left
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.horizontalCenter
margin-top: 5
text: Soul:
CapLabel < GameLabel
id: capLabel
color: white
font: verdana-11px-rounded
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.horizontalCenter
margin-top: 5
text: Cap:
ConditionWidget < UIWidget
size: 18 18
$!first:
margin-left: 5
margin-left: 2
MiniWindow
icon: healthinfo.png
@@ -68,9 +77,14 @@ MiniWindow
id: conditionPanel
layout:
type: horizontalBox
fit-children: true
height: 18
margin-top: 5
height: 22
margin-top: 4
padding: 2
anchors.top: prev.bottom
anchors.horizontalcenter: parent.horizontalcenter
anchors.left: parent.left
anchors.right: parent.right
border-width: 1
border-color: #00000077
background-color: #ffffff11
SoulLabel
CapLabel