Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this acts as the menu that appears between the boot area, and the main menu, and can act as Lock Screen
- settings.load(".settings")
- local w, h = term.getSize()
- local Password = settings.get("os_LockScreenPassword")
- local OsMenu = settings.get("os_DesktopLoc")
- local function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function CenterText(y,text)
- local x = math.floor((w - string.len(text)) /2)
- term.setCursorPos(x,y)
- term.clearLine()
- term.write(text)
- end
- function DrawLockScreen()
- term.setBackgroundColor(colors.blue)
- Clear()
- CenterText(1,"Lock Screen")
- CenterText(4,"Login")
- CenterText(5,"--==Password==--")
- CenterText(7,"--==Continue==--")
- term.setCursorPos(w/3, 6)
- local event
- local input
- term.setTextColor(colours.yellow)
- while true do
- local event = {os.pullEvent("key")}
- if event[2] == keys.enter then break end
- input = read("*")
- end
- term.setTextColor(colours.white)
- if input == Password then
- shell.run(OsMenu)
- else
- print("incorrect Password")
- os.sleep(3)
- DrawLockScreen()
- end
- end
- local function StartMenu()
- term.setBackgroundColor(colors.purple)
- Clear()
- CenterText(2,"=Login=")
- CenterText(4,"User")
- CenterText(5,settings.get("os_Username"))
- CenterText(10,"Press Enter to continue")
- local event
- repeat
- event = {os.pullEvent("key")}
- until event[2] == keys.enter
- if Password == "n" then
- shell.run(OsMenu)
- else
- DrawLockScreen()
- end
- end
- local function Handler()
- Clear()
- StartMenu()
- end
- Handler()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement