Many UI fixes.

This commit is contained in:
Henrique Santiago 2012-08-24 05:18:15 -03:00
parent 0c18e4ff28
commit f97fa65d37
8 changed files with 88 additions and 81 deletions

View File

@ -22,3 +22,11 @@ MenuLabel < Label
GameLabel < UILabel GameLabel < UILabel
font: verdana-11px-antialised font: verdana-11px-antialised
color: #bbbbbb color: #bbbbbb
FrameCounterLabel < Label
@onSetup: |
self.updateEvent = cycleEvent(function()
local text = 'FPS: ' .. g_app.getBackgroundPaneFps()
self:setText(text)
end, 1000)
@onDestroy: self.updateEvent:cancel()

View File

@ -68,7 +68,6 @@ MiniWindow < UIMiniWindow
$!on: $!on:
width: 0 width: 0
margin-right: 4
ResizeBorder ResizeBorder
id: bottomResizeBorder id: bottomResizeBorder
@ -88,6 +87,7 @@ MiniWindowContents < ScrollablePanel
margin-left: 3 margin-left: 3
margin-bottom: 3 margin-bottom: 3
margin-top: 22 margin-top: 22
margin-right: 1
vertical-scrollbar: miniwindowScrollBar vertical-scrollbar: miniwindowScrollBar
BorderlessGameWindow < UIWindow BorderlessGameWindow < UIWindow

View File

@ -37,13 +37,18 @@ TopMenuButtonsPanel < Panel
fit-children: true fit-children: true
padding: 6 4 padding: 6 4
TopPanel < Panel TopMenuPanel < Panel
height: 36 height: 36
image-source: images/top_panel.png image-source: images/top_panel.png
image-repeated: true image-repeated: true
focusable: false focusable: false
TopPanel TopMenuFrameCounterLabel < FrameCounterLabel
color: white
margin-top: 10
margin-right: 5
TopMenuPanel
id: topMenu id: topMenu
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
@ -62,25 +67,11 @@ TopPanel
anchors.left: prev.right anchors.left: prev.right
visible: false visible: false
UILabel TopMenuFrameCounterLabel
id: frameCounter id: frameCounter
text-align: right
text-auto-resize: true text-auto-resize: true
color: white
id: frameCounter
anchors.top: parent.top anchors.top: parent.top
anchors.left: prev.right anchors.left: prev.right
margin-top: 10
margin-right: 5
@onSetup: |
cycleEvent(function()
local frameCounter = rootWidget:recursiveGetChildById('frameCounter')
if frameCounter then
local text = 'FPS: ' .. g_app.getBackgroundPaneFps()
frameCounter:setText(text)
--print(text)
end
end, 250)
TopMenuButtonsPanel TopMenuButtonsPanel
id: rightButtonsPanel id: rightButtonsPanel

View File

