Atom888

XynSoft 0.0 - Setup

Jan 11th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.09 KB | None | 0 0
  1. os.loadAPI("/XynSoft/System/SystemCC/xs")
  2. xs.FS(colors.black)
  3. sleep(0.1)
  4. xs.FS(colors.gray)
  5. sleep(0.1)
  6. xs.FS(colors.lightGray)
  7. sleep(0.1)
  8. xs.FS(colors.white,false)
  9. xs.DrawTitleBar("XynSoft",colors.gray,2,"Setup")
  10. xs.Write("Username - ",7,8,colors.white,colors.black)
  11. xs.Write("Password - ",7,10,colors.white,colors.black)
  12. xs.Write("   Label - ",7,12,colors.white,colors.black)
  13. user = xs.Input("Username - ",7,8,colors.white,colors.black)
  14. pass = xs.Input("Password - ",7,10,colors.white,colors.black)
  15. labl = xs.Input("   Label - ",7,12,colors.white,colors.black)
  16. fs.open("/XynSoft/Data/User/Username","w")
  17. fs.close()  
  18. fs.open("/XynSoft/Data/User/Password","w")
  19. fs.close()  
  20. fs.open("/XynSoft/Data/Label","w")
  21. fs.close()
  22. xs.FS(colors.white,false,nil,nil)
  23. xs.DrawTitleBar("XynSoft",
  24. function UpdateColor(colr)
  25.    local col = colr
  26.    xs.F(h,1,col)
  27.    xs.F(h,2,col)
  28.    xs.F(h,3,col)
  29.    xs.Write("XynSoft 0.0",3,2,col,colors.white)
  30.    xs.Write("Setup",15,2,col,colors.lightGray)
  31.    xs.Button("Next",5,16,colr,colr)
  32.    syscol = colr
  33. end
  34. function UC()
  35.    local col = syscol
  36.    xs.FS(colors.white,false)
  37.    xs.DrawTitleBar("XynSoft",colors.gray,2,"Setup")
  38. end
  39. c1 = 7
  40. c2 = 9
  41. xs.Write("  ",16,8,colors.white,colors.yellow)
  42. xs.Write("  ",18,8,colors.white,colors.orange)
  43. xs.Write("  ",20,8,colors.white,colors.red)
  44. xs.Write("  ",22,8,colors.white,colors.lime)
  45. xs.Write("  ",24,8,colors.white,colors.green)
  46. xs.Write("  ",26,8,colors.white,colors.lightBlue)
  47. xs.Write("  ",28,8,colors.white,colors.blue)
  48. xs.Write("  ",30,8,colors.white,colors.pink)
  49. xs.Write("  ",32,8,colors.white,colors.magenta)
  50. xs.Write("  ",34,8,colors.white,colors.brown)
  51. a = true
  52. while a do
  53.    if xs.ShellEventAdv(mouse_click,1,16,17,8,8) then  
  54.       UpdateColor(colors.yellow)
  55.       CP(1,c1)
  56.       term.clearLine()
  57.       CP(1,c2)
  58.       term.clearLine()
  59.       xs.Write("__",16,c1,colors.white,colors.lightGray)
  60.       xs.Write("__",16,c2,colors.white,colors.lightGray)
  61.    
  62.    elseif xs.ShellEventAdv(mouse_click,1,18,19,8,8) then  
  63.      UpdateColor(colors.orange)
  64.      CP(1,c1)
  65.      term.clearLine()
  66.      CP(1,c2)
  67.      term.clearLine()
  68.      xs.Write("__",18,c1,colors.white,colors.lightGray)
  69.      xs.Write("__",18,c2,colors.white,colors.lightGray)
  70.  
  71.   elseif xs.ShellEventAdv(mouse_click,1,20,21,8,8) then  
  72.      UpdateColor(colors.red)
  73.      CP(1,c1)
  74.      term.clearLine()
  75.      CP(1,c2)
  76.      term.clearLine()
  77.      xs.Write("__",20,c1,colors.white,colors.lightGray)
  78.      xs.Write("__",20,c2,colors.white,colors.lightGray)
  79.  
  80.   elseif xs.ShellEventAdv(mouse_click,1,22,23,8,8) then  
  81.      UpdateColor(colors.lime)
  82.      CP(1,c1)
  83.      term.clearLine()
  84.      CP(1,c2)
  85.      term.clearLine()
  86.      xs.Write("__",22,c1,colors.white,colors.lightGray)
  87.      xs.Write("__",22,c2,colors.white,colors.lightGray)
  88.    
  89.   elseif xs.ShellEventAdv(mouse_click,1,24,25,8,8) then  
  90.      UpdateColor(colors.green)
  91.      CP(1,c1)
  92.      term.clearLine()
  93.      CP(1,c2)
  94.      term.clearLine()
  95.      xs.Write("__",24,c1,colors.white,colors.lightGray)
  96.      xs.Write("__",24,c2,colors.white,colors.lightGray)
  97.  
  98.   elseif xs.ShellEventAdv(mouse_click,1,26,27,8,8) then  
  99.      UpdateColor(colors.lightBlue)
  100.      CP(1,c1)
  101.      term.clearLine()
  102.      CP(1,c2)
  103.      term.clearLine()
  104.      xs.Write("__",26,c1,colors.white,colors.lightGray)
  105.      xs.Write("__",26,c2,colors.white,colors.lightGray)
  106.    
  107.   elseif xs.ShellEventAdv(mouse_click,1,28,29,8,8) then  
  108.      UpdateColor(colors.blue)
  109.      CP(1,c1)
  110.      term.clearLine()
  111.      CP(1,c2)
  112.      term.clearLine()
  113.      xs.Write("__",28,c1,colors.white,colors.lightGray)
  114.      xs.Write("__",28,c2,colors.white,colors.lightGray)
  115.    
  116.   elseif xs.ShellEventAdv(mouse_click,1,30,31,8,8) then  
  117.      UpdateColor(colors.pink)
  118.      CP(1,c1)
  119.      term.clearLine()
  120.      CP(1,c2)
  121.      term.clearLine()
  122.      xs.Write("__",30,c1,colors.white,colors.lightGray)
  123.      xs.Write("__",30,c2,colors.white,colors.lightGray)
  124.  
  125.   elseif xs.ShellEventAdv(mouse_click,1,32,33,8,8) then  
  126.      UpdateColor(colors.magenta)
  127.      CP(1,c1)
  128.      term.clearLine()
  129.      CP(1,c2)
  130.      term.clearLine()
  131.      xs.Write("__",32,c1,colors.white,colors.lightGray)
  132.      xs.Write("__",32,c2,colors.white,colors.lightGray)
  133.    
  134.   elseif xs.ShellEventAdv(mouse_click,1,34,35,8,8) then  
  135.      UpdateColor(colors.brown)
  136.      CP(1,c1)
  137.      term.clearLine()
  138.      CP(1,c2)
  139.      term.clearLine()
  140.      xs.Write("__",34,c1,colors.white,colors.lightGray)
  141.      xs.Write("__",34,c2,colors.white,colors.lightGray)
  142.   end
  143.    
  144.   if xs.ShellEventAdv(mouse_click,1,5,10,15,17) then
  145.      a = false
  146.   end
  147. end
  148. xs.FS(colors.white,false)
  149. UC()
  150. xs.Write("Advanced Options",16,6,colors.white,colors.gray)
  151. xs.Write("Login",7,9,colors.white,colors.lightGray)
  152. xs.Write("Auto Update",7,11,colors.white,colors.lightGray)
  153. adv_2 = true
  154. adv_1 = true
  155. function UpdateA()
  156.    adv_1 = not adv_1
  157.    if adv_1 then
  158.       xs.Write("  ",19,9,syscol,colors.white)
  159.       xs.Write(" ",21,9,colors.gray,colors.white)
  160.    else
  161.       xs.Write(" ",19,9,gray,colors.white)
  162.       xs.Write("  ",20,9,colors.lightGray,colors.white)
  163.    end
  164. end
  165. function UpdateB()
  166.    adv_2 = not adv_2
  167.    if adv_2 then
  168.       xs.Write("  ",19,11,syscol,colors.white)
  169.       xs.Write(" ",21,11,colors.gray,colors.white)
  170.    else
  171.       xs.Write(" ",19,11,gray,colors.white)
  172.       xs.Write("  ",20,11,colors.lightGray,colors.white)
  173.    end
  174. end
  175. xs.Button("Next",38,17,syscol,colors.white)
  176. b = true
  177. while b do
  178.    if xs.ShellEventAdv("mouse_click",1,37,16,43,18) then
  179.       b = false
  180.    end
  181.    if xs.ShellEventAdv("mouse_click",1,19,9,21,9) then
  182.       UpdateA()
  183.    end
  184.    if xs.ShellEventAdv("mouse_click",1,19,11,21,11) then
  185.       UpdateB()
  186.    end
  187. end
  188. xs.FS(colors.white,false)
  189. xs.DrawTitleBar("XynSoft",colors.gray,2,"Setup")
  190.  
  191. UC()
  192. xs.Button("Configurate",18,9,syscol,colors.white)
  193. c = true
  194. function A()
  195.    xs.GlobalWrite("/XynSoft/Data/User/Username",user)
  196. end
  197. function B()
  198.    xs.GlobalWrite("/XynSoft/Data/User/Password",pass)
  199. end
  200. function C()
  201.    xs.GlobalWrite("/XynSoft/Data/Label",labl)
  202. end
  203. function D()
  204.    xs.GlobalWrite("/XynSoft/Data/User/Color",syscol)
  205. end
  206. function E()
  207.    local u = fs.open("/XynSoft/Data/AdvSettings","w")
  208.    u.writeLine(adv_1)
  209.    u.writeLine(adv_2)
  210.    fs.close(u)
  211. end
  212. function End()
  213.    Config()
  214.    xs.FS(colors.white,false)
  215.    UC()
  216.    xs.Write("Your computer got succesfully configurated...",15,9,colors.white,colors.lightGray)
  217.    xs.Write("Welcome, "..user.."!",20,11,colors.white,colors.gray)
  218.    xs.Button("Restart",23,17,syscol,colors.white)
  219.    c = true
  220.    while c do
  221.       if xs.ShellEventAdv("mouse_click",1,22,16,31,18) then
  222.          c = false
  223.       end
  224.    end
  225.    os.reboot()
  226. end
  227. function Config()
  228.    xs.FS(colors.white)
  229.    UC()
  230.    xs.Write("                        ",7,colors.lightGray,colors.white)
  231.    sleep(0.5)
  232.    A()
  233.    xs.Write("    ",7,syscol,colors.white)
  234.    sleep(1)
  235.    B()
  236.    xs.Write("    ",12,syscol,colors.white)
  237.    sleep(0.3)
  238.    C()
  239.    xs.Write("    ",17,syscol,colors.white)
  240.    sleep(0.5)
  241.    D()
  242.    xs.Write("    ",22,syscol,colors.white)
  243.    sleep(0.8)
  244.    E()
  245.    xs.Write("    ",27,syscol,colors.white)
  246.    sleep(1)
  247.    End()  
  248. end
  249. End()
Add Comment
Please, Sign In to add comment