mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Added event for playing sound on button press.
This commit is contained in:
BIN
app/src/main/resources/assets/audio/music/godfrey.mp3
Normal file
BIN
app/src/main/resources/assets/audio/music/godfrey.mp3
Normal file
Binary file not shown.
BIN
app/src/main/resources/assets/audio/music/mw2-main-menu.mp3
Normal file
BIN
app/src/main/resources/assets/audio/music/mw2-main-menu.mp3
Normal file
Binary file not shown.
@@ -36,7 +36,14 @@ public class SoundManager {
|
|||||||
.listen(this::handlePlaySound)
|
.listen(this::handlePlaySound)
|
||||||
.listen(this::handleStopSound)
|
.listen(this::handleStopSound)
|
||||||
.listen(this::handleMusicStart)
|
.listen(this::handleMusicStart)
|
||||||
.listen(this::handleVolumeChange);
|
.listen(this::handleVolumeChange)
|
||||||
|
.listen(AudioEvents.playOnClickButton.class, _ -> {
|
||||||
|
try {
|
||||||
|
playSound("hitsound0.wav", false);
|
||||||
|
} catch (UnsupportedAudioFileException | LineUnavailableException | IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handlePlaySound(AudioEvents.PlayAudio event) {
|
private void handlePlaySound(AudioEvents.PlayAudio event) {
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ public class AudioEvents extends EventsBase {
|
|||||||
|
|
||||||
public record StartBackgroundMusic() implements EventWithoutSnowflake {}
|
public record StartBackgroundMusic() implements EventWithoutSnowflake {}
|
||||||
public record ChangeVolume(double newVolume) implements EventWithoutSnowflake {}
|
public record ChangeVolume(double newVolume) implements EventWithoutSnowflake {}
|
||||||
|
public record playOnClickButton() implements EventWithoutSnowflake {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user