2012-01-20 02:12:26 +01:00
|
|
|
function UIMap:onDragEnter(mousePos)
|
2012-01-20 03:33:11 +01:00
|
|
|
local tile = self:getTile(mousePos)
|
2012-01-20 02:12:26 +01:00
|
|
|
if not tile then return false end
|
2012-01-24 19:39:16 +01:00
|
|
|
|
2012-01-20 02:12:26 +01:00
|
|
|
local thing = tile:getTopMoveThing()
|
|
|
|
if not thing then return false end
|
2012-01-20 03:33:11 +01:00
|
|
|
|
2012-01-20 02:12:26 +01:00
|
|
|
self.currentDragThing = thing
|
|
|
|
setTargetCursor()
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function UIMap:onDragLeave(widget, mousePos)
|
|
|
|
self.currentDragThing = nil
|
|
|
|
restoreCursor()
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
function UIMap:onDrop(widget, mousePos)
|
|
|
|
if not widget or not widget.currentDragThing then return false end
|
2012-01-24 19:39:16 +01:00
|
|
|
|
2012-01-21 02:01:11 +01:00
|
|
|
local tile = self:getTile(mousePos)
|
|
|
|
if not tile then return false end
|
2012-01-24 19:39:16 +01:00
|
|
|
local count = widget.currentDragThing:getData()
|
|
|
|
|
2012-01-21 02:01:11 +01:00
|
|
|
Game.move(widget.currentDragThing, tile:getPos(), count)
|
2012-01-20 02:12:26 +01:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2012-01-09 21:54:37 +01:00
|
|
|
function UIMap:onMouseRelease(mousePosition, mouseButton)
|
|
|
|
local tile = self:getTile(mousePosition)
|
|
|
|
if tile and Game.processMouseAction(mousePosition, mouseButton, nil, tile:getTopLookThing(), tile:getTopUseThing(), tile:getTopCreature(), tile:getTopMultiUseThing()) then return true end
|
2012-01-09 19:06:16 +01:00
|
|
|
return false
|
|
|
|
end
|
2012-01-20 02:12:26 +01:00
|
|
|
|