diff --git a/platforms/minigame/platforms/alipay/wrapper/engine/index.js b/platforms/minigame/platforms/alipay/wrapper/engine/index.js index 5f15e577d1..f552640051 100644 --- a/platforms/minigame/platforms/alipay/wrapper/engine/index.js +++ b/platforms/minigame/platforms/alipay/wrapper/engine/index.js @@ -1,4 +1,3 @@ -require('./sys'); require('./Label'); require('./Console'); require('./AudioPlayer'); \ No newline at end of file diff --git a/platforms/minigame/platforms/alipay/wrapper/engine/sys.js b/platforms/minigame/platforms/alipay/wrapper/engine/sys.js deleted file mode 100644 index aa17c99d46..0000000000 --- a/platforms/minigame/platforms/alipay/wrapper/engine/sys.js +++ /dev/null @@ -1,11 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init; -const adapter = window.__globalAdapter; -const env = adapter.getSystemInfoSync(); - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.ALIPAY_MINI_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/minigame/platforms/baidu/wrapper/engine/index.js b/platforms/minigame/platforms/baidu/wrapper/engine/index.js index c12f4ff3c7..a219ad04e7 100644 --- a/platforms/minigame/platforms/baidu/wrapper/engine/index.js +++ b/platforms/minigame/platforms/baidu/wrapper/engine/index.js @@ -1,2 +1 @@ -require('./sys'); require('./sprite-frame'); \ No newline at end of file diff --git a/platforms/minigame/platforms/baidu/wrapper/engine/sys.js b/platforms/minigame/platforms/baidu/wrapper/engine/sys.js deleted file mode 100644 index fe98e84459..0000000000 --- a/platforms/minigame/platforms/baidu/wrapper/engine/sys.js +++ /dev/null @@ -1,11 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init; -const adapter = window.__globalAdapter; -const env = adapter.getSystemInfoSync(); - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.BAIDU_MINI_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/minigame/platforms/bytedance/wrapper/engine/index.js b/platforms/minigame/platforms/bytedance/wrapper/engine/index.js index 42d703017c..4df96db517 100644 --- a/platforms/minigame/platforms/bytedance/wrapper/engine/index.js +++ b/platforms/minigame/platforms/bytedance/wrapper/engine/index.js @@ -1,3 +1,2 @@ -require('./sys'); require('./Label'); require('./ImageAsset'); \ No newline at end of file diff --git a/platforms/minigame/platforms/bytedance/wrapper/engine/sys.js b/platforms/minigame/platforms/bytedance/wrapper/engine/sys.js deleted file mode 100644 index b7f033683f..0000000000 --- a/platforms/minigame/platforms/bytedance/wrapper/engine/sys.js +++ /dev/null @@ -1,40 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init; -const adapter = window.__globalAdapter; -const env = adapter.getSystemInfoSync(); - -Object.assign(sys, { - __init () { - originInit.call(this); - if (env.platform === 'devtools') { - let system = env.system.toLowerCase(); - if (system.indexOf('android') > -1) { - this.os = this.OS_ANDROID; - } - else if (system.indexOf('ios') > -1) { - this.os = this.OS_IOS; - } - } - this.platform = this.BYTEDANCE_MINI_GAME; - - // move to common if other platforms support - this.getSafeAreaRect = function () { - let view = cc.view; - let safeArea = adapter.getSafeArea(); - let screenSize = view.getFrameSize(); // Get leftBottom and rightTop point in UI coordinates - let leftBottom = new cc.Vec2(safeArea.left, safeArea.bottom); - let rightTop = new cc.Vec2(safeArea.right, safeArea.top); // Returns the real location in view. - let relatedPos = { - left: 0, - top: 0, - width: screenSize.width, - height: screenSize.height - }; - view.convertToLocationInView(leftBottom.x, leftBottom.y, relatedPos, leftBottom); - view.convertToLocationInView(rightTop.x, rightTop.y, relatedPos, rightTop); // convert view point to design resolution size - view._convertPointWithScale(leftBottom); - view._convertPointWithScale(rightTop); - return cc.rect(leftBottom.x, leftBottom.y, rightTop.x - leftBottom.x, rightTop.y - leftBottom.y); - }; - }, -}); \ No newline at end of file diff --git a/platforms/minigame/platforms/wechat/wrapper/engine/index.js b/platforms/minigame/platforms/wechat/wrapper/engine/index.js index 59420d14ea..67786cdb6b 100644 --- a/platforms/minigame/platforms/wechat/wrapper/engine/index.js +++ b/platforms/minigame/platforms/wechat/wrapper/engine/index.js @@ -1,4 +1,3 @@ -require('./sys'); require('./VideoPlayer'); require('./pc-adapter'); require('./sprite-frame'); \ No newline at end of file diff --git a/platforms/minigame/platforms/wechat/wrapper/engine/sys.js b/platforms/minigame/platforms/wechat/wrapper/engine/sys.js deleted file mode 100644 index 292e544fbc..0000000000 --- a/platforms/minigame/platforms/wechat/wrapper/engine/sys.js +++ /dev/null @@ -1,46 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init; -const adapter = window.__globalAdapter; -const env = adapter.getSystemInfoSync(); - -Object.assign(sys, { - __init () { - originInit.call(this); - // TODO: add mac platform - if (env.platform === 'windows') { - this.isMobile = false; - this.os = this.OS_WINDOWS; - } - else if (env.platform === 'devtools') { - let system = env.system.toLowerCase(); - if (system.indexOf('android') > -1) { - this.os = this.OS_ANDROID; - } - else if (system.indexOf('ios') > -1) { - this.os = this.OS_IOS; - } - } - this.platform = this.WECHAT_GAME; - - // move to common if other platforms support - this.getSafeAreaRect = function () { - let view = cc.view; - let safeArea = adapter.getSafeArea(); - let screenSize = view.getFrameSize(); // Get leftBottom and rightTop point in UI coordinates - let leftBottom = new cc.Vec2(safeArea.left, safeArea.bottom); - let rightTop = new cc.Vec2(safeArea.right, safeArea.top); // Returns the real location in view. - let relatedPos = { - left: 0, - top: 0, - width: screenSize.width, - height: screenSize.height, - }; - view.convertToLocationInView(leftBottom.x, leftBottom.y, relatedPos, leftBottom); - view.convertToLocationInView(rightTop.x, rightTop.y, relatedPos, rightTop); // convert view point to design resolution size - view._convertPointWithScale(leftBottom); - view._convertPointWithScale(rightTop); - - return cc.rect(leftBottom.x, leftBottom.y, rightTop.x - leftBottom.x, rightTop.y - leftBottom.y); - }; - }, -}); \ No newline at end of file diff --git a/platforms/minigame/platforms/xiaomi/wrapper/engine/index.js b/platforms/minigame/platforms/xiaomi/wrapper/engine/index.js deleted file mode 100644 index 90f30812b5..0000000000 --- a/platforms/minigame/platforms/xiaomi/wrapper/engine/index.js +++ /dev/null @@ -1,2 +0,0 @@ -require('./sys'); -require('./download-ttf'); \ No newline at end of file diff --git a/platforms/minigame/platforms/xiaomi/wrapper/engine/sys.js b/platforms/minigame/platforms/xiaomi/wrapper/engine/sys.js deleted file mode 100644 index 0982fc9e2a..0000000000 --- a/platforms/minigame/platforms/xiaomi/wrapper/engine/sys.js +++ /dev/null @@ -1,11 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init; -const adapter = window.__globalAdapter; -const env = adapter.getSystemInfoSync(); - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.XIAOMI_QUICK_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/common/engine/index.js b/platforms/runtime/common/engine/index.js index 60fa9c8ebb..4b8dfc393e 100644 --- a/platforms/runtime/common/engine/index.js +++ b/platforms/runtime/common/engine/index.js @@ -24,7 +24,6 @@ ****************************************************************************/ require('./fs-utils'); require('./canvas'); -require('./sys.js'); require('./asset-manager.js'); require('./EditBox.js'); require('./game.js'); diff --git a/platforms/runtime/common/engine/sys.js b/platforms/runtime/common/engine/sys.js deleted file mode 100644 index b5c0a93dd6..0000000000 --- a/platforms/runtime/common/engine/sys.js +++ /dev/null @@ -1,77 +0,0 @@ -Object.assign(cc.sys, { - __init() { - this.isNative = false; - this.isBrowser = false; - this.isMobile = true; - - let sysInfo = ral.getSystemInfoSync(); - // TODO: remove __getCurrentLanguage call - let language = sysInfo.language || (__getCurrentLanguage && __getCurrentLanguage()); - this.language = language.substr(0, 2); - this.languageCode = language.toLowerCase(); - var system = sysInfo.system.toLowerCase(); - var platform = sysInfo.platform.toLowerCase(); - - if (platform === "android") { - this.os = this.OS_ANDROID; - } - else if (platform === "ios") { - this.os = this.OS_IOS; - } - - // Adaptation to Android P - if (system === 'android p') { - system = 'android p 9.0'; - } - - var version = /[\d\.]+/.exec(system); - this.osVersion = version ? version[0] : system; - this.osMainVersion = parseInt(this.osVersion); - - this.browserType = null; - this.browserVersion = null; - - var w = sysInfo.screenWidth; - var h = sysInfo.screenHeight; - var ratio = sysInfo.pixelRatio || 1; - this.windowPixelResolution = { - width: ratio * w, - height: ratio * h - }; - - this.localStorage = window.localStorage; - - var _supportWebp = false; - try { - var _canvas = document.createElement("canvas"); - _supportWebp = _canvas.toDataURL('image/webp').startsWith('data:image/webp'); - } - catch (err) { } - - this.capabilities = { - canvas: true, - opengl: true, - webp: _supportWebp, - imageBitmap: false, - touches: true, - mouse: false, - keyboard: false, - accelerometer: true, - }; - this.__audioSupport = { - ONLY_ONE: false, - WEB_AUDIO: false, - DELAY_CREATE_CTX: false, - format: ['.mp3'] - }; - }, - - openURL(url) { - console.warn("unspport openURL"); - }, - - getBatteryLevel() { - const batteryInfo = ral.getBatteryInfoSync(); - return batteryInfo && batteryInfo.level; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/cocos-play/engine/index.js b/platforms/runtime/platforms/cocos-play/engine/index.js index ac17ede847..14c781b351 100644 --- a/platforms/runtime/platforms/cocos-play/engine/index.js +++ b/platforms/runtime/platforms/cocos-play/engine/index.js @@ -1,5 +1,4 @@ // engine common adapter require('../../../common/engine/index'); // engine platform adapter overwirte -require('./orientation'); -require('./sys'); \ No newline at end of file +require('./orientation'); \ No newline at end of file diff --git a/platforms/runtime/platforms/cocos-play/engine/sys.js b/platforms/runtime/platforms/cocos-play/engine/sys.js deleted file mode 100644 index d4e48bddb3..0000000000 --- a/platforms/runtime/platforms/cocos-play/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.COCOSPLAY; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/cocos-runtime/engine/index.js b/platforms/runtime/platforms/cocos-runtime/engine/index.js index ac17ede847..14c781b351 100644 --- a/platforms/runtime/platforms/cocos-runtime/engine/index.js +++ b/platforms/runtime/platforms/cocos-runtime/engine/index.js @@ -1,5 +1,4 @@ // engine common adapter require('../../../common/engine/index'); // engine platform adapter overwirte -require('./orientation'); -require('./sys'); \ No newline at end of file +require('./orientation'); \ No newline at end of file diff --git a/platforms/runtime/platforms/cocos-runtime/engine/sys.js b/platforms/runtime/platforms/cocos-runtime/engine/sys.js deleted file mode 100644 index d4e48bddb3..0000000000 --- a/platforms/runtime/platforms/cocos-runtime/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.COCOSPLAY; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/huawei-quick-game/engine/index.js b/platforms/runtime/platforms/huawei-quick-game/engine/index.js index ba805dc630..a3a39fbc1c 100644 --- a/platforms/runtime/platforms/huawei-quick-game/engine/index.js +++ b/platforms/runtime/platforms/huawei-quick-game/engine/index.js @@ -1,3 +1,2 @@ require('../../../common/engine/index'); -require('./orientation'); -require('./sys'); \ No newline at end of file +require('./orientation'); \ No newline at end of file diff --git a/platforms/runtime/platforms/huawei-quick-game/engine/sys.js b/platforms/runtime/platforms/huawei-quick-game/engine/sys.js deleted file mode 100644 index 1841b6ac2e..0000000000 --- a/platforms/runtime/platforms/huawei-quick-game/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.HUAWEI_QUICK_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/link-sure/engine/index.js b/platforms/runtime/platforms/link-sure/engine/index.js index 742a2e4890..64b7277b14 100644 --- a/platforms/runtime/platforms/link-sure/engine/index.js +++ b/platforms/runtime/platforms/link-sure/engine/index.js @@ -1,4 +1,3 @@ require('../../../common/engine/index'); require('./orientation'); -require('./sys'); require('./resize'); \ No newline at end of file diff --git a/platforms/runtime/platforms/link-sure/engine/sys.js b/platforms/runtime/platforms/link-sure/engine/sys.js deleted file mode 100644 index 3d4a7688f6..0000000000 --- a/platforms/runtime/platforms/link-sure/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.LINKSURE_MINI_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/oppo-mini-game/engine/index.js b/platforms/runtime/platforms/oppo-mini-game/engine/index.js index 64e01e3e72..43b8c45b9e 100644 --- a/platforms/runtime/platforms/oppo-mini-game/engine/index.js +++ b/platforms/runtime/platforms/oppo-mini-game/engine/index.js @@ -1,4 +1,3 @@ require('../../../common/engine/index'); require('./orientation'); -require('./sys'); require('./VideoPlayer'); \ No newline at end of file diff --git a/platforms/runtime/platforms/oppo-mini-game/engine/sys.js b/platforms/runtime/platforms/oppo-mini-game/engine/sys.js deleted file mode 100644 index 190ea64981..0000000000 --- a/platforms/runtime/platforms/oppo-mini-game/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.OPPO_MINI_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/qtt/engine/index.js b/platforms/runtime/platforms/qtt/engine/index.js index ba805dc630..a3a39fbc1c 100644 --- a/platforms/runtime/platforms/qtt/engine/index.js +++ b/platforms/runtime/platforms/qtt/engine/index.js @@ -1,3 +1,2 @@ require('../../../common/engine/index'); -require('./orientation'); -require('./sys'); \ No newline at end of file +require('./orientation'); \ No newline at end of file diff --git a/platforms/runtime/platforms/qtt/engine/sys.js b/platforms/runtime/platforms/qtt/engine/sys.js deleted file mode 100644 index 3c37a495ac..0000000000 --- a/platforms/runtime/platforms/qtt/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.QTT_MINI_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/runtime/platforms/vivo-mini-game/engine/index.js b/platforms/runtime/platforms/vivo-mini-game/engine/index.js index ba805dc630..a3a39fbc1c 100644 --- a/platforms/runtime/platforms/vivo-mini-game/engine/index.js +++ b/platforms/runtime/platforms/vivo-mini-game/engine/index.js @@ -1,3 +1,2 @@ require('../../../common/engine/index'); -require('./orientation'); -require('./sys'); \ No newline at end of file +require('./orientation'); \ No newline at end of file diff --git a/platforms/runtime/platforms/vivo-mini-game/engine/sys.js b/platforms/runtime/platforms/vivo-mini-game/engine/sys.js deleted file mode 100644 index ad36b1437c..0000000000 --- a/platforms/runtime/platforms/vivo-mini-game/engine/sys.js +++ /dev/null @@ -1,9 +0,0 @@ -const sys = cc.sys; -const originInit = sys.__init;; - -Object.assign(sys, { - __init () { - originInit.call(this); - this.platform = this.VIVO_MINI_GAME; - }, -}); \ No newline at end of file diff --git a/platforms/web/README.md b/platforms/web/README.md deleted file mode 100644 index cef1080587..0000000000 --- a/platforms/web/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Adapter for Web platform -included platforms: -- web-mobile -- web-desktop \ No newline at end of file