Revision 47ba5ddc
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/effect/win/WinEffect.java | ||
---|---|---|
36 | 36 |
public enum Type |
37 | 37 |
{ |
38 | 38 |
NONE (WinEffectNone.class), |
39 |
SPIN (WinEffectSpin.class), |
|
40 | 39 |
GLOW (WinEffectGlow.class), |
41 | 40 |
; |
42 | 41 |
|
... | ... | |
77 | 76 |
|
78 | 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
79 | 78 |
|
79 |
abstract void createEffects(int duration); |
|
80 |
|
|
81 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
82 |
|
|
83 |
private void assignEffects() |
|
84 |
{ |
|
85 |
mCubeEffectNumber = ( mCubeEffects!=null ) ? mCubeEffects.length : 0; |
|
86 |
mNodeEffectNumber = ( mNodeEffects!=null ) ? mNodeEffects.length : 0; |
|
87 |
|
|
88 |
if( mCubeEffectNumber==0 && mNodeEffectNumber==0 ) |
|
89 |
{ |
|
90 |
throw new RuntimeException("Cube and Node Effects both not created!"); |
|
91 |
} |
|
92 |
|
|
93 |
for(int i=0; i<mCubeEffectNumber; i++) |
|
94 |
{ |
|
95 |
mCube.apply(mCubeEffects[i],mCubeEffectPosition[i]); |
|
96 |
mCubeEffects[i].notifyWhenFinished(this); |
|
97 |
} |
|
98 |
|
|
99 |
DistortedEffects nodeEffects = mCube.getEffects(); |
|
100 |
|
|
101 |
for(int i=0; i<mNodeEffectNumber; i++) |
|
102 |
{ |
|
103 |
nodeEffects.apply(mNodeEffects[i],mNodeEffectPosition[i]); |
|
104 |
mNodeEffects[i].notifyWhenFinished(this); |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
109 |
// PUBLIC API |
|
110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
111 |
|
|
112 |
@SuppressWarnings("unused") |
|
80 | 113 |
public static String[] getNames() |
81 | 114 |
{ |
82 | 115 |
String[] names = new String[NUM_EFFECTS]; |
... | ... | |
91 | 124 |
|
92 | 125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
93 | 126 |
|
127 |
@SuppressWarnings("unused") |
|
94 | 128 |
public static WinEffect create(int ordinal) throws InstantiationException, IllegalAccessException |
95 | 129 |
{ |
96 | 130 |
return types[ordinal].effect.newInstance(); |
97 | 131 |
} |
98 | 132 |
|
99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
100 |
|
|
101 |
abstract void createEffects(int duration); |
|
102 |
|
|
103 | 133 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
104 | 134 |
|
105 | 135 |
public void effectFinished(final long effectID) |
... | ... | |
132 | 162 |
|
133 | 163 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
134 | 164 |
|
165 |
@SuppressWarnings("unused") |
|
135 | 166 |
public long start(int duration, RubikRenderer renderer) |
136 | 167 |
{ |
137 | 168 |
mScreen = renderer.getScreen(); |
... | ... | |
145 | 176 |
return FAKE_EFFECT_ID; |
146 | 177 |
} |
147 | 178 |
|
148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
149 |
|
|
150 |
private void assignEffects() |
|
151 |
{ |
|
152 |
mCubeEffectNumber = ( mCubeEffects!=null ) ? mCubeEffects.length : 0; |
|
153 |
mNodeEffectNumber = ( mNodeEffects!=null ) ? mNodeEffects.length : 0; |
|
154 |
|
|
155 |
if( mCubeEffectNumber==0 && mNodeEffectNumber==0 ) |
|
156 |
{ |
|
157 |
throw new RuntimeException("Cube and Node Effects both not created!"); |
|
158 |
} |
|
159 |
|
|
160 |
for(int i=0; i<mCubeEffectNumber; i++) |
|
161 |
{ |
|
162 |
mCube.apply(mCubeEffects[i],mCubeEffectPosition[i]); |
|
163 |
mCubeEffects[i].notifyWhenFinished(this); |
|
164 |
} |
|
165 |
|
|
166 |
DistortedEffects nodeEffects = mCube.getEffects(); |
|
167 |
|
|
168 |
for(int i=0; i<mNodeEffectNumber; i++) |
|
169 |
{ |
|
170 |
nodeEffects.apply(mNodeEffects[i],mNodeEffectPosition[i]); |
|
171 |
mNodeEffects[i].notifyWhenFinished(this); |
|
172 |
} |
|
173 |
} |
|
174 |
|
|
175 | 179 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
176 | 180 |
|
177 | 181 |
@SuppressWarnings("unused") |
Also available in: Unified diff
RubikCube: further fixes