add: some more languages

This commit is contained in:
ramollia
2025-10-05 16:59:37 +02:00
parent 043b789da1
commit 2362333d46
29 changed files with 656 additions and 188 deletions

View File

@@ -41,7 +41,7 @@ public class SoundManager {
.listen(this::handleMusicStart)
.listen(this::handleVolumeChange)
.listen(this::handleGetCurrentVolume)
.listen(AudioEvents.clickButton.class, _ -> {
.listen(AudioEvents.ClickButton.class, _ -> {
try {
playSound("medium-button-click.wav", false);
} catch (UnsupportedAudioFileException | LineUnavailableException | IOException e) {
@@ -69,15 +69,16 @@ public class SoundManager {
}
private void handleVolumeChange(AudioEvents.ChangeVolume event) {
if (event.newVolume() > 1.0) this.volume = 1.0;
else this.volume = Math.max(event.newVolume(), 0.0);
double newVolume = event.newVolume() / 100.0;
if (newVolume > 1.0) this.volume = 1.0;
else this.volume = Math.max(newVolume, 0.0);
for (MediaPlayer mediaPlayer : this.activeMusic) {
mediaPlayer.setVolume(this.volume);
}
}
private void handleGetCurrentVolume(AudioEvents.GetCurrentVolume event) {
new EventFlow().addPostEvent(new AudioEvents.GetCurrentVolumeReponse(volume, event.snowflakeId()))
new EventFlow().addPostEvent(new AudioEvents.GetCurrentVolumeReponse(volume * 100.0, event.snowflakeId()))
.asyncPostEvent();
}

View File

@@ -37,5 +37,5 @@ public class AudioEvents extends EventsBase {
return snowflakeId;
}
}
public record clickButton() implements EventWithoutSnowflake {}
public record ClickButton() implements EventWithoutSnowflake {}
}