Browse Source

Tweak modules interface

Minimize miniwindows space usage
Implement easier minimap navigation
Redesign inventory, minimap and healthinfo layout
Eduardo Bart 8 years ago
parent
commit
ebc88b8354

+ 4
- 2
modules/client_skins/skins/default/styles/miniwindow.otui View File

@@ -82,8 +82,10 @@ MiniWindowContents < ScrollablePanel
82 82
   id: contentsPanel
83 83
   anchors.fill: parent
84 84
   anchors.right: miniwindowScrollBar.left
85
-  margin-top: 19
86
-  padding: 3 5 3 5
85
+  margin-right: -1
86
+  margin-top: 21
87
+  padding: 4
88
+  padding-top: 2
87 89
   vertical-scrollbar: miniwindowScrollBar
88 90
 
89 91
 BorderlessGameWindow < UIWindow

+ 5
- 4
modules/corelib/mouse.lua View File

@@ -32,14 +32,15 @@ function g_mouse.isPressed(button)
32 32
   return g_window.isMouseButtonPressed(button)
33 33
 end
34 34
 
35
-function g_mouse.bindAutoPress(widget, callback)
35
+function g_mouse.bindAutoPress(widget, callback, delay)
36 36
   connect(widget, { onMousePress = function(widget, mousePos, mouseButton)
37
-    callback()
37
+    local startTime = g_clock.millis()
38
+    callback(widget, mousePos, mouseButton, 0)
38 39
     periodicalEvent(function()
39
-      callback()
40
+      callback(widget, g_window.getMousePosition(), mouseButton, g_clock.millis() - startTime)
40 41
     end, function()
41 42
       return widget:isPressed()
42
-    end, 30, 300)
43
+    end, 30, delay)
43 44
     return true
44 45
   end })
45 46
 end

+ 4
- 0
modules/corelib/ui/uiminiwindow.lua View File

@@ -246,3 +246,7 @@ function UIMiniWindow:saveParentIndex(parentId, index)
246 246
   selfSettings.index = index
247 247
   self:setSettings(selfSettings)
248 248
 end
249
+
250
+function UIMiniWindow:disableResize()
251
+  self:getChildById('bottomResizeBorder'):disable()
252
+end

+ 7
- 6
modules/game_combatcontrols/combatcontrols.lua View File

@@ -44,6 +44,7 @@ function CombatControls.init()
44 44
   combatControlsButton = TopMenu.addRightGameToggleButton('combatControlsButton', tr('Combat Controls'), 'combatcontrols.png', CombatControls.toggle)
45 45
   combatControlsButton:setOn(true)
46 46
   combatControlsWindow = g_ui.loadUI('combatcontrols.otui', GameInterface.getRightPanel())
47
+  combatControlsWindow:disableResize()
47 48
 
48 49
   fightOffensiveBox = combatControlsWindow:recursiveGetChildById('fightOffensiveBox')
49 50
   fightBalancedBox = combatControlsWindow:recursiveGetChildById('fightBalancedBox')
@@ -134,9 +135,9 @@ function CombatControls.online()
134 135
   local player = g_game.getLocalPlayer()
135 136
   if(player) then
136 137
     local char = player:getName()
137
-    
138
+
138 139
     local lastCombatControls = g_settings.getNode('LastCombatControls')
139
-    
140
+
140 141
     if(not table.empty(lastCombatControls)) then
141 142
       if(lastCombatControls[char]) then
142 143
         g_game.setFightMode(lastCombatControls[char].fightMode)
@@ -145,7 +146,7 @@ function CombatControls.online()
145 146
       end
146 147
     end
147 148
   end
148
-  
149
+
149 150
   combatControlsWindow:setVisible(combatControlsButton:isOn())
150 151
   CombatControls.update()
151 152
 end
@@ -155,16 +156,16 @@ function CombatControls.offline()
155 156
   if(not lastCombatControls) then
156 157
     lastCombatControls = {}
157 158
   end
158
-  
159
+
159 160
   local player = g_game.getLocalPlayer()
160 161
   if(player) then
161
-    local char = player:getName()    
162
+    local char = player:getName()
162 163
     lastCombatControls[char] = {
163 164
       fightMode = g_game.getFightMode(),
164 165
       chaseMode = g_game.getChaseMode(),
165 166
       safeFight = g_game.isSafeFight()
166 167
     }
167
-    
168
+
168 169
     -- save last combat control settings
169 170
     g_settings.setNode('LastCombatControls', lastCombatControls)
170 171
   end

+ 16
- 12
modules/game_combatcontrols/combatcontrols.otui View File

@@ -2,8 +2,11 @@ CombatBox < UICheckBox
2 2
   size: 20 20
3 3
   image-clip: 0 0 20 20
4 4
   anchors.top: parent.top
5
-  margin-left: 5
6
-  margin-right: 5
5
+  margin: 0 4
6
+  $first:
7
+    margin: 0 1
8
+  $last:
9
+    margin: 0 1
7 10
 
8 11
   $checked:
9 12
     image-clip: 0 20 20 20
@@ -23,27 +26,28 @@ MiniWindow
23 26
   id: combatControlsWindow
24 27
   !text: tr('Combat Controls')
25 28
   icon: combatcontrols.png
26
-  height: 64
29
+  height: 48
27 30
   @onClose: CombatControls.onMiniWindowClose()
28 31
   &save: true
29 32
 
30 33
   MiniWindowContents
31 34
     FightOffensiveBox
32 35
       id: fightOffensiveBox
33
-      anchors.right: next.left
34
-      anchors.top: next.top
36
+      anchors.left: parent.left
37
+      anchors.verticalCenter: parent.verticalCenter
35 38
     FightBalancedBox
36 39
       id: fightBalancedBox
37
-      anchors.right: next.left
38
-      anchors.top: next.top
40
+      anchors.left: prev.right
41
+      anchors.verticalCenter: parent.verticalCenter
39 42
     FightDefensiveBox
40 43
       id: fightDefensiveBox
41
-      anchors.centerIn: parent
44
+      anchors.left: prev.right
45
+      anchors.verticalCenter: parent.verticalCenter
42 46
     ChaseModeBox
43 47
       id: chaseModeBox
44
-      anchors.left: prev.right
45
-      anchors.top: prev.top
48
+      anchors.right: next.left
49
+      anchors.verticalCenter: parent.verticalCenter
46 50
     SafeFightBox
47 51
       id: safeFightBox
48
-      anchors.left: prev.right
49
-      anchors.top: prev.top
52
+      anchors.right: parent.right
53
+      anchors.verticalCenter: parent.verticalCenter

+ 1
- 2
modules/game_containers/container.otui View File

@@ -30,7 +30,6 @@ ContainerWindow < MiniWindow
30 30
     padding-right: 0
31 31
     layout:
32 32
       type: grid
33
-      cell-size: 40 40
33
+      cell-size: 34 34
34 34
       flow: true
35
-      cell-spacing: 0
36 35
 

+ 2
- 2
modules/game_containers/containers.lua View File

@@ -26,7 +26,7 @@ local function onContainerOpen(container, previousContainer)
26 26
 
27 27
   -- this disables scrollbar auto hiding
28 28
   local scrollbar = containerWindow:getChildById('miniwindowScrollBar')
29
-  scrollbar:mergeStyle({ ['$disabled'] = { ['width'] = scrollbar:getWidth() } })
29
+  scrollbar:mergeStyle({ ['$!on'] = { }})
30 30
 
31 31
   local upButton = containerWindow:getChildById('upButton')
32 32
   upButton.onClick = function()
@@ -45,7 +45,7 @@ local function onContainerOpen(container, previousContainer)
45 45
     local itemWidget = g_ui.createWidget('Item', containerPanel)
46 46
     itemWidget:setId('item' .. slot)
47 47
     itemWidget:setItem(container:getItem(slot))
