Revision ecf3d6e3
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java | ||
---|---|---|
27 | 27 |
import org.distorted.library.main.DistortedScreen; |
28 | 28 |
import org.distorted.library.message.EffectListener; |
29 | 29 |
|
30 |
import org.distorted.objectlib.main.ObjectPreRender; |
|
30 | 31 |
import org.distorted.objectlib.main.ObjectType; |
31 | 32 |
import org.distorted.objectlib.main.TwistyObject; |
32 |
|
|
33 | 33 |
import org.distorted.objectlib.effects.BaseEffect; |
34 |
import org.distorted.objectlib.effects.EffectController; |
|
35 | 34 |
import org.distorted.objectlib.helpers.MovesFinished; |
36 | 35 |
|
37 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
67 | 66 |
} |
68 | 67 |
} |
69 | 68 |
|
70 |
private EffectController mController;
|
|
69 |
private ObjectPreRender mPre;
|
|
71 | 70 |
private int mEffectReturned; |
72 | 71 |
private int mNumScramblesLeft; |
73 | 72 |
private int mDurationPerDegree; |
... | ... | |
134 | 133 |
int angle= mScrambles[mNumScrambles][2]; |
135 | 134 |
|
136 | 135 |
mNumScramblesLeft--; |
137 |
mController.addRotation(this, axis, (1<<row), angle, mDurationPerDegree);
|
|
136 |
mPre.addRotation(this, axis, (1<<row), angle, mDurationPerDegree);
|
|
138 | 137 |
mNumScrambles++; |
139 | 138 |
} |
140 | 139 |
else |
141 | 140 |
{ |
142 | 141 |
mRotReady = true; |
143 |
if( mPluginReady ) mController.effectFinished(FAKE_EFFECT_ID);
|
|
142 |
if( mPluginReady ) mPre.effectFinished(FAKE_EFFECT_ID);
|
|
144 | 143 |
} |
145 | 144 |
} |
146 | 145 |
|
... | ... | |
224 | 223 |
disassignEffects(); |
225 | 224 |
|
226 | 225 |
mPluginReady = true; |
227 |
if( mRotReady ) mController.effectFinished(FAKE_EFFECT_ID);
|
|
226 |
if( mRotReady ) mPre.effectFinished(FAKE_EFFECT_ID);
|
|
228 | 227 |
} |
229 | 228 |
} |
230 | 229 |
|
... | ... | |
258 | 257 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
259 | 258 |
|
260 | 259 |
@SuppressWarnings("unused") |
261 |
public long start(int duration, DistortedScreen screen, EffectController cont)
|
|
260 |
public long start(int duration, DistortedScreen screen, ObjectPreRender pre)
|
|
262 | 261 |
{ |
263 |
mObject = cont.getObject();
|
|
264 |
mController= cont;
|
|
262 |
mObject= pre.getObject();
|
|
263 |
mPre = pre;
|
|
265 | 264 |
|
266 | 265 |
// NOT mController.solve() !! This would be a very subtle bug. We need to do this immediately, |
267 | 266 |
// because here we are already inside the mController.preRender() function (doing 'scrambleObjectNow') |
... | ... | |
271 | 270 |
|
272 | 271 |
mBasicAngle = mObject.getBasicAngle(); |
273 | 272 |
|
274 |
int numScrambles = cont.getNumScrambles();
|
|
273 |
int numScrambles = pre.getNumScrambles();
|
|
275 | 274 |
int dura = (int)(duration*Math.pow(numScrambles,0.66f)); |
276 | 275 |
createBaseEffects(dura,numScrambles); |
277 | 276 |
createEffects (dura,numScrambles); |
Also available in: Unified diff
1) introduce possibility to move objects, i.e. display them not in the middle of the screen (not fully functional yet)
2) do away with unneeded any more interface 'EffectController' - since ObjectPreRender is the only implementation now.