mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
Tweak modules interface
Minimize miniwindows space usage Implement easier minimap navigation Redesign inventory, minimap and healthinfo layout
This commit is contained in:
@@ -5,10 +5,15 @@ local minimapWidget
|
||||
local minimapButton
|
||||
local minimapWindow
|
||||
local DEFAULT_ZOOM = 60
|
||||
local navigating = false
|
||||
minimapFirstLoad = true
|
||||
|
||||
-- private functions
|
||||
function onMinimapMouseRelease(self, mousePosition, mouseButton)
|
||||
if navigating then
|
||||
navigating = false
|
||||
return
|
||||
end
|
||||
local tile = self:getTile(mousePosition)
|
||||
if tile and mouseButton == MouseLeftButton and self:isPressed() then
|
||||
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), tile:getPosition(), 127)
|
||||
@@ -47,7 +52,9 @@ function Minimap.init()
|
||||
|
||||
minimapWindow = g_ui.loadUI('minimap.otui', GameInterface.getRightPanel())
|
||||
|
||||
|
||||
minimapWidget = minimapWindow:recursiveGetChildById('minimap')
|
||||
g_mouse.bindAutoPress(minimapWidget, Minimap.compassClick)
|
||||
minimapWidget:setAutoViewMode(false)
|
||||
minimapWidget:setViewMode(1) -- mid view
|
||||
minimapWidget:setDrawMinimapColors(true)
|
||||
@@ -109,7 +116,10 @@ function Minimap.isClickInRange(position, fromPosition, toPosition)
|
||||
end
|
||||
|
||||
-- hooked functions
|
||||
function Minimap.compassClick(self, mousePos)
|
||||
function Minimap.compassClick(self, mousePos, mouseButton, elapsed)
|
||||
if elapsed < 300 then return end
|
||||
|
||||
navigating = true
|
||||
local px = mousePos.x - self:getX()
|
||||
local py = mousePos.y - self:getY()
|
||||
local dx = px - self:getWidth()/2
|
||||
|
@@ -30,44 +30,22 @@ MiniWindow
|
||||
@onClose: Minimap.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
Label
|
||||
text: ?
|
||||
text-align: center
|
||||
phantom: false
|
||||
!tooltip: tr('Hold left mouse button to navigate')
|
||||
anchors.top: minimizeButton.top
|
||||
anchors.right: minimizeButton.left
|
||||
margin-right: 3
|
||||
size: 14 14
|
||||
|
||||
MiniWindowContents
|
||||
padding: 3
|
||||
padding: 2
|
||||
UIMap
|
||||
id: minimap
|
||||
anchors.fill: parent
|
||||
|
||||
UIButton
|
||||
id: compass
|
||||
image-source: /game_minimap/compass.png
|
||||
image-smooth: true
|
||||
color: #ffffff
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
size: 48 48
|
||||
margin-top: 4
|
||||
margin-left: 4
|
||||
@onClick: function(...) Minimap.compassClick(...) end
|
||||
|
||||
UIButton
|
||||
id: compassReset
|
||||
text: R
|
||||
font: verdana-11px-rounded
|
||||
anchors.centerIn: compass
|
||||
margin-top: 2
|
||||
margin-right: 1
|
||||
@onClick: function(...) Minimap.center(...) end
|
||||
$pressed:
|
||||
color: #eb9f4f88
|
||||
|
||||
$hover !pressed:
|
||||
color: #eb9f4f
|
||||
|
||||
$!pressed !hover:
|
||||
color: #ffffff
|
||||
|
||||
$disabled:
|
||||
image-color: #ffffff88
|
||||
|
||||
FloorUpControl
|
||||
id: floorUp
|
||||
anchors.right: parent.right
|
||||
@@ -109,3 +87,12 @@ MiniWindow
|
||||
enabled: true
|
||||
@onClick: Minimap.onButtonClick(self:getId())
|
||||
|
||||
Button
|
||||
id: reset
|
||||
!text: tr('Center')
|
||||
width: 44
|
||||
anchors.left: parent.left
|
||||
anchors.top: parent.top
|
||||
margin: 4
|
||||
@onClick: Minimap.center()
|
||||
|
||||
|
Reference in New Issue
Block a user