new nice shutdown/reboot animation
This commit is contained in:
parent
8f2bc9e5a6
commit
829d6c15b4
1 changed files with 34 additions and 38 deletions
|
@ -305,54 +305,50 @@ local function kernel()
|
|||
sPhone.forceReboot = os.reboot
|
||||
|
||||
function os.shutdown()
|
||||
local w, h = term.getSize()
|
||||
local text = "Shutting down"
|
||||
local x = math.ceil(w/2)-math.ceil(#text/2)+1
|
||||
local y = math.ceil(h/2)
|
||||
sPhone.inHome = false
|
||||
os.pullEvent = os.pullEventRaw
|
||||
while true do
|
||||
if sPhone.doneShutdown then
|
||||
clear()
|
||||
w, h = term.getSize()
|
||||
term.setCursorPos( (w/2)- 7, h/2)
|
||||
write("Shutdown Aborted.")
|
||||
sPhone.winOk("Error","Can not shutdown",colors.lightBlue,colors.red, colors.white, colors.lightBlue)
|
||||
return
|
||||
local function printMsg(color)
|
||||
term.setBackgroundColor(color)
|
||||
term.setTextColor(colors.white)
|
||||
term.clear()
|
||||
term.setCursorPos(x,y)
|
||||
print(text)
|
||||
sleep(0.1)
|
||||
end
|
||||
sPhone.doneShutdown = true
|
||||
clear()
|
||||
w, h = term.getSize()
|
||||
term.setCursorPos( (w / 2) - 1, h / 2)
|
||||
for i = 1,3 do
|
||||
sleep(0.3)
|
||||
write(".")
|
||||
end
|
||||
sleep(0.2)
|
||||
printMsg(colors.white)
|
||||
printMsg(colors.lightGray)
|
||||
printMsg(colors.gray)
|
||||
printMsg(colors.black)
|
||||
sleep(0.6)
|
||||
sPhone.forceShutdown()
|
||||
end
|
||||
end
|
||||
|
||||
function os.reboot()
|
||||
local w, h = term.getSize()
|
||||
local text = "Shutting down"
|
||||
local x = math.ceil(w/2)-math.ceil(#text/2)+1
|
||||
local y = math.ceil(h/2)
|
||||
sPhone.inHome = false
|
||||
os.pullEvent = os.pullEventRaw
|
||||
while true do
|
||||
if sPhone.doneShutdown then
|
||||
clear()
|
||||
w, h = term.getSize()
|
||||
term.setCursorPos( (w/2)- 7, h/2)
|
||||
write("Reboot Aborted.")
|
||||
sPhone.winOk("Error","Can not reboot",colors.lightBlue,colors.red, colors.white, colors.lightBlue)
|
||||
return
|
||||
local function printMsg(color)
|
||||
term.setBackgroundColor(color)
|
||||
term.setTextColor(colors.white)
|
||||
term.clear()
|
||||
term.setCursorPos(x,y)
|
||||
print(text)
|
||||
sleep(0.1)
|
||||
end
|
||||
sPhone.doneShutdown = true
|
||||
clear()
|
||||
w, h = term.getSize()
|
||||
term.setCursorPos( (w / 2) - 1, h / 2)
|
||||
for i = 1,3 do
|
||||
sleep(0.3)
|
||||
write(".")
|
||||
end
|
||||
sleep(0.2)
|
||||
printMsg(colors.white)
|
||||
printMsg(colors.lightGray)
|
||||
printMsg(colors.gray)
|
||||
printMsg(colors.black)
|
||||
sleep(0.6)
|
||||
sPhone.forceReboot()
|
||||
end
|
||||
end
|
||||
|
||||
function sPhone.header(title, butt)
|
||||
|
||||
|
|
Loading…
Reference in a new issue