init
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { _decorator, AudioClip, Component, Node, Prefab, resources, Sprite, SpriteFrame } from 'cc';
|
||||
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;
|
||||
|
||||
onLoad() {
|
||||
AssetController.instance = this;
|
||||
}
|
||||
|
||||
loadSetSprite(path: string, sprite: Sprite) {
|
||||
path = path + "/spriteFrame"
|
||||
resources.load(path, SpriteFrame, (err, spriteFrame: SpriteFrame) => {
|
||||
if (err) {
|
||||
console.log(err.message || err);
|
||||
return;
|
||||
}
|
||||
sprite.spriteFrame = spriteFrame;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user