/** * 背包数据管理 */ let LaunchMgr = { /** * 初始化 * * @author Pyden * @date 2019-03-21 */ init () { if (CC_EDITOR) { return; } this.initLocalStorage(); }, /** * 获取管理器的本地存储值 * * @author Wetion * @date 2019-03-27 * @param {String} key * @returns {object} */ getStorageValue (key) { if (!this._localStorage) { G.LogUtils.error('Bug:用户本地存储不存在'); return; } return this._localStorage.getValue(key); }, /** * 设置管理器本地存储值 * * @author Wetion * @date 2019-03-27 * @param {String} key * @param {object} value */ setStorageValue (key, value) { if (!this._localStorage) { G.LogUtils.error('Bug:用户本地存储不存在'); return; } this._localStorage.setValue(key, value); }, /** * 批量设置管理器本地存储值 * * @author Wetion * @date 2019-03-27 * @param {Object} values */ setStorageValues (values) { if (!this._localStorage) { G.LogUtils.error('Bug:用户本地存储不存在'); return; } this._localStorage.setValues(values); }, getPatform () { if (cc.sys.platform == cc.sys.ANDROID) { return '1'; } else { return '2'; } }, // 热更新临时缓存文件夹 getHotfixPath () { return jsb.fileUtils.getWritablePath() + this._getHotfixPathName(); }, // 热更新临时缓存文件夹,热更新未完成时,下载文件在该文件夹 getHotfixTempPath () { return jsb.fileUtils.getWritablePath() + this._getHotfixPathTempName(); }, _getHotfixPathName () { return 'remote-assets'; }, _getHotfixPathTempName () { return this._getHotfixPathName() + '_temp'; } }; module.exports = LaunchMgr;