我正在尝试创建自定义ActionEvent
。当我尝试发送事件时,scene.dipatchEvent
正在向我询问EventDispatcherChain
对象。我没有做任何复杂的事情来实际创建新EventDispatcherChain
的实现。我如何获得默认的EventDispatcherChain,以便将其传递给scene.dispatchEvent
?
的EventType
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);
答案 0 :(得分:1)
事件只是通过Event.fireEvent()发送,这是一种静态方法。