package eu.jonahbauer.wizard.client.libgdx.listeners;

import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import eu.jonahbauer.wizard.client.libgdx.util.SoundManager;

public class ButtonClickListener extends ChangeListener {
    private final SoundManager sounds;

    public ButtonClickListener(SoundManager sounds) {
        this.sounds = sounds;
    }

    @Override
    public void changed(ChangeEvent event, Actor actor) {
        if (actor instanceof Button) {
            sounds.sfxClick();
        }
    }
}
