일시 중지 후 게임 상태를 저장하십시오.andongine.
문제
게임을 다시 시작한 후 모든 엔진이 다시로드되고 응용 프로그램이 다시 초기화됩니다. 나는 엔진 상태를 저장하고 "onresume"에서 게임 Proccess를 재개하고 싶습니다.
모든 엔진 (Mengine)을 저장 한 다음 "OnLoadEngine"Return Engine에서 게임을 다시 시작한 후에도 시도했습니다.나는 그것이 나쁜 해결책이라고 생각하며 가 작동하지 않는다고 생각합니다.
PAUSE \ \ resume 게임 (예를 들어, 전원 키를 눌러 눌렀다)
해결책
The solution I found was to serialize the state of the engine as JSON and save it as shared storage. Its a lot of work, but it does save it. Since andengine is going to re-init your engine and textures after a pause, I think there are not many choices, unless you want to re-write some of andengine for your game. (which you can)
In my JSON I record the position type velocity etc of each sprite. The complexity of what gets saved depends on the complexity of your game. And then to each class I added a deserialize method that accepts the JSON as input.
As a footnote to that method, I cannot speak highly enough of the amazing GSON library for making that an easier task. http://code.google.com/p/google-gson/
But remeber when restoring the game, to set the restored state to paused so the user knows when the game will re-commence.