Revision 20dbec0e
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/library/message/EffectListener.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 | 23 |
|
24 |
import org.distorted.library.main.DistortedEffects;
|
|
24 |
import org.distorted.library.effect.Effect;
|
|
25 | 25 |
|
26 | 26 |
/** |
27 |
* This interface lets users of the DistortedLibrary library get notified when something happens to one of the effects. |
|
28 |
* To receive the notifications, we first have to register with a call to {@link DistortedEffects#registerForMessages(EffectListener)}. |
|
29 |
* List of all possible events that can happen is defined in {@link EffectMessage} |
|
27 |
* This interface lets users of the DistortedLibrary library get notified when a given effect finishes. |
|
28 |
* To receive the notifications, we first have to register with a call to {@link Effect#notifyWhenFinished(EffectListener)}. |
|
30 | 29 |
*/ |
31 | 30 |
|
32 | 31 |
public interface EffectListener |
33 | 32 |
{ |
34 | 33 |
/** |
35 |
* Gets called when event of type 'eventType' happens to effect 'effectID'.
|
|
34 |
* Gets called when Effect 'effectID' finishes execution (i.e. the Dynamic inside it reaches its final point).
|
|
36 | 35 |
* |
37 |
* @param eventType Type of event that happened. |
|
38 |
* @param effectID ID of the effect the event happened to, as returned by {@link org.distorted.library.effect.Effect#getID() } |
|
39 |
* @param objectID the ID of the DistortedEffects object, as returned by {@link org.distorted.library.main.DistortedEffects#getID()}, |
|
40 |
* this event happened to. |
|
41 |
* @see EffectMessage |
|
36 |
* @param effectID ID of the finished effect, as returned by {@link org.distorted.library.effect.Effect#getID() } |
|
42 | 37 |
*/ |
43 | 38 |
|
44 |
void effectMessage(final EffectMessage eventType, final long effectID, final long objectID);
|
|
39 |
void effectFinished(final long effectID);
|
|
45 | 40 |
} |
46 | 41 |
|
47 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Simplify the way applications can get notifications when an effect finishes.
Now, instead of the 'DistortedEffects.(de)registerForNotifications()' 2 APIs, we call a single 'Effect.notifyWhenFinished()'.