Advertisement
LepzinTM

gui

Oct 22nd, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.75 KB | None | 0 0
  1. --Varibles
  2.   version = "2.1"
  3.   running = true
  4.  
  5.  
  6.   --Images
  7.   _dt = paintutils.loadImage("/1")
  8.   system = paintutils.loadImage("/sys")
  9.  
  10.   --Booleans
  11.   _ms = 0
  12.   _rcm = 0
  13.    
  14. --Functions
  15.   clear = function()
  16.     term.setBackgroundColor(colors.black)
  17.     term.clear()
  18.     term.setCursorPos(1, 1)
  19.   end
  20.  
  21.   drawMenu1 = function()
  22.     term.setCursorPos(1, 18)
  23.     term.setBackgroundColor( colors.blue )
  24.     term.setTextColor( colors.white )
  25.     print("Desligar          ")
  26.     term.setCursorPos(1, 17)
  27.     term.setBackgroundColor(colors.blue)
  28.     term.setTextColor(colors.white)
  29.     print("Reiniciar         ")
  30.     term.setCursorPos(1, 16)
  31.     term.setBackgroundColor(colors.lightBlue)
  32.     term.setTextColor(colors.lightBlue)
  33.     print("AAAAAAAAAAAAAAAAAA")
  34.     term.setCursorPos(1, 15)
  35.     term.setBackgroundColor(colors.lightBlue)
  36.     term.setTextColor(colors.black)
  37.     print("Jogo da Minhoca   ")
  38.     term.setCursorPos(1, 14)
  39.     term.setBackgroundColor(colors.lightBlue)
  40.     term.setTextColor(colors.black)
  41.     print("Aventura          ")
  42.     term.setCursorPos(1, 13)
  43.     term.setBackgroundColor(colors.lightBlue)
  44.     term.setTextColor(colors.black)
  45.     print("CraftOS           ")
  46.     term.setCursorPos(1, 12)
  47.     term.setBackgroundColor(colors.lightBlue)
  48.     term.setTextColor(colors.black)
  49.     print("Monitor           ")
  50.     term.setCursorPos(1, 11)
  51.     term.setBackgroundColor(colors.lightBlue)
  52.     term.setTextColor(colors.black)
  53.     print("Paint!            ")
  54.     term.setCursorPos(1, 10)
  55.     term.setBackgroundColor(colors.lightBlue)
  56.     term.setTextColor(colors.black)
  57.     print("TextEdit++        ")
  58.     term.setCursorPos(1, 9)
  59.     term.setBackgroundColor(colors.lightBlue)
  60.     term.setTextColor(colors.black)
  61.     print("Versao do sistema ")
  62.     term.setCursorPos(1, 8)
  63.     term.setBackgroundColor(colors.lightBlue)
  64.     term.setTextColor(colors.black)
  65.     print("Discar iG         ")
  66.     term.setCursorPos(1, 7)
  67.     term.setBackgroundColor(colors.lightBlue)
  68.     term.setTextColor(colors.lightBlue)
  69.     print("AAAAAAAAAAAAAAAAAA")
  70.     term.setCursorPos(1, 6)
  71.     term.setBackgroundColor(colors.blue)
  72.     term.setTextColor(colors.white)
  73.     print("  Admin           ")
  74.  
  75.   end
  76.  
  77.   rightClickMenu = function(x, y)
  78.     term.setCursorPos(x, y)
  79.     term.setBackgroundColor(colors.white)
  80.     term.setTextColor(colors.black)
  81.     print(" Prompt de comando ")
  82.     term.setCursorPos(x, y+1)
  83.     print(" Config.           ")
  84.     term.setCursorPos(x, y+2)
  85.     print(" Personalizar      ")
  86.     term.setCursorPos(x, y+3)
  87.     print(" Senha             ")
  88.     local event, button, xPos, yPos = os.pullEvent("mouse_click")
  89.     while true do
  90.       if button ==1 and yPos == y and xPos <= (x+7) and xPos >= x then
  91.         clear()
  92.         running = false
  93.         term.setTextColor(colors.lime)
  94.         print("Prompt do LepOS foi aberto")
  95.         shell.run("lua")
  96.         restart()
  97.         break
  98.       elseif button == 1 and yPos == y+1 and xPos <= (x+19) and xPos >= x then
  99.         clear()
  100.         shell.run("edit", "/gui")
  101.         restart()
  102.         break
  103.       elseif button == 1 and yPos == y+2 and xPos <= (x+19) and xPos >= x then
  104.         shell.run("paint", "/1")
  105.         restart()
  106.         break
  107.       elseif button == 1 and yPos == y+3 and xPos <= (x+19) and xPos >= x then
  108.         clear()
  109.         shell.run("edit", "/pass")
  110.         restart()
  111.         break  
  112.       else
  113.         init()
  114.         break
  115.       end
  116.     end
  117.     _rcm = 0      
  118.   end
  119.  
  120.    
  121.   drawTaskBar = function()
  122.     term.setCursorPos(1, 19)
  123.     term.setBackgroundColor( colors.blue )
  124.     term.clearLine()
  125.     term.setCursorPos(1, 19)
  126.     term.setBackgroundColor( colors.lime )
  127.     term.setTextColor( colors.black )
  128.     term.write(" Iniciar")
  129.   end
  130.  
  131.   drawDeskTop = function()
  132.     term.setBackgroundColor(colors.lightBlue)
  133.     term.clear()
  134.     paintutils.drawImage(_dt, 1, 1)
  135.   end
  136.  
  137.   stop = function()
  138.     clear()
  139.     running = false
  140.      term.setCursorPos(17, 10)
  141.     term.setBackgroundColor(colors.lightBlue)
  142.     term.clear()
  143.     term.setTextColor(colors.black)
  144.     print("Fazendo Logoff...")
  145.     sleep(2)
  146.     term.setCursorPos(20, 10)
  147.     term.setBackgroundColor(colors.lightBlue)
  148.     term.clear()
  149.     term.setTextColor(colors.black)
  150.     print("Encerrando...")
  151.     sleep(4)
  152.     os.shutdown()
  153.   end
  154.    
  155.   dialUp = function()
  156.     drawDeskTop()
  157.     drawTaskBar()
  158.     sleep(0,1)
  159.     paintutils.drawFilledBox(5, 3, 36, 10, colors.white)
  160.     paintutils.drawPixel(5, 3, colors.blue)
  161.     paintutils.drawPixel(6, 3, colors.blue)
  162.     paintutils.drawPixel(7, 3, colors.blue)
  163.     paintutils.drawPixel(8, 3, colors.blue)
  164.     paintutils.drawPixel(9, 3, colors.blue)
  165.     paintutils.drawPixel(10, 3, colors.blue)
  166.     paintutils.drawPixel(11, 3, colors.blue)
  167.     paintutils.drawPixel(12, 3, colors.blue)
  168.     paintutils.drawPixel(13, 3, colors.blue)
  169.     paintutils.drawPixel(14, 3, colors.blue)
  170.     paintutils.drawPixel(15, 3, colors.blue)
  171.     paintutils.drawPixel(16, 3, colors.blue)
  172.     paintutils.drawPixel(17, 3, colors.blue)
  173.     paintutils.drawPixel(18, 3, colors.blue)
  174.     paintutils.drawPixel(19, 3, colors.blue)
  175.     paintutils.drawPixel(20, 3, colors.blue)
  176.     paintutils.drawPixel(21, 3, colors.blue)
  177.     paintutils.drawPixel(22, 3, colors.blue)
  178.     paintutils.drawPixel(23, 3, colors.blue)
  179.     paintutils.drawPixel(24, 3, colors.blue)
  180.     paintutils.drawPixel(25, 3, colors.blue)
  181.     paintutils.drawPixel(26, 3, colors.blue)
  182.     paintutils.drawPixel(27, 3, colors.blue)
  183.     paintutils.drawPixel(28, 3, colors.blue)
  184.     paintutils.drawPixel(29, 3, colors.blue)
  185.     paintutils.drawPixel(30, 3, colors.blue)
  186.     paintutils.drawPixel(31, 3, colors.blue)
  187.     paintutils.drawPixel(32, 3, colors.blue)
  188.     paintutils.drawPixel(33, 3, colors.blue)
  189.     paintutils.drawPixel(34, 3, colors.blue)
  190.     paintutils.drawPixel(35, 3, colors.blue)
  191.     paintutils.drawPixel(36, 3, colors.red)            
  192.     term.setCursorPos(6, 4)
  193.     term.setBackgroundColor(colors.white)
  194.     term.setTextColor(colors.black)
  195.     print("Abrindo porta...")
  196.     sleep(0.5)
  197.     term.setCursorPos(6, 4)
  198.     print("Porta foi aberta")
  199.     sleep(0.5)
  200.     paintutils.drawFilledBox(5, 3, 36, 10, colors.white)
  201.     paintutils.drawPixel(5, 3, colors.blue)
  202.     paintutils.drawPixel(6, 3, colors.blue)
  203.     paintutils.drawPixel(7, 3, colors.blue)
  204.     paintutils.drawPixel(8, 3, colors.blue)
  205.     paintutils.drawPixel(9, 3, colors.blue)
  206.     paintutils.drawPixel(10, 3, colors.blue)
  207.     paintutils.drawPixel(11, 3, colors.blue)
  208.     paintutils.drawPixel(12, 3, colors.blue)
  209.     paintutils.drawPixel(13, 3, colors.blue)
  210.     paintutils.drawPixel(14, 3, colors.blue)
  211.     paintutils.drawPixel(15, 3, colors.blue)
  212.     paintutils.drawPixel(16, 3, colors.blue)
  213.     paintutils.drawPixel(17, 3, colors.blue)
  214.     paintutils.drawPixel(18, 3, colors.blue)
  215.     paintutils.drawPixel(19, 3, colors.blue)
  216.     paintutils.drawPixel(20, 3, colors.blue)
  217.     paintutils.drawPixel(21, 3, colors.blue)
  218.     paintutils.drawPixel(22, 3, colors.blue)
  219.     paintutils.drawPixel(23, 3, colors.blue)
  220.     paintutils.drawPixel(24, 3, colors.blue)
  221.     paintutils.drawPixel(25, 3, colors.blue)
  222.     paintutils.drawPixel(26, 3, colors.blue)
  223.     paintutils.drawPixel(27, 3, colors.blue)
  224.     paintutils.drawPixel(28, 3, colors.blue)
  225.     paintutils.drawPixel(29, 3, colors.blue)
  226.     paintutils.drawPixel(30, 3, colors.blue)
  227.     paintutils.drawPixel(31, 3, colors.blue)
  228.     paintutils.drawPixel(32, 3, colors.blue)
  229.     paintutils.drawPixel(33, 3, colors.blue)
  230.     paintutils.drawPixel(34, 3, colors.blue)
  231.     paintutils.drawPixel(35, 3, colors.blue)
  232.     paintutils.drawPixel(36, 3, colors.red)        
  233.     term.setCursorPos(6, 4)
  234.     term.setBackgroundColor(colors.white)
  235.     term.setTextColor(colors.black)
  236.     print("Discando")
  237.     term.setCursorPos(18, 4)
  238.     textutils.slowPrint("5702340003")
  239.     sleep(41)
  240.     term.setTextColor(colors.black)
  241.     term.setCursorPos(6, 4)
  242.     print("iG Conectado a 33,5 Kbps")
  243.     local event, button, x, y = os.pullEvent("mouse_click")
  244.     if button == 1 and y == y and x <= (x+1) and x >= x then
  245.       init()    
  246.     end            
  247.   end
  248.  
  249.   textEdit = function()
  250.     clear()
  251.     running = false
  252.     shell.run("edit", "arquivo1")
  253.     restart()
  254.   end
  255.  
  256.   paint = function()
  257.     clear()
  258.     running = false
  259.     shell.run("mkdir", "fotos")
  260.     sleep(0.1)
  261.     shell.run("paint", "/fotos/foto1")
  262.     restart()
  263.   end
  264.  
  265.   systemVersion = function()
  266.     drawDeskTop()
  267.     drawTaskBar()
  268.     sleep(0.1)
  269.     paintutils.drawFilledBox(1, 1, 49, 18, colors.white)
  270.     paintutils.drawImage(system, 1, 2)
  271.     term.setCursorPos(1, 1)
  272.     term.setBackgroundColor(colors.blue)
  273.     term.clearLine()
  274.     paintutils.drawPixel(49, 1, colors.red)
  275.     term.setCursorPos(7, 7)
  276.     term.setBackgroundColor(colors.white)
  277.     term.setTextColor(colors.black)
  278.     print("CyberOS 2.3 com SimSoft Plus!")
  279.     term.setCursorPos(7, 8)
  280.     print("Versao: 2.3 Plus!")
  281.     term.setCursorPos(7, 9)
  282.     print("Memoria livre do HD: 493.34 GB")
  283.     term.setCursorPos(7, 10)
  284.     print("Memoria RAM: 10 GB")
  285.     term.setCursorPos(7, 11)
  286.     print("Copyright (c) SimSoft 2017.")
  287.     local event, butto, x, y = os.pullEvent("mouse_click")
  288.     if button == 1 and y == y and x <= (x+49) and x >= x then
  289.       init()
  290.     end  
  291.   end
  292.  
  293.   playAdventure = function()
  294.     clear()
  295.     running = false
  296.     shell.run("adventure")
  297.     restart()
  298.   end
  299.  
  300.   playWorm = function()
  301.     clear()
  302.     running = false
  303.     shell.run("worm")
  304.     restart()
  305.   end
  306.  
  307.   reboot = function()
  308.     clear()
  309.     running = false
  310.     term.setCursorPos(17, 10)
  311.     term.setBackgroundColor(colors.lightBlue)
  312.     term.clear()
  313.     term.setTextColor(colors.black)
  314.     print("Fazendo Logoff...")
  315.     sleep(2)
  316.     term.setCursorPos(20, 10)
  317.     term.setBackgroundColor(colors.lightBlue)
  318.     term.clear()
  319.     term.setTextColor(colors.black)
  320.     print("Encerrando...")
  321.     sleep(4)
  322.     os.reboot()
  323.   end
  324.  
  325.   restart = function()
  326.     clear()
  327.     running = false
  328.     sleep(0,2)
  329.     term.setBackgroundColor(colors.gray)
  330.     sleep(0,2)
  331.     term.setBackgroundColor(colors.blue)
  332.     sleep(0,1)
  333.     shell.run("gui")
  334.   end    
  335.  
  336.   runTime = function()
  337.     while running do
  338.       event, button, x, y = os.pullEvent("mouse_click")
  339.       if _ms == 0 and button == 1 and x < 9 and y == 19 then
  340.         drawMenu1()
  341.         _ms = 1
  342.       elseif _ms == 1 and button == 1 and y == 18 and x < 19 then
  343.         stop()
  344.       elseif _ms == 1 and button == 1 and y == 17 and x < 19 then
  345.         reboot()
  346.       elseif _ms == 1 and button == 1 and y == 15 and x < 19 then
  347.         playWorm()
  348.       elseif _ms == 1 and button == 1 and y == 14 and x < 19 then
  349.         playAdventure()
  350.       elseif _ms == 1 and button == 1 and y == 13 and x < 19 then
  351.         clear()
  352.         running = false
  353.       elseif _ms == 1 and button == 1 and y == 12 and x < 19 then
  354.         clear()
  355.         running = false
  356.         shell.run("monitor", "monitor_2", "gui")
  357.         restart()
  358.       elseif _ms == 1 and button == 1 and y == 11 and x < 19 then
  359.         paint()
  360.       elseif _ms == 1 and button == 1 and y == 10 and x < 19 then
  361.         textEdit()
  362.       elseif _ms == 1 and button == 1 and y == 9 and x < 19 then
  363.         systemVersion()
  364.       elseif _ms == 1 and button == 1 and y == 8 and x < 19 then
  365.         dialUp()  
  366.       elseif _ms == 1 and button == 1 and x < 9 and y == 19 then
  367.         init()
  368.       elseif _ms == 0 and button == 1 and x < 1 and y == 1 then
  369.         init()          
  370.       elseif _ms == 0 and _rcm == 0 and button == 2 then
  371.         rightClickMenu(x ,y)
  372.         _rcm = 1  
  373.       end
  374.     end
  375.   end
  376.  
  377.  
  378.   init = function()
  379.     _ms = 0
  380.     _rcm = 0
  381.     drawDeskTop()
  382.     drawTaskBar()
  383.     runTime()
  384.   end
  385.  
  386.  
  387. --Main Stuff
  388. init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement