Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unicode = require('unicode')
- component = require('component')
- gpu = component.gpu
- gpu.setResolution(100,40)
- local GUI = require('GUI')
- local event=require("event")
- ------------------
- local items = {
- { name = "Древние обломки", qty = 27 },
- { name = "Сигнальный факел", qty = 48 },
- { name = "Тыква с вырезанным лицом", qty = 6 },
- { name = "Алмазная кирка", qty = 14 },
- { name = "Зачарованное золотое яблоко", qty = 52 },
- { name = "Бродячая паутина", qty = 61 },
- { name = "Бутылка", qty = 42 },
- { name = "Блок медового сота", qty = 22 },
- { name = "Железный нагрудник", qty = 29 },
- { name = "Фонарь из тыквы", qty = 35 },
- { name = "Водоросли", qty = 63 },
- { name = "Лестница", qty = 7 },
- { name = "Блок магмы", qty = 52 },
- { name = "Кирка из нефрита", qty = 14 },
- { name = "Обсидиан", qty = 54 },
- { name = "Отполированный чернокамень", qty = 45 },
- { name = "Кварцевый столб", qty = 48 },
- { name = "Редстоун-повторитель", qty = 15 },
- { name = "Песок душ", qty = 11 },
- { name = "Череп черепахи", qty = 24 },
- { name = "Мембрана векса", qty = 28 },
- { name = "Яйцо спауна скитающегося торговца", qty = 8 },
- { name = "Бутылка опыта", qty = 16 },
- { name = "Желтая шерсть", qty = 44 },
- { name = "Яйцо спауна свинолюда", qty = 57 },
- { name = "Яйцо спауна старших стражей", qty = 62 },
- { name = "Предмет платежей маяка", qty = 61 },
- { name = "Морковь на палочке", qty = 60 },
- { name = "Алмазные ботинки", qty = 3 },
- { name = "Зачарованная книга", qty = 21 },
- { name = "Падение с высоты", qty = 46 },
- { name = "Стеклянная панель", qty = 10 },
- { name = "Люк", qty = 20 },
- { name = "Музыкальный блок", qty = 51 },
- }
- local WIDTH,HEIGHT = gpu.getResolution()
- local defBG, defFG = gpu.getBackground(),gpu.getForeground()
- local gui = GUI:new()
- :setBackground(0x262626)
- :setForeground(0xCCCCCC)
- :clear()
- -- gui:printBySymbol('Проснись, Нео!',10,9)
- -- os.sleep(1)
- gui:clear()
- local frame = gui:create(GUI.components.frame)
- :new()
- -- :new(WIDTH-10,HEIGHT-4, 5, 2)
- :draw():drawTitle('Title 2')
- frame:drawTitle('"Hello World" by Rijen','bottom')
- local actions = {
- function()
- gpu.fill(3,5,WIDTH-21,1,' ')
- gui:printBySymbol('Ай!',3,5)
- end,
- function()
- gpu.fill(3,5,WIDTH-21,1,' ')
- gui:printBySymbol('Ой!',3,5)
- end,
- function()
- gpu.fill(3,5,WIDTH-21,1,' ')
- gui:printBySymbol('Перестань!',3,5)
- end,
- }
- gui:create(GUI.components.smallButton)
- :new('Кнопочка 1', 2, 38):draw()
- :on('touch',actions[1])
- gui:create(GUI.components.button)
- :new('Кнопочка 2', 2, 1, 18):draw()
- :on('touch',actions[2])
- gui:create(GUI.components.button)
- :new('Кнопочка 3', 22, 1, 18):draw()
- :on('touch',actions[3])
- -- gpu.fill(2,2,WIDTH-21,1,' ')
- -- gui:printBySymbol('Следуй за белым кроликом...',2,2)
- gui:create(GUI.components.table)
- :new(35,20,2,6)
- -- :draw()
- :setRows(items)
- :drawRows()
- itemSel = gui:create(GUI.components.itemSelector)
- :new(37, 6, 39, 6)
- :draw()
- -- gpu.set(3, 30, '₪ - Доступна переработка')
- -- gpu.set(3, 31, '$ - Доступна продажа')
- local preventDefault = false
- function handleEvent(eventID,...)
- local args = {...}
- if eventID == 'touch'
- or eventID == 'scroll' then
- local action = gui.eventMatrix[args[2]][args[3]][eventID]
- if action then
- action(...)
- preventDefault = true
- return true
- end
- elseif eventID == 'interrupted' then
- gui:setBackground(defBG)
- :setForeground(defFG)
- :clear()
- os.exit()
- return true
- elseif eventID == 'gui.table.select' then
- itemSel.itemName = items[args[1]].name
- itemSel:draw()
- elseif eventID == 'gui.table.deselect' then
- itemSel.itemName = 'Выберите предмет из списка'
- itemSel:draw()
- end
- -- print(eventID,...)
- end
- while 1 do
- preventDefault = false
- handleEvent(event.pull())
- -- if preventDefault==false then
- -- gpu.fill(3,5,WIDTH-21,1,' ')
- -- gui:printBySymbol('Следуй за белым кроликом...',3,5,true)
- -- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement