Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local backColor = colors.white
- function ManualInstall()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- write("UID: ")
- local UID = read()
- write("Name: ")
- local Name = read()
- if (fs.exists("Apps/" .. Name)) then
- print("An App with the same name allready exists.")
- else
- shell.run("pastebin", "get", UID, "Apps/" .. Name .. "/" .. Name .. ".lua")
- print("The App was downloaded successfully!")
- end
- end
- function DeleteApp()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- for _, file in ipairs(fs.list("Apps")) do
- print(file)
- end
- write("> ")
- local App = read()
- fs.delete("Apps/" .. App)
- end
- function BrowseApps()
- end
- function EventsMain(x,y)
- if (x==2 and y==2) then --Exit
- error("",0)
- elseif (x>=2 and x<=10 and y==4) then --Manual
- ManualInstall()
- elseif (x>=2 and x<=8 and y==6) then --Browse
- BrowseApps()
- elseif (x>=2 and x<=12 and y==8) then --Delete
- DeleteApp()
- end
- end
- function GuiMain()
- term.setBackgroundColor(backColor)
- term.clear()
- --Title
- term.setTextColor(colors.black)
- term.setCursorPos(6,2)
- term.write("-App Market-")
- --Exit Button
- term.setTextColor(colors.white)
- paintutils.drawPixel(2,2,colors.red)
- term.setCursorPos(2,2)
- term.write("x")
- --Manual Button
- term.setTextColor(colors.white)
- paintutils.drawLine(2, 4, 9, 4, colors.yellow)
- term.setCursorPos(2,4)
- term.write("Use code")
- --Browse Button
- term.setTextColor(colors.white)
- paintutils.drawLine(2, 6, 7, 6, colors.yellow)
- term.setCursorPos(2,6)
- term.write("Browse")
- --Delete Button
- term.setTextColor(colors.white)
- paintutils.drawLine(2, 8, 12, 8, colors.red)
- term.setCursorPos(2,8)
- term.write("Delete Apps")
- end
- -- Main --
- local click = false
- while(true) do
- local e,b,x,y
- parallel.waitForAny(
- function()
- GuiMain()
- sleep(2)
- end,
- function()
- e,b,x,y = os.pullEvent("mouse_click")
- click = true
- end)
- if (click) then
- click = false
- EventsMain(x,y)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement