Project

General

Profile

« Previous | Next » 

Revision e1a86bf2

Added by Leszek Koltunski over 2 years ago

Move the main app to the 'J1M1' object creation mode, i.e. create them from the Json files and using the Dmesh fiels as well.

Make it possible for any app descending from the 'objectlib' to use any of the J0M0, J0M1, J1M0, J1M1 modes.

View differences:

src/main/java/org/distorted/objectlib/json/JsonReader.java
42 42

  
43 43
public class JsonReader
44 44
{
45
  private static JsonReader mThis;
46

  
47 45
  private ScrambleState[] mStates;
48 46
  private int[][] mSolvedQuats;
49 47
  private Static4D[] mQuats;
......
64 62
  private ObjectSticker[] mObjectSticker;
65 63
  private Static3D[] mAxis;
66 64
  private int[] mBasicAngle;
67
  private String mLongName, mInventor;
65
  private String mLongName, mShortName, mInventor;
68 66
  private int mYearOfInvention, mComplexity;
69 67
  private int[] mNumLayers;
70 68
  private float mSize;
71
  private int mScrambleType;
69
  private int mScrambleType, mNumScrambles;
72 70
  private int[] mColor;
73

  
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75

  
76
  private JsonReader()
77
    {
78

  
79
    }
80

  
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

  
83
  public static JsonReader getInstance()
84
    {
85
    if( mThis==null ) mThis = new JsonReader();
86
    return mThis;
87
    }
71
  private ObjectType mType;
88 72

  
89 73
///////////////////////////////////////////////////////////////////////////////////////////////////
90 74

  
91 75
  private void parseMetadata(JSONObject object) throws JSONException
92 76
    {
93 77
    mLongName        = object.getString("longname");
78
    mShortName       = object.getString("shortname");
94 79
    mInventor        = object.getString("inventor");
95 80
    mYearOfInvention = object.getInt("year");
96 81
    mComplexity      = object.getInt("complexity");
97 82
    mSize            = (float)object.getDouble("size");
98 83
    mSolvedFuncIndex = object.getInt("solved_func");
84
    mNumScrambles    = object.getInt("scrambles");
85

  
86
    int ordinal = ObjectType.getOrdinal(mShortName);
87
    mType = ordinal>=0 ? ObjectType.getObject(ordinal) : null;
99 88
    }
100 89

  
101 90
///////////////////////////////////////////////////////////////////////////////////////////////////
......
655 644
    return mCubitFaceColor[cubit][face];
656 645
    }
657 646

  
647
///////////////////////////////////////////////////////////////////////////////////////////////////
648

  
649
  public int getNumScrambles()
650
    {
651
    return mNumScrambles;
652
    }
653

  
658 654
///////////////////////////////////////////////////////////////////////////////////////////////////
659 655

  
660 656
  public ObjectSticker retSticker(int sticker)
......
680 676

  
681 677
  public ObjectType intGetObjectType()
682 678
    {
683
    return null;
679
    return mType;
684 680
    }
685 681

  
686 682
///////////////////////////////////////////////////////////////////////////////////////////////////
......
690 686
    return mLongName;
691 687
    }
692 688

  
689
///////////////////////////////////////////////////////////////////////////////////////////////////
690

  
691
  public String getShortName()
692
    {
693
    return mShortName;
694
    }
695

  
693 696
///////////////////////////////////////////////////////////////////////////////////////////////////
694 697

  
695 698
  public String getInventor()

Also available in: Unified diff