@ -49,7 +49,7 @@ function init()
mouseWidget:setVisible(false) mouseWidget:setVisible(false)
mouseWidget:setFocusable(false) mouseWidget:setFocusable(false)
battleWindow:setContentMinimumHeight(56) battleWindow:setContentMinimumHeight(80)
battleWindow:setContentMaximumHeight(384) battleWindow:setContentMaximumHeight(384)
connect(Creature, { onSkullChange = checkCreatureSkull, connect(Creature, { onSkullChange = checkCreatureSkull,

View File

@ -44,58 +44,58 @@ MiniWindow
@onClose: modules.game_battle.onMiniWindowClose() @onClose: modules.game_battle.onMiniWindowClose()
&save: true &save: true
BattlePlayers Panel
id: hidePlayers
!tooltip: tr('Hide players')
anchors.top: parent.top
anchors.right: next.left
margin-right: 5
margin-top: 26 margin-top: 26
@onCheckChange: modules.game_battle.checkCreatures()
BattleNPCs
id: hideNPCs
!tooltip: tr('Hide Npcs')
anchors.top: parent.top anchors.top: parent.top
anchors.right: next.left anchors.left: parent.left
margin-right: 5 anchors.right: miniwindowScrollBar.left
margin-top: 26 height: 20
@onCheckChange: modules.game_battle.checkCreatures()
BattleMonsters Panel
id: hideMonsters anchors.top: parent.top
!tooltip: tr('Hide monsters') anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top height: 20
anchors.horizontalCenter: parent.horizontalCenter width: 120
margin-top: 26 // width*count + spacing*(count-1)
@onCheckChange: modules.game_battle.checkCreatures() layout:
type: horizontalBox
spacing: 5
BattleSkulls BattlePlayers
id: hideSkulls id: hidePlayers
!tooltip: tr('Hide non-skull players') !tooltip: tr('Hide players')
anchors.top: prev.top @onCheckChange: modules.game_battle.checkCreatures()
anchors.left: prev.right
margin-left: 5
@onCheckChange: modules.game_battle.checkCreatures()
BattleParty BattleNPCs
id: hideParty id: hideNPCs
!tooltip: tr('Hide party members') !tooltip: tr('Hide Npcs')
anchors.top: prev.top @onCheckChange: modules.game_battle.checkCreatures()
anchors.left: prev.right
margin-left: 5 BattleMonsters
phantom: true id: hideMonsters
@onCheckChange: modules.game_battle.checkCreatures() !tooltip: tr('Hide monsters')
@onCheckChange: modules.game_battle.checkCreatures()
BattleSkulls
id: hideSkulls
!tooltip: tr('Hide non-skull players')
@onCheckChange: modules.game_battle.checkCreatures()
BattleParty
id: hideParty
!tooltip: tr('Hide party members')
@onCheckChange: modules.game_battle.checkCreatures()
HorizontalSeparator HorizontalSeparator
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: miniwindowScrollBar.left
margin-top: 5 margin-right: 1
margin-top: 4
MiniWindowContents MiniWindowContents
anchors.top: parent.top anchors.top: prev.bottom
margin-top: 50 margin-top: 0
Panel Panel
id: battlePanel id: battlePanel

View File

@ -26,6 +26,7 @@ function createTrade()
g_game.rejectTrade() g_game.rejectTrade()
tradeWindow:hide() tradeWindow:hide()
end end
tradeWindow:setup()
end end
function fillTrade(name, items, counter) function fillTrade(name, items, counter)
@ -53,7 +54,7 @@ function fillTrade(name, items, counter)
local itemWidget = g_ui.createWidget('Item', tradeContainer) local itemWidget = g_ui.createWidget('Item', tradeContainer)
itemWidget:setItem(item) itemWidget:setItem(item)
itemWidget:setVirtual(true) itemWidget:setVirtual(true)
itemWidget:setMargin(1) itemWidget:setMargin(0)
itemWidget.onClick = function() itemWidget.onClick = function()
g_game.inspectTrade(counter, index-1) g_game.inspectTrade(counter, index-1)
end end
@ -69,7 +70,8 @@ function onGameCounterTrade(name, items)
end end
function onGameCloseTrade() function onGameCloseTrade()
if not tradeWindow then return end if tradeWindow then
tradeWindow:destroy() tradeWindow:destroy()
tradeWindow = nil tradeWindow = nil
end
end end

View File

@ -12,7 +12,7 @@ TradeWindow < MiniWindow
margin-left: 4 margin-left: 4
MiniWindowContents MiniWindowContents
padding: 6 padding: 4
ScrollableFlatPanel ScrollableFlatPanel
id: ownTradeContainer id: ownTradeContainer
@ -20,26 +20,27 @@ TradeWindow < MiniWindow
anchors.bottom: acceptButton.top anchors.bottom: acceptButton.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: ownTradeScrollBar.left anchors.right: ownTradeScrollBar.left
margin-top: 14 margin-top: 16
margin-bottom: 4 margin-bottom: 4
padding: 2 padding: 2
layout: layout:
type: grid type: grid
cell-size: 36 36 cell-size: 34 34
flow: true flow: true
cell-spacing: 0 cell-spacing: 1
vertical-scrollbar: ownTradeScrollBar vertical-scrollbar: ownTradeScrollBar
VerticalScrollBar VerticalScrollBar
id: ownTradeScrollBar id: ownTradeScrollBar
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: acceptButton.top anchors.bottom: acceptButton.top
anchors.right: counterTradeContainer.left anchors.right: parent.horizontalCenter
margin-top: 14 margin-top: 16
margin-bottom: 4 margin-bottom: 4
margin-right: 2
step: 14 step: 14
pixels-scroll: true pixels-scroll: true
$disabled: $!on:
width: 0 width: 0
ScrollableFlatPanel ScrollableFlatPanel
@ -48,14 +49,15 @@ TradeWindow < MiniWindow
anchors.bottom: acceptButton.top anchors.bottom: acceptButton.top
anchors.left: parent.horizontalCenter anchors.left: parent.horizontalCenter
anchors.right: counterTradeScrollBar.left anchors.right: counterTradeScrollBar.left
margin-top: 14 margin-top: 16
margin-bottom: 4 margin-bottom: 4
margin-left: 2
padding: 2 padding: 2
layout: layout:
type: grid type: grid
cell-size: 36 36 cell-size: 34 34
flow: true flow: true
cell-spacing: 0 cell-spacing: 1
vertical-scrollbar: counterTradeScrollBar vertical-scrollbar: counterTradeScrollBar
VerticalScrollBar VerticalScrollBar
@ -63,25 +65,26 @@ TradeWindow < MiniWindow
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: acceptButton.top anchors.bottom: acceptButton.top
anchors.right: parent.right anchors.right: parent.right
margin-top: 14 margin-top: 16
margin-bottom: 4 margin-bottom: 4
margin-right: 1
step: 14 step: 14
pixels-scroll: true pixels-scroll: true
$disabled: $!on:
width: 0 width: 0
Label Label
id: ownTradeLabel id: ownTradeLabel
anchors.bottom: ownTradeContainer.top anchors.bottom: ownTradeContainer.top
anchors.left: ownTradeContainer.left anchors.left: ownTradeContainer.left
anchors.right: ownTradeContainer.right anchors.right: parent.horizontalCenter
margin-bottom: 2 margin-bottom: 2
Label Label
id: counterTradeLabel id: counterTradeLabel
anchors.bottom: counterTradeContainer.top anchors.bottom: counterTradeContainer.top
anchors.left: counterTradeContainer.left anchors.left: parent.horizontalCenter
anchors.right: counterTradeContainer.right anchors.right: counterTradeScrollBar.right
margin-bottom: 2 margin-bottom: 2
Button Button
@ -101,4 +104,4 @@ TradeWindow < MiniWindow
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.horizontalCenter anchors.left: parent.horizontalCenter
margin-left: 2 margin-left: 2
@onClick: g_game.rejectTrade() @onClick: g_game.rejectTrade()

View File

@ -55,7 +55,10 @@ void UIItem::drawSelf(Fw::DrawPane drawPane)
float scaleFactor = std::min(drawRect.width() / (float)exactSize, drawRect.height() / (float)exactSize); float scaleFactor = std::min(drawRect.width() / (float)exactSize, drawRect.height() / (float)exactSize);
dest += (m_item->getDisplacement() - Point(32,32)) * scaleFactor; dest += (m_item->getDisplacement() - Point(32,32)) * scaleFactor;
g_painter->setColor(Color::white); if(isEnabled())
g_painter->setColor(Color::white);
else
g_painter->setColor(Color(100, 100, 100));
m_item->draw(dest, scaleFactor, true); m_item->draw(dest, scaleFactor, true);
if(m_font && (m_item->isStackable() || m_item->isChargeable()) && m_item->getCountOrSubType() > 1) { if(m_font && (m_item->isStackable() || m_item->isChargeable()) && m_item->getCountOrSubType() > 1) {