mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
restore old modules
* partially restore vip, battle, healthbar, skills and inventory modules * more fixes on UIWidgets * implement UIMiniWindow close/minimize functionality * allow drag and drop miniwindows beteween game panels
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Inventory = {}
|
||||
|
||||
-- private variables
|
||||
local inventoryWindow
|
||||
local inventoryPanel
|
||||
local inventoryButton
|
||||
|
||||
@@ -13,7 +14,9 @@ function Inventory.init()
|
||||
|
||||
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
|
||||
|
||||
inventoryPanel = displayUI('inventory.otui', GameInterface.getRightPanel()):getChildById('inventoryPanel')
|
||||
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
|
||||
inventoryWindow.onClose = Inventory.toggle
|
||||
inventoryPanel = inventoryWindow:getChildById('contentsPanel')
|
||||
inventoryButton = TopMenu.addGameToggleButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
|
||||
inventoryButton:setOn(true)
|
||||
|
||||
@@ -30,15 +33,16 @@ function Inventory.terminate()
|
||||
|
||||
Keyboard.unbindKeyDown('Ctrl+I')
|
||||
|
||||
inventoryPanel:destroy()
|
||||
inventoryPanel = nil
|
||||
inventoryWindow:destroy()
|
||||
inventoryButton:destroy()
|
||||
inventoryWindow = nil
|
||||
inventoryButton = nil
|
||||
inventoryPanel = nil
|
||||
end
|
||||
|
||||
function Inventory.toggle()
|
||||
local visible = not inventoryPanel:isExplicitlyVisible()
|
||||
inventoryPanel:setVisible(visible)
|
||||
local visible = not inventoryWindow:isExplicitlyVisible()
|
||||
inventoryWindow:setVisible(visible)
|
||||
inventoryButton:setOn(visible)
|
||||
end
|
||||
|
||||
|
@@ -2,12 +2,10 @@ MiniWindow
|
||||
id: inventoryMiniWindow
|
||||
text: Inventory
|
||||
icon: inventory.png
|
||||
width: 192
|
||||
height: 154
|
||||
height: 180
|
||||
@onClose: Inventory.toggle()
|
||||
|
||||
MiniWindowContents
|
||||
id: inventoryPanel
|
||||
|
||||
Item
|
||||
// head
|
||||
id: slot1
|
||||
@@ -37,7 +35,6 @@ MiniWindow
|
||||
anchors.top: prev.bottom
|
||||
anchors.horizontalCenter: prev.horizontalCenter
|
||||
margin-top: 5
|
||||
margin-bottom: 10
|
||||
&position: {x=65535, y=8, z=0}
|
||||
|
||||
Item
|
||||
|
Reference in New Issue
Block a user