カスタムを作成しようとしています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);