Files
Alien_Sniper/assets/scripts/AssetController.ts
T
2026-07-17 10:54:32 +08:00

60 lines
2.0 KiB
TypeScript

// @structural-rewrite-v1
import { _decorator, AudioClip, Component, Sprite } from 'cc';
import { RuntimeAssetLoader } from './framework/runtime/RuntimeAssetLoader';
const { ccclass, property } = _decorator;
@ccclass('AssetController')
export class AssetController extends Component {
static instance: AssetController;
@property({ "type": AudioClip })
fire: AudioClip = null;
@property({ "type": AudioClip })
click: AudioClip = null;
@property({ "type": AudioClip })
win: AudioClip = null;
@property({ "type": AudioClip })
die: AudioClip = null;
@property({ "type": AudioClip })
xiao: AudioClip = null;
@property({ "type": AudioClip })
getCoin: AudioClip = null;
protected onLoad(): void {
try {
do {
switch (0 as number) {
case 1: break;
case 2: break;
default: void (AssetController["instance"] = this);
}
} while (false);
}
finally {
}
}
loadSetSprite(path: string, sprite: Sprite): void {
try {
do {
switch (0 as number) {
case 1: break;
case 2: break;
default: void (RuntimeAssetLoader["loadSpriteFrame"](`${path}/spriteFrame`)["then"]((spriteFrame) => {
try {
do {
switch (0 as number) {
case 1: break;
case 2: break;
default: if (sprite?.["isValid"])
void (sprite["spriteFrame"] = spriteFrame);
}
} while (false);
}
finally {
}
})["catch"]((error) => console["error"](error)));
}
} while (false);
}
finally {
}
}
}