Revision 5f54927b
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/json/JsonWriter.java | ||
---|---|---|
350 | 350 |
|
351 | 351 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
352 | 352 |
|
353 |
private JSONObject generateMetadata(TwistyObject object) throws JSONException |
|
353 |
private JSONObject generateMetadata(TwistyObject object, int ordinal) throws JSONException
|
|
354 | 354 |
{ |
355 | 355 |
JSONObject metadata = new JSONObject(); |
356 | 356 |
|
357 |
ObjectType type = object.getObjectType();
|
|
357 |
ObjectType type = ObjectType.getObject(ordinal);
|
|
358 | 358 |
|
359 | 359 |
metadata.put("longname" , object.getObjectName() ); |
360 | 360 |
metadata.put("inventor" , object.getInventor()); |
... | ... | |
362 | 362 |
metadata.put("complexity" , object.getComplexity()); |
363 | 363 |
metadata.put("size" , object.getSize() ); |
364 | 364 |
metadata.put("scrambles" , type.getNumScramble() ); |
365 |
metadata.put("shortname" , type.name() );
|
|
365 |
metadata.put("shortname" , object.getShortName() );
|
|
366 | 366 |
metadata.put("resetmaps" , object.shouldResetTextureMaps() ); |
367 | 367 |
metadata.put("num_faces" , object.getNumFaces() ); |
368 |
metadata.put("signature" , object.getSignature() ); |
|
368 | 369 |
|
369 | 370 |
return metadata; |
370 | 371 |
} |
... | ... | |
549 | 550 |
|
550 | 551 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
551 | 552 |
|
552 |
public String createObjectString(TwistyObject object) throws JSONException |
|
553 |
public String createObjectString(TwistyObject object,int ordinal) throws JSONException
|
|
553 | 554 |
{ |
554 | 555 |
JSONObject json = new JSONObject(); |
555 | 556 |
|
556 |
JSONObject metadata = generateMetadata(object); |
|
557 |
JSONObject metadata = generateMetadata(object,ordinal);
|
|
557 | 558 |
JSONObject mesh = generateMesh(object); |
558 | 559 |
JSONArray axis = generateAxis(object); |
559 | 560 |
JSONArray quats = generateQuats(object); |
... | ... | |
585 | 586 |
if( tuts!=null ) |
586 | 587 |
{ |
587 | 588 |
JSONObject json = new JSONObject(); |
588 |
ObjectType type = object.getObjectType(); |
|
589 | 589 |
JSONArray tutorials = new JSONArray(); |
590 | 590 |
|
591 | 591 |
for(String[] tut : tuts) |
... | ... | |
607 | 607 |
|
608 | 608 |
json.put("major" , VERSION_EXTRAS_MAJOR); |
609 | 609 |
json.put("minor" , VERSION_EXTRAS_MINOR); |
610 |
json.put("object" , type.name() );
|
|
610 |
json.put("object" , object.getShortName() );
|
|
611 | 611 |
json.put("tutorials" , tutorials); |
612 | 612 |
|
613 | 613 |
return json.toString(); |
Also available in: Unified diff
Preparation for local creation of puzzles: remove the 'ObjectType' enum from TwistyObject class.