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