-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
45 lines (34 loc) · 1.08 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
local json = require "json"
local gameManager = require("gameManager") -- Require your game manager module
local function onSystemEvent(event)
if event.type == "applicationSuspend" or event.type == "applicationExit" then
gameManager.autoSave() -- Call the autoSave function from your game manager
end
end
-- Add the system event listener
Runtime:addEventListener("system", onSystemEvent)
-- Initialize your game manager module
gameManager.init()
function jsonParse( src )
local filename = system.pathForFile( src )
local data, pos, msg
data, pos, msg = json.decodeFile(filename)
-- 디버깅
if data then
return data
else
print("WARNING: " .. pos, msg)
return nil
end
end
-- hide the status bar
display.setStatusBar( display.HiddenStatusBar )
-- include the Corona "composer" module
local composer = require "composer"
-- load menu screen
composer.gotoScene( "stage2" )