Advertisement
Good_Pudge

Code: Security

Sep 11th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1. --Подключили модули--
  2. local gp = require("GPAPI")
  3. local comp = require("computer")
  4. local com,gpu,term,color,unicode,seri = gp.require()
  5.  
  6. --Проверяем экран--
  7. if gpu.maxResolution() < 80 then
  8.     print("Ваш экран I уровня. Нужен хотя бы II")
  9.     os.exit()
  10. end
  11.  
  12. --Переменные--
  13. local StyleBackground = color.gray
  14. local StyleForeground = color.white
  15. local char = string.char()
  16.  
  17. --Сохранили старые настройки--
  18. local OldB,OldF,OldW,OldH = gp.saveOld()
  19.  
  20. --Поставили новые настройки--
  21. gpu.setResolution(80,25)
  22. gpu.setBackground(StyleBackground,true)
  23. gpu.setForeground(color.green,true)
  24.  
  25. --Отрисовка начального интерфейса--
  26. gp.textbox(_,2,"Code: Security","center")
  27. gp.textBox(_,24,char("U+2699").." Выйти","right",_,StyleForeground)
  28. gp.textbox()
  29.  
  30. --Выбор типов защиты--
  31. gp.textbox(_,4,"Магнитная","center")
  32. gp.textbox(_,6,"RFID","center")
  33. gp.textbox(_,8,"Отпечаток пальца ноги","center")
  34. gp.textbox(_,10,"Детектор движения","center")
  35. gp.textbox(_,12,"Детектор душ","center")
  36. gp.textbox(_,14,"Keypad","center")
  37. gp.charStolb(30,4,6,"U+2610")
  38.  
  39. --Стартовый цикл--
  40. while true do
  41.     local typeT,_,sX,sY,button,nick = comp.pullSignal(0,"touch") --Захват сигнала касания
  42.  
  43.     --Кнопки--
  44.     gp.button(sX,sY,70,24,5,1,GPAPI.exit,OldB,OldF,OldW,OldH)
  45.    
  46.     if typeT == "touch" then
  47.         if sX >= 70 and sX < 75 then
  48.             if sY >= 24 and sY < 25 then
  49.                 goto Settings
  50.             end
  51.         end
  52.     end
  53.  
  54. end
  55.  
  56. --Цикл для меню настройки--
  57. ::Settings::
  58. term.clear()
  59. gp.textbox(_,2,"Code: Security","center")
  60. gp.textBox(_,24,"Выйти","right",_,StyleForeground)
  61. gp.textbox(_,2,"Вернуться")
  62.  
  63. while true do
  64.     local typeT,_,sX,sY,button,nick = comp.pullSignal(0,"touch") --Захват сигнала касания
  65.  
  66.     --Кнопки--
  67.     gp.button(sX,sY,70,24,5,1,GPAPI.exit,OldB,OldF,OldW,OldH)
  68. end
  69.  
  70. --Ставим старые настройки--
  71. gp.setOld(OldB,OldF,OldW,OldH)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement