Advertisement
PolskiWisnia

Untitled

Mar 6th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. -- Oprogramowanie skladowe/instalator systemow/czesc skladowa stworzonych przez uzytkownika serwisu Discord - Wisnia#5536 --
  2. -- Jesli zaplaciles za to oprogramowanie zostales oszukany. --
  3. -- Zakazuje sie kopiowania oprogramowania bez zgody autora, czerpania korzysci materialnych, podpisywania sie pod oprogramowaniem --
  4. -- Dozwolone jest tworzenie modyfikacji oprogramowania badz jego czesci wylacznie wtedy, gdy widoczna jest informacja o oryginalnym autorze --
  5. -- Kompletna EULA dostepna jest na serwerze Discord: CRfXMXU --
  6. os.pullEvent = os.pullEventRaw
  7. local w,h = term.getSize()
  8.  
  9. function printCentered( y,s )
  10. local x = math.floor((w - string.len(s)) / 2)
  11. term.setCursorPos(x,y)
  12. term.clearLine()
  13. term.write( s )
  14. end
  15.  
  16. local nOption = 1
  17.  
  18. local function drawMenu()
  19. term.clear()
  20. term.setCursorPos(1,1)
  21. term.write("Minedows v2.0 ")
  22.  
  23.  
  24. term.setCursorPos(w-11,1)
  25. if nOption == 1 then
  26. term.write("CMD")
  27. elseif nOption == 2 then
  28. term.write("Programy")
  29. elseif nOption == 3 then
  30. term.write("Wylacz ")
  31. else
  32. end
  33.  
  34. end
  35.  
  36. --GUI
  37. term.setBackgroundColor(colors.cyan)
  38. term.clear()
  39. term.setBackgroundColor(colors.cyan)
  40. term.setTextColor(colors.white)
  41. local function drawFrontend()
  42. printCentered( math.floor(h/2) - 3, "")
  43. printCentered( math.floor(h/2) - 2, "Menu Start" )
  44. printCentered( math.floor(h/2) - 1, "")
  45. printCentered( math.floor(h/2) + 0, ((nOption == 1) and "[ CMD ]") or "CMD" )
  46. printCentered( math.floor(h/2) + 1, ((nOption == 2) and "[ Programy ]") or "Programy" )
  47. printCentered( math.floor(h/2) + 2, ((nOption == 3) and "[ Wylacz ]") or "Wylacz" )
  48. printCentered( math.floor(h/2) + 4, "")
  49. end
  50.  
  51. --Display
  52. drawMenu()
  53. drawFrontend()
  54.  
  55. while true do
  56. local e,p = os.pullEvent()
  57. if e == "key" then
  58. local key = p
  59. if key == 17 or key == 200 then
  60.  
  61. if nOption > 1 then
  62. nOption = nOption - 1
  63. drawMenu()
  64. drawFrontend()
  65. end
  66. elseif key == 31 or key == 208 then
  67. if nOption < 4 then
  68. nOption = nOption + 1
  69. drawMenu()
  70. drawFrontend()
  71. end
  72. elseif key == 28 then
  73. --End should not be here!!
  74. break
  75. end --End should be here!!
  76. end
  77. end
  78. term.clear()
  79.  
  80. --Conditions
  81. if nOption == 1 then
  82. shell.run("os/.cmd")
  83. elseif nOption == 2 then
  84. shell.run("os/.programy")
  85. elseif nOption == 3 then
  86. os.shutdown()
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement