Version 2.2 - retro layout + bug fixes

This commit is contained in:
OTCv8
2020-03-31 21:34:09 +02:00
parent 1df9b82846
commit 6b39f061ae
189 changed files with 3384 additions and 4603 deletions

View File

@@ -8,13 +8,15 @@ oldZoom = nil
oldPos = nil
function init()
minimapButton = modules.client_topmenu.addRightGameToggleButton('minimapButton',
tr('Minimap') .. ' (Ctrl+M)', '/images/topbuttons/minimap', toggle)
minimapButton:setOn(true)
minimapWindow = g_ui.loadUI('minimap', modules.game_interface.getRightPanel())
minimapWindow:setContentMinimumHeight(64)
if not minimapWindow.forceOpen then
minimapButton = modules.client_topmenu.addRightGameToggleButton('minimapButton',
tr('Minimap') .. ' (Ctrl+M)', '/images/topbuttons/minimap', toggle)
minimapButton:setOn(true)
end
minimapWidget = minimapWindow:recursiveGetChildById('minimap')
local gameRootPanel = modules.game_interface.getRootPanel()
@@ -64,10 +66,13 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+Shift+M')
minimapWindow:destroy()
minimapButton:destroy()
if minimapButton then
minimapButton:destroy()
end
end
function toggle()
if not minimapButton then return end
if minimapButton:isOn() then
minimapWindow:close()
minimapButton:setOn(false)
@@ -78,7 +83,9 @@ function toggle()
end
function onMiniWindowClose()
minimapButton:setOn(false)
if minimapButton then
minimapButton:setOn(false)
end
end
function preload()
@@ -104,12 +111,16 @@ function loadMap(clean)
if otmm then
local minimapFile = '/minimap.otmm'
if g_resources.fileExists(minimapFile) then
if g_resources.fileExists('/data' .. minimapFile) then
g_minimap.loadOtmm('/data' .. minimapFile)
elseif g_resources.fileExists(minimapFile) then
g_minimap.loadOtmm(minimapFile)
end
else
local minimapFile = '/minimap_' .. clientVersion .. '.otcm'
if g_resources.fileExists(minimapFile) then
if g_resources.fileExists('/data' .. minimapFile) then
g_map.loadOtcm('/data' .. minimapFile)
elseif g_resources.fileExists(minimapFile) then
g_map.loadOtcm(minimapFile)
end
end

View File

@@ -1,30 +1,7 @@
MiniWindow
MinimapWindow
id: minimapWindow
!text: tr('Minimap')
height: 150
icon: /images/topbuttons/minimap
@onClose: modules.game_minimap.onMiniWindowClose()
&save: true
&autoOpen: 1
--&forceOpen: true
Label
text: ?
text-align: center
phantom: false
!tooltip: tr('Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks\nPress Ctrl+Shift+M to view the entire game map')
anchors.top: lockButton.top
anchors.right: lockButton.left
margin-right: 3
size: 14 14
MiniWindowContents
Minimap
id: minimap
anchors.fill: parent
ResizeBorder
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
enabled: true