mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
added back button sounds because SOMEONE fucked it up.....
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package org.toop.app.widget;
|
||||
|
||||
import javafx.scene.image.ImageView;
|
||||
import org.toop.framework.audio.events.AudioEvents;
|
||||
import org.toop.framework.eventbus.EventFlow;
|
||||
import org.toop.framework.resource.resources.ImageAsset;
|
||||
import org.toop.local.AppContext;
|
||||
|
||||
@@ -73,8 +75,11 @@ public final class Primitive {
|
||||
}
|
||||
|
||||
if (onAction != null) {
|
||||
button.setOnAction(_ ->
|
||||
onAction.run());
|
||||
button.setOnAction(_ -> {
|
||||
onAction.run();
|
||||
playButtonSound();
|
||||
System.out.println("HI I got called button");
|
||||
});
|
||||
}
|
||||
|
||||
return button;
|
||||
@@ -116,10 +121,16 @@ public final class Primitive {
|
||||
slider.setValue(value);
|
||||
|
||||
if (onValueChanged != null) {
|
||||
slider.valueProperty().addListener((_, _, newValue) ->
|
||||
onValueChanged.accept(newValue.intValue()));
|
||||
slider.valueProperty().addListener((_, _, newValue) -> {
|
||||
onValueChanged.accept(newValue.intValue());
|
||||
});
|
||||
}
|
||||
|
||||
slider.setOnMouseReleased(event -> {
|
||||
playButtonSound();
|
||||
System.out.println("I got called!");
|
||||
});
|
||||
|
||||
return slider;
|
||||
}
|
||||
|
||||
@@ -137,8 +148,11 @@ public final class Primitive {
|
||||
}
|
||||
|
||||
if (onValueChanged != null) {
|
||||
choice.valueProperty().addListener((_, _, newValue) ->
|
||||
onValueChanged.accept(newValue));
|
||||
choice.valueProperty().addListener((_, _, newValue) -> {
|
||||
onValueChanged.accept(newValue);
|
||||
playButtonSound();
|
||||
System.out.println("hi i got called choice");
|
||||
});
|
||||
}
|
||||
|
||||
choice.setItems(FXCollections.observableArrayList(items));
|
||||
@@ -191,4 +205,8 @@ public final class Primitive {
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
private static void playButtonSound() {
|
||||
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).postEvent();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package org.toop.app.widget.complex;
|
||||
|
||||
import org.toop.app.widget.Primitive;
|
||||
import org.toop.app.widget.Widget;
|
||||
import org.toop.framework.audio.events.AudioEvents;
|
||||
import org.toop.framework.eventbus.EventFlow;
|
||||
import org.toop.local.AppContext;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
@@ -30,6 +32,7 @@ public class ToggleWidget implements Widget {
|
||||
updateText();
|
||||
if (onToggle != null) {
|
||||
onToggle.accept(state);
|
||||
new EventFlow().addPostEvent(new AudioEvents.ClickButton()).postEvent(); // TODO FIX PRIMITIVES
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user