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