71 lines
2.4 KiB
TypeScript
71 lines
2.4 KiB
TypeScript
import { _decorator, Canvas, Component, DynamicAtlasManager, profiler } from "cc";
|
|
const { ccclass, property } = _decorator;
|
|
import { PetManager } from "../games/scripts/pets";
|
|
|
|
DynamicAtlasManager.instance.enabled = false;
|
|
@ccclass("LocalTest")
|
|
export class LocalTest extends Component {
|
|
@property(Canvas)
|
|
private canvas: Canvas = null;
|
|
|
|
protected onLoad(): void {
|
|
// this.remoteSprite.remoteUrl = "https://i.imgs.ovh/2025/10/28/7KzDD1.png";
|
|
// this.remoteSprite.node.destroy();
|
|
|
|
// let items = [];
|
|
// for (let index = 0; index < 10; index++) {
|
|
// let item = instantiate(this.remoteSprite.node);
|
|
// item.parent = this.node;
|
|
// items.push(item);
|
|
// }
|
|
// setTimeout(() => {
|
|
// console.log("3秒后销毁节点");
|
|
// items.forEach((element) => {
|
|
// element.destroy();
|
|
// });
|
|
// this.remoteSprite.remoteUrl = null;
|
|
// }, 3000);
|
|
// setTimeout(() => {
|
|
// console.log("3秒后替换贴图");
|
|
// this.remoteSprite.remoteUrl = "https://i.imgs.ovh/2025/10/28/7KAsRH.png";
|
|
// }, 3000);
|
|
// setTimeout(() => {
|
|
// console.log("45秒后重新加载节点");
|
|
// this.remoteSprite.remoteUrl = null;
|
|
// }, 6000);
|
|
// 显示Coocs Creator 内存信息
|
|
// sys.
|
|
profiler.showStats();
|
|
|
|
setTimeout(() => {
|
|
void this.testLoad();
|
|
}, 5000);
|
|
}
|
|
|
|
protected async testLoad() {
|
|
// let prefab: Prefab = null;
|
|
// let dialogBox: Node = null;
|
|
// prefab = await ResManager.getInstance().loadAsset<Prefab>({
|
|
// bundle: "games",
|
|
// path: "prefabs/uis/CommonDialogBox",
|
|
// type: Prefab,
|
|
// });
|
|
// dialogBox = instantiate(prefab);
|
|
// dialogBox.parent = this.canvas.node;
|
|
// setTimeout(() => {
|
|
// dialogBox.destroy();
|
|
// }, 5000);
|
|
// setTimeout(() => {
|
|
// ResManager.getInstance().releaseAsset(prefab);
|
|
// }, 10000);
|
|
|
|
const petNode = await PetManager.getInstance().getPet("BaiLuWang");
|
|
petNode.parent = this.canvas.node;
|
|
|
|
setTimeout(() => {
|
|
petNode.destroy();
|
|
}, 5000);
|
|
// UIManager.getInstance().openUI(CommonToast, "这是一条测试消息");
|
|
}
|
|
}
|