diff --git a/data/locales/pt.lua b/data/locales/pt.lua index ebf2a7da..f01bc13f 100644 --- a/data/locales/pt.lua +++ b/data/locales/pt.lua @@ -271,6 +271,7 @@ locale = { ["Remove"] = "Remover", ["Report Bug"] = "Reportar defeito", ["Reserved for more functionality later."] = "Reservado para futura maior funcionalidade.", + ["Reset All"] = "Resetar Todos", ["Reset Market"] = "Resetar Mercado", ["Revoke %s's Invitation"] = "Não aceitar o convite do %s", ["Rotate"] = "Girar", diff --git a/data/styles/30-minimap.otui b/data/styles/30-minimap.otui index cb6a7440..da6664c8 100644 --- a/data/styles/30-minimap.otui +++ b/data/styles/30-minimap.otui @@ -141,7 +141,7 @@ MinimapFlagWindow < MainWindow margin-top: 3 anchors.left: parent.left anchors.top: prev.bottom - width: 158 + anchors.right: parent.right MinimapFlagCheckBox id: flag0 @@ -245,3 +245,20 @@ MinimapFlagWindow < MainWindow width: 64 anchors.right: parent.right anchors.bottom: parent.bottom + +// Minimap Full Panel + +MinimapFullPanel < UIWidget + image-smooth: true + border-width: 2 + border-color: #000000 + anchors.fill: parent + anchors.top: topMenu.bottom + + Button + !text: tr('Close') + margin-right: 4 + margin-top: 4 + anchors.right: parent.right + anchors.top: parent.top + @onClick: self:getParent():destroy() diff --git a/modules/corelib/ui/uibutton.lua b/modules/corelib/ui/uibutton.lua index 1b91f9df..5be35107 100644 --- a/modules/corelib/ui/uibutton.lua +++ b/modules/corelib/ui/uibutton.lua @@ -5,4 +5,9 @@ function UIButton.create() local button = UIButton.internalCreate() button:setFocusable(false) return button -end \ No newline at end of file +end + +function UIButton:onMouseRelease(pos, button) + if self:isPressed() then return true end + return false +end diff --git a/modules/game_minimap/minimap.lua b/modules/game_minimap/minimap.lua index 726426ad..c3f421a9 100644 --- a/modules/game_minimap/minimap.lua +++ b/modules/game_minimap/minimap.lua @@ -13,10 +13,10 @@ function init() minimapWidget = minimapWindow:recursiveGetChildById('minimap') local gameRootPanel = modules.game_interface.getRootPanel() - g_keyboard.bindKeyPress('Alt+Left', function() minimapWidget:move(-1,0) end, gameRootPanel) - g_keyboard.bindKeyPress('Alt+Right', function() minimapWidget:move(1,0) end, gameRootPanel) - g_keyboard.bindKeyPress('Alt+Up', function() minimapWidget:move(0,-1) end, gameRootPanel) - g_keyboard.bindKeyPress('Alt+Down', function() minimapWidget:move(0,1) end, gameRootPanel) + g_keyboard.bindKeyPress('Alt+Left', function() minimapWidget:move(1,0) end, gameRootPanel) + g_keyboard.bindKeyPress('Alt+Right', function() minimapWidget:move(-1,0) end, gameRootPanel) + g_keyboard.bindKeyPress('Alt+Up', function() minimapWidget:move(0,1) end, gameRootPanel) + g_keyboard.bindKeyPress('Alt+Down', function() minimapWidget:move(0,-1) end, gameRootPanel) g_keyboard.bindKeyDown('Ctrl+M', toggle) minimapWindow:setup() @@ -105,3 +105,7 @@ function saveMap() end minimapWidget:save() end + +function getMinimap() + return minimapWidget +end diff --git a/modules/gamelib/ui/uiminimap.lua b/modules/gamelib/ui/uiminimap.lua index e0bfffa9..e8a50dc1 100644 --- a/modules/gamelib/ui/uiminimap.lua +++ b/modules/gamelib/ui/uiminimap.lua @@ -7,6 +7,7 @@ function UIMinimap:onSetup() self.zoomOutWidget = self:getChildById('zoomOut') self.dx = 0 self.dy = 0 + self.autowalk = true self.onPositionChange = function() self:followLocalPlayer() end self.onAddAutomapFlag = function(pos, icon, description) self:addFlag(pos, icon, description) end self.onRemoveAutomapFlag = function(pos, icon, description) self:addFlag(pos, icon, description) end @@ -24,6 +25,36 @@ function UIMinimap:onDestroy() onRemoveAutomapFlag = self.onRemoveAutomapFlag, }) self:destroyFlagWindow() + self:destroyFullPanel() +end + +function UIMinimap:onVisibilityChange() + if not self:isVisible() then + self:destroyFlagWindow() + self:destroyFullPanel() + end +end + +function UIMinimap:hideFlags() + self.flagsWidget:hide() +end + +function UIMinimap:hideFloor() + self.floorUpWidget:hide() + self.floorDownWidget:hide() +end + +function UIMinimap:hideZoom() + self.zoomInWidget:hide() + self.zoomOutWidget:hide() +end + +function UIMinimap:disableAutoWalk() + self.autowalk = false +end + +function UIMinimap:enableFullPanel(image) + self.fullImage = image end function UIMinimap:load() @@ -192,8 +223,7 @@ function UIMinimap:onMousePress(pos, button) end function UIMinimap:onMouseRelease(pos, button) - -- TODO: - --if not self.allowNextRelease then return true end + if not self.allowNextRelease then return true end self.allowNextRelease = false local mapPos = self:getPosition(pos) @@ -201,15 +231,14 @@ function UIMinimap:onMouseRelease(pos, button) if button == MouseLeftButton then local player = g_game.getLocalPlayer() - if not player:autoWalk(mapPos) then + if self.autowalk and not player:autoWalk(mapPos) then player.onAutoWalkFail = function() modules.game_textmessage.displayFailureMessage(tr('There is no way.')) end end return true elseif button == MouseRightButton then local menu = g_ui.createWidget('PopupMenu') - menu:addOption(tr('Create mark'), function() - self:createFlagWindow(mapPos) - end) + menu:addOption(tr('Create mark'), function() self:createFlagWindow(mapPos) end) + if self.fullImage then menu:addOption(tr('Full map'), function() self:createFullPanel() end) end menu:display(pos) return true end @@ -229,6 +258,19 @@ function UIMinimap:onDragLeave(widget, pos) return true end +function UIMinimap:createFullPanel() + self.fullPanel = g_ui.createWidget('MinimapFullPanel', rootWidget) + self.fullPanel:setImageSource(self.fullImage) + self.fullPanel.onDestroy = function() self.fullPanel = nil end +end + +function UIMinimap:destroyFullPanel() + if self.fullPanel then + self.fullPanel:destroy() + self.fullPanel = nil + end +end + function UIMinimap:createFlagWindow(pos) if self.flagWindow then return end if not pos then return end