나는 코로나로 응용 프로그램을 만들었습니다. 문서 폴더를 사용하여 게임 진행 상황을 저장할 수 있습니다. 거기에 저장하지 말아야 할 것은 게임 자산 등입니다. 자산 및 코드를 특정 폴더에 배치하면 안됩니다. 폴더 이름을 사용하지 않고 앱의 '루트'폴더에서 직접 액세스 할 수 있습니다. 앱을 사용하는 동안 변경되지 않는 게임에 사용할 항목을 배치 할 수 있습니다. 그러니까 기본적으로, 당신은 더 특별한 일을하려고하지 않는 한 것 :
- 로드 이미지 코드 방금 자신의 이름을 사용하여 변경하지 않을 SQLite는 데이터베이스. 예 :
filedata:copyFile("scores.db", system.ResourceDirectory, "scores.db", system.DocumentsDirectory ,0)
이이 filedata:copyFile
함수의 내용 다음과 같습니다 :
function filedata:copyFile(srcName, srcPath, dstName, dstPath, overwrite)
local results = true -- assume no errors
-- Copy the source file to the destination file
--
local rfilePath = system.pathForFile(srcName, srcPath)
local wfilePath = system.pathForFile(dstName, dstPath)
local rfh = io.open(rfilePath, "rb")
local wfh = io.open(wfilePath, "rb")
if wfh~=nil then
if overwrite==0 then
results=false
return
else
end
end
--io.close(wfh)
local wfh = io.open(wfilePath, "wb")
if not wfh then
results = false -- error
else
-- Read the file from the Resource directory and write it to the destination directory
local data = rfh:read("*a")
if not data then
--print("read error!")
results = false -- error
else
if not wfh:write(data) then
--print("write error!")
results = false -- error
end
end
end
-- Clean up our file handles
rfh:close()
wfh:close()
return results
end
그리고 당신은 항상 진행 데이터베이스에 액세스 할 문서 폴더에 local picture = display.newImageRect("mypic.png", 40, 47)
로드 및 저장 진행 데이터 그 내용을 Documents 디렉토리에 저장하십시오. 알다시피, 이것은 제안보다 훨씬 쉽습니다 :)