Fix signalCall, healthinfo tooltips

master
Henrique Santiago 11 years ago
parent 11cb287a21
commit dfb0150a7d

@ -375,6 +375,7 @@ locale = {
["You are strengthened"] = "Você está reforçado", ["You are strengthened"] = "Você está reforçado",
["You are within a protection zone"] = "Você está dentro de uma zona de proteção", ["You are within a protection zone"] = "Você está dentro de uma zona de proteção",
["You can enter new text."] = "Você pode entrar com um novo texto.", ["You can enter new text."] = "Você pode entrar com um novo texto.",
["You have %d%% to advance to level %d."] = "Você tem %d%% para avançar para o nível %d.",
["You have %s percent to go"] = "Você tem %s porcento para avançar", ["You have %s percent to go"] = "Você tem %s porcento para avançar",
["You have %s percent"] = "Você tem %s porcento", ["You have %s percent"] = "Você tem %s porcento",
["You may not logout during a fight"] = "Você não pode sair durante um combate", ["You may not logout during a fight"] = "Você não pode sair durante um combate",
@ -385,6 +386,8 @@ locale = {
["You read the following, written by \n%s\n"] = "Você lê o seguinte, escrito por \n%s\n", ["You read the following, written by \n%s\n"] = "Você lê o seguinte, escrito por \n%s\n",
["You read the following, written on \n%s.\n"] = "Você lê o seguinte, escrito em \n%s.\n", ["You read the following, written on \n%s.\n"] = "Você lê o seguinte, escrito em \n%s.\n",
["Your Capacity"] = "Sua capacidade", ["Your Capacity"] = "Sua capacidade",
["Your character health is %d out of %d."] = "A vida do seu personagem é %d de %d.",
["Your character mana is %d out of %d."] = "A mana do seu personagem é %d de %d.",
["Your Money"] = "Seu dinheiro", ["Your Money"] = "Seu dinheiro",
} }
} }

@ -54,7 +54,7 @@ end
function init() function init()
connect(g_app, { onRun = startup, connect(g_app, { onRun = startup,
onClose = exit }) onExit = exit })
g_window.setMinimumSize({ width = 600, height = 480 }) g_window.setMinimumSize({ width = 600, height = 480 })
g_sounds.preload(musicFilename) g_sounds.preload(musicFilename)
@ -99,7 +99,7 @@ end
function terminate() function terminate()
disconnect(g_app, { onRun = startup, disconnect(g_app, { onRun = startup,
onClose = exit }) onExit = exit })
-- save window configs -- save window configs
g_settings.set('window-size', g_window.getUnmaximizedSize()) g_settings.set('window-size', g_window.getUnmaximizedSize())
g_settings.set('window-pos', g_window.getUnmaximizedPos()) g_settings.set('window-pos', g_window.getUnmaximizedPos())
@ -113,4 +113,4 @@ end
function exit() function exit()
g_logger.info("Exiting application..") g_logger.info("Exiting application..")
end end

@ -4,7 +4,6 @@ UIProgressBar = extends(UIWidget)
function UIProgressBar.create() function UIProgressBar.create()
local progressbar = UIProgressBar.internalCreate() local progressbar = UIProgressBar.internalCreate()
progressbar:setFocusable(false) progressbar:setFocusable(false)
progressbar:setPhantom(true)
progressbar.min = 0 progressbar.min = 0
progressbar.max = 100 progressbar.max = 100
progressbar.value = 0 progressbar.value = 0

@ -23,6 +23,9 @@ manaBar = nil
experienceBar = nil experienceBar = nil
soulLabel = nil soulLabel = nil
capLabel = nil capLabel = nil
healthTooltip = 'Your character health is %d out of %d.'
manaTooltip = 'Your character mana is %d out of %d.'
experienceTooltip = 'You have %d%% to advance to level %d.'
function init() function init()
connect(LocalPlayer, { onHealthChange = onHealthChange, connect(LocalPlayer, { onHealthChange = onHealthChange,
@ -96,19 +99,6 @@ function toggleIcon(bitChanged)
end end
end end
function hideLabels()
local removeHeight = math.max(capLabel:getMarginRect().height, soulLabel:getMarginRect().height)
capLabel:setOn(false)
soulLabel:setOn(false)
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end
function hideExperience()
local removeHeight = experienceBar:getMarginRect().height
experienceBar:setOn(false)
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end
function offline() function offline()
healthInfoWindow:recursiveGetChildById('conditionPanel'):destroyChildren() healthInfoWindow:recursiveGetChildById('conditionPanel'):destroyChildren()
end end
@ -120,16 +110,19 @@ end
function onHealthChange(localPlayer, health, maxHealth) function onHealthChange(localPlayer, health, maxHealth)
healthBar:setText(health .. ' / ' .. maxHealth) healthBar:setText(health .. ' / ' .. maxHealth)
healthBar:setTooltip(tr(healthTooltip, health, maxHealth))
healthBar:setValue(health, 0, maxHealth) healthBar:setValue(health, 0, maxHealth)
end end
function onManaChange(localPlayer, mana, maxMana) function onManaChange(localPlayer, mana, maxMana)
manaBar:setText(mana .. ' / ' .. maxMana) manaBar:setText(mana .. ' / ' .. maxMana)
manaBar:setTooltip(tr(manaTooltip, mana, maxMana))
manaBar:setValue(mana, 0, maxMana) manaBar:setValue(mana, 0, maxMana)
end end
function onLevelChange(localPlayer, value, percent) function onLevelChange(localPlayer, value, percent)
experienceBar:setText(percent .. "%") experienceBar:setText(percent .. '%')
experienceBar:setTooltip(tr(experienceTooltip, percent, value+1))
experienceBar:setPercent(percent) experienceBar:setPercent(percent)
end end
@ -154,3 +147,29 @@ function onStatesChange(localPlayer, now, old)
end end
end end
end end
-- personalization functions
function hideLabels()
local removeHeight = math.max(capLabel:getMarginRect().height, soulLabel:getMarginRect().height)
capLabel:setOn(false)
soulLabel:setOn(false)
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end
function hideExperience()
local removeHeight = experienceBar:getMarginRect().height
experienceBar:setOn(false)
healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end
function setHealthTooltip(tooltip)
healthTooltip = tooltip
end
function setManaTooltip(tooltip)
manaTooltip = tooltip
end
function setExperienceTooltip(tooltip)
experienceTooltip = tooltip
end

@ -152,6 +152,7 @@ void Application::poll()
void Application::exit() void Application::exit()
{ {
g_lua.callGlobalField<bool>("g_app", "onExit");
m_stopping = true; m_stopping = true;
} }

@ -506,7 +506,7 @@ int LuaInterface::signalCall(int numArgs, int numRets)
} }
pop(numArgs + 1); // pops the table of function and arguments pop(numArgs + 1); // pops the table of function and arguments
if(numRets == 1) { if(numRets == 1 || numRets == -1) {
rets = 1; rets = 1;
pushBoolean(done); pushBoolean(done);
} }

Loading…
Cancel
Save