Advertisement
PolskiWisnia

Untitled

Sep 6th, 2019
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.37 KB | None | 0 0
  1. local function s(...) return sleep(...) end
  2. local function w(...) return write(...) end
  3. local function p(...) return print(...) end
  4. local function tw(...) return term.write(...) end
  5. local function scp(...) return term.setCursorPos(...) end
  6. local function sbc(...) return term.setBackgroundColor(...) end
  7. local function stc(...) return term.setTextColor(...) end
  8. local function tc(...) return term.clear(...) end
  9. local function tcl(...) return term.clearLine(...) end
  10. local function r(...) return shell.run(...) end
  11. local function sp(...) return textutils.slowPrint(...) end
  12. local function sw(...) return textutils.slowWrite(...) end
  13. local function fse(...) return fs.exists(...) end
  14. local function pul(...) return paintutils.loadImage(...) end
  15. local function pud(...) return paintutils.drawImage(...) end
  16. local function pfb(...) return paintutils.drawFilledBox(...) end
  17. local function su(...) return os.shutdown(...) end
  18. local function re(...) return os.reboot(...) end
  19. local function pdp(...) return paintutils.drawPixel(...) end
  20. function start()
  21. pfb(1, 11, 20, 18, colors.white)
  22. scp(1,10)
  23. stc(colors.white)
  24. sbc(colors.black)
  25. p("NextUI Start        ")
  26. scp(1,11)
  27. p("Zainstaluj z dysku  ")
  28. p("Paint               ")
  29. p("2048                ")
  30. p("Snake               ")
  31. p("Edytor              ")
  32. p("Powrot do CraftOS   ")
  33. p("Ustawienia          ")
  34. p("Ikony pulpitu       ")
  35. sbc(colors.white)
  36. stc(colors.black)
  37. scp(1,10)
  38. p("NextUI Start        ")
  39. local event, click, x, y = os.pullEvent("mouse_click")
  40. if x>0 and x<21 and y == 11 then dysk() end
  41. if x>0 and x<21 and y == 18 then ikony() end
  42. if x>0 and x<21 and y == 16 then error("Opuszczono NextUI 1.0. Aby powrocic wpisz /os/.next") end
  43. if x>0 and x<21 and y == 14 then sbc(colors.black) r("worm") end
  44. if x>0 and x<21 and y == 12 then r("/os/.paint") end
  45. if x>0 and x<21 and y == 17 then ust() end
  46. if x>0 and x<21 and y == 13 then r("/os/.2048") end
  47. if x>0 and x<21 and y == 15 then r("/os/.luaide")
  48. end
  49. end
  50. function getSize(path)
  51.   local size = 0
  52.   for _, file in ipairs(fs.list(path)) do
  53.     if fs.isDir(fs.combine(path, file)) then
  54.       size = size + getSize(fs.combine(path, file))
  55.     else
  56.       size = size + fs.getSize(fs.combine(path, file))
  57.     end
  58.   end
  59.   return size
  60. end
  61. function obraz()
  62. sbc(colors.black)
  63. tc()
  64. sbc(colors.black)
  65. pfb(6, 19, 49, 19, colors.blue)
  66. sbc(colors.green)
  67. stc(colors.white)
  68. scp(1,19)
  69. w("Start")
  70. pdp(50,19, colors.red)
  71. pdp(51,19, colors.orange)
  72. pfb(1, 1, 51, 1, colors.blue)
  73. scp(1,1)
  74. sbc(colors.blue)
  75. stc(colors.white)
  76. p("Zarzadzanie aplikacjami")
  77. pfb(3, 3, 5, 3, colors.gray)
  78. pdp(3, 3, colors.lightGray)
  79. scp(6,3)
  80. stc(colors.white)
  81. sbc(colors.black)
  82. miejsce = math.ceil(fs.getFreeSpace("/")/1024)
  83. p("Dysk twardy   Wolne miejsce: ", miejsce, "KB")
  84. scp(1,6)
  85. p("Aplikacje:")
  86. scp(6,8)
  87. stc(colors.white)
  88. sbc(colors.black)
  89. if fs.exists("/nshop/") then rozmiar = math.ceil(getSize("/nshop/")/1024) else
  90. scp(1,7) sbc(colors.black) stc(colors.white) p("Brak dostepnych aplikacji") end
  91. if fs.exists("/nshop/.exp") then pfb(3, 8, 5, 8, colors.blue) scp(6,8) stc(colors.white) sbc(colors.black) p("Eksplorator      Rozmiar na dysku: ", rozmiar, "KB") scp(1,8) stc(colors.white) sbc(colors.red) p("X") end
  92. end
  93. while true do
  94. obraz()
  95. local event, click, x, y = os.pullEvent("mouse_click")
  96. if x>0 and x<6 and y == 19 then start() end
  97. if x == 1 and y == 8 then fs.delete("/nshop/.exp") end
  98. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement