Revision f647630d
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/effect/AppearEffect.java | ||
---|---|---|
22 | 22 |
import org.distorted.library.effect.Effect; |
23 | 23 |
import org.distorted.library.main.DistortedScreen; |
24 | 24 |
import org.distorted.library.message.EffectListener; |
25 |
import org.distorted.library.message.EffectMessage; |
|
26 | 25 |
import org.distorted.magic.RubikCube; |
27 | 26 |
|
28 | 27 |
import java.lang.reflect.Method; |
... | ... | |
95 | 94 |
|
96 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
97 | 96 |
|
98 |
public void effectMessage(final EffectMessage em, final long effectID, final long objectID)
|
|
97 |
public void effectFinished(final long effectID)
|
|
99 | 98 |
{ |
100 | 99 |
for(int i=0; i<mCubeEffectNumber; i++) |
101 | 100 |
{ |
... | ... | |
107 | 106 |
|
108 | 107 |
if( mCubeEffectReturned == mCubeEffectFinished ) |
109 | 108 |
{ |
110 |
mListener.effectMessage(null, FAKE_EFFECT_ID, 0); |
|
111 |
} |
|
112 |
|
|
113 |
if( mCubeEffectReturned == mCubeEffectNumber ) |
|
114 |
{ |
|
115 |
mCube.deregisterForMessages(this); |
|
109 |
mListener.effectFinished(FAKE_EFFECT_ID); |
|
116 | 110 |
} |
117 | 111 |
|
118 | 112 |
mCube.remove(id); |
... | ... | |
143 | 137 |
for(int i=0; i<mCubeEffectNumber; i++) |
144 | 138 |
{ |
145 | 139 |
mCube.apply(mCubeEffects[i],mCubeEffectPosition[i]); |
140 |
mCubeEffects[i].notifyWhenFinished(this); |
|
146 | 141 |
} |
147 | 142 |
|
148 |
mCube.registerForMessages(this); |
|
149 | 143 |
mScreen.attach(mCube); |
150 | 144 |
|
151 | 145 |
return FAKE_EFFECT_ID; |
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()'.