1

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

1 に答える 1

1

イベントは、静的メソッドであるEvent.fireEvent()を介して送信されるだけです。

于 2013-01-31T19:55:45.813 に答える