[adapters] 增加小游戏适配部分源码

This commit is contained in:
SmallMain
2024-10-16 17:12:08 +08:00
parent 887d4a96c9
commit 07bf3b7a96
345 changed files with 38447 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
if (cc.Texture2D) {
cc.Texture2D.prototype._checkPackable = function () {
let dynamicAtlas = cc.dynamicAtlasManager;
if (!dynamicAtlas) return;
if (this._isCompressed()) {
this._packable = false;
return;
}
let w = this.width, h = this.height;
if (!this._image ||
w > dynamicAtlas.maxFrameSize || h > dynamicAtlas.maxFrameSize ||
this._getHash() !== dynamicAtlas.Atlas.DEFAULT_HASH) {
this._packable = false;
return;
}
// HACK: Can't tell if it's a Canvas or an Image by instanceof on Baidu.
if (this._image && this._image.getContext) {
this._packable = true;
}
};
}

View File

@@ -0,0 +1 @@
require('./Texture2D');