Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this acts as main script CSP
- version = "1.0.3"
- settings.load(".settings")
- local w, h = term.getSize()
- local BaseAppsInstalled = {true,false,true}
- local IntPrograms = {"os/os_Programs/ClientApps/os_AccountPgScript","os/os_Programs/os_LinksProvider","os/os_Programs/os_SettingsMenu"}
- local ProgramNames = {"Account","Online Items","Settings"}
- local TimeSpot = h
- 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
- local function BetaAppsLoad()
- ProgramNames = {}
- IntPrograms = {}
- settings.load(".settings")
- ProgramNames = settings.get("ClientApps_Names")
- IntPrograms = settings.get("ClientApps_Paths")
- ProgramNames[#ProgramNames + 1] = "reboot"
- ProgramNames[#ProgramNames + 1] = "shutdown"
- IntPrograms[#IntPrograms + 1] = "reboot"
- IntPrograms[#IntPrograms + 1] = "shutdown"
- TimeSpot = #ProgramNames + 5
- end
- local function MenuDrawer()
- term.setBackgroundColor(colors.cyan)
- Clear()
- local Background = paintutils.loadImage("os/os_SystemFiles/Images/MenuBackground")
- paintutils.drawImage(Background,1,1)
- CenterText(1,"==Desktop==version"..version.."==")
- CenterText(3,"-=Applications=-")
- term.setBackgroundColor(colors.cyan)
- CenterText(TimeSpot,os.date())
- if settings.get("os_BetaTest") == true then CenterText(TimeSpot -1,"Experimental Mode") end
- end
- function CUI(m) --declare function
- n=1
- local l = #m
- local BoxPositions = {{2,5},{8,5},{14,5},{2,13},{8,13},{14,13},{2,21},{8,21},{14,21}}
- while true do
- for i=1, #m, 1 do --traverse the table of options
- paintutils.drawFilledBox(BoxPositions[i][1],BoxPositions[i][2],BoxPositions[i][1] + 5, BoxPositions[i][2] + 7, colors.gray)
- term.setCursorPos(BoxPositions[i][1],BoxPositions[i][2])
- term.write(m[i])
- end
- a, b, c, d = os.pullEvent("mouse_click") --wait for keypress
- for i = 1, #m do
- n = i
- if c < 2 and d < 2 then shell.run("os/os_Programs/os_PowerMenu") end
- if c > BoxPositions[i][1] and c < BoxPositions[i][1] + 5 and d > BoxPositions[i][2] and d < BoxPositions[i][2] + 7 then break end
- end
- end
- return n --return the value
- end
- Clear()
- if settings.get("os_BetaTest") == true then
- BetaAppsLoad()
- end
- MenuDrawer()
- local n = CUI(ProgramNames)
- if IntPrograms[n] == "reboot" then
- os.reboot()
- elseif IntPrograms[n] == "shutdown" then
- os.shutdown()
- else
- shell.run(shell.resolve(IntPrograms[n]))
- end
Add Comment
Please, Sign In to add comment