Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArg = {...}
- local Username = "guest"
- local UserPortrait = "os/UI/Icons/UserDefaultPortrait.nfp"
- local w, h = term.getSize()
- local User_AppKeys = {}
- local DeskBackOptions = {{"Sunny Day","os/UI/Desk_Back1.nfp"},{"Window","os/UI/Desk_Back2"}}
- settings.load("os/settings.txt")
- local Menus = {{"AppKeys",{"User Keys:",User_AppKeys}}}--title,info,buttons(text,action,
- local Opts ={}--settingsname,editType(file or setting), name, other
- local function Mid(text)
- local Tw = string.len(text)
- local X = w/2 - Tw/2
- return X
- end
- function UserAccount(action,a,b,c)
- if action == "open" then
- local file = fs.open(fs.combine("os/System/Users",Username,"UserAccount.txt"),"r")
- UserPortrait = file.readLine()
- file.close()
- end
- end
- function HomeScreen()
- App.Clear()
- App.setBackground(colors.white)
- App.setTextColor(colors.black)
- App.newImage("ProfileIcon",UserPortrait,2,2)
- App.newText("accountName",Username,2,1)
- App.newButton("button_account","Account","tsk.openAccount",10,2)
- App.newButton("button_Display","Display","tsk.openDisplay",10,4)
- end
- function AccountPage()
- App.setBackground(colors.lightGray)
- OpenPg("Account")
- App.newText("text_username",Username,Mid(Username),3)
- App.newImage("image_ProfileIcon",UserPortrait,2,3)
- if Username == "Guest" then
- App.newText("Alert1","finish account setup",Mid("finish account setup"),6)
- App.newText("Alert2","setup your account at any available terminals that support this device",1,7)
- else
- App.newButton("button1","change portrait","tsk.openPortraits",1,6)
- App.newButton("button2","app keys","tsk.openMenu_AppKeys",1,7)
- end
- end
- function OpenMenu(I)
- App.Clear()
- App.newButton("return","return","tsk.home",1,1)
- App.newText("title",Menus[I][1],3 + Mid(Menus[I][1]),1)
- local Y = 2
- if Menus[I][2] ~= -1 then
- for i = 1, #Menus[I][2] do
- term.setCursorPos(1,Y)
- term.write(Menus[I][2][i])
- Y = Y + 1
- end
- end
- end
- function DisplayPage()
- OpenPg("Display")
- App.newText("text_Displays","Menus",1,3)
- App.newButton("button_DeskBack","desktop","tsk.desktopBackground_Menu",1,5)
- end
- function BackgroundMenu(Menu,options)
- OpenPg(Menu)
- for i = 1, #options do
- App.newButton("button"..i,options[i][1],"tsk.setDesktopBack_"..i,1,(i * 2) + 2)
- end
- end
- function OpenPg(name,options)
- App.Clear()
- local tw = string.len(name)
- local x = w/2 - tw/2
- App.newText("title",name,x,1)
- App.newButton("button_return","return","tsk.home",1,1)
- end
- function GetVariables()
- local F1 = fs.open(fs.combine("os/System/Users",settings.get("active_user"),"UserKeys.txt"),"r")
- User_AppKeys = textutils.unserialize(F1.readAll())
- F1.close()
- end
- Username = settings.get("active_user")
- UserAccount("open")
- GetVariables()
- if tArg[1] == "start" then
- HomeScreen()
- else
- if tArg[1] == "openAccount" then
- AccountPage()
- elseif tArg[1] == "openDisplay" then
- DisplayPage()
- elseif tArg[1] == "home" then
- HomeScreen()
- else
- if tArg[1] == "desktopBackground_Menu" then
- BackgroundMenu("desktop", DeskBackOptions)
- elseif string.find(tArg[1],"setDesktopBack_") then
- settings.set("screen_desktop_background",DeskBackOptions[textutils.unserialize(string.sub(tArg[1],string.len(tArg[1])))][2])
- settings.save("os/settings.txt")
- elseif string.find(tArg[1],"openMenu") then
- OpenMenu(string.sub(tArg[1],10,string.len(tArg[1])))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement