From f97fa65d37af7119fe599553fdbbf9e2622b5040 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Fri, 24 Aug 2012 05:18:15 -0300 Subject: [PATCH] Many UI fixes. --- .../skins/default/styles/labels.otui | 8 ++ .../skins/default/styles/miniwindow.otui | 2 +- modules/client_topmenu/topmenu.otui | 25 ++---- modules/game_battle/battle.lua | 2 +- modules/game_battle/battle.otui | 86 +++++++++---------- modules/game_playertrade/playertrade.lua | 10 ++- modules/game_playertrade/tradewindow.otui | 35 ++++---- src/otclient/uiitem.cpp | 5 +- 8 files changed, 90 insertions(+), 83 deletions(-) diff --git a/modules/client_skins/skins/default/styles/labels.otui b/modules/client_skins/skins/default/styles/labels.otui index 88833000..80e503d3 100644 --- a/modules/client_skins/skins/default/styles/labels.otui +++ b/modules/client_skins/skins/default/styles/labels.otui @@ -22,3 +22,11 @@ MenuLabel < Label GameLabel < UILabel font: verdana-11px-antialised color: #bbbbbb + +FrameCounterLabel < Label + @onSetup: | + self.updateEvent = cycleEvent(function() + local text = 'FPS: ' .. g_app.getBackgroundPaneFps() + self:setText(text) + end, 1000) + @onDestroy: self.updateEvent:cancel() diff --git a/modules/client_skins/skins/default/styles/miniwindow.otui b/modules/client_skins/skins/default/styles/miniwindow.otui index 9dee716f..8546eb0c 100644 --- a/modules/client_skins/skins/default/styles/miniwindow.otui +++ b/modules/client_skins/skins/default/styles/miniwindow.otui @@ -68,7 +68,6 @@ MiniWindow < UIMiniWindow $!on: width: 0 - margin-right: 4 ResizeBorder id: bottomResizeBorder @@ -88,6 +87,7 @@ MiniWindowContents < ScrollablePanel margin-left: 3 margin-bottom: 3 margin-top: 22 + margin-right: 1 vertical-scrollbar: miniwindowScrollBar BorderlessGameWindow < UIWindow diff --git a/modules/client_topmenu/topmenu.otui b/modules/client_topmenu/topmenu.otui index fabec497..b52f6f89 100644 --- a/modules/client_topmenu/topmenu.otui +++ b/modules/client_topmenu/topmenu.otui @@ -37,13 +37,18 @@ TopMenuButtonsPanel < Panel fit-children: true padding: 6 4 -TopPanel < Panel +TopMenuPanel < Panel height: 36 image-source: images/top_panel.png image-repeated: true focusable: false -TopPanel +TopMenuFrameCounterLabel < FrameCounterLabel + color: white + margin-top: 10 + margin-right: 5 + +TopMenuPanel id: topMenu anchors.top: parent.top anchors.left: parent.left @@ -62,25 +67,11 @@ TopPanel anchors.left: prev.right visible: false - UILabel + TopMenuFrameCounterLabel id: frameCounter - text-align: right text-auto-resize: true - color: white - id: frameCounter anchors.top: parent.top 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 id: rightButtonsPanel diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index bbf0795b..8fa4115e 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -49,7 +49,7 @@ function init() mouseWidget:setVisible(false) mouseWidget:setFocusable(false) - battleWindow:setContentMinimumHeight(56) + battleWindow:setContentMinimumHeight(80) battleWindow:setContentMaximumHeight(384) connect(Creature, { onSkullChange = checkCreatureSkull, diff --git a/modules/game_battle/battle.otui b/modules/game_battle/battle.otui index bade8b81..25fc6816 100644 --- a/modules/game_battle/battle.otui +++ b/modules/game_battle/battle.otui @@ -44,58 +44,58 @@ MiniWindow @onClose: modules.game_battle.onMiniWindowClose() &save: true - BattlePlayers - id: hidePlayers - !tooltip: tr('Hide players') - anchors.top: parent.top - anchors.right: next.left - margin-right: 5 + Panel margin-top: 26 - @onCheckChange: modules.game_battle.checkCreatures() - - BattleNPCs - id: hideNPCs - !tooltip: tr('Hide Npcs') anchors.top: parent.top - anchors.right: next.left - margin-right: 5 - margin-top: 26 - @onCheckChange: modules.game_battle.checkCreatures() + anchors.left: parent.left + anchors.right: miniwindowScrollBar.left + height: 20 - BattleMonsters - id: hideMonsters - !tooltip: tr('Hide monsters') - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - margin-top: 26 - @onCheckChange: modules.game_battle.checkCreatures() - - BattleSkulls - id: hideSkulls - !tooltip: tr('Hide non-skull players') - anchors.top: prev.top - anchors.left: prev.right - margin-left: 5 - @onCheckChange: modules.game_battle.checkCreatures() - - BattleParty - id: hideParty - !tooltip: tr('Hide party members') - anchors.top: prev.top - anchors.left: prev.right - margin-left: 5 - phantom: true - @onCheckChange: modules.game_battle.checkCreatures() + Panel + anchors.top: parent.top + anchors.horizontalCenter: parent.horizontalCenter + height: 20 + width: 120 + // width*count + spacing*(count-1) + layout: + type: horizontalBox + spacing: 5 + + BattlePlayers + id: hidePlayers + !tooltip: tr('Hide players') + @onCheckChange: modules.game_battle.checkCreatures() + + BattleNPCs + id: hideNPCs + !tooltip: tr('Hide Npcs') + @onCheckChange: modules.game_battle.checkCreatures() + + BattleMonsters + id: hideMonsters + !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 anchors.top: prev.bottom anchors.left: parent.left - anchors.right: parent.right - margin-top: 5 + anchors.right: miniwindowScrollBar.left + margin-right: 1 + margin-top: 4 MiniWindowContents - anchors.top: parent.top - margin-top: 50 + anchors.top: prev.bottom + margin-top: 0 Panel id: battlePanel diff --git a/modules/game_playertrade/playertrade.lua b/modules/game_playertrade/playertrade.lua index 3a1bfd11..1e93258b 100644 --- a/modules/game_playertrade/playertrade.lua +++ b/modules/game_playertrade/playertrade.lua @@ -26,6 +26,7 @@ function createTrade() g_game.rejectTrade() tradeWindow:hide() end + tradeWindow:setup() end function fillTrade(name, items, counter) @@ -53,7 +54,7 @@ function fillTrade(name, items, counter) local itemWidget = g_ui.createWidget('Item', tradeContainer) itemWidget:setItem(item) itemWidget:setVirtual(true) - itemWidget:setMargin(1) + itemWidget:setMargin(0) itemWidget.onClick = function() g_game.inspectTrade(counter, index-1) end @@ -69,7 +70,8 @@ function onGameCounterTrade(name, items) end function onGameCloseTrade() - if not tradeWindow then return end - tradeWindow:destroy() - tradeWindow = nil + if tradeWindow then + tradeWindow:destroy() + tradeWindow = nil + end end diff --git a/modules/game_playertrade/tradewindow.otui b/modules/game_playertrade/tradewindow.otui index 3b7df930..15708d14 100644 --- a/modules/game_playertrade/tradewindow.otui +++ b/modules/game_playertrade/tradewindow.otui @@ -12,7 +12,7 @@ TradeWindow < MiniWindow margin-left: 4 MiniWindowContents - padding: 6 + padding: 4 ScrollableFlatPanel id: ownTradeContainer @@ -20,26 +20,27 @@ TradeWindow < MiniWindow anchors.bottom: acceptButton.top anchors.left: parent.left anchors.right: ownTradeScrollBar.left - margin-top: 14 + margin-top: 16 margin-bottom: 4 padding: 2 layout: type: grid - cell-size: 36 36 + cell-size: 34 34 flow: true - cell-spacing: 0 + cell-spacing: 1 vertical-scrollbar: ownTradeScrollBar VerticalScrollBar id: ownTradeScrollBar anchors.top: parent.top anchors.bottom: acceptButton.top - anchors.right: counterTradeContainer.left - margin-top: 14 + anchors.right: parent.horizontalCenter + margin-top: 16 margin-bottom: 4 + margin-right: 2 step: 14 pixels-scroll: true - $disabled: + $!on: width: 0 ScrollableFlatPanel @@ -48,14 +49,15 @@ TradeWindow < MiniWindow anchors.bottom: acceptButton.top anchors.left: parent.horizontalCenter anchors.right: counterTradeScrollBar.left - margin-top: 14 + margin-top: 16 margin-bottom: 4 + margin-left: 2 padding: 2 layout: type: grid - cell-size: 36 36 + cell-size: 34 34 flow: true - cell-spacing: 0 + cell-spacing: 1 vertical-scrollbar: counterTradeScrollBar VerticalScrollBar @@ -63,25 +65,26 @@ TradeWindow < MiniWindow anchors.top: parent.top anchors.bottom: acceptButton.top anchors.right: parent.right - margin-top: 14 + margin-top: 16 margin-bottom: 4 + margin-right: 1 step: 14 pixels-scroll: true - $disabled: + $!on: width: 0 Label id: ownTradeLabel anchors.bottom: ownTradeContainer.top anchors.left: ownTradeContainer.left - anchors.right: ownTradeContainer.right + anchors.right: parent.horizontalCenter margin-bottom: 2 Label id: counterTradeLabel anchors.bottom: counterTradeContainer.top - anchors.left: counterTradeContainer.left - anchors.right: counterTradeContainer.right + anchors.left: parent.horizontalCenter + anchors.right: counterTradeScrollBar.right margin-bottom: 2 Button @@ -101,4 +104,4 @@ TradeWindow < MiniWindow anchors.right: parent.right anchors.left: parent.horizontalCenter margin-left: 2 - @onClick: g_game.rejectTrade() \ No newline at end of file + @onClick: g_game.rejectTrade() diff --git a/src/otclient/uiitem.cpp b/src/otclient/uiitem.cpp index 0e826f89..a9f8a492 100644 --- a/src/otclient/uiitem.cpp +++ b/src/otclient/uiitem.cpp @@ -55,7 +55,10 @@ void UIItem::drawSelf(Fw::DrawPane drawPane) float scaleFactor = std::min(drawRect.width() / (float)exactSize, drawRect.height() / (float)exactSize); 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); if(m_font && (m_item->isStackable() || m_item->isChargeable()) && m_item->getCountOrSubType() > 1) {