Recently in the development of the Hand tour, the project to the late, need to consider the automatic Update game resources implementation (if the logic is written in script, the script is actually a resource).
The design is divided into the following parts:
1. Client Resource Packaging
An index file is added to describe all resource file names (with relative path names), size, MD5 checksum, corresponding to the server-side relative path
2. Server-Side Download
Set up Apache server, put the resource bundle in the server corresponding version number directory according to the version number
3. Client Download
The client uses the HTTP protocol to download the resource index file, compares the local file, finds the file that needs to be updated, and then downloads the corresponding file from the server based on the HTTP protocol, then updates the local index file (last update of the index file so that the update failed index file is not updated and the next start is updated again)
You need to be aware of storage path issues when storing resources on mobile devices after downloading them:
iOS version is written under the documents directory, so read resources first to read resources under the documents directory
Android version can be written in the unpacking path
Two paths a little different