48
-    itemWidget:setMargin(3)
48
+    itemWidget:setMargin(0)
49 49
     itemWidget.position = container:getSlotPosition(slot)
50 50
   end
51 51
 

+ 17
- 5
modules/game_healthinfo/healthinfo.lua View File

@@ -28,18 +28,21 @@ local soulBar
28 28
 local healthLabel
29 29
 local manaLabel
30 30
 local soulLabel
31
+local capLabel
31 32
 
32 33
 -- public functions
33 34
 function HealthInfo.init()
34 35
   connect(LocalPlayer, { onHealthChange = HealthInfo.onHealthChange,
35 36
                          onManaChange = HealthInfo.onManaChange,
36 37
                          onStatesChange = HealthInfo.onStatesChange,
37
-                         onSoulChange = HealthInfo.onSoulChange })
38
+                         onSoulChange = HealthInfo.onSoulChange,
39
+                         onFreeCapacityChange = HealthInfo.onFreeCapacityChange })
38 40
 
39 41
   connect(g_game, { onGameEnd = HealthInfo.offline })
40 42
 
41 43
   healthInfoWindow = g_ui.loadUI('healthinfo.otui', GameInterface.getRightPanel())
42 44
   healthInfoButton = TopMenu.addRightGameToggleButton('healthInfoButton', tr('Health Information'), 'healthinfo.png', HealthInfo.toggle)
45
+  healthInfoWindow:disableResize()
43 46
   healthInfoButton:setOn(true)
44 47
   healthBar = healthInfoWindow:recursiveGetChildById('healthBar')
45 48
   manaBar = healthInfoWindow:recursiveGetChildById('manaBar')
@@ -47,6 +50,7 @@ function HealthInfo.init()
47 50
   manaLabel = healthInfoWindow:recursiveGetChildById('manaLabel')
48 51
   soulBar = healthInfoWindow:recursiveGetChildById('soulBar')
49 52
   soulLabel = healthInfoWindow:recursiveGetChildById('soulLabel')
53
+  capLabel = healthInfoWindow:recursiveGetChildById('capLabel')
50 54
 
51 55
   if g_game.isOnline() then
52 56
     local localPlayer = g_game.getLocalPlayer()
@@ -54,6 +58,7 @@ function HealthInfo.init()
54 58
     HealthInfo.onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana())
55 59
     HealthInfo.onStatesChange(localPlayer, localPlayer:getStates(), 0)
56 60
     HealthInfo.onSoulChange(localPlayer, localPlayer:getSoul())
61
+    HealthInfo.onFreeCapacityChange(localPlayer, localPlayer:getFreeCapacity())
57 62
   end
58 63
 end
59 64
 
@@ -61,7 +66,8 @@ function HealthInfo.terminate()
61 66
   disconnect(LocalPlayer, { onHealthChange = HealthInfo.onHealthChange,
62 67
                             onManaChange = HealthInfo.onManaChange,
63 68
                             onStatesChange = HealthInfo.onStatesChange,
64
-                            onSoulChange = HealthInfo.onSoulChange })
69
+                            onSoulChange = HealthInfo.onSoulChange,
70
+                            onFreeCapacityChange = HealthInfo.onFreeCapacityChange })
65 71
 
66 72
   disconnect(g_game, { onGameEnd = HealthInfo.offline })
67 73
 
@@ -69,14 +75,15 @@ function HealthInfo.terminate()
69 75
   healthInfoButton:destroy()
70 76
   healthInfoWindow = nil
71 77
   healthInfoButton = nil
72
-  
78
+
73 79
   healthBar = nil
74 80
   manaBar = nil
75 81
   soulBar = nil
76
-  
82
+
77 83
   healthLabel = nil
78 84
   manaLabel = nil
79 85
   soulLabel = nil
86
+  capLabel = nil
80 87
 
81 88
   HealthInfo = nil
82 89
 end
@@ -118,9 +125,14 @@ function HealthInfo.onManaChange(localPlayer, mana, maxMana)
118 125
 end
119 126
 
