gpt4 book ai didi

lua - 电晕SDK : Restart an app only when user press "home"

转载 作者:行者123 更新时间:2023-12-02 05:08:58 24 4
gpt4 key购买 nike

使用 corona SDK,我希望每次用户点击主页按钮时都能干净地重启我的应用程序。如果他/她接到电话,拉下下拉菜单等,我希望该应用程序继续保持其当前状态。

有什么建议吗?

谢谢,/S

最佳答案

我是怎么解决的!

suspendTime = 0
resumeTime = 0

function onSystemEvent( event )
if event.type == "applicationSuspend" then
suspendTime = os.time()
print(suspendTime)
elseif event.type == "applicationResume" then
resumeTime = os.time()
print(resumeTime)
print("deltaTime: "..resumeTime - suspendTime )
if(resumeTime - suspendTime > 30) then
local sceneName = storyboard.getCurrentSceneName()
if(sceneName ~= "levels.splash") then
print(sceneName)
print(resumeTime)
storyboard.gotoScene("levels.splash")
end
end
end

end
Runtime:addEventListener("system", onSystemEvent)

关于lua - 电晕SDK : Restart an app only when user press "home",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15817314/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com