mirror of
https://github.com/kepler155c/opus
synced 2024-12-24 15:40:26 +00:00
slide out for UI + turtle.has
This commit is contained in:
parent
a8a4ceb85d
commit
0df22efdc2
@ -95,7 +95,7 @@ function Manager:init()
|
||||
singleThread('monitor_touch', function(side, x, y)
|
||||
if self.currentPage then
|
||||
if self.currentPage.parent.device.side == side then
|
||||
self:click(1, x, y)
|
||||
self:click('mouse_click', 1, x, y)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@ -2320,6 +2320,39 @@ function UI.Wizard:eventHandler(event)
|
||||
end
|
||||
end
|
||||
|
||||
--[[-- SlideOut --]]--
|
||||
UI.SlideOut = class(UI.Window)
|
||||
UI.SlideOut.defaults = {
|
||||
UIElement = 'SlideOut',
|
||||
}
|
||||
function UI.SlideOut:setParent()
|
||||
UI.Window.setParent(self)
|
||||
self.canvas = self:addLayer()
|
||||
end
|
||||
|
||||
function UI.SlideOut:enable()
|
||||
self.enabled = false
|
||||
end
|
||||
|
||||
function UI.SlideOut:show()
|
||||
self:addTransition('expandUp')
|
||||
self.canvas:setVisible(true)
|
||||
self.enabled = true
|
||||
for _,child in pairs(self.children) do
|
||||
child:enable()
|
||||
end
|
||||
self:focusFirst()
|
||||
self:draw()
|
||||
UI:capture(self)
|
||||
end
|
||||
|
||||
function UI.SlideOut:hide()
|
||||
self:disable()
|
||||
self.canvas:setVisible(false)
|
||||
UI:release(self)
|
||||
self:refocus()
|
||||
end
|
||||
|
||||
--[[-- Notification --]]--
|
||||
UI.Notification = class(UI.Window)
|
||||
UI.Notification.defaults = {
|
||||
|
@ -786,6 +786,11 @@ function turtle.getSummedInventory()
|
||||
return t
|
||||
end
|
||||
|
||||
function turtle.has(item, count)
|
||||
local slot = turtle.getSummedInventory()[item]
|
||||
return slot and slot.count >= (count or 1)
|
||||
end
|
||||
|
||||
function turtle.getFilledSlots(startSlot)
|
||||
startSlot = startSlot or 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user