Browse Source

UI tweaks

Eduardo Bart 8 years ago
parent
commit
beaba25af1

+ 22
- 0
BUGS View File

@@ -0,0 +1,22 @@
1
+== CRASHS
2
+modules recursivity makes client crash, it should generate a warning
3
+
4
+== P1 BUGS (affects game play)
5
+private channels are not closed when switching characters
6
+sometimes minimap desync Z pos
7
+follow and autowalk doesn't cancel when walking via hotkeys
8
+
9
+== P2 BUGS
10
+battle sometimes doesn't clear attacked/followed creatures when they go out of range
11
+if you move a backpack to left panel, and resize it, client will go into a infinite loop resizing the backpack switching 4,5 columns
12
+when looking from floor 5 in floor 7, sometimes a tile have 2 invisible grounds in floor 6 that should be ignored
13
+
14
+== P3 BUGS
15
+widgets may have been destroyed when adding event in onSetup (UIResizeBorder), generating invalid events
16
+too many talk messages in game map make the messages boxes disappear
17
+hotkeys works while windows are locked, it shouldn't
18
+skulls is rendering outside map bounds
19
+party options does not work when re-logging inside a party
20
+sometimes we can still view hits from above/bottom floors from a fight that is not visible
21
+must removeThing in protocol parseTileAdd when stackpos is greater than 11
22
+

+ 67
- 40
TODO View File

@@ -1,51 +1,78 @@
1
-== Core
2
-create a class for reading binary files
3
-rework lua/c++ logger
1
+== MODULES
2
+game_shaders (with shader manager)
3
+game_map (with save/load/options)
4
+game_minimap (with all tibia functionality)
5
+game_playertrade
6
+game_textbooks
7
+game_questlog
8
+game_ruleviolations
4 9
 
5
-== Graphics
6
-map zoom rendering could be optimized using framebuffer caches
7
-implement graphics options menu
10
+== NOTABLE FEATURES
11
+make left panel optional
12
+must close last container when opening a new containers
13
+add options "Copy Text", "Copy Name", "Message" in console labels with a popupmenu
14
+move chat tabs
15
+save/load mini windows states/location when restarting the client
16
+graphics options menu
17
+load modules from zip files
18
+manual autoload setting in module manager
19
+complete a smarter miniwindow moving/resizing
20
+make miniwindow borderless on double click
8 21
 
9
-== Modules
10
-fix modules recursivity, it makes client crash
22
+== BEFORE RELEASE
23
+polish interface skin
24
+new optional skin
25
+send otclient/system information to a third party server
26
+
27
+== LATER FEATURES
28
+reload spr/dat while ingame
29
+create and bind new game events
30
+text selection
31
+login queue
32
+port to MacOs and iphone
33
+allow multiple Map and Game instances ?
34
+
35
+== MINOR FEATURES
36
+display exit box when exiting from game
37
+case insensitive npctrade
11 38
 load modules from zip packages
39
+move up/down in lineedits
40
+select characters in lineedits
41
+scrolling multiline edit
42
+mouse wheel lineedits
12 43
 
13
-== Lua engine
14
-make possible to bind non LuaObject derived classes on lua engine (for usage with Point,Rect,Color,Size)
15
-review usage of x,y/width,height in lua instead of point/size
44
+== OPTIMIZATIONS AND REWORKS
45
+* game
46
+do not redraw in MapView far zoom
47
+map zoom rendering could be optimized using framebuffer caches
48
+multisample option in map view
49
+move redering of creatures names, skulls, etc to UI and scripts
50
+clean sprites cache periodically
51
+handle corrupt errors in dat/spr
16 52
 
17
-== Platform
18
-port to MacOs and iphone
53
+* framework
54
+rework Settings/g_configs
55
+platform cursor cache
56
+replace onKey events with Hotkeys.bind
57
+add -no-sound option
58
+rework lua/c++ logger
19 59
 
20
-== UI
21
-review anchors API, add possibility to get/remove anchors
22
-multiline rich text widget
23
-move layout proprieties to widget style
24
-multiline text editor widget
25
-fix style inheritance using a style translator
26
-find a way to add new widgets without focusing them
60
+* ui
61
+rework hover => onWidgetVisibilityChange onWidgetEnableChange onWidgetMove onAppear onDisappear
62
+reset dragging widget on destruction/visibility change/enable change
63
+cancel layout changes on non visible widgets (acts like it doesn't exist)
64
+add more anchors warnings to make creation of OTUIs easier
27 65
 review UI/style loader and make more error prone with more warnings
66
+change Align/Anchors lua API from enum to text
67
+review widgets rendering order, consider adding z-index
28 68
 reapply anchor styles when adding new childs
69
+style inheritance using a style translator
70
+find a way to add new widgets without focusing them
29 71
 make set of background/icon/image width alone work
30
-check for recursive anchors and print a error instead of crashing
31 72
 make api to enable/disable capture of events like mouseMove to avoid massive event processing
32
-review style apply system
33
-review widgets rendering order, consider adding z-index
34
-change Align/Anchors lua API from enum to text
35
-
36
-== Game
37
-clean sprites cache periodically
38
-create a shader manager
39
-find a way to load map rendering styles
40
-move redering of creatures names, skulls, etc to UI
41
-handle corrupt errors in dat/spr
42
-remake spr/dat using OTML and image files
43
-
44
-== Game modules
45
-minimap window
46
-login queue
47
-questlog
48
-edit texts
49
-trade window
50
-shop window
73
+move layout proprieties to widget style
74
+terminate rework of ui events propagation  (for Key events)
51 75
 
76
+* lua engine
77
+make possible to bind non LuaObject derived classes on lua engine (for usage with Point,Rect,Color,Size)
78
+review usage of x,y/width,height in lua instead of point/size

+ 1
- 1
modules/client_locales/locales.lua View File

@@ -24,7 +24,7 @@ function Locales.init()
24 24
 
25 25
   local userLocaleName = Settings.get('locale')
26 26
   if userLocaleName and Locales.setLocale(userLocaleName)then
27
-    print('Using configurated locale: ' .. userLocaleName)
27
+    print('Using configured locale: ' .. userLocaleName)
28 28
   else
29 29
     print('Using default locale: ' .. defaultLocaleName)
30 30
     Locales.setLocale(defaultLocaleName)

+ 26
- 12
modules/client_modulemanager/modulemanager.otui View File

@@ -26,14 +26,15 @@ ModuleInfoLabel < Label
26 26
 ModuleValueLabel < UILabel
27 27
   font: verdana-11px-antialised
28 28
   color: #aaaaaa
29
-  text-offset: 3 0
29
+  text-offset: 2 3
30
+  padding-bottom: 5
30 31
   image-source: /core_styles/styles/images/panel_flat.png
31 32
   image-border: 1
32
-  height: 16
33
+  height: 20
33 34
 
34 35
 MainWindow
35 36
   id: moduleManagerWindow
36
-  size: 480 450
37
+  size: 450 450
37 38
   !text: tr('Module Manager')
38 39
 
39 40
   @onEscape: ModuleManager.hide()
@@ -43,36 +44,47 @@ MainWindow
43 44
     anchors.top: parent.top
44 45
     anchors.left: parent.left
45 46
     anchors.bottom: parent.bottom
46
-    width: 180
47
+    width: 190
47 48
     padding: 1
48 49
     focusable: false
49 50
     margin-bottom: 30
51
+    vertical-scrollbar: moduleListScrollBar
52
+
53
+  VerticalScrollBar
54
+    id: moduleListScrollBar
55
+    anchors.top: moduleList.top
56
+    anchors.bottom: moduleList.bottom
57
+    anchors.left: moduleList.right
58
+    step: 14
59
+    pixels-scroll: true
50 60
 
51 61
   Button
52 62
     id: refreshModulesButton
53 63
     anchors.top: moduleList.bottom
54 64
     anchors.left: moduleList.left
55 65
     margin-top: 8
56
-    width: 80
57 66
     !text: tr('Refresh')
67
+    text-auto-resize: true
58 68
     @onClick: ModuleManager.refreshModules()
59 69
 
60 70
   Button
61 71
     id: reloadAllModulesButton
62 72
     anchors.top: moduleList.bottom
63
-    anchors.right: moduleList.right
73
+    anchors.right: moduleListScrollBar.right
64 74
     margin-top: 8
65
-    width: 80
66 75
     !text: tr('Reload All')
76
+    text-auto-resize: true
67 77
     @onClick: ModuleManager.reloadAllModules()
68 78
 
69 79
   Panel
70 80
     id: moduleInfo
71
-    anchors.left: moduleList.right
81
+    anchors.left: moduleListScrollBar.right
72 82
     anchors.top: parent.top
73 83
     anchors.right: parent.right
74 84
     margin: 0 5 5 15
75
-    layout: verticalBox
85
+    layout:
86
+      type: verticalBox
87
+      fit-children: true
76 88
     height: 265
77 89
 
78 90
     ModuleInfoLabel
@@ -84,8 +96,8 @@ MainWindow
84 96
       !text: tr('Description')
85 97
     ModuleValueLabel
86 98
       id: moduleDescription
87
-      height: 100
88 99
       text-wrap: true
100
+      height: 100
89 101
 
90 102
     //ModuleInfoLabel
91 103
     //  !text: tr('Autoload')
@@ -105,7 +117,7 @@ MainWindow
105 117
 
106 118
     ModuleInfoLabel
107 119
       !text: tr('Website')
108
-    ModuleValueLabel
120
+    TextEdit
109 121
       id: moduleWebsite
110 122
 
111 123
     ModuleInfoLabel
@@ -120,6 +132,7 @@ MainWindow
120 132
     margin-top: 8
121 133
     !text: tr('Load')
122 134
     enabled: false
135
+    width: 90
123 136
     @onClick: ModuleManager.reloadCurrentModule()
124 137
 
125 138
   Button
@@ -130,6 +143,7 @@ MainWindow
130 143
     margin-top: 8
131 144
     !text: tr('Unload')
132 145
     enabled: false
146
+    width: 90
133 147
     @onClick: ModuleManager.unloadCurrentModule()
134 148
 
135 149
   Button
@@ -137,6 +151,6 @@ MainWindow
137 151
     anchors.bottom: parent.bottom
138 152
     anchors.right: parent.right
139 153
     !text: tr('Close')
140
-    width: 60
154
+    width: 90
141 155
     @onClick: ModuleManager.hide()
142 156
 

+ 1
- 0
modules/core_styles/styles/buttons.otui View File

@@ -6,6 +6,7 @@ Button < UIButton
6 6
   image-color: white
7 7
   image-source: /core_styles/styles/images/button.png
8 8
   image-border: 5
9
+  padding: 5 10 5 10
9 10
 
10 11
   $hover !disabled:
11 12
     image-source: /core_styles/styles/images/button_hover.png

+ 1
- 12
modules/game/gameinterface.otui View File

@@ -44,7 +44,7 @@ UIWidget
44 44
   GameSidePanel
45 45
     id: gameRightPanel
46 46
     layout: verticalBox
47
-    anchors.left: rightSplitter.left
47
+    width: 190
48 48
     anchors.right: parent.right
49 49
     anchors.top: parent.top
50 50
     anchors.bottom: parent.bottom
@@ -60,17 +60,6 @@ UIWidget
60 60
     @canUpdateMargin: function(self, newMargin) return math.max(math.min(newMargin, self:getParent():getHeight() - 300), 100) end
61 61
     @onGeometryChange: function(self) self:setMarginBottom(math.min(math.max(self:getParent():getHeight() - 300, 100), self:getMarginBottom())) end
62 62
 
63
-  Splitter
64
-    id: rightSplitter
65
-    anchors.right: parent.right
66
-    anchors.top: parent.top
67
-    anchors.bottom: parent.bottom
68
-    relative-margin: right
69
-    margin-right: 190
70
-    enabled: false
71
-    @canUpdateMargin: function(self, newMargin) return math.max(math.min(newMargin, self:getParent():getWidth() - 300), 150) end
72
-    @onGeometryChange: function(self) self:setMarginRight(math.min(math.max(self:getParent():getWidth() - 300, 150), self:getMarginRight())) end
73
-
74 63
   UIWidget
75 64
     id: mouseGrabber
76 65
     focusable: false

+ 2
- 2
modules/game/styles/miniwindow.otui View File

@@ -5,7 +5,6 @@ MiniWindow < UIMiniWindow
5 5
   height: 200
6 6
   text-offset: 24 5
7 7
   text-align: topLeft
8
-  margin-bottom: 2
9 8
   image-source: /game/images/miniwindow.png
10 9
   image-border: 4
11 10
   image-border-top: 23
@@ -84,7 +83,8 @@ MiniWindowContents < ScrollablePanel
84 83
   id: contentsPanel
85 84
   anchors.fill: parent
86 85
   anchors.right: miniwindowScrollBar.left
87
-  padding: 24 5 3 5
86
+  margin-top: 19
87
+  padding: 3 5 3 5
88 88
   vertical-scrollbar: miniwindowScrollBar
89 89
 
90 90
 BorderlessGameWindow < UIWindow

+ 3
- 0
modules/game_battle/battle.otui View File

@@ -50,6 +50,7 @@ MiniWindow
50 50
       anchors.top: parent.top
51 51
       anchors.right: next.left
52 52
       margin-right: 5
53
+      margin-top: 3
53 54
 
54 55
     BattleNPCs
55 56
       id: hideNPCs
@@ -57,12 +58,14 @@ MiniWindow
57 58
       anchors.top: parent.top
58 59
       anchors.right: next.left
59 60
       margin-right: 5
61
+      margin-top: 3
60 62
 
61 63
     BattleMonsters
62 64
       id: hideMonsters
63 65
       !tooltip: tr('Hide monsters')
64 66
       anchors.top: parent.top
65 67
       anchors.horizontalCenter: parent.horizontalCenter
68
+      margin-top: 3
66 69
 
67 70
     BattleSkulls
68 71
       id: hideSkulls

+ 1
- 1
modules/game_console/console.lua View File

@@ -99,7 +99,7 @@ local function onCreatureSpeak(name, level, speaktype, message, channelId, creat
99 99
 
100 100
     if channel then
101 101
       Console.addText(message, speaktype, channel)
102
-    elseif channelid ~= 0 then
102
+    elseif channelId ~= 0 then
103 103
       -- server sent a message on a channel that is not open
104 104
       warning('message in channel id ' .. channelId .. ' which is unknown, this is a server bug, relogin if you want to see messages in this channel')
105 105
     end

+ 4
- 3
modules/game_containers/container.otui View File

@@ -27,9 +27,10 @@ ContainerWindow < MiniWindow
27 27
       image-clip: 42 28 14 14
28 28
 
29 29
   MiniWindowContents
30
-    padding: 27 6 6 8
30
+    padding-right: 0
31 31
     layout:
32 32
       type: grid
33
-      cell-size: 34 34
33
+      cell-size: 40 40
34 34
       flow: true
35
-      auto-spacing: true
35
+      cell-spacing: 0
36
+

+ 5
- 0
modules/game_containers/containers.lua View File

@@ -24,6 +24,10 @@ local function onContainerOpen(container, previousContainer)
24 24
     containerWindow:hide()
25 25
   end
26 26
 
27
+  -- this disables scrollbar auto hiding
28
+  local scrollbar = containerWindow:getChildById('miniwindowScrollBar')
29
+  scrollbar:mergeStyle({ ['$disabled'] = { ['width'] = scrollbar:getWidth() } })
30
+
27 31
   local upButton = containerWindow:getChildById('upButton')
28 32
   upButton.onClick = function()
29 33
     g_game.openParent(container)
@@ -41,6 +45,7 @@ local function onContainerOpen(container, previousContainer)
41 45
     local itemWidget = createWidget('Item', containerPanel)
42 46
     itemWidget:setId('item' .. slot)
43 47
     itemWidget:setItem(container:getItem(slot))
48
+    itemWidget:setMargin(3)
44 49
     itemWidget.position = container:getSlotPosition(slot)
45 50
   end
46 51
 

+ 1
- 0
modules/game_healthbar/healthbar.otui View File

@@ -5,6 +5,7 @@ HealthBar < ProgressBar
5 5
   anchors.top: parent.top
6 6
   anchors.left: parent.left
7 7
   anchors.right: parent.right
8
+  margin-top: 3
8 9
 
9 10
 ManaBar < ProgressBar
10 11
   id: manaBar

+ 1
- 0
modules/game_inventory/inventory.otui View File

@@ -11,6 +11,7 @@ MiniWindow
11 11
       id: slot1
12 12
       anchors.top: parent.top
13 13
       anchors.horizontalCenter: parent.horizontalCenter
14
+      margin-top: 4
14 15
       &position: {x=65535, y=1, z=0}
15 16
 
16 17
     Item

+ 1
- 0
src/framework/luafunctions.cpp View File

@@ -72,6 +72,7 @@ void Application::registerLuaFunctions()
72 72
     g_lua.bindClassMemberFunction<UIWidget>("moveChildToIndex", &UIWidget::moveChildToIndex);
73 73
     g_lua.bindClassMemberFunction<UIWidget>("lockChild", &UIWidget::lockChild);
74 74
     g_lua.bindClassMemberFunction<UIWidget>("unlockChild", &UIWidget::unlockChild);
75
+    g_lua.bindClassMemberFunction<UIWidget>("mergeStyle", &UIWidget::mergeStyle);
75 76
     g_lua.bindClassMemberFunction<UIWidget>("applyStyle", &UIWidget::applyStyle);
76 77
     g_lua.bindClassMemberFunction<UIWidget>("addAnchor", &UIWidget::addAnchor);
77 78
     g_lua.bindClassMemberFunction<UIWidget>("removeAnchor", &UIWidget::removeAnchor);

+ 3
- 1
src/framework/ui/uigridlayout.cpp View File

@@ -101,8 +101,10 @@ bool UIGridLayout::internalUpdate()
101 101
         Point virtualPos = Point(column * (m_cellSize.width() + cellSpacing), line * (m_cellSize.height() + cellSpacing));
102 102
         preferredHeight = virtualPos.y + m_cellSize.height();
103 103
         Point pos = topLeft + virtualPos - parentWidget->getVirtualOffset();
104
+        Rect dest = Rect(pos, m_cellSize);
105
+        dest.expand(-widget->getMarginTop(), -widget->getMarginRight(), -widget->getMarginBottom(), -widget->getMarginLeft());
104 106
 
105
-        if(widget->setRect(Rect(pos, m_cellSize)))
107
+        if(widget->setRect(dest))
106 108
             changed = true;
107 109
 
108 110
         index++;

+ 7
- 0
src/framework/ui/uiwidget.cpp View File

@@ -458,6 +458,13 @@ void UIWidget::unlockChild(const UIWidgetPtr& child)
458 458
     }
459 459
 }
460 460
 
461
+void UIWidget::mergeStyle(const OTMLNodePtr& styleNode)
462
+{
463
+    applyStyle(styleNode);
464
+    m_style->merge(styleNode);
465
+    updateStyle();
466
+}
467
+
461 468
 void UIWidget::applyStyle(const OTMLNodePtr& styleNode)
462 469
 {
463 470
     if(m_destroyed)

+ 1
- 0
src/framework/ui/uiwidget.h View File

@@ -90,6 +90,7 @@ public:
90 90
     void moveChildToIndex(const UIWidgetPtr& child, int index);
91 91
     void lockChild(const UIWidgetPtr& child);
92 92
     void unlockChild(const UIWidgetPtr& child);
93
+    void mergeStyle(const OTMLNodePtr& styleNode);
93 94
     void applyStyle(const OTMLNodePtr& styleNode);
94 95
     void addAnchor(Fw::AnchorEdge anchoredEdge, const std::string& hookedWidgetId, Fw::AnchorEdge hookedEdge);
95 96
     void removeAnchor(Fw::AnchorEdge anchoredEdge);

+ 1
- 1
src/framework/ui/uiwidgettext.cpp View File

@@ -43,7 +43,7 @@ void UIWidget::updateText()
43 43
     // update rect size
44 44
     if(!m_rect.isValid() || m_textAutoResize) {
45 45
         Size textBoxSize = getTextSize();
46
-        textBoxSize += Size(m_padding.left + m_padding.right, m_padding.top + m_padding.left);
46
+        textBoxSize += Size(m_padding.left + m_padding.right, m_padding.top + m_padding.bottom);
47 47
         Size size = getSize();
48 48
         if(size.width() <= 0 || (m_textAutoResize && !m_textWrap))
49 49
             size.setWidth(textBoxSize.width());

+ 0
- 1
src/otclient/ui/uiitem.cpp View File

@@ -38,7 +38,6 @@ void UIItem::drawSelf()
38 38
         Rect drawRect = getClippingRect();
39 39
         Point dest = drawRect.topLeft();
40 40
         float scaleFactor = std::min(drawRect.width() / (float)m_item->getExactSize(), drawRect.height() / (float)m_item->getExactSize());
41
-        dest += (1 - scaleFactor)*32;
42 41
         dest += m_item->getDisplacement() * scaleFactor;
43 42
 
44 43
         g_painter->setColor(Color::white);

Loading…
Cancel
Save