This commit is contained in:
OTCv8
2020-11-16 08:43:23 +01:00
parent a4f9250ddb
commit 2d1cbaae12
141 changed files with 14564 additions and 106 deletions

View File

@@ -1,9 +1,14 @@
local gameStart = 0
function init()
connect(Container, { onOpen = onContainerOpen,
onClose = onContainerClose,
onSizeChange = onContainerChangeSize,
onUpdateItem = onContainerUpdateItem })
connect(Game, { onGameEnd = clean() })
connect(g_game, {
onGameStart = markStart,
onGameEnd = clean
})
reloadContainers()
end
@@ -13,7 +18,10 @@ function terminate()
onClose = onContainerClose,
onSizeChange = onContainerChangeSize,
onUpdateItem = onContainerUpdateItem })
disconnect(Game, { onGameEnd = clean() })
disconnect(g_game, {
onGameStart = markStart,
onGameEnd = clean
})
end
function reloadContainers()
@@ -29,6 +37,10 @@ function clean()
end
end
function markStart()
gameStart = g_clock.millis()
end
function destroy(container)
if container.window then
container.window:destroy()
@@ -93,7 +105,12 @@ function onContainerOpen(container, previousContainer)
else
containerWindow = g_ui.createWidget('ContainerWindow', modules.game_interface.getContainerPanel())
end
containerWindow:setId('container' .. container:getId())
containerWindow:setId('container' .. container:getId() .. '_' .. container:getName())
if gameStart + 1000 < g_clock.millis() then
containerWindow:clearSettings()
end
local containerPanel = containerWindow:getChildById('contentsPanel')
local containerItemWidget = containerWindow:getChildById('containerItemWidget')
containerWindow.onClose = function()