兼容creator3.7+版本支持

This commit is contained in:
gongxh
2025-05-09 21:48:17 +08:00
parent 351c806d1b
commit 17d3cc968e
6 changed files with 31 additions and 17 deletions

View File

@@ -32,7 +32,7 @@ export class AssetPool {
this.add(item, bundle, batchName);
}
} else {
let uuid = asset.uuid;
let uuid = asset.uuid || asset._uuid;
if (this._uuidToName.has(uuid)) {
return;
}

View File

@@ -38,17 +38,22 @@ export class CocosAdapter extends Adapter {
* @internal
*/
protected registerResizeCallback(callback: (...args: any) => void): void {
ccScreen.on("window-resize", (...args: any) => {
debug("window-resize");
callback(...args);
}, this);
ccScreen.on("orientation-change", (...args: any) => {
debug("orientation-change");
callback(...args);
}, this);
ccScreen.on("fullscreen-change", (...args: any) => {
debug("fullscreen-change");
callback(...args);
}, this);
if (ccScreen && ccScreen.on) {
ccScreen.on("window-resize", (...args: any) => {
debug("window-resize");
callback(...args);
}, this);
ccScreen.on("orientation-change", (...args: any) => {
debug("orientation-change");
callback(...args);
}, this);
ccScreen.on("fullscreen-change", (...args: any) => {
debug("fullscreen-change");
callback(...args);
}, this);
} else {
// 3.8.0之前的版本
view.setResizeCallback(callback);
}
}
}

View File

@@ -3,10 +3,11 @@
* @Date: 2024-12-07
* @Description: cocos UI模块
*/
import { _decorator, debug } from "cc";
import { _decorator } from "cc";
import { GRoot } from "fairygui-cc";
import { ModuleBase } from "../module/ModuleBase";
import { debug } from "../tool/log";
import { WindowManager } from "../ui/WindowManager";
import { WindowResPool } from "../ui/WindowResPool";
import { CocosWindowContainer } from "./CocosWindowContainer";