Advertisement
Subsidedgibbon0

OS

Jan 31st, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Variables
  2. version = 7.1
  3. running = true
  4.  
  5. --Images
  6. _dt = paintutils.loadImage("dt")
  7. _dt2 = paintutils.loadImage("dt2")
  8. _shutdown = paintutils.loadImage("/.shutdown/apagado")
  9. _shutdown2 = paintutils.loadImage("/.shutdown/apagado2")
  10. _shutdown3 = paintutils.loadImage("/.shutdown/apagado3")
  11. _shutdown4 = paintutils.loadImage("/.shutdown/apagado4")
  12. _shutdown5 = paintutils.loadImage("/.shutdown/apagado5")
  13. _shutdown6 = paintutils.loadImage("/.shutdown/apagado6")
  14. _shutdown7 = paintutils.loadImage("/.shutdown/apagado7")
  15. _shutdown8 = paintutils.loadImage("/.shutdown/apagado8")
  16. _shutdown9 = paintutils.loadImage("/.shutdown/apagado9")
  17. _shutdown10 = paintutils.loadImage("/.shutdown/apagado10")
  18. _shutdown11 = paintutils.loadImage("/.shutdown/apagado11")
  19. _shutdown12 = paintutils.loadImage("/.shutdown/apagado12")
  20. _shutdown13 = paintutils.loadImage("/.shutdown/apagado13")
  21. _shutdown14 = paintutils.loadImage("/.shutdown/apagado14")
  22.  
  23. --Colors
  24.  
  25.  
  26. --Booleans
  27. _ms = 0
  28. _rcm = 0
  29.  
  30. --Functions
  31. clear = function()
  32. term.setBackgroundColor(colors.black)
  33. term.clear()
  34. term.setCursorPos(1 ,1)
  35.  
  36. end
  37.  
  38. drawMenu1 = function()
  39. term.setCursorPos(1, 2)
  40. term.setBackgroundColor( colors.blue )
  41. term.setTextColor( colors.white )
  42. print( "Apagar" )
  43.  
  44. end
  45.  
  46. ReDraw = function()
  47.  
  48. drawDeskTop()
  49. drawTaskBar()
  50.  
  51. end
  52.  
  53. drawTaskBar = function()
  54. term.setCursorPos(1, 1)
  55. --term.setBackgroundColor( colTaskBar )
  56. term.clearLine()
  57. term.setCursorPos( 1, 1 )
  58. term.setBackgroundColor( colors.lime )
  59. term.setTextColor( colors.white )
  60. term.write( "Inicio" )
  61.  
  62. end
  63.  
  64. drawRightClickMenu = function(x, y)
  65. term.setCursorPos(x, y)
  66. term.setBackgroundColor(colors.white)
  67. term.setTextColor(colors.black)
  68. term.write(" LUA ")
  69. term.setCursorPos(x, y+1)
  70. term.write(" IDE ")
  71. local event, button, xPos, yPos = os.pullEvent("mouse_click")
  72. while true do
  73. if button ==1 and yPos == y and xPos <= (x+9) and xPos >= x then
  74. running = false
  75. clear()
  76. term.setTextColor( colors.red )
  77. print("Abriendo Simbolo de Sistema...")
  78. print("El sistema podria apagarse tras salir del Simbolo de Sistema")
  79. print("Ninguna funcion del Sistema esta en las funciones de LUA ahora")
  80. shell.run("lua")
  81. break
  82. elseif button == 1 and yPos == (y+1) and xPos <= (x+9) and xPos >= x then
  83. shell.run("edit", "/gui")
  84. init()
  85. break
  86. else
  87. ReDraw()
  88. break
  89. end
  90. end
  91. _rcm = 0
  92. end
  93.  
  94. drawDeskTop = function()
  95. term.setBackgroundColor( colBackground)
  96. term.clear()
  97. term.setCursorPos(1 ,1)
  98. paintutils.drawImage(_dt, 1, 1)
  99.  
  100. end
  101.  
  102. closingSesion = function()
  103. paintutils.drawImage(_shutdown, 1, 1)
  104. term.setCursorPos(18 ,9)
  105. print("Cerrando sesion")
  106. term.setCursorPos(1 ,1)
  107. sleep(1)
  108. shell.run("clear")
  109. paintutils.drawImage(_shutdown4, 1, 1)
  110. term.setCursorPos(18 ,9)
  111. print("Cerrando sesion")
  112. term.setCursorPos(1 ,1)
  113. sleep(2)
  114. shell.run("clear")
  115. paintutils.drawImage(_shutdown7, 1, 1)
  116. term.setCursorPos(18 ,9)
  117. print("Cerrando sesion")
  118. term.setCursorPos(1 ,1)
  119. sleep(2)
  120. shell.run("clear")
  121. paintutils.drawImage(_shutdown12, 1, 1)
  122. term.setCursorPos(18 ,9)
  123. print("Cerrando sesion")
  124. term.setCursorPos(1 ,1)
  125. sleep(3)
  126.  
  127. paintutils.drawImage(_shutdown, 1, 1)
  128. term.setCursorPos(18 ,9)
  129. print("Apagando equipo")
  130. term.setCursorPos(1 ,1)
  131. sleep(1)
  132. shell.run("clear")
  133. paintutils.drawImage(_shutdown4, 1, 1)
  134. term.setCursorPos(18 ,9)
  135. print("Apagando equipo")
  136. term.setCursorPos(1 ,1)
  137. sleep(2)
  138. shell.run("clear")
  139. paintutils.drawImage(_shutdown7, 1, 1)
  140. term.setCursorPos(18 ,9)
  141. print("Apagando equipo")
  142. term.setCursorPos(1 ,1)
  143. sleep(2)
  144. shell.run("clear")
  145. paintutils.drawImage(_shutdown12, 1, 1)
  146. term.setCursorPos(18 ,9)
  147. print("Apagando equipo")
  148. term.setCursorPos(1 ,1)
  149. sleep(3)
  150. shell.run("shutdown")
  151.  
  152.  
  153. end
  154.  
  155. loadConfig = function()
  156.  
  157. end
  158.  
  159.  
  160.  
  161. stop = function()
  162.  
  163.  
  164. clear()
  165. running = false
  166. paintutils.drawImage(_dt2, 1, 1)
  167. term.setCursorPos(18 ,9)
  168. term.setTextColor( colors.black )
  169. print("Apagando equipo")
  170. sleep(2)
  171. clear()
  172. term.setCursorPos(18 ,9)
  173. print("Cerrando sesion")
  174. exit()
  175.  
  176.  
  177. end
  178.  
  179. runTime = function()
  180. while running do
  181. event, button, x, y = os.pullEvent("mouse_click")
  182. if _ms == 0 and button == 1 and x < 10 and y == 1 then
  183. drawMenu1()
  184. _ms = 1
  185. elseif _ms == 1 and button == 1 and y == 2 and x < 10 then
  186. stop()
  187. elseif _ms == 1 and button == 1 and x < 10 and y == 1 then
  188. init()
  189. elseif _ms == 0 and _rcm == 0 and button == 2 then
  190. drawRightClickMenu(x, y)
  191. _rcm = 1
  192. elseif _ms == 0 and _rcm == 1 and x > 52 and y > 20 then
  193. drawDeskTop()
  194. _rcm = 0
  195. end
  196. end
  197. end
  198.  
  199. init = function()
  200. _ms = 0
  201. _rcm = 0
  202. drawDeskTop()
  203. drawTaskBar()
  204. runTime()
  205.  
  206. end
  207.  
  208. --Main Stuff
  209.  
  210. init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement