This class is used to auto update resources, such as pictures or scripts.
More...
#include <AssetsManagerEx.h>
|
| enum | State {
UNCHECKED,
PREDOWNLOAD_VERSION,
DOWNLOADING_VERSION,
VERSION_LOADED,
PREDOWNLOAD_MANIFEST,
DOWNLOADING_MANIFEST,
MANIFEST_LOADED,
NEED_UPDATE,
UPDATING,
UP_TO_DATE,
FAIL_TO_UPDATE
} |
| | Update states. More...
|
| |
|
| std::string | basename (const std::string &path) const |
| local | basename ( local path) |
| std::string | get (const std::string &key) const |
| void | initManifests (const std::string &manifestUrl) |
| var | initManifests ( var manifestUrl) |
| local | initManifests ( local manifestUrl) |
| void | loadLocalManifest (const std::string &manifestUrl) |
| var | loadLocalManifest ( var manifestUrl) |
| local | loadLocalManifest ( local manifestUrl) |
| void | prepareLocalManifest () |
| void | setStoragePath (const std::string &storagePath) |
| var | setStoragePath ( var storagePath) |
| local | setStoragePath ( local storagePath) |
| void | adjustPath (std::string &path) |
| void | dispatchUpdateEvent (EventAssetsManagerEx::EventCode code, const std::string &message="", const std::string &assetId="", int curle_code=0, int curlm_code=0) |
| local | dispatchUpdateEvent ( local code, local 0, local 0) |
| void | downloadVersion () |
| void | parseVersion () |
| void | downloadManifest () |
| var | downloadManifest () |
| local | downloadManifest () |
| void | parseManifest () |
| void | startUpdate () |
| void | updateSucceed () |
| bool | decompress (const std::string &filename) |
| var | decompress ( var filename) |
| local | decompress ( local filename) |
| void | decompressDownloadedZip () |
| void | updateAssets (const Downloader::DownloadUnits &assets) |
| | Update a list of assets under the current AssetsManagerEx context. More...
|
| |
| const Downloader::DownloadUnits & | getFailedAssets () const |
| | Retrieve all failed assets during the last update. More...
|
| |
| void | destroyDownloadedVersion () |
| | Function for destorying the downloaded version file and manifest file. More...
|
| |
| virtual void | onError (const Downloader::Error &error) |
| | Call back function for error handling, the error will then be reported to user's listener registed in addUpdateEventListener. More...
|
| |
| virtual void | onProgress (double total, double downloaded, const std::string &url, const std::string &customId) |
| | Call back function for recording downloading percent of the current asset, the progression will then be reported to user's listener registed in addUpdateProgressEventListener. More...
|
| |
| virtual void | onSuccess (const std::string &srcUrl, const std::string &storagePath, const std::string &customId) |
| | Call back function for success of the current asset the success event will then be send to user's listener registed in addUpdateEventListener. More...
|
| |
| | Ref () |
| | Constructor. More...
|
| |
| | Ref () |
| | Constructor. More...
|
| |
This class is used to auto update resources, such as pictures or scripts.
Update states.
| Enumerator |
|---|
| UNCHECKED |
|
| PREDOWNLOAD_VERSION |
|
| DOWNLOADING_VERSION |
|
| VERSION_LOADED |
|
| PREDOWNLOAD_MANIFEST |
|
| DOWNLOADING_MANIFEST |
|
| MANIFEST_LOADED |
|
| NEED_UPDATE |
|
| UPDATING |
|
| UP_TO_DATE |
|
| FAIL_TO_UPDATE |
|
Update states.
| Enumerator |
|---|
| UNCHECKED |
|
| PREDOWNLOAD_VERSION |
|
| DOWNLOADING_VERSION |
|
| VERSION_LOADED |
|
| PREDOWNLOAD_MANIFEST |
|
| DOWNLOADING_MANIFEST |
|
| MANIFEST_LOADED |
|
| NEED_UPDATE |
|
| UPDATING |
|
| UP_TO_DATE |
|
| FAIL_TO_UPDATE |
|
Update states.
| Enumerator |
|---|
| UNCHECKED |
|
| PREDOWNLOAD_VERSION |
|
| DOWNLOADING_VERSION |
|
| VERSION_LOADED |
|
| PREDOWNLOAD_MANIFEST |
|
| DOWNLOADING_MANIFEST |
|
| MANIFEST_LOADED |
|
| NEED_UPDATE |
|
| UPDATING |
|
| UP_TO_DATE |
|
| FAIL_TO_UPDATE |
|
| void adjustPath |
( |
std::string & |
path | ) |
|
|
protected |
| var adjustPath |
( |
var |
path | ) |
|
|
protected |
| local adjustPath |
( |
local |
path | ) |
|
|
protected |
| std::string basename |
( |
const std::string & |
path | ) |
const |
|
protected |
| local basename |
( |
local |
path | ) |
|
|
protected |
Check out if there is a new version of manifest.
You may use this method before updating, then let user determine whether he wants to update resources.
Check out if there is a new version of manifest.
You may use this method before updating, then let user determine whether he wants to update resources.
Check out if there is a new version of manifest.
You may use this method before updating, then let user determine whether he wants to update resources.
| static AssetsManagerEx* create |
( |
const std::string & |
manifestUrl, |
|
|
const std::string & |
storagePath |
|
) |
| |
|
static |
Create function for creating a new AssetsManagerEx.
- Parameters
-
| manifestUrl | The url for the local manifest file |
| storagePath | The storage path for downloaded assetes |
- Warning
- The cached manifest in your storage path have higher priority and will be searched first, only if it doesn't exist, AssetsManagerEx will use the given manifestUrl.
| var create |
( |
var |
manifestUrl, |
|
|
var |
storagePath |
|
) |
| |
|
static |
Create function for creating a new AssetsManagerEx.
- Parameters
-
| manifestUrl | The url for the local manifest file |
| storagePath | The storage path for downloaded assetes |
- Warning
- The cached manifest in your storage path have higher priority and will be searched first, only if it doesn't exist, AssetsManagerEx will use the given manifestUrl.
| local create |
( |
local |
manifestUrl, |
|
|
local |
storagePath |
|
) |
| |
|
static |
Create function for creating a new AssetsManagerEx.
- Parameters
-
| manifestUrl | The url for the local manifest file |
| storagePath | The storage path for downloaded assetes |
- Warning
- The cached manifest in your storage path have higher priority and will be searched first, only if it doesn't exist, AssetsManagerEx will use the given manifestUrl.
| bool decompress |
( |
const std::string & |
filename | ) |
|
|
protected |
| var decompress |
( |
var |
filename | ) |
|
|
protected |
| local decompress |
( |
local |
filename | ) |
|
|
protected |
| void decompressDownloadedZip |
( |
| ) |
|
|
protected |
| var decompressDownloadedZip |
( |
| ) |
|
|
protected |
| local decompressDownloadedZip |
( |
| ) |
|
|
protected |
| void destroyDownloadedVersion |
( |
| ) |
|
|
protected |
Function for destorying the downloaded version file and manifest file.
| var destroyDownloadedVersion |
( |
| ) |
|
|
protected |
Function for destorying the downloaded version file and manifest file.
| local destroyDownloadedVersion |
( |
| ) |
|
|
protected |
Function for destorying the downloaded version file and manifest file.
| void dispatchUpdateEvent |
( |
EventAssetsManagerEx::EventCode |
code, |
|
|
const std::string & |
message = "", |
|
|
const std::string & |
assetId = "", |
|
|
int |
curle_code = 0, |
|
|
int |
curlm_code = 0 |
|
) |
| |
|
protected |
| var dispatchUpdateEvent |
( |
var |
code, |
|
|
var |
message = "", |
|
|
var |
assetId = "", |
|
|
var |
curle_code = 0, |
|
|
var |
curlm_code = 0 |
|
) |
| |
|
protected |
| local dispatchUpdateEvent |
( |
local |
code, |
|
|
local |
message = "", |
|
|
local |
assetId = "", |
|
|
local |
curle_code = 0, |
|
|
local |
curlm_code = 0 |
|
) |
| |
|
protected |
| void downloadFailedAssets |
( |
| ) |
|
| var downloadFailedAssets |
( |
| ) |
|
| local downloadFailedAssets |
( |
| ) |
|
| void downloadManifest |
( |
| ) |
|
|
protected |
| local downloadManifest |
( |
| ) |
|
|
protected |
| local downloadVersion |
( |
| ) |
|
|
protected |
| std::string get |
( |
const std::string & |
key | ) |
const |
|
protected |
Retrieve all failed assets during the last update.
Retrieve all failed assets during the last update.
| local getFailedAssets |
( |
| ) |
|
|
protected |
Retrieve all failed assets during the last update.
| const Manifest* getLocalManifest |
( |
| ) |
const |
Function for retrieve the local manifest object.
Function for retrieve the local manifest object.
| local getLocalManifest |
( |
| ) |
|
Function for retrieve the local manifest object.
| const Manifest* getRemoteManifest |
( |
| ) |
const |
Function for retrieve the remote manifest object.
| var getRemoteManifest |
( |
| ) |
|
Function for retrieve the remote manifest object.
| local getRemoteManifest |
( |
| ) |
|
Function for retrieve the remote manifest object.
Gets the current update state.
Gets the current update state.
Gets the current update state.
| const std::string& getStoragePath |
( |
| ) |
const |
| void initManifests |
( |
const std::string & |
manifestUrl | ) |
|
|
protected |
| var initManifests |
( |
var |
manifestUrl | ) |
|
|
protected |
| local initManifests |
( |
local |
manifestUrl | ) |
|
|
protected |
| void loadLocalManifest |
( |
const std::string & |
manifestUrl | ) |
|
|
protected |
| var loadLocalManifest |
( |
var |
manifestUrl | ) |
|
|
protected |
| local loadLocalManifest |
( |
local |
manifestUrl | ) |
|
|
protected |
Call back function for error handling, the error will then be reported to user's listener registed in addUpdateEventListener.
- Parameters
-
| error | The error object contains ErrorCode, message, asset url, asset key |
- Warning
- AssetsManagerEx internal use only
| virtual void onProgress |
( |
double |
total, |
|
|
double |
downloaded, |
|
|
const std::string & |
url, |
|
|
const std::string & |
customId |
|
) |
| |
|
protectedvirtual |
Call back function for recording downloading percent of the current asset, the progression will then be reported to user's listener registed in addUpdateProgressEventListener.
- Parameters
-
| total | Total size to download for this asset |
| downloaded | Total size already downloaded for this asset |
| url | The url of this asset |
| customId | The key of this asset |
- Warning
- AssetsManagerEx internal use only
| virtual void onSuccess |
( |
const std::string & |
srcUrl, |
|
|
const std::string & |
storagePath, |
|
|
const std::string & |
customId |
|
) |
| |
|
protectedvirtual |
Call back function for success of the current asset the success event will then be send to user's listener registed in addUpdateEventListener.
- Parameters
-
| srcUrl | The url of this asset |
| customId | The key of this asset |
- Warning
- AssetsManagerEx internal use only
| void prepareLocalManifest |
( |
| ) |
|
|
protected |
| var prepareLocalManifest |
( |
| ) |
|
|
protected |
| local prepareLocalManifest |
( |
| ) |
|
|
protected |
| void setStoragePath |
( |
const std::string & |
storagePath | ) |
|
|
protected |
| var setStoragePath |
( |
var |
storagePath | ) |
|
|
protected |
| local setStoragePath |
( |
local |
storagePath | ) |
|
|
protected |
Update with the current local manifest.
Update with the current local manifest.
Update with the current local manifest.
| var updateAssets |
( |
var |
assets | ) |
|
|
protected |
| local updateAssets |
( |
local |
assets | ) |
|
|
protected |
| int downloadProgressFunc |
( |
Downloader::ProgressData * |
ptr, |
|
|
double |
totalToDownload, |
|
|
double |
nowDownloaded, |
|
|
double |
totalToUpLoad, |
|
|
double |
nowUpLoaded |
|
) |
| |
|
friend |
| var downloadProgressFunc |
( |
var |
ptr, |
|
|
var |
totalToDownload, |
|
|
var |
nowDownloaded, |
|
|
var |
totalToUpLoad, |
|
|
var |
nowUpLoaded |
|
) |
| |
|
friend |
| local downloadProgressFunc |
( |
local |
ptr, |
|
|
local |
totalToDownload, |
|
|
local |
nowDownloaded, |
|
|
local |
totalToUpLoad, |
|
|
local |
nowUpLoaded |
|
) |
| |
|
friend |
| const std::string BATCH_UPDATE_ID |
|
static |
| const std::string MANIFEST_ID |
|
static |
| const std::string VERSION_ID |
|
static |
The documentation for this class was generated from the following file: