我正在尝试创建一个自定义ActionEvent
. 当我尝试分派事件时,scene.dipatchEvent
它要求我提供一个EventDispatcherChain
对象。我没有做任何复杂的事情来实际创建一个新的EventDispatcherChain
. 我将如何获得默认的 EventDispatcherChain 以便将其传递给scene.dispatchEvent
?
事件类型
public class SquirrelEventType extends EventType<SquirrelActionEvent> {
public SquirrelEventType() {
super("Squirrel.NotifyPreloader");
}
}
事件
public class SquirrelActionEvent extends ActionEvent {
private Preloader.PreloaderNotification preloaderNotification;
private String details;
private double progress;
/**
*
*/
public SquirrelActionEvent(double progress){
preloaderNotification = new Preloader.ProgressNotification(progress);
}
public PreloaderNotification getPreloaderNotification() {
return preloaderNotification;
}
public void setPreloaderNotification(PreloaderNotification preloaderNotification) {
this.preloaderNotification = preloaderNotification;
}
这是调用dispatchEvent
SquirrelActionEvent event = new SquirrelActionEvent(0.1d);
mainScene.getEventDispatcher().dispatchEvent(event, null);