Fixes to miniwindows
This commit is contained in:
parent
eec6114b2d
commit
39403e612f
|
@ -75,6 +75,8 @@ function UIMiniWindow:onSetup()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local oldParent = self:getParent()
|
||||||
|
|
||||||
local settings = Settings.getNode('MiniWindows')
|
local settings = Settings.getNode('MiniWindows')
|
||||||
if settings then
|
if settings then
|
||||||
local selfSettings = settings[self:getId()]
|
local selfSettings = settings[self:getId()]
|
||||||
|
@ -83,6 +85,7 @@ function UIMiniWindow:onSetup()
|
||||||
local parent = rootWidget:recursiveGetChildById(selfSettings.parentId)
|
local parent = rootWidget:recursiveGetChildById(selfSettings.parentId)
|
||||||
if parent then
|
if parent then
|
||||||
if parent:getClassName() == 'UIMiniWindowContainer' and selfSettings.index and parent:isOn() then
|
if parent:getClassName() == 'UIMiniWindowContainer' and selfSettings.index and parent:isOn() then
|
||||||
|
self.miniIndex = selfSettings.index
|
||||||
parent:scheduleInsert(self, selfSettings.index)
|
parent:scheduleInsert(self, selfSettings.index)
|
||||||
elseif selfSettings.position then
|
elseif selfSettings.position then
|
||||||
self:setParent(parent)
|
self:setParent(parent)
|
||||||
|
@ -101,6 +104,17 @@ function UIMiniWindow:onSetup()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local newParent = self:getParent()
|
||||||
|
|
||||||
|
self.miniLoaded = true
|
||||||
|
|
||||||
|
if oldParent and oldParent:getClassName() == 'UIMiniWindowContainer' then
|
||||||
|
oldParent:order()
|
||||||
|
end
|
||||||
|
if newParent and newParent:getClassName() == 'UIMiniWindowContainer' and newParent ~= oldParent then
|
||||||
|
newParent:order()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIMiniWindow:onDragEnter(mousePos)
|
function UIMiniWindow:onDragEnter(mousePos)
|
||||||
|
@ -199,6 +213,8 @@ function UIMiniWindow:onFocusChange(focused)
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIMiniWindow:setSettings(data)
|
function UIMiniWindow:setSettings(data)
|
||||||
|
if not self.save then return end
|
||||||
|
|
||||||
local settings = Settings.getNode('MiniWindows')
|
local settings = Settings.getNode('MiniWindows')
|
||||||
if not settings then
|
if not settings then
|
||||||
settings = {}
|
settings = {}
|
||||||
|
|
|
@ -54,9 +54,6 @@ function UIMiniWindowContainer:scheduleInsert(widget, index)
|
||||||
if oldParent ~= self then
|
if oldParent ~= self then
|
||||||
oldParent:removeChild(widget)
|
oldParent:removeChild(widget)
|
||||||
self:insertChild(index, widget)
|
self:insertChild(index, widget)
|
||||||
else
|
|
||||||
self:swapInsert(widget, index)
|
|
||||||
end
|
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
local placed = false
|
local placed = false
|
||||||
|
@ -70,13 +67,33 @@ function UIMiniWindowContainer:scheduleInsert(widget, index)
|
||||||
end
|
end
|
||||||
if not placed then break end
|
if not placed then break end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UIMiniWindowContainer:order()
|
||||||
|
local children = self:getChildren()
|
||||||
|
for i=1,#children do
|
||||||
|
if not children[i].miniLoaded then return end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i=1,#children do
|
||||||
|
if children[i].miniIndex then
|
||||||
|
self:swapInsert(children[i], children[i].miniIndex)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIMiniWindowContainer:saveChildren()
|
function UIMiniWindowContainer:saveChildren()
|
||||||
local children = self:getChildren()
|
local children = self:getChildren()
|
||||||
|
local ignoreIndex = 0
|
||||||
for i=1,#children do
|
for i=1,#children do
|
||||||
children[i]:saveParentIndex(self:getId(), i)
|
if children[i].save then
|
||||||
|
children[i]:saveParentIndex(self:getId(), i - ignoreIndex)
|
||||||
|
else
|
||||||
|
ignoreIndex = ignoreIndex + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ MiniWindow
|
||||||
height: 166
|
height: 166
|
||||||
icon: battle.png
|
icon: battle.png
|
||||||
@onClose: Battle.onMiniWindowClose()
|
@onClose: Battle.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
BattlePlayers
|
BattlePlayers
|
||||||
|
|
|
@ -25,6 +25,7 @@ MiniWindow
|
||||||
icon: combatcontrols.png
|
icon: combatcontrols.png
|
||||||
height: 64
|
height: 64
|
||||||
@onClose: CombatControls.onMiniWindowClose()
|
@onClose: CombatControls.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
FightOffensiveBox
|
FightOffensiveBox
|
||||||
|
|
|
@ -46,6 +46,7 @@ MiniWindow
|
||||||
!text: tr('Health Bar')
|
!text: tr('Health Bar')
|
||||||
height: 86
|
height: 86
|
||||||
@onClose: HealthBar.onMiniWindowClose()
|
@onClose: HealthBar.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
HealthBar
|
HealthBar
|
||||||
|
|
|
@ -4,6 +4,7 @@ MiniWindow
|
||||||
icon: inventory.png
|
icon: inventory.png
|
||||||
height: 180
|
height: 180
|
||||||
@onClose: Inventory.onMiniWindowClose()
|
@onClose: Inventory.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
Item
|
Item
|
||||||
|
|
|
@ -83,16 +83,19 @@ function Minimap.terminate()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Minimap.toggle()
|
function Minimap.toggle()
|
||||||
local visible = not minimapWindow:isExplicitlyVisible()
|
if minimapButton:isOn() then
|
||||||
if visible then
|
|
||||||
minimapWindow:open()
|
|
||||||
minimapButton:setOn(true)
|
|
||||||
else
|
|
||||||
minimapWindow:close()
|
minimapWindow:close()
|
||||||
minimapButton:setOn(false)
|
minimapButton:setOn(false)
|
||||||
|
else
|
||||||
|
minimapWindow:open()
|
||||||
|
minimapButton:setOn(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Minimap.onMiniWindowClose()
|
||||||
|
minimapButton:setOn(false)
|
||||||
|
end
|
||||||
|
|
||||||
function Minimap.reset()
|
function Minimap.reset()
|
||||||
local player = g_game.getLocalPlayer()
|
local player = g_game.getLocalPlayer()
|
||||||
if not player then return end
|
if not player then return end
|
||||||
|
|
|
@ -3,6 +3,8 @@ MiniWindow
|
||||||
!text: tr('Minimap')
|
!text: tr('Minimap')
|
||||||
height: 150
|
height: 150
|
||||||
icon: minimap.png
|
icon: minimap.png
|
||||||
|
@onClose: Minimap.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
padding: 3
|
padding: 3
|
||||||
|
|
|
@ -36,6 +36,7 @@ MiniWindow
|
||||||
height: 150
|
height: 150
|
||||||
icon: skills.png
|
icon: skills.png
|
||||||
@onClose: Skills.onMiniWindowClose()
|
@onClose: Skills.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
@ -9,6 +9,7 @@ MiniWindow
|
||||||
height: 100
|
height: 100
|
||||||
icon: viplist.png
|
icon: viplist.png
|
||||||
@onClose: VipList.onMiniWindowClose()
|
@onClose: VipList.onMiniWindowClose()
|
||||||
|
&save: true
|
||||||
|
|
||||||
MiniWindowContents
|
MiniWindowContents
|
||||||
layout: verticalBox
|
layout: verticalBox
|
||||||
|
|
Loading…
Reference in New Issue