Hot update mechanism under cocos2d-js
First introduce project.manifest: For example
{
"packageUrl" : "http://192.168.1.108/games/dragon_gold",
"remoteManifestUrl" : "http://192.168.1.108/games/dragon_gold/project.manifest",
"remoteVersionUrl" : "http://192.168.1.108/games/dragon_gold/version.manifest",
"version" : "1.0.2",
"groupVersions" : {
"1" : "1.0.1",
"2" : "1.0.2"
},
"engineVersion" : "3.6",
"assets" : {
"update1" : {
"path" : "dragon_gold1.zip",
"md5" : "140caaa2a4508912424e807a941bf71",
"compressed" : true,
"group" : "1"
},
"update2" : {
"path" : "dragon_gold2.zip",
"md5" : "140caaa2a4508912424e807a941bf7bc",
"compressed" : true,
"group" : "2"
}
},
"searchPaths" : [
]
}
- packageUrl : The download root path of the remote resource. (It is for " dragon_gold1.zip ", without this root path we can't find the package to download)
- remoteVersionUrl : The path of the remote version file, used to determine whether there is a new version of the resource on the server side.
- remoteManifestUrl : The path of the remote configuration file, including version information and all resource information.
- version : The version corresponding to the configuration file. (This is used to determine whether there is a new update package)
- assets : This is more important: the value inside corresponds to the package to be updated, where path is the package name of the updated package, and md5: used to compare the md5 code of the corresponding package in the manifest file downloaded this time and the last downloaded manifest file in the next update. compressed is used to determine whether the downloaded package needs to be decompressed. group is the most important, it is used to achieve incremental and new, and its value corresponds to groupVersions .
"packageUrl" : "http://192.168.1.108/games/dragon_gold",
"remoteManifestUrl" : "http://192.168.1.108/games/dragon_gold/project.manifest",
"remoteVersionUrl" : "http://192.168.1.108/games/dragon_gold/version.manifest",
"version" : "1.0.2",
"groupVersions" : {
"1" : "1.0.1",
"2" : "1.0.2"
}
}