Revision 09cf2a36
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/config/ConfigActivity.java | ||
---|---|---|
222 | 222 |
int jsonID = object.getJsonID(); |
223 | 223 |
int meshID = object.getMeshID(); |
224 | 224 |
|
225 |
int meshState = object.getMeshState(); |
|
226 |
|
|
225 | 227 |
InputStream jsonStream = ObjectJson.getStream(jsonID,this); |
226 | 228 |
InputStream meshStream = ObjectMesh.getStream(meshID,this); |
227 |
control.changeIfDifferent(object.getOrdinal(),jsonStream,meshStream); |
|
229 |
|
|
230 |
control.changeIfDifferent(object.getOrdinal(),meshState,jsonStream,meshStream); |
|
228 | 231 |
} |
229 | 232 |
} |
230 | 233 |
|
231 | 234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
232 | 235 |
// PUBLIC API |
236 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
237 |
|
|
238 |
public void changeObject(RubikObject object) |
|
239 |
{ |
|
240 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
|
241 |
ObjectControl control = view.getObjectControl(); |
|
242 |
changeIfDifferent(object,control); |
|
243 |
} |
|
244 |
|
|
245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
246 |
|
|
247 |
public void changeMeshState(RubikObject object) |
|
248 |
{ |
|
249 |
if( object!=null ) |
|
250 |
{ |
|
251 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
|
252 |
ObjectControl control = view.getObjectControl(); |
|
253 |
|
|
254 |
int jsonID = object.getJsonID(); |
|
255 |
int meshID = object.getMeshID(); |
|
256 |
|
|
257 |
int meshState = object.getMeshState(); |
|
258 |
|
|
259 |
InputStream jsonStream = ObjectJson.getStream(jsonID,this); |
|
260 |
InputStream meshStream = ObjectMesh.getStream(meshID,this); |
|
261 |
|
|
262 |
control.changeObject(object.getOrdinal(),meshState,jsonStream,meshStream); |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
233 | 266 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
234 | 267 |
|
235 | 268 |
public FirebaseAnalytics getAnalytics() |
... | ... | |
308 | 341 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
309 | 342 |
return view.isVertical(); |
310 | 343 |
} |
311 |
|
|
312 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
313 |
|
|
314 |
public void changeObject(RubikObject object) |
|
315 |
{ |
|
316 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
|
317 |
ObjectControl control = view.getObjectControl(); |
|
318 |
changeIfDifferent(object,control); |
|
319 |
} |
|
320 | 344 |
} |
src/main/java/org/distorted/config/ConfigScreenPane.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.config; |
21 | 21 |
|
22 |
import java.io.InputStream; |
|
23 |
|
|
22 | 24 |
import android.util.TypedValue; |
23 | 25 |
import android.widget.ImageView; |
24 | 26 |
import android.widget.LinearLayout; |
... | ... | |
32 | 34 |
import org.distorted.objects.RubikObject; |
33 | 35 |
import org.distorted.objects.RubikObjectList; |
34 | 36 |
|
35 |
import java.io.InputStream; |
|
37 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE; |
|
38 |
import static org.distorted.objectlib.main.TwistyObject.MESH_FAST; |
|
36 | 39 |
|
37 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 41 |
|
39 | 42 |
public class ConfigScreenPane |
40 | 43 |
{ |
41 |
public static final int MESH_NICE = 0; |
|
42 |
public static final int MESH_FAST = 1; |
|
43 |
|
|
44 | 44 |
private static final int[] IMAGES = |
45 | 45 |
{ |
46 | 46 |
R.id.configDifficulty0, |
... | ... | |
64 | 64 |
private void switchMeshState(ConfigActivity act, int meshState) |
65 | 65 |
{ |
66 | 66 |
RubikObjectList.setMeshState(mObjectOrdinal,meshState); |
67 |
|
|
68 |
// TODO: rebuild the mesh
|
|
67 |
RubikObject object = RubikObjectList.getObject(mObjectOrdinal); |
|
68 |
act.changeMeshState(object);
|
|
69 | 69 |
} |
70 | 70 |
|
71 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
61 | 61 |
import org.distorted.screens.RubikScreenPlay; |
62 | 62 |
import org.distorted.tutorials.TutorialActivity; |
63 | 63 |
|
64 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE; |
|
65 |
|
|
64 | 66 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
65 | 67 |
|
66 | 68 |
public class RubikActivity extends AppCompatActivity |
... | ... | |
485 | 487 |
|
486 | 488 |
public void changeIfDifferent(int ordinal, ObjectControl control) |
487 | 489 |
{ |
490 |
RubikObject object = RubikObjectList.getObject(ordinal); |
|
491 |
int meshState = object!=null ? object.getMeshState() : MESH_NICE; |
|
492 |
|
|
488 | 493 |
InputStream jsonStream = ObjectJson.getStream(this,ordinal); |
489 | 494 |
InputStream meshStream = ObjectMesh.getStream(this,ordinal); |
490 |
control.changeIfDifferent(ordinal,jsonStream,meshStream); |
|
495 |
control.changeIfDifferent(ordinal,meshState,jsonStream,meshStream);
|
|
491 | 496 |
} |
492 | 497 |
|
493 | 498 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/RubikObject.java | ||
---|---|---|
24 | 24 |
import org.distorted.objectlib.main.ObjectType; |
25 | 25 |
import org.distorted.patterns.RubikPatternList; |
26 | 26 |
|
27 |
import static org.distorted.config.ConfigScreenPane.MESH_NICE;
|
|
27 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
|
|
28 | 28 |
|
29 | 29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 | 30 |
|
src/main/java/org/distorted/objects/RubikObjectList.java | ||
---|---|---|
29 | 29 |
|
30 | 30 |
import java.util.ArrayList; |
31 | 31 |
|
32 |
import static org.distorted.config.ConfigScreenPane.MESH_NICE;
|
|
32 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
|
|
33 | 33 |
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS; |
34 | 34 |
|
35 | 35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
---|---|---|
42 | 42 |
|
43 | 43 |
import org.distorted.main.R; |
44 | 44 |
import org.distorted.dialogs.RubikDialogError; |
45 |
import org.distorted.objects.RubikObject; |
|
45 | 46 |
import org.distorted.objects.RubikObjectList; |
46 | 47 |
|
48 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE; |
|
49 |
|
|
47 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 51 |
|
49 | 52 |
public class TutorialActivity extends AppCompatActivity |
... | ... | |
222 | 225 |
|
223 | 226 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
224 | 227 |
|
225 |
private void changeIfDifferent(int objectOrdinal,ObjectControl control)
|
|
228 |
private void changeIfDifferent(int ordinal,ObjectControl control) |
|
226 | 229 |
{ |
227 |
InputStream jsonStream = ObjectJson.getStream(this,objectOrdinal); |
|
228 |
InputStream meshStream = ObjectMesh.getStream(this,objectOrdinal); |
|
229 |
control.changeIfDifferent(objectOrdinal,jsonStream,meshStream); |
|
230 |
RubikObject object = RubikObjectList.getObject(ordinal); |
|
231 |
int meshState = object!=null ? object.getMeshState() : MESH_NICE; |
|
232 |
|
|
233 |
InputStream jsonStream = ObjectJson.getStream(this,ordinal); |
|
234 |
InputStream meshStream = ObjectMesh.getStream(this,ordinal); |
|
235 |
control.changeIfDifferent(ordinal,meshState,jsonStream,meshStream); |
|
230 | 236 |
} |
231 | 237 |
|
232 | 238 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Introduce 'Simple' and 'Nice' meshes.