| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- /**
- * 背包数据管理
- */
- 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;
|