Website tutorial: developer.egret.com/cn/github/e… Details can see the official website tutorial, I just record the actual operation process, leave a record…
Main process:
1 Set the app loading mode
2 Set up the PHP file
3. Every time you make a new package, you only need to change the GAME_code version number of PHP after uploading the package to the server. If the game_code name of app local and PHP is inconsistent, hot update can be realized.
1 Set the loading mode
The default is 0. If the value is set to 1, it means that when the app is started, go back to PHP and check whether the names of “game_code.zip” are consistent. If they are not, update them.
Change case 1 to own PHP address.
About the game_code.zip name
App local is set in the main file
The server is set up in PHP, as described in section 2 PHP files.
2 the PHP file
Modify $IP address of PHP for oneself, I PHP access link is “www.biliking.com/demo/hotupd…
Change the version number of define(‘CASE_NAME’,’666′) again each time a new package is released, in this case 666.
<? php define('CASE_NAME', '666'); function startsWith($string, $pattern) { return $pattern === "" || strrpos($string, $pattern, -strlen($string)) ! == FALSE; } $json = array(); // if it does not exist, false; if (! startsWith(CASE_NAME, 'http://')) { $ip = "http://www.biliking.com/demo/hotupdate/"; $root = $ip . CASE_NAME ."/game_code_".CASE_NAME. ".zip"; $update = $ip . CASE_NAME; $json["code_url"] = $root; $json["update_url"] = $update; } else { $json["code_url"] = CASE_NAME; $json["update_url"] = dirname(CASE_NAME); } echo(json_encode($json)); ? >Copy the code
You can type the PHP access address directly into your browser to see if the returned information is correct. If the format is not correct, it can not be corrected.
Note to release a new package, create a folder with the same version number and store it in the folder. Instead of putting it directly in your PHP sibling directory.
3. Dung yellow interface for hot updates
When there is a heat wave, there is a yellow screen that exists for a short period of time, which is a progress bar that fills the screen.
I don’t care about that, because I used to put an image on top of it to prevent it from loading a black screen, and that image would also cover up the shit-yellow screen.
4 Some tests
4.1 If the game_code suffix remains unchanged, will the modified code be hot updated? Don’t.
4.1 If the game_code suffix remains unchanged, will the modified image be hot updated? Don’t.
4.2 If the suffix of game_code changes, will the picture be updated if the name and size of the picture remain the same? Will be.