Revision b0a2ce63
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/effect/AppearEffect.java | ||
---|---|---|
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
public static final int NUM_EFFECTS = Type.values().length; |
52 |
private static final Type[] types; |
|
53 |
|
|
54 |
static |
|
55 |
{ |
|
56 |
int i=0; |
|
57 |
|
|
58 |
types = new Type[NUM_EFFECTS]; |
|
59 |
|
|
60 |
for(Type type: Type.values()) |
|
61 |
{ |
|
62 |
types[i] = type; |
|
63 |
i++; |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
52 | 67 |
private final int FAKE_EFFECT_ID = -1; |
53 | 68 |
|
54 | 69 |
private int mCubeEffectNumber, mCubeEffectFinished, mCubeEffectReturned; |
... | ... | |
71 | 86 |
|
72 | 87 |
abstract int createEffects(int duration); |
73 | 88 |
|
89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
90 |
|
|
91 |
public static Type getType(int ordinal) |
|
92 |
{ |
|
93 |
return types[ordinal]; |
|
94 |
} |
|
95 |
|
|
74 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
75 | 97 |
|
76 | 98 |
public void effectMessage(final EffectMessage em, final long effectID, final long objectID) |
src/main/java/org/distorted/effect/DisappearEffect.java | ||
---|---|---|
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
public static final int NUM_EFFECTS = Type.values().length; |
52 |
private static final Type[] types; |
|
53 |
|
|
54 |
static |
|
55 |
{ |
|
56 |
int i=0; |
|
57 |
|
|
58 |
types = new Type[NUM_EFFECTS]; |
|
59 |
|
|
60 |
for(Type type: Type.values()) |
|
61 |
{ |
|
62 |
types[i] = type; |
|
63 |
i++; |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
52 | 67 |
private final int FAKE_EFFECT_ID = -2; |
53 | 68 |
|
54 | 69 |
private int mCubeEffectNumber, mCubeEffectFinished, mCubeEffectReturned; |
... | ... | |
71 | 86 |
|
72 | 87 |
abstract int createEffects(int duration); |
73 | 88 |
|
89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
90 |
|
|
91 |
public static Type getType(int ordinal) |
|
92 |
{ |
|
93 |
return types[ordinal]; |
|
94 |
} |
|
95 |
|
|
74 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
75 | 97 |
|
76 | 98 |
public void effectMessage(final EffectMessage em, final long effectID, final long objectID) |
src/main/java/org/distorted/magic/RubikActivity.java | ||
---|---|---|
27 | 27 |
import android.support.v7.app.AppCompatActivity; |
28 | 28 |
import android.view.View; |
29 | 29 |
|
30 |
import org.distorted.effect.AppearEffect; |
|
31 |
import org.distorted.effect.DisappearEffect; |
|
30 | 32 |
import org.distorted.library.main.DistortedLibrary; |
31 | 33 |
|
32 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
52 | 54 |
setContentView(R.layout.layout); |
53 | 55 |
markButton(mSize); |
54 | 56 |
|
55 |
mAppearPos = 10; |
|
56 |
mDisappearPos = 10; |
|
57 |
mAppearType = 1; |
|
58 |
mDisappearType = 1; |
|
57 |
onComplete(10, 10, 1, 1); |
|
59 | 58 |
} |
60 | 59 |
|
61 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
127 | 126 |
mDisappearPos = dP; |
128 | 127 |
mAppearType = aT; |
129 | 128 |
mDisappearType= dT; |
129 |
|
|
130 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
131 |
RubikRenderer renderer = view.getRenderer(); |
|
132 |
|
|
133 |
renderer.setAppearDuration(mAppearPos*100); |
|
134 |
renderer.setDisappearDuration(mDisappearPos*100); |
|
135 |
renderer.setAppearType(AppearEffect.getType(mAppearType)); |
|
136 |
renderer.setDisappearType(DisappearEffect.getType(mDisappearType)); |
|
130 | 137 |
} |
131 | 138 |
|
132 | 139 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/res/layout/settings.xml | ||
---|---|---|
11 | 11 |
android:paddingStart="15dp" |
12 | 12 |
android:paddingEnd="15dp" |
13 | 13 |
android:gravity="start|bottom" |
14 |
android:text="@string/appear" |
|
14 |
android:text="@string/disappear"
|
|
15 | 15 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
16 | 16 |
|
17 | 17 |
<LinearLayout |
... | ... | |
21 | 21 |
android:orientation="horizontal"> |
22 | 22 |
|
23 | 23 |
<SeekBar |
24 |
android:id="@+id/appearDuration" |
|
24 |
android:id="@+id/disappearDuration"
|
|
25 | 25 |
android:layout_weight="0.6" |
26 | 26 |
android:layout_width="fill_parent" |
27 | 27 |
android:layout_height="fill_parent" |
... | ... | |
29 | 29 |
android:paddingRight="10dp" /> |
30 | 30 |
|
31 | 31 |
<Spinner |
32 |
android:id="@+id/appearType" |
|
32 |
android:id="@+id/disappearType"
|
|
33 | 33 |
android:layout_weight="0.4" |
34 | 34 |
android:layout_width="fill_parent" |
35 | 35 |
android:layout_height="fill_parent" |
... | ... | |
45 | 45 |
android:paddingStart="15dp" |
46 | 46 |
android:paddingEnd="15dp" |
47 | 47 |
android:gravity="start|bottom" |
48 |
android:text="@string/disappear"
|
|
48 |
android:text="@string/appear" |
|
49 | 49 |
android:textAppearance="?android:attr/textAppearanceMedium" /> |
50 | 50 |
|
51 | 51 |
<LinearLayout |
... | ... | |
55 | 55 |
android:orientation="horizontal"> |
56 | 56 |
|
57 | 57 |
<SeekBar |
58 |
android:id="@+id/disappearDuration"
|
|
58 |
android:id="@+id/appearDuration" |
|
59 | 59 |
android:layout_weight="0.6" |
60 | 60 |
android:layout_width="fill_parent" |
61 | 61 |
android:layout_height="fill_parent" |
... | ... | |
63 | 63 |
android:paddingRight="10dp" /> |
64 | 64 |
|
65 | 65 |
<Spinner |
66 |
android:id="@+id/disappearType"
|
|
66 |
android:id="@+id/appearType" |
|
67 | 67 |
android:layout_weight="0.4" |
68 | 68 |
android:layout_width="fill_parent" |
69 | 69 |
android:layout_height="fill_parent" |
Also available in: Unified diff
Connect the dialog values to RubikRenderer.