import { _decorator, Component, Node, game, find } from 'cc'; import { Sound } from '../core/sound/Sound'; const { ccclass, property } = _decorator; @ccclass('SoundSystem') export class SoundSystem extends Component { private static thisObject: SoundSystem; start() { SoundSystem.thisObject = this; game.addPersistRootNode(this.node); } public static play(index: number) { this.thisObject.getComponent(Sound).play(index); } public static stop() { this.thisObject && this.thisObject.getComponent(Sound).stop(); } public static setVolume(value: number) { this.thisObject.getComponent(Sound).volume = value; } }