120 127
 function HealthInfo.onSoulChange(localPlayer, soul)
121
-  soulLabel:setText('Soul: ' .. soul)
128
+  soulLabel:setText(tr('Soul') .. ': ' .. soul)
122 129
 end
123 130
 
131
+function HealthInfo.onFreeCapacityChange(player, freeCapacity)
132
+  capLabel:setText(tr('Cap') .. ': ' .. freeCapacity)
133
+end
134
+
135
+
124 136
 function HealthInfo.onStatesChange(localPlayer, now, old)
125 137
   if now == old then return end
126 138
 

+ 24
- 10
modules/game_healthinfo/healthinfo.otui View File

@@ -5,7 +5,6 @@ HealthBar < ProgressBar
5 5
   anchors.top: parent.top
6 6
   anchors.left: parent.left
7 7
   anchors.right: parent.right
8
-  margin-top: 3
9 8
 
10 9
 ManaBar < ProgressBar
11 10
   id: manaBar
@@ -33,23 +32,33 @@ ManaLabel < GameLabel
33 32
   anchors.fill: manaBar
34 33
   margin-top: 2
35 34
   text: 0 / 0
36
-  
35
+
37 36
 SoulLabel < GameLabel
38 37
   id: soulLabel
38
+  text-align: right
39 39
   color: white
40
-  text-align: center
41 40
   font: verdana-11px-rounded
42
-  anchors.top: prev.bottom
43
-  anchors.left: parent.left
41
+  anchors.bottom: parent.bottom
44 42
   anchors.right: parent.right
43
+  anchors.left: parent.horizontalCenter
45 44
   margin-top: 5
46 45
   text: Soul:
47 46
 
47
+CapLabel < GameLabel
48
+  id: capLabel
49
+  color: white
50
+  font: verdana-11px-rounded
51
+  anchors.bottom: parent.bottom
52
+  anchors.left: parent.left
53
+  anchors.right: parent.horizontalCenter
54
+  margin-top: 5
55
+  text: Cap:
56
+
48 57
 ConditionWidget < UIWidget
49 58
   size: 18 18
50 59
 
51 60
   $!first:
52
-    margin-left: 5
61
+    margin-left: 2
53 62
 
54 63
 MiniWindow
55 64
   icon: healthinfo.png
@@ -68,9 +77,14 @@ MiniWindow
68 77
       id: conditionPanel
69 78
       layout:
70 79
         type: horizontalBox
71
-        fit-children: true
72
-      height: 18
73
-      margin-top: 5
80
+      height: 22
81
+      margin-top: 4
82
+      padding: 2
74 83
       anchors.top: prev.bottom
75
-      anchors.horizontalcenter: parent.horizontalcenter
84
+      anchors.left: parent.left
85
+      anchors.right: parent.right
86
+      border-width: 1
87
+      border-color: #00000077
88
+      background-color: #ffffff11
76 89
     SoulLabel
90
+    CapLabel

+ 1
- 2
modules/game_interface/gameinterface.otui View File

@@ -2,6 +2,7 @@ GameSidePanel < UIMiniWindowContainer
2 2
   image-source: /images/sidepanel.png
3 3
   image-border: 4
4 4
   padding: 4
5
+  width: 198
5 6
 
6 7
 GameBottomPanel < Panel
7 8
   image-source: /images/bottompanel.png
@@ -34,7 +35,6 @@ UIWidget
34 35
 
35 36
   GameSidePanel
36 37
     id: gameLeftPanel
37
-    width: 190
38 38
     layout: verticalBox
39 39
     anchors.left: parent.left
40 40
     anchors.top: parent.top
@@ -49,7 +49,6 @@ UIWidget
49 49
   GameSidePanel
50 50
     id: gameRightPanel
51 51
     layout: verticalBox
52
-    width: 190
53 52
     anchors.right: parent.right
54 53
     anchors.top: parent.top
55 54
     anchors.bottom: parent.bottom

+ 3
- 10
modules/game_inventory/inventory.lua View File

@@ -21,13 +21,13 @@ local inventoryButton
21 21
 
22 22
 -- public functions
23 23
 function Inventory.init()
24
-  connect(LocalPlayer, { onInventoryChange = Inventory.onInventoryChange,
25
-                         onFreeCapacityChange = Inventory.onFreeCapacityChange })
24
+  connect(LocalPlayer, { onInventoryChange = Inventory.onInventoryChange })
26 25
   connect(g_game, { onGameStart = Inventory.refresh })
27 26
 
28 27
   g_keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
29 28
 
30 29
   inventoryWindow = g_ui.loadUI('inventory.otui', GameInterface.getRightPanel())
30
+  inventoryWindow:disableResize()
31 31
   inventoryPanel = inventoryWindow:getChildById('contentsPanel')
32 32
   inventoryButton = TopMenu.addRightGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', 'inventory.png', Inventory.toggle)
33 33
   inventoryButton:setOn(true)
@@ -36,8 +36,7 @@ function Inventory.init()
36 36
 end
37 37
 
38 38
 function Inventory.terminate()
39
-  disconnect(LocalPlayer, { onInventoryChange = Inventory.onInventoryChange,
40
-                         onFreeCapacityChange = Inventory.onFreeCapacityChange })
39
+  disconnect(LocalPlayer, { onInventoryChange = Inventory.onInventoryChange })
41 40
   disconnect(g_game, { onGameStart = Inventory.refresh })
42 41
 
43 42
   g_keyboard.unbindKeyDown('Ctrl+I')
@@ -87,9 +86,3 @@ function Inventory.onInventoryChange(player, slot, item, oldItem)
87 86
     itemWidget:setItem(nil)
88 87
   end
89 88
 end
90
-
91
-function Inventory.onFreeCapacityChange(player, freeCapacity)
92
-  local widget = inventoryPanel:getChildById('capacity')
93
-  widget:setText("Cap:\n" .. freeCapacity)
94
-end
95
-

+ 32
- 84
modules/game_inventory/inventory.otui View File

@@ -1,129 +1,77 @@
1
-HeadSlot < Item
1
+InventoryItem < Item
2
+  margin: 0 1
3
+
4
+HeadSlot < InventoryItem
2 5
   id: slot1
3 6
   image-source: /game_inventory/slots/head.png
7
+  &position: {x=65535, y=1, z=0}
4 8
 
5
-BodySlot < Item
9
+BodySlot < InventoryItem
6 10
   id: slot4
7 11
   image-source: /game_inventory/slots/body.png
12
+  &position: {x=65535, y=4, z=0}
8 13
 
9
-LegSlot < Item
14
+LegSlot < InventoryItem
10 15
   id: slot7
11 16
   image-source: /game_inventory/slots/legs.png
17
+  &position: {x=65535, y=7, z=0}
12 18
 
13
-FeetSlot < Item
19
+FeetSlot < InventoryItem
14 20
   id: slot8
15 21
   image-source: /game_inventory/slots/feet.png
22
+  &position: {x=65535, y=8, z=0}
16 23
 
17
-NeckSlot < Item
24
+NeckSlot < InventoryItem
18 25
   id: slot2
19 26
   image-source: /game_inventory/slots/neck.png
27
+  &position: {x=65535, y=2, z=0}
20 28
 
21
-LeftSlot < Item
29
+LeftSlot < InventoryItem
22 30
   id: slot6
23 31
   image-source: /game_inventory/slots/left-hand.png
32
+  &position: {x=65535, y=6, z=0}
24 33
 
25
-FingerSlot < Item
34
+FingerSlot < InventoryItem
26 35
   id: slot9
27 36
   image-source: /game_inventory/slots/finger.png
37
+  &position: {x=65535, y=9, z=0}
28 38
 
29
-BackSlot < Item
39
+BackSlot < InventoryItem
30 40
   id: slot3
31 41
   image-source: /game_inventory/slots/back.png
42
+  &position: {x=65535, y=3, z=0}
32 43
 
33
-RightSlot < Item
44
+RightSlot < InventoryItem
34 45
   id: slot5
35 46
   image-source: /game_inventory/slots/right-hand.png
47
+  &position: {x=65535, y=5, z=0}
36 48
 
37
-AmmoSlot < Item
49
+AmmoSlot < InventoryItem
38 50
   id: slot10
39 51
   image-source: /game_inventory/slots/ammo.png
52
+  &position: {x=65535, y=10, z=0}
40 53
 
41 54
 MiniWindow
42 55
   id: inventoryWindow
43 56
   !text: tr('Inventory')
44 57
   icon: inventory.png
45
-  height: 180
58
+  height: 95
46 59
   @onClose: Inventory.onMiniWindowClose()
47 60
   &save: true
48 61
 
49
-  MiniWindowContents    
62
+  MiniWindowContents
63
+    padding: 4 5
64
+    layout:
65
+      type: grid
66
+      flow: true
67
+      cell-size: 36 34
50 68
     HeadSlot
51
-      // head
52
-      anchors.top: parent.top
53
-      anchors.horizontalCenter: parent.horizontalCenter
54
-      margin-top: 4
55
-      &position: {x=65535, y=1, z=0}
56
-
57 69
     BodySlot
58
-      // body
59
-      anchors.top: prev.bottom
60
-      anchors.horizontalCenter: prev.horizontalCenter
61
-      margin-top: 5
62
-      &position: {x=65535, y=4, z=0}
63
-
64 70
     LegSlot
65
-      // legs
66
-      anchors.top: prev.bottom
67
-      anchors.horizontalCenter: prev.horizontalCenter
68
-      margin-top: 5
69
-      &position: {x=65535, y=7, z=0}
70
-
71 71
     FeetSlot
72
-      // feet
73
-      anchors.top: prev.bottom
74
-      anchors.horizontalCenter: prev.horizontalCenter
75
-      margin-top: 5
76
-      &position: {x=65535, y=8, z=0}
77
-
78
-    NeckSlot
79
-      // neck
80
-      anchors.top: parent.top
81
-      anchors.right: slot1.left
82
-      margin-top: 10
83
-      margin-right: 5
84
-      &position: {x=65535, y=2, z=0}
85
-
72
+    RightSlot
86 73
     LeftSlot
87
-      // left hand
88
-      anchors.top: prev.bottom
89
-      anchors.horizontalCenter: prev.horizontalCenter
90
-      margin-top: 5
91
-      &position: {x=65535, y=6, z=0}
92
-
74
+    NeckSlot
93 75
     FingerSlot
94
-      // finger
95
-      anchors.top: prev.bottom
96
-      anchors.horizontalCenter: prev.horizontalCenter
97
-      margin-top: 5
98
-      &position: {x=65535, y=9, z=0}
99
-
100 76
     BackSlot
101
-      // back
102
-      anchors.top: parent.top
103
-      anchors.left: slot1.right
104
-      margin-top: 10
105
-      margin-left: 5
106
-      &position: {x=65535, y=3, z=0}
107
-
108
-    RightSlot
109
-      // right hand
110
-      anchors.top: prev.bottom
111
-      anchors.horizontalCenter: prev.horizontalCenter
112
-      margin-top: 5
113
-      &position: {x=65535, y=5, z=0}
114
-
115 77
     AmmoSlot
116
-      // ammo
117
-      anchors.top: prev.bottom
118
-      anchors.horizontalCenter: prev.horizontalCenter
119
-      margin-top: 5
120
-      &position: {x=65535, y=10, z=0}
121
-
122
-    GameLabel
123
-      id: capacity
124
-      height: 30
125
-      anchors.top: slot10.bottom
126
-      anchors.left: slot10.left
127
-      margin-top: 5
128
-      text-align: center
129
-      text-auto-resize: true

+ 11
- 1
modules/game_minimap/minimap.lua View File

@@ -5,10 +5,15 @@ local minimapWidget
5 5
 local minimapButton
6 6
 local minimapWindow
7 7
 local DEFAULT_ZOOM = 60
8
+local navigating = false
8 9
 minimapFirstLoad = true
9 10
 
10 11
 -- private functions
11 12
 function onMinimapMouseRelease(self, mousePosition, mouseButton)
13
+  if navigating then
14
+    navigating = false
15
+    return
16
+  end
12 17
   local tile = self:getTile(mousePosition)
13 18
   if tile and mouseButton == MouseLeftButton and self:isPressed() then
14 19
     local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), tile:getPosition(), 127)
@@ -47,7 +52,9 @@ function Minimap.init()
47 52
 
48 53
   minimapWindow = g_ui.loadUI('minimap.otui', GameInterface.getRightPanel())
49 54
 
55
+
50 56
   minimapWidget = minimapWindow:recursiveGetChildById('minimap')
57
+  g_mouse.bindAutoPress(minimapWidget, Minimap.compassClick)
51 58
   minimapWidget:setAutoViewMode(false)
52 59
   minimapWidget:setViewMode(1) -- mid view
53 60
   minimapWidget:setDrawMinimapColors(true)
@@ -109,7 +116,10 @@ function Minimap.isClickInRange(position, fromPosition, toPosition)
109 116
 end
110 117
 
111 118
 -- hooked functions
112
-function Minimap.compassClick(self, mousePos)
119
+function Minimap.compassClick(self, mousePos, mouseButton, elapsed)
120
+  if elapsed < 300 then return end
121
+
122
+  navigating = true
113 123
   local px = mousePos.x - self:getX()
114 124
   local py = mousePos.y - self:getY()
115 125
   local dx = px - self:getWidth()/2

+ 20
- 33
modules/game_minimap/minimap.otui View File

@@ -30,44 +30,22 @@ MiniWindow
30 30
   @onClose: Minimap.onMiniWindowClose()
31 31
   &save: true
32 32
 
33
+  Label
34
+    text: ?
35
+    text-align: center
36
+    phantom: false
37
+    !tooltip: tr('Hold left mouse button to navigate')
38
+    anchors.top: minimizeButton.top
39
+    anchors.right: minimizeButton.left
40
+    margin-right: 3
41
+    size: 14 14
42
+
33 43
   MiniWindowContents
34
-    padding: 3
44
+    padding: 2
35 45
     UIMap
36 46
       id: minimap
37 47
       anchors.fill: parent
38 48
 
39
-    UIButton
40
-      id: compass
41
-      image-source: /game_minimap/compass.png
42
-      image-smooth: true
43
-      color: #ffffff
44
-      anchors.left: parent.left
45
-      anchors.top: parent.top
46
-      size: 48 48
47
-      margin-top: 4
48
-      margin-left: 4
49
-      @onClick: function(...) Minimap.compassClick(...) end
50
-
51
-    UIButton
52
-      id: compassReset
53
-      text: R
54
-      font: verdana-11px-rounded
55
-      anchors.centerIn: compass
56
-      margin-top: 2
57
-      margin-right: 1
58
-      @onClick: function(...) Minimap.center(...) end
59
-      $pressed:
60
-        color: #eb9f4f88
61
-
62
-      $hover !pressed:
63
-        color: #eb9f4f
64
-
65
-      $!pressed !hover:
66
-        color: #ffffff
67
-
68
-      $disabled:
69
-        image-color: #ffffff88
70
-
71 49
     FloorUpControl
72 50
       id: floorUp
73 51
       anchors.right: parent.right
@@ -109,3 +87,12 @@ MiniWindow
109 87
       enabled: true
110 88
       @onClick: Minimap.onButtonClick(self:getId())
111 89
 
90
+    Button
91
+      id: reset
92
+      !text: tr('Center')
93
+      width: 44
94
+      anchors.left: parent.left
95
+      anchors.top: parent.top
96
+      margin: 4
97
+      @onClick: Minimap.center()
98
+

Loading…
Cancel
Save