import { _decorator, Button, Component, Node } from 'cc';
import { SoundManager } from '../../Managers/global/Sound/SoundManager';
const { ccclass, property } = _decorator;

@ccclass('ButtonSound')
export class ButtonSound extends Component 
{
    private soundManager: SoundManager;
    
    protected onEnable(): void 
    {
        if (!this.soundManager)
            this.soundManager = SoundManager.m_GetInstance;
        
        this.node.on(Button.EventType.CLICK, () => this.soundManager.fn_PlayBtnClip());
    }

    protected onDisable(): void 
    {
        this.node.off(Button.EventType.CLICK);
    }
}

