Revision de4a7e02
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/json/JsonReader.java | ||
---|---|---|
64 | 64 |
private ObjectSticker[] mObjectSticker; |
65 | 65 |
private Static3D[] mAxis; |
66 | 66 |
private int[] mBasicAngle; |
67 |
private String mLongName, mShortName, mInventor; |
|
68 |
private String mSmallIcon, mMediumIcon, mBigIcon, mHugeIcon, mMeshFile; |
|
67 |
private String mLongName, mInventor; |
|
69 | 68 |
private int mYearOfInvention, mComplexity; |
70 | 69 |
private int[] mNumLayers; |
71 | 70 |
private float mSize; |
72 |
private int mNumScrambles, mScrambleType;
|
|
71 |
private int mScrambleType; |
|
73 | 72 |
private int[] mColor; |
74 | 73 |
|
75 | 74 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
92 | 91 |
private void parseMetadata(JSONObject object) throws JSONException |
93 | 92 |
{ |
94 | 93 |
mLongName = object.getString("longname"); |
95 |
mShortName = object.getString("shortname"); |
|
96 | 94 |
mInventor = object.getString("inventor"); |
97 | 95 |
mYearOfInvention = object.getInt("year"); |
98 | 96 |
mComplexity = object.getInt("complexity"); |
99 |
mSmallIcon = object.getString("icon_small"); |
|
100 |
mMediumIcon = object.getString("icon_medium"); |
|
101 |
mBigIcon = object.getString("icon_big"); |
|
102 |
mHugeIcon = object.getString("icon_huge"); |
|
103 |
mMeshFile = object.getString("mesh"); |
|
104 |
mNumScrambles = object.getInt("num_scrambles"); |
|
105 | 97 |
mSize = (float)object.getDouble("size"); |
106 | 98 |
mSolvedFuncIndex = object.getInt("solved_func"); |
107 | 99 |
} |
... | ... | |
691 | 683 |
return null; |
692 | 684 |
} |
693 | 685 |
|
694 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
695 |
|
|
696 |
public String getShortName() |
|
697 |
{ |
|
698 |
return mShortName; |
|
699 |
} |
|
700 |
|
|
701 | 686 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
702 | 687 |
|
703 | 688 |
public String getObjectName() |
... | ... | |
754 | 739 |
return mSize; |
755 | 740 |
} |
756 | 741 |
|
757 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
758 |
|
|
759 |
public int getNumScrambles() |
|
760 |
{ |
|
761 |
return mNumScrambles; |
|
762 |
} |
|
763 |
|
|
764 | 742 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
765 | 743 |
|
766 | 744 |
public int getScrambleType() |
src/main/java/org/distorted/objectlib/json/JsonWriter.java | ||
---|---|---|
36 | 36 |
import org.distorted.objectlib.helpers.ObjectSticker; |
37 | 37 |
import org.distorted.objectlib.helpers.ScrambleState; |
38 | 38 |
import org.distorted.objectlib.main.TwistyObject; |
39 |
import org.distorted.objectlib.main.ObjectType; |
|
40 | 39 |
|
41 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 41 |
|
... | ... | |
355 | 354 |
{ |
356 | 355 |
JSONObject metadata = new JSONObject(); |
357 | 356 |
|
358 |
ObjectType type = object.getObjectType(); |
|
359 |
String inventor = object.getInventor(); |
|
360 |
String shortname = type.name(); |
|
361 |
String lowerShort= shortname.toLowerCase(); |
|
362 |
String longname = object.getObjectName(); |
|
363 |
|
|
364 |
metadata.put("longname" , longname ); |
|
365 |
metadata.put("shortname" , shortname ); |
|
366 |
metadata.put("inventor" , inventor); |
|
367 |
metadata.put("year" , object.getYearOfInvention()); |
|
368 |
metadata.put("complexity" , object.getComplexity()); |
|
369 |
metadata.put("icon_huge" , "h_"+lowerShort+".png"); |
|
370 |
metadata.put("icon_big" , "b_"+lowerShort+".png"); |
|
371 |
metadata.put("icon_medium" , "m_"+lowerShort+".png"); |
|
372 |
metadata.put("icon_small" , "s_"+lowerShort+".png"); |
|
373 |
metadata.put("mesh" , lowerShort+".dmesh"); |
|
374 |
metadata.put("num_scrambles", type.getNumScramble() ); |
|
375 |
metadata.put("size" , object.getSize() ); |
|
376 |
metadata.put("solved_func" , object.getSolvedFunctionIndex() ); |
|
357 |
metadata.put("longname" , object.getObjectName() ); |
|
358 |
metadata.put("inventor" , object.getInventor()); |
|
359 |
metadata.put("year" , object.getYearOfInvention()); |
|
360 |
metadata.put("complexity" , object.getComplexity()); |
|
361 |
metadata.put("size" , object.getSize() ); |
|
362 |
metadata.put("solved_func", object.getSolvedFunctionIndex() ); |
|
377 | 363 |
|
378 | 364 |
return metadata; |
379 | 365 |
} |
Also available in: Unified diff
Remove ObjectType and info it held (icons, mesh file, num of scrambles, shortname) from the JSON file.