parent
a91b7ed6be
commit
4d2bd54f6b
|
@ -138,6 +138,24 @@ function UIMiniWindow:onDragEnter(mousePos)
|
|||
return true
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
||||
if self.movedWidget then
|
||||
self.setMovedChildMargin(0)
|
||||
self.movedWidget = nil
|
||||
self.setMovedChildMargin = nil
|
||||
self.movedIndex = nil
|
||||
end
|
||||
|
||||
local parent = self:getParent()
|
||||
if parent then
|
||||
if parent:getClassName() == 'UIMiniWindowContainer' then
|
||||
parent:saveChildren()
|
||||
else
|
||||
self:saveParentPosition(parent:getId(), self:getPosition())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragMove(mousePos, mouseMoved)
|
||||
local oldMousePosY = mousePos.y - mouseMoved.y
|
||||
local children = rootWidget:recursiveGetChildrenByMarginPos(mousePos)
|
||||
|
@ -188,24 +206,6 @@ function UIMiniWindow:onMousePress()
|
|||
end
|
||||
end
|
||||
|
||||
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
||||
if self.movedWidget then
|
||||
self.setMovedChildMargin(0)
|
||||
self.movedWidget = nil
|
||||
self.setMovedChildMargin = nil
|
||||
self.movedIndex = nil
|
||||
end
|
||||
|
||||
local parent = self:getParent()
|
||||
if parent then
|
||||
if parent:getClassName() == 'UIMiniWindowContainer' then
|
||||
parent:saveChildren()
|
||||
else
|
||||
self:saveParentPosition(parent:getId(), self:getPosition())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIMiniWindow:onFocusChange(focused)
|
||||
-- miniwindows only raises when its outside MiniWindowContainers
|
||||
if not focused then return end
|
||||
|
@ -253,3 +253,13 @@ end
|
|||
function UIMiniWindow:disableResize()
|
||||
self:getChildById('bottomResizeBorder'):disable()
|
||||
end
|
||||
|
||||
function UIMiniWindow:setMinimumHeight(height)
|
||||
local resizeBorder = self:getChildById('bottomResizeBorder')
|
||||
resizeBorder:setMinimum(height)
|
||||
end
|
||||
|
||||
function UIMiniWindow:setMaximumHeight(height)
|
||||
local resizeBorder = self:getChildById('bottomResizeBorder')
|
||||
resizeBorder:setMaximum(height)
|
||||
end
|
||||
|
|
|
@ -8,6 +8,10 @@ function UIWindow.create()
|
|||
return window
|
||||
end
|
||||
|
||||
function UIWindow:getClassName()
|
||||
return 'UIWindow'
|
||||
end
|
||||
|
||||
function UIWindow:onKeyDown(keyCode, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardNoModifier then
|
||||
if keyCode == KeyEnter then
|
||||
|
|
|
@ -41,7 +41,7 @@ MiniWindow
|
|||
!text: tr('Battle')
|
||||
height: 166
|
||||
icon: battle.png
|
||||
@onClose: onMiniWindowClose()
|
||||
@onClose: modules.game_battle.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
|
|
|
@ -28,7 +28,7 @@ MiniWindow
|
|||
icon: combatcontrols.png
|
||||
height: 48
|
||||
&save: true
|
||||
@onClose: onMiniWindowClose()
|
||||
@onClose: modules.game_combatcontrols.onMiniWindowClose()
|
||||
|
||||
MiniWindowContents
|
||||
FightOffensiveBox
|
||||
|
|
|
@ -65,7 +65,7 @@ MiniWindow
|
|||
id: healthInfoWindow
|
||||
!text: tr('Health Info')
|
||||
height: 102
|
||||
@onClose: onMiniWindowClose()
|
||||
@onClose: modules.game_healthinfo.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
|
|
|
@ -179,10 +179,10 @@ function onUseWith(clickedWidget, mousePosition)
|
|||
local tile = clickedWidget:getTile(mousePosition)
|
||||
if tile then
|
||||
g_game.useWith(selectedThing, tile:getTopMultiUseThing())
|
||||
end
|
||||
elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
|
||||
g_game.useWith(selectedThing, clickedWidget:getItem())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function onTradeWith(clickedWidget, mousePosition)
|
||||
|
|
|
@ -7,7 +7,6 @@ function UIGameMap.create()
|
|||
return gameMap
|
||||
end
|
||||
|
||||
|
||||
function UIGameMap:onDragEnter(mousePos)
|
||||
local tile = self:getTile(mousePos)
|
||||
if not tile then return false end
|
||||
|
@ -28,7 +27,7 @@ function UIGameMap:onDragLeave(droppedWidget, mousePos)
|
|||
end
|
||||
|
||||
function UIGameMap:onDrop(widget, mousePos)
|
||||
if not widget or not widget.currentDragThing then return false end
|
||||
if not self:canAcceptDrop(widget, mousePos) then return false end
|
||||
|
||||
local tile = self:getTile(mousePos)
|
||||
if not tile then return false end
|
||||
|
@ -82,3 +81,20 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
|
|||
|
||||
return ret
|
||||
end
|
||||
|
||||
function UIGameMap:canAcceptDrop(widget, mousePos)
|
||||
if not widget or not widget.currentDragThing then return false end
|
||||
|
||||
local children = rootWidget:recursiveGetChildrenByPos(mousePos)
|
||||
for i=1,#children do
|
||||
local child = children[i]
|
||||
if child == self then
|
||||
return true
|
||||
elseif not child:isPhantom() then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
error('Widget ' .. self:getId() .. ' not in drop list.')
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -20,9 +20,7 @@ function UIItem:onDragLeave(droppedWidget, mousePos)
|
|||
end
|
||||
|
||||
function UIItem:onDrop(widget, mousePos)
|
||||
if self:isVirtual() then return false end
|
||||
|
||||
if not widget or not widget.currentDragThing then return false end
|
||||
if not self:canAcceptDrop(widget, mousePos) then return false end
|
||||
|
||||
local item = widget.currentDragThing
|
||||
if not item:isItem() then return false end
|
||||
|
@ -94,3 +92,20 @@ function UIItem:onMouseRelease(mousePosition, mouseButton)
|
|||
return false
|
||||
end
|
||||
|
||||
function UIItem:canAcceptDrop(widget, mousePos)
|
||||
if self:isVirtual() then return false end
|
||||
if not widget or not widget.currentDragThing then return false end
|
||||
|
||||
local children = rootWidget:recursiveGetChildrenByPos(mousePos)
|
||||
for i=1,#children do
|
||||
local child = children[i]
|
||||
if child == self then
|
||||
return true
|
||||
elseif not child:isPhantom() then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
error('Widget ' .. self:getId() .. ' not in drop list.')
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -56,7 +56,7 @@ MiniWindow
|
|||
!text: tr('Inventory')
|
||||
icon: inventory.png
|
||||
height: 95
|
||||
@onClose: onMiniWindowClose()
|
||||
@onClose: modules.game_inventory.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
|
|
|
@ -25,7 +25,7 @@ MiniWindow
|
|||
!text: tr('Minimap')
|
||||
height: 150
|
||||
icon: minimap.png
|
||||
@onClose: onMiniWindowClose()
|
||||
@onClose: modules.game_minimap.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
Label
|
||||
|
|
|
@ -35,7 +35,7 @@ MiniWindow
|
|||
!text: tr('Skills')
|
||||
height: 150
|
||||
icon: skills.png
|
||||
@onClose: onMiniWindowClose()
|
||||
@onClose: modules.game_skills.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
|
@ -149,4 +149,3 @@ MiniWindow
|
|||
!text: tr('Fishing')
|
||||
SkillValueLabel
|
||||
SkillPercentPanel
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ function init()
|
|||
g_keyboard.bindKeyDown('Ctrl+P', toggle)
|
||||
|
||||
vipWindow = g_ui.loadUI('viplist.otui', modules.game_interface.getRightPanel())
|
||||
vipWindow.onClose = onMiniWindowClose
|
||||
vipButton = TopMenu.addRightGameToggleButton('vipListButton', tr('VIP list') .. ' (Ctrl+P)', 'viplist.png', toggle)
|
||||
vipButton:setOn(true)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ MiniWindow
|
|||
!text: tr('VIP List')
|
||||
height: 100
|
||||
icon: viplist.png
|
||||
@onClose: modules.game_viplist.onMiniWindowClose()
|
||||
&save: true
|
||||
|
||||
MiniWindowContents
|
||||
|
|
|
@ -1198,7 +1198,6 @@ UIWidgetPtr UIWidget::backwardsGetWidgetById(const std::string& id)
|
|||
return widget;
|
||||
}
|
||||
|
||||
|
||||
bool UIWidget::setState(Fw::WidgetState state, bool on)
|
||||
{
|
||||
if(state == Fw::InvalidState)
|
||||
|
|
|
@ -156,7 +156,7 @@ void Creature::internalDrawOutfit(Point dest, float scaleFactor, bool animateWal
|
|||
if(m_outfit.getCategory() == ThingCategoryEffect)
|
||||
animationPhase = std::min(animationPhase+1, getAnimationPhases());
|
||||
|
||||
rawGetThingType()->draw(dest, scaleFactor, 0, 0, 0, 0, animationPhase);
|
||||
rawGetThingType()->draw(dest - (getDisplacement() * scaleFactor), scaleFactor, 0, 0, 0, 0, animationPhase);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -632,6 +632,30 @@ int Creature::getStepDuration()
|
|||
return interval;
|
||||
}
|
||||
|
||||
Point Creature::getDisplacement()
|
||||
{
|
||||
Point displacement = Thing::getDisplacement();
|
||||
if(m_outfit.getCategory() == ThingCategoryEffect)
|
||||
displacement = Point(8, 8);
|
||||
return displacement;
|
||||
}
|
||||
|
||||
int Creature::getDisplacementX()
|
||||
{
|
||||
int displacementX = Thing::getDisplacementX();
|
||||
if(m_outfit.getCategory() == ThingCategoryEffect)
|
||||
displacementX = 8;
|
||||
return displacementX;
|
||||
}
|
||||
|
||||
int Creature::getDisplacementY()
|
||||
{
|
||||
int displacementY = Thing::getDisplacementY();
|
||||
if(m_outfit.getCategory() == ThingCategoryEffect)
|
||||
displacementY = 8;
|
||||
return displacementY;
|
||||
}
|
||||
|
||||
const ThingTypePtr& Creature::getThingType()
|
||||
{
|
||||
return g_things.getThingType(m_outfit.getId(), m_outfit.getCategory());
|
||||
|
|
|
@ -84,6 +84,9 @@ public:
|
|||
Point getDrawOffset();
|
||||
int getStepDuration();
|
||||
Point getWalkOffset() { return m_walkOffset; }
|
||||
virtual Point getDisplacement();
|
||||
virtual int getDisplacementX();
|
||||
virtual int getDisplacementY();
|
||||
|
||||
void updateShield();
|
||||
|
||||
|
|
|
@ -65,9 +65,9 @@ public:
|
|||
Size getSize() { return rawGetThingType()->getSize(); }
|
||||
int getWidth() { return rawGetThingType()->getWidth(); }
|
||||
int getHeight() { return rawGetThingType()->getHeight(); }
|
||||
Point getDisplacement() { return rawGetThingType()->getDisplacement(); }
|
||||
int getDisplacementX() { return rawGetThingType()->getDisplacementX(); }
|
||||
int getDisplacementY() { return rawGetThingType()->getDisplacementY(); }
|
||||
virtual Point getDisplacement() { return rawGetThingType()->getDisplacement(); }
|
||||
virtual int getDisplacementX() { return rawGetThingType()->getDisplacementX(); }
|
||||
virtual int getDisplacementY() { return rawGetThingType()->getDisplacementY(); }
|
||||
int getExactSize() { return rawGetThingType()->getExactSize(); }
|
||||
int getLayers() { return rawGetThingType()->getLayers(); }
|
||||
int getNumPatternX() { return rawGetThingType()->getNumPatternX(); }
|
||||
|
|
Loading…
Reference in New Issue