mirror of https://github.com/kepler155c/opus
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)
|
singleThread('monitor_touch', function(side, x, y)
|
||||||
if self.currentPage then
|
if self.currentPage then
|
||||||
if self.currentPage.parent.device.side == side then
|
if self.currentPage.parent.device.side == side then
|
||||||
self:click(1, x, y)
|
self:click('mouse_click', 1, x, y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -2320,6 +2320,39 @@ function UI.Wizard:eventHandler(event)
|
||||||
end
|
end
|
||||||
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 --]]--
|
--[[-- Notification --]]--
|
||||||
UI.Notification = class(UI.Window)
|
UI.Notification = class(UI.Window)
|
||||||
UI.Notification.defaults = {
|
UI.Notification.defaults = {
|
||||||
|
|
|
@ -786,6 +786,11 @@ function turtle.getSummedInventory()
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function turtle.has(item, count)
|
||||||
|
local slot = turtle.getSummedInventory()[item]
|
||||||
|
return slot and slot.count >= (count or 1)
|
||||||
|
end
|
||||||
|
|
||||||
function turtle.getFilledSlots(startSlot)
|
function turtle.getFilledSlots(startSlot)
|
||||||
startSlot = startSlot or 1
|
startSlot = startSlot or 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue