(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i 0) { setTimeout(deferredDelete, self.deleteInterval); } else { cleaning = false; } } setTimeout(deferredDelete, self.deleteInterval); }); }, removeCache: function removeCache(url) { if (this.cachedFiles.has(url)) { var self = this; var path = this.cachedFiles.remove(url).url; this.writeCacheFile(function () { if (self._isZipFile(url)) { rmdirSync(path, true); self._deleteFileCB(); } else { deleteFile(path, self._deleteFileCB.bind(self)); } }); } }, _deleteFileCB: function _deleteFileCB(err) { if (!err) this.outOfStorage = false; }, makeBundleFolder: function makeBundleFolder(bundleName) { makeDirSync(this.cacheDir + '/' + bundleName, true); }, unzipAndCacheBundle: function unzipAndCacheBundle(id, zipFilePath, cacheBundleRoot, onComplete) { var time = Date.now().toString(); var targetPath = "".concat(this.cacheDir, "/").concat(cacheBundleRoot, "/").concat(time).concat(suffix++); var self = this; makeDirSync(targetPath, true); unzip(zipFilePath, targetPath, function (err) { if (err) { rmdirSync(targetPath, true); onComplete && onComplete(err); return; } self.cachedFiles.add(id, { bundle: cacheBundleRoot, url: targetPath, lastTime: time }); self.writeCacheFile(); onComplete && onComplete(null, targetPath); }); }, _isZipFile: function _isZipFile(url) { return url.slice(-4) === '.zip'; } }; cc.assetManager.cacheManager = module.exports = cacheManager; },{}],3:[function(require,module,exports){ "use strict"; /**************************************************************************** Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ require('./rt-sys.js'); require('./rt_input.js'); require('./rt-game.js'); require('./rt-jsb.js'); require('./jsb-node.js'); require('./jsb-audio.js'); require('./AssetManager.js'); require('./jsb-editbox.js'); },{"./AssetManager.js":1,"./jsb-audio.js":4,"./jsb-editbox.js":5,"./jsb-node.js":6,"./rt-game.js":8,"./rt-jsb.js":9,"./rt-sys.js":10,"./rt_input.js":11}],4:[function(require,module,exports){ "use strict"; /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ var Audio = cc._Audio = function (src) { this.src = src; this.volume = 1; this.loop = false; this.id = -1; }; var handleVolume = function handleVolume(volume) { if (volume === undefined) { // set default volume as 1 volume = 1; } else if (typeof volume === 'string') { volume = Number.parseFloat(volume); } return volume; }; (function (proto, audioEngine) { if (!audioEngine) return; // Using the new audioEngine cc.audioEngine = audioEngine; cc.audioEngine.getMaxAudioInstance = function () { return 13; }; audioEngine.setMaxWebAudioSize = function () {}; Audio.State = audioEngine.AudioState; proto.play = function () { audioEngine.stop(this.id); var clip = this.src; this.id = audioEngine.play(clip, this.loop, this.volume); }; proto.pause = function () { audioEngine.pause(this.id); }; proto.resume = function () { audioEngine.resume(this.id); }; proto.stop = function () { audioEngine.stop(this.id); }; proto.destroy = function () {}; proto.setLoop = function (loop) { this.loop = loop; audioEngine.setLoop(this.id, loop); }; proto.getLoop = function () { return this.loop; }; proto.setVolume = function (volume) { volume = handleVolume(volume); this.volume = volume; return audioEngine.setVolume(this.id, volume); }; proto.getVolume = function () { return this.volume; }; proto.setCurrentTime = function (time) { audioEngine.setCurrentTime(this.id, time); }; proto.getCurrentTime = function () { return audioEngine.getCurrentTime(this.id); }; proto.getDuration = function () { return audioEngine.getDuration(this.id); }; proto.getState = function () { return audioEngine.getState(this.id); }; // polyfill audioEngine var _music = { id: -1, clip: '', loop: false, volume: 1 }; var _effect = { volume: 1 }; audioEngine.play = function (clip, loop, volume) { if (typeof volume !== 'number') { volume = 1; } var audioFilePath; if (typeof clip === 'string') { // backward compatibility since 1.10 cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio'); audioFilePath = clip; } else { if (clip.loaded) { if (typeof clip._nativeAsset === "string") { audioFilePath = clip._nativeAsset; } else { audioFilePath = clip._nativeAsset.src; } } else { // audio delay loading clip._nativeAsset = audioFilePath = clip.nativeUrl; clip.loaded = true; } } return audioEngine.play2d(audioFilePath, loop, volume); }; audioEngine.playMusic = function (clip, loop) { audioEngine.stop(_music.id); _music.id = audioEngine.play(clip, loop, _music.volume); _music.loop = loop; _music.clip = clip; return _music.id; }; audioEngine.stopMusic = function () { audioEngine.stop(_music.id); }; audioEngine.pauseMusic = function () { audioEngine.pause(_music.id); return _music.id; }; audioEngine.resumeMusic = function () { audioEngine.resume(_music.id); return _music.id; }; audioEngine.getMusicVolume = function () { return _music.volume; }; audioEngine.setMusicVolume = function (volume) { _music.volume = handleVolume(volume); audioEngine.setVolume(_music.id, _music.volume); return volume; }; audioEngine.isMusicPlaying = function () { return audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING; }; audioEngine.playEffect = function (filePath, loop) { return audioEngine.play(filePath, loop || false, _effect.volume); }; audioEngine.setEffectsVolume = function (volume) { _effect.volume = handleVolume(volume); }; audioEngine.getEffectsVolume = function () { return _effect.volume; }; audioEngine.pauseEffect = function (audioID) { return audioEngine.pause(audioID); }; audioEngine.pauseAllEffects = function () { var musicPlay = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING; audioEngine.pauseAll(); if (musicPlay) { audioEngine.resume(_music.id); } }; audioEngine.resumeEffect = function (id) { audioEngine.resume(id); }; audioEngine.resumeAllEffects = function () { var musicPaused = audioEngine.getState(_music.id) === audioEngine.AudioState.PAUSED; audioEngine.resumeAll(); if (musicPaused && audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING) { audioEngine.pause(_music.id); } }; audioEngine.stopEffect = function (id) { return audioEngine.stop(id); }; audioEngine.stopAllEffects = function () { var musicPlaying = audioEngine.getState(_music.id) === audioEngine.AudioState.PLAYING; var currentTime = audioEngine.getCurrentTime(_music.id); audioEngine.stopAll(); if (musicPlaying) { _music.id = audioEngine.play(_music.clip, _music.loop); audioEngine.setCurrentTime(_music.id, currentTime); } }; // Unnecessary on native platform audioEngine._break = function () {}; audioEngine._restore = function () {}; // deprecated audioEngine._uncache = audioEngine.uncache; audioEngine.uncache = function (clip) { var path; if (typeof clip === 'string') { // backward compatibility since 1.10 cc.warnID(8401, 'cc.audioEngine', 'cc.AudioClip', 'AudioClip', 'cc.AudioClip', 'audio'); path = clip; } else { if (!clip) { return; } path = clip._nativeAsset; } audioEngine._uncache(path); }; audioEngine._preload = audioEngine.preload; audioEngine.preload = function (filePath, callback) { cc.warn('`cc.audioEngine.preload` is deprecated, use `cc.assetManager.loadRes(url, cc.AudioClip)` instead please.'); audioEngine._preload(filePath, callback); }; })(Audio.prototype, __globalAdapter.AudioEngine); },{}],5:[function(require,module,exports){ "use strict"; /**************************************************************************** Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ (function () { if (!(cc && cc.EditBox)) { return; } var EditBox = cc.EditBox; var js = cc.js; var KeyboardReturnType = EditBox.KeyboardReturnType; var MAX_VALUE = 65535; var _currentEditBoxImpl = null; function getKeyboardReturnType(type) { switch (type) { case KeyboardReturnType.DEFAULT: case KeyboardReturnType.DONE: return 'done'; case KeyboardReturnType.SEND: return 'send'; case KeyboardReturnType.SEARCH: return 'search'; case KeyboardReturnType.GO: return 'go'; case KeyboardReturnType.NEXT: return 'next'; } return 'done'; } var BaseClass = EditBox._ImplClass; function MiniGameEditBoxImpl() { BaseClass.call(this); this._eventListeners = { onKeyboardInput: null, onKeyboardConfirm: null, onKeyboardComplete: null }; } js.extend(MiniGameEditBoxImpl, BaseClass); EditBox._ImplClass = MiniGameEditBoxImpl; Object.assign(MiniGameEditBoxImpl.prototype, { init: function init(delegate) { if (!delegate) { cc.error('EditBox init failed'); return; } this._delegate = delegate; }, beginEditing: function beginEditing() { // In case multiply register events if (_currentEditBoxImpl === this) { return; } var delegate = this._delegate; // handle the old keyboard if (_currentEditBoxImpl) { var currentImplCbs = _currentEditBoxImpl._eventListeners; currentImplCbs.onKeyboardComplete(); __globalAdapter.updateKeyboard && __globalAdapter.updateKeyboard({ value: delegate._string }); } else { this._showKeyboard(); } this._registerKeyboardEvent(); this._editing = true; _currentEditBoxImpl = this; delegate.editBoxEditingDidBegan(); }, endEditing: function endEditing() { this._hideKeyboard(); var cbs = this._eventListeners; cbs.onKeyboardComplete && cbs.onKeyboardComplete(); }, _registerKeyboardEvent: function _registerKeyboardEvent() { var self = this; var delegate = this._delegate; var cbs = this._eventListeners; cbs.onKeyboardInput = function (res) { if (delegate._string !== res.value) { delegate.editBoxTextChanged(res.value); } }; cbs.onKeyboardConfirm = function (res) { delegate.editBoxEditingReturn(); var cbs = self._eventListeners; cbs.onKeyboardComplete && cbs.onKeyboardComplete(); }; cbs.onKeyboardComplete = function () { self._editing = false; _currentEditBoxImpl = null; self._unregisterKeyboardEvent(); delegate.editBoxEditingDidEnded(); }; __globalAdapter.onKeyboardInput(cbs.onKeyboardInput); __globalAdapter.onKeyboardConfirm(cbs.onKeyboardConfirm); __globalAdapter.onKeyboardComplete(cbs.onKeyboardComplete); }, _unregisterKeyboardEvent: function _unregisterKeyboardEvent() { var cbs = this._eventListeners; if (cbs.onKeyboardInput) { __globalAdapter.offKeyboardInput(cbs.onKeyboardInput); cbs.onKeyboardInput = null; } if (cbs.onKeyboardConfirm) { __globalAdapter.offKeyboardConfirm(cbs.onKeyboardConfirm); cbs.onKeyboardConfirm = null; } if (cbs.onKeyboardComplete) { __globalAdapter.offKeyboardComplete(cbs.onKeyboardComplete); cbs.onKeyboardComplete = null; } }, _showKeyboard: function _showKeyboard() { var delegate = this._delegate; var multiline = delegate.inputMode === EditBox.InputMode.ANY; var maxLength = delegate.maxLength < 0 ? MAX_VALUE : delegate.maxLength; __globalAdapter.showKeyboard({ defaultValue: delegate._string, maxLength: maxLength, multiple: multiline, confirmHold: false, confirmType: getKeyboardReturnType(delegate.returnType), success: function success(res) {}, fail: function fail(res) { cc.warn(res.errMsg); } }); }, _hideKeyboard: function _hideKeyboard() { __globalAdapter.hideKeyboard({ success: function success(res) {}, fail: function fail(res) { cc.warn(res.errMsg); } }); } }); })(); },{}],6:[function(require,module,exports){ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ 'use strict'; var _typedArray_temp = new Float32Array(16); var _mat4_temp = new cc.Mat4(); function _mat4ToArray(typedArray, mat4) { typedArray[0] = mat4.m00; typedArray[1] = mat4.m01; typedArray[2] = mat4.m02; typedArray[3] = mat4.m03; typedArray[4] = mat4.m04; typedArray[5] = mat4.m05; typedArray[6] = mat4.m06; typedArray[7] = mat4.m07; typedArray[8] = mat4.m08; typedArray[9] = mat4.m09; typedArray[10] = mat4.m10; typedArray[11] = mat4.m11; typedArray[12] = mat4.m12; typedArray[13] = mat4.m13; typedArray[14] = mat4.m14; typedArray[15] = mat4.m15; } cc.Node.prototype.getWorldRTInAB = function () { this.getWorldRT(_mat4_temp); return _mat4_temp.m; }; cc.Node.prototype.getWorldMatrixInAB = function () { this._updateWorldMatrix(); return this._worldMatrix.m; ; }; },{}],7:[function(require,module,exports){ 'use strict'; // Please go to : // https://github.com/cocos-creator-packages/jsb-adapter/pull/130 // to see more information about function clamp and unpremutAlpha function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var _clamp = function _clamp(value) { value = Math.round(value); return value < 0 ? 0 : value < 255 ? value : 255; }; // Because the blend factor is modified to SRC_ALPHA, here must perform unpremult alpha. var _premultAlpha = function _premultAlpha(data, premult) { var alpha; if (premult) { for (var i = 0, len = data._data.length; i < len; i += 4) { alpha = data._data[i + 3] / 255; if (alpha > 0 && alpha < 255) { data._data[i + 0] = clamp(data._data[i + 0] * alpha); data._data[i + 1] = clamp(data._data[i + 1] * alpha); data._data[i + 2] = clamp(data._data[i + 2] * alpha); } } } else { for (var _i = 0, _len = data._data.length; _i < _len; _i += 4) { alpha = 255 / data._data[_i + 3]; if (alpha > 0 && alpha < 255) { data._data[_i + 0] = _clamp(data._data[_i + 0] * alpha); data._data[_i + 1] = _clamp(data._data[_i + 1] * alpha); data._data[_i + 2] = _clamp(data._data[_i + 2] * alpha); } } } }; var _loop = function _loop() { var rt = window["__globalAdapter"]; if (_typeof(rt) != "object") { console.error("not quick game platform"); return "break"; } if ((typeof cc === "undefined" ? "undefined" : _typeof(cc)) !== "object") { console.error("can not get cocos creator version"); return "break"; } // Judge version,is newer than 2.0.9 var versionJudge = "2.0.9"; var engineVersion = cc.ENGINE_VERSION; var versionJudgeNum = versionJudge.replace(/[a-zA-Z]/g, function (match, i) { return match.charCodeAt(); }).replace(/[^\d]/g, '') - 0; var engineVersionNum = engineVersion.replace(/[a-zA-Z]/g, function (match, i) { return match.charCodeAt(); }).replace(/[^\d]/g, '') - 0; var isEngineVersionNew = engineVersionNum >= versionJudgeNum; var isRTSupportFeature = typeof rt.getFeature == "function" && typeof rt.setFeature === "function"; var featureName = "canvas.context2d.premultiply_image_data"; var shouldPremult = false; if (!isEngineVersionNew && !isRTSupportFeature) { // old creator old runtime return "break"; } if (!isEngineVersionNew) { shouldPremult = true; } if (isRTSupportFeature) { rt.setFeature(featureName, shouldPremult); if (rt.getFeature(featureName) === shouldPremult) { return "break"; } } // set feature fail var dataDescriptor = Object.getOwnPropertyDescriptor(HTMLCanvasElement.prototype, "_data"); var dataGetter = void 0; // get old getter if (_typeof(dataDescriptor) === "object") { dataGetter = dataDescriptor["get"]; } // delete old runtime version _data property delete HTMLCanvasElement.prototype._data; var _newDataGetter = function _newDataGetter() { var data; if (typeof dataGetter === "function") { data = dataGetter.bind(this)(); } else { // old runtime version data = this._dataInner; } if (data === null) { return null; } var premultHandled = data["_premultHandled"]; if (premultHandled === true) { return data; } _premultAlpha(data, shouldPremult); data["_premultHandled"] = true; return data; }; Object.defineProperty(HTMLCanvasElement.prototype, "_data", { get: _newDataGetter, set: function set(params) { this._dataInner = params; } }); }; do { var _ret = _loop(); if (_ret === "break") break; } while (false); },{}],8:[function(require,module,exports){ "use strict"; cc.game.restart = function () { cc.sys.restartVM(); }; __globalAdapter.onHide(function () { cc.game.emit(cc.game.EVENT_HIDE); }); __globalAdapter.onShow(function () { cc.game.emit(cc.game.EVENT_SHOW); }); __globalAdapter.onWindowResize && __globalAdapter.onWindowResize(function () { // Since the initialization of the creator engine may not take place until after the onWindowResize call, // you need to determine whether the canvas already exists before you can call the setCanvasSize method cc.game.canvas && cc.view.setCanvasSize(window.innerWidth, window.innerHeight); }); },{}],9:[function(require,module,exports){ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ 'use strict'; var _window$fsUtils = window.fsUtils, fs = _window$fsUtils.fs, readJsonSync = _window$fsUtils.readJsonSync, readArrayBufferSync = _window$fsUtils.readArrayBufferSync, writeFileSync = _window$fsUtils.writeFileSync; var rt = __globalAdapter; jsb.fileUtils = { getStringFromFile: function getStringFromFile(url) { return readJsonSync(url); }, getDataFromFile: function getDataFromFile(url) { return readArrayBufferSync(url); }, getWritablePath: function getWritablePath() { return "".concat(rt.env.USER_DATA_PATH, "/"); }, writeToFile: function writeToFile(map, url) { var str = JSON.stringify(map); var result = false; try { writeFileSync(url, str, "utf8"); result = true; } catch (error) { cc.error(error); throw new Error('writeToFile fail:', error); } return result; }, getValueMapFromFile: function getValueMapFromFile(url) { var read; try { read = readJsonSync(url); } catch (error) { cc.error(error); return {}; } return read; } }; if (typeof jsb.saveImageData === 'undefined') { if (rt.saveImageTempSync && fs.saveFileSync) { jsb.saveImageData = function (data, width, height, filePath) { var index = filePath.lastIndexOf("."); if (index === -1) { return false; } var fileType = filePath.substr(index + 1); var tempFilePath = rt.saveImageTempSync({ 'data': data, 'width': width, 'height': height, 'fileType': fileType }); if (tempFilePath === '') { return false; } var savedFilePath = fs.saveFileSync(tempFilePath, filePath); if (savedFilePath === filePath) { return true; } return false; }; } } if (typeof jsb.setPreferredFramesPerSecond === 'undefined') { if (typeof rt.setPreferredFramesPerSecond !== 'undefined') { jsb.setPreferredFramesPerSecond = rt.setPreferredFramesPerSecond; } else { jsb.setPreferredFramesPerSecond = function () { console.error("The jsb.setPreferredFramesPerSecond is not define!"); }; } } },{}],10:[function(require,module,exports){ /**************************************************************************** Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ 'use strict'; var sys = cc.sys; if (typeof __globalAdapter.getNetworkType === 'function') { sys.getNetworkType = __globalAdapter.getNetworkType; } else { sys.getNetworkType = function () { console.error("The sys.getNetworkType is not define!"); }; } if (typeof __globalAdapter.getBatteryLevel === 'function') { sys.getBatteryLevel = __globalAdapter.getBatteryLevel; } else { sys.getBatteryLevel = function () { console.error("The sys.getBatteryLevel is not define!"); }; } if (typeof __globalAdapter.triggerGC === 'function') { sys.garbageCollect = __globalAdapter.triggerGC; } else { sys.garbageCollect = function () { console.error("The sys.garbageCollect is not define!"); }; } sys.restartVM = function () { console.error("The restartVM is not define!"); }; sys.isObjectValid = function () { console.error("The sys.isObjectValid is not define!"); }; sys.isBrowser = false; sys.isMobile = true; if (typeof __globalAdapter.getSystemInfoSync === 'function') { var env = __globalAdapter.getSystemInfoSync(); var language = undefined; if (env.language) { language = env.language; } else if (typeof __getCurrentLanguage !== "undefined") { language = __getCurrentLanguage(); } sys.language = language.substr(0, 2); sys.languageCode = language.toLowerCase(); var system = env.system.toLowerCase(); // Adaptation to Android P if (system === 'android p') { system = 'android p 9.0'; } var version = /[\d\.]+/.exec(system); sys.osVersion = version ? version[0] : system; sys.osMainVersion = parseInt(sys.osVersion); sys.browserType = null; sys.browserVersion = null; } },{}],11:[function(require,module,exports){ "use strict"; /**************************************************************************** Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ jsb.inputBox = { onConfirm: function onConfirm(cb) { __globalAdapter.onKeyboardConfirm(cb); }, offConfirm: function offConfirm(cb) { __globalAdapter.offKeyboardConfirm(cb); }, onComplete: function onComplete(cb) { __globalAdapter.onKeyboardComplete(cb); }, offComplete: function offComplete(cb) { __globalAdapter.offKeyboardComplete(cb); }, onInput: function onInput(cb) { __globalAdapter.onKeyboardInput(cb); }, offInput: function offInput(cb) { __globalAdapter.offKeyboardInput(cb); }, /** * @param {string} options.defaultValue * @param {number} options.maxLength * @param {bool} options.multiple * @param {bool} options.confirmHold * @param {string} options.confirmType * @param {string} options.inputType * * Values of options.confirmType can be [done|next|search|go|send]. * Values of options.inputType can be [text|email|number|phone|password]. */ show: function show(options) { __globalAdapter.showKeyboard(options); }, hide: function hide() { __globalAdapter.hideKeyboard(); } }; },{}],12:[function(require,module,exports){ "use strict"; if (jsb.device && !jsb.device.getDeviceMotionValue) { var _tempX = 0, _tempY = 0, _tempZ = 0; var _tempGravitySenceArray = undefined; jsb.device.setAccelerometerEnabled = function (enabled) { if (_tempGravitySenceArray !== undefined === enabled) return; if (!enabled) { qg.stopAccelerometer(); _tempX = 0; _tempY = 0; _tempZ = 0; _tempGravitySenceArray = undefined; return; } _tempGravitySenceArray = new Array(6).fill(0); qg.onAccelerometerChange(function (obj) { _tempGravitySenceArray[3] = 1.25 * obj.x + _tempX; _tempGravitySenceArray[4] = 1.25 * obj.y + _tempY; _tempGravitySenceArray[5] = 1.25 * obj.z + _tempZ; _tempX = 0.8 * _tempX + 0.2 * _tempGravitySenceArray[3]; _tempY = 0.8 * _tempY + 0.2 * _tempGravitySenceArray[4]; _tempZ = 0.8 * _tempZ + 0.2 * _tempGravitySenceArray[5]; }); }; jsb.device.getDeviceMotionValue = function () { if (_tempGravitySenceArray === undefined) { return undefined; } return _tempGravitySenceArray.slice(); }; } },{}],13:[function(require,module,exports){ "use strict"; /**************************************************************************** Copyright (c) 2017-2019 Xiamen Yaji Software Co., Ltd. https://www.cocos.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of fsUtils software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in fsUtils License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ var fs = qg.getFileSystemManager ? qg.getFileSystemManager() : null; var fsUtils = { fs: fs, _subpackagesPath: 'usr_', getUserDataPath: function getUserDataPath() { return qg.env.USER_DATA_PATH; }, checkFsValid: function checkFsValid() { if (!fs) { console.warn('can not get the file system!'); return false; } return true; }, deleteFile: function deleteFile(filePath, onComplete) { fs.unlink({ filePath: filePath, success: function success() { onComplete && onComplete(null); }, fail: function fail(res) { console.warn("Delete file failed: path: ".concat(filePath, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg)); } }); }, downloadFile: function downloadFile(remoteUrl, filePath, header, onProgress, onComplete) { var options = { url: remoteUrl, success: function success(res) { if (res.statusCode === 200) { onComplete && onComplete(null, res.tempFilePath || res.filePath); } else { if (res.filePath) { fsUtils.deleteFile(res.filePath); } console.warn("Download file failed: path: ".concat(remoteUrl, " message: ").concat(res.statusCode)); onComplete && onComplete(new Error(res.statusCode), null); } }, fail: function fail(res) { console.warn("Download file failed: path: ".concat(remoteUrl, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg), null); } }; if (filePath) options.filePath = filePath; if (header) options.header = header; var task = qg.downloadFile(options); onProgress && task.onProgressUpdate(onProgress); }, saveFile: function saveFile(srcPath, destPath, onComplete) { fs.saveFile({ tempFilePath: srcPath, filePath: destPath, success: function success(res) { onComplete && onComplete(null); }, fail: function fail(res) { console.warn("Save file failed: path: ".concat(srcPath, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg)); } }); }, copyFile: function copyFile(srcPath, destPath, onComplete) { fs.copyFile({ srcPath: srcPath, destPath: destPath, success: function success() { onComplete && onComplete(null); }, fail: function fail(res) { console.warn("Copy file failed: path: ".concat(srcPath, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg)); } }); }, writeFile: function writeFile(path, data, encoding, onComplete) { fs.writeFile({ filePath: path, encoding: encoding, data: data, success: function success() { onComplete && onComplete(null); }, fail: function fail(res) { console.warn("Write file failed: path: ".concat(path, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg)); } }); }, writeFileSync: function writeFileSync(path, data, encoding) { try { fs.writeFileSync(path, data, encoding); return null; } catch (e) { console.warn("Write file failed: path: ".concat(path, " message: ").concat(e.message)); return new Error(e.message); } }, readFile: function readFile(filePath, encoding, onComplete) { fs.readFile({ filePath: filePath, encoding: encoding, success: function success(res) { onComplete && onComplete(null, res.data); }, fail: function fail(res) { console.warn("Read file failed: path: ".concat(filePath, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg), null); } }); }, readDir: function readDir(filePath, onComplete) { fs.readdir({ dirPath: filePath, success: function success(res) { onComplete && onComplete(null, res.files); }, fail: function fail(res) { console.warn("Read directory failed: path: ".concat(filePath, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error(res.errMsg), null); } }); }, readText: function readText(filePath, onComplete) { fsUtils.readFile(filePath, 'utf8', onComplete); }, readArrayBuffer: function readArrayBuffer(filePath, onComplete) { fsUtils.readFile(filePath, '', onComplete); }, readArrayBufferSync: function readArrayBufferSync(path) { try { var buffer = fs.readFileSync(path, 'binary'); return buffer; } catch (e) { console.warn("Read json failed: path: ".concat(path, " message: ").concat(e.message)); return new Error(e); } }, readJson: function readJson(filePath, onComplete) { fsUtils.readFile(filePath, 'utf8', function (err, text) { var out = null; if (!err) { try { out = JSON.parse(text); } catch (e) { console.warn("Read json failed: path: ".concat(filePath, " message: ").concat(e.message)); err = new Error(e.message); } } onComplete && onComplete(err, out); }); }, readJsonSync: function readJsonSync(path) { try { var str = fs.readFileSync(path, 'utf8'); return JSON.parse(str); } catch (e) { console.warn("Read json failed: path: ".concat(path, " message: ").concat(e.message)); return new Error(e); } }, makeDirSync: function makeDirSync(path, recursive) { try { fs.mkdirSync(path, recursive); return null; } catch (e) { console.warn("Make directory failed: path: ".concat(path, " message: ").concat(e.message)); return new Error(e); } }, rmdirSync: function rmdirSync(dirPath, recursive) { try { fs.rmdirSync(dirPath, recursive); } catch (e) { console.warn("rm directory failed: path: ".concat(dirPath, " message: ").concat(e.message)); return new Error(e); } }, exists: function exists(filePath, onComplete) { fs.access({ path: filePath, success: function success() { onComplete && onComplete(true); }, fail: function fail() { onComplete && onComplete(false); } }); }, existsSync: function existsSync(filePath) { try { fs.accessSync(filePath); } catch (error) { return new Error(e); } }, loadSubpackage: function loadSubpackage(name, onProgress, onComplete) { var task = qg.loadSubpackage({ name: fsUtils._subpackagesPath + name, success: function success() { onComplete && onComplete(); }, fail: function fail(res) { console.warn("Load Subpackage failed: path: ".concat(name, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error("Failed to load subpackage ".concat(name, ": ").concat(res.errMsg))); } }); onProgress && task.onProgressUpdate(onProgress); return task; }, unzip: function unzip(zipFilePath, targetPath, onComplete) { fs.unzip({ zipFilePath: zipFilePath, targetPath: targetPath, success: function success() { onComplete && onComplete(null); }, fail: function fail(res) { console.warn("unzip failed: path: ".concat(zipFilePath, " message: ").concat(res.errMsg)); onComplete && onComplete(new Error('unzip failed: ' + res.errMsg)); } }); } }; cc.assetManager.fsUtils = window.fsUtils = module.exports = fsUtils; },{}],14:[function(require,module,exports){ "use strict"; do { if (typeof qg === 'undefined') { console.error("not quick game platform"); break; } window.__globalAdapter = qg; require('../../../common/engine/rt-feature-premut-alpha.js'); require('./fs-utils.js'); require('../../../common/engine/index.js'); require('./DeviceMotionEvent.js'); require('./rt-videoplayer.js'); } while (false); },{"../../../common/engine/index.js":3,"../../../common/engine/rt-feature-premut-alpha.js":7,"./DeviceMotionEvent.js":12,"./fs-utils.js":13,"./rt-videoplayer.js":15}],15:[function(require,module,exports){ "use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } /**************************************************************************** Copyright (c) 2018 Xiamen Yaji Software Co., Ltd. https://www.cocos.com/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated engine source code (the "Software"), a limited, worldwide, royalty-free, non-assignable, revocable and non-exclusive license to use Cocos Creator solely to develop games on your target platforms. You shall not use Cocos Creator software for developing other software or tools that's used for developing games. You are not granted to publish, distribute, sublicense, and/or sell copies of Cocos Creator. The software or tools in this License Agreement are licensed, not sold. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ (function () { if (typeof loadRuntime === "undefined") { return; } var rt = loadRuntime(); if (!(cc && cc.VideoPlayer && cc.VideoPlayer.Impl)) { return; } var Mat4 = cc.Mat4; var _worldMat = new cc.Mat4(); var _cameraMat = new cc.Mat4(); var _impl = cc.VideoPlayer.Impl; var _p = cc.VideoPlayer.Impl.prototype; cc.VideoPlayer.prototype._updateVideoSource = function _updateVideoSource() { var _this = this; var clip = this._clip; if (this.resourceType === cc.VideoPlayer.ResourceType.REMOTE) { this._impl.setURL(this.remoteURL, this._mute || this._volume === 0); } else if (clip) { if (clip._nativeAsset) { this._impl.setURL(clip._nativeAsset, this._mute || this._volume === 0); } else { // deferred loading video clip cc.assetManager.postLoadNative(clip, function (err) { if (err) { console.error(err.message, err.stack); return; } _this._impl.setURL(clip._nativeAsset, _this._mute || _this._volume === 0); }); } } }; _p._bindEvent = function () { var video = this._video, self = this; if (!video) { return; } video.onPlay(function () { if (self._video !== video) return; self._playing = true; self._dispatchEvent(_impl.EventType.PLAYING); }); video.onEnded(function () { if (self._video !== video) return; self._playing = false; self._currentTime = self._duration; // ensure currentTime is at the end of duration self._dispatchEvent(_impl.EventType.COMPLETED); }); video.onPause(function () { if (self._video !== video) return; self._playing = false; self._dispatchEvent(_impl.EventType.PAUSED); }); video.onTimeUpdate(function (res) { var data = JSON.parse(res.position); if (_typeof(data) === "object") { self._duration = data.duration; self._currentTime = data.position; return; } self._duration = res.duration; self._currentTime = res.position; }); // onStop not supported }; _p._unbindEvent = function () { var video = this._video; if (!video) { return; } // BUG: video.offPlay(cb) is invalid video.offPlay(); video.offEnded(); video.offPause(); video.offTimeUpdate(); // offStop not supported }; _p.setVisible = function (value) { var video = this._video; if (!video) { return; } if (value) { video.width = this._actualWidth || 0; } else { video.width = 0; // hide video } this._visible = value; }; _p.createDomElementIfNeeded = function () { if (!rt.createVideo) { cc.warn('VideoPlayer not supported'); return; } }; _p.setURL = function (path, _mute) { var video = this._video; if (video && video.src === path) { return; } if (!this._tx) { return; } if (this._video) { this.destroy(); this._video = null; } var videoUrl; if (typeof path !== 'string') { videoUrl = path._audio; } else { videoUrl = path; } this._duration = -1; this._currentTime = -1; this._video = rt.createVideo({ x: this._tx, y: this._ty, width: this._width, height: this._height, src: videoUrl, objectFit: "contain", live: false }); video = this._video; video.src = videoUrl; video.muted = true; var self = this; this._loaded = false; var loadedCallback = function loadedCallback() { video.offPlay(loadedCallback); video.offTimeUpdate(timeCallBack); self.enable(); self._bindEvent(); video.stop(); video.muted = false; self._loaded = true; self._playing = false; self._currentTime = 0; self._dispatchEvent(_impl.EventType.READY_TO_PLAY); }; var timeCallBack = function timeCallBack(res) { var data = JSON.parse(res.position); if (_typeof(data) === "object") { self._duration = data.duration; self._currentTime = data.position; return; } self._duration = res.duration; self._currentTime = res.position; }; video.onPlay(loadedCallback); video.onTimeUpdate(timeCallBack); // HACK: keep playing till video loaded video.play(); }; _p.getURL = function () { var video = this._video; if (!video) { return ''; } return video.src; }; _p.play = function () { var video = this._video; if (!video || !this._visible || this._playing) return; video.play(); }; _p.setStayOnBottom = function (enabled) {}; _p.pause = function () { var video = this._video; if (!this._playing || !video) return; video.pause(); }; _p.resume = function () { var video = this._video; if (this._playing || !video) return; video.play(); }; _p.stop = function () { var video = this._video; if (!video || !this._visible) return; video.stop(); this._dispatchEvent(_impl.EventType.STOPPED); this._playing = false; }; _p.setVolume = function (volume) {// wx not support setting video volume }; _p.seekTo = function (time) { var video = this._video; if (!video || !this._loaded) return; video.seek(time); }; _p.isPlaying = function () { return this._playing; }; _p.duration = function () { return this._duration; }; _p.currentTime = function () { if (!this._currentTime) { return -1; } return this._currentTime; }; _p.setKeepAspectRatioEnabled = function (isEnabled) { cc.log('On wechat game is always keep the aspect ratio'); }; _p.isKeepAspectRatioEnabled = function () { return true; }; _p.isFullScreenEnabled = function () { return this._fullScreenEnabled; }; _p.setFullScreenEnabled = function (enable) { var video = this._video; if (video) { video.exitFullScreen(); if (enable) { video.requestFullScreen(); } this._fullScreenEnabled = enable; } }; _p.enable = function () { this.setVisible(true); }; _p.disable = function () { this.setVisible(false); }; _p.destroy = function () { this.disable(); this._unbindEvent(); this.stop(); if (this._video) { this._video.destroy(); this._video = undefined; } rt.triggerGC(); }; _p.updateMatrix = function (node) { node.getWorldMatrix(_worldMat); if (this._m00 === _worldMat.m[0] && this._m01 === _worldMat.m[1] && this._m04 === _worldMat.m[4] && this._m05 === _worldMat.m[5] && this._m12 === _worldMat.m[12] && this._m13 === _worldMat.m[13] && this._w === node._contentSize.width && this._h === node._contentSize.height) { return; } // update matrix cache this._m00 = _worldMat.m[0]; this._m01 = _worldMat.m[1]; this._m04 = _worldMat.m[4]; this._m05 = _worldMat.m[5]; this._m12 = _worldMat.m[12]; this._m13 = _worldMat.m[13]; this._w = node._contentSize.width; this._h = node._contentSize.height; var camera = cc.Camera.findCamera(node); camera.getWorldToScreenMatrix2D(_cameraMat); Mat4.multiply(_cameraMat, _cameraMat, _worldMat); var viewScaleX = cc.view._scaleX, viewScaleY = cc.view._scaleY; var dpr = cc.view._devicePixelRatio; viewScaleX /= dpr; viewScaleY /= dpr; var finalScaleX = _cameraMat.m[0] * viewScaleX, finalScaleY = _cameraMat.m[5] * viewScaleY; var finalWidth = this._w * finalScaleX, finalHeight = this._h * finalScaleY; var appx = finalWidth * node._anchorPoint.x; var appy = finalHeight * node._anchorPoint.y; var viewport = cc.view._viewportRect; var offsetX = viewport.x / dpr, offsetY = viewport.y / dpr; var tx = _cameraMat.m[12] * viewScaleX - appx + offsetX, ty = _cameraMat.m[13] * viewScaleY - appy + offsetY; var height = cc.view.getFrameSize().height; this._tx = tx; this._ty = ty; this._width = finalWidth; //w; this._height = finalHeight; //h; if (this._video) { this._video.x = tx; this._video.y = height - finalHeight - ty; this._video.width = finalWidth; this._video.height = finalHeight; } this._actualWidth = finalWidth; }; })(); },{}]},{},[14]);