Project

General

Profile

« Previous | Next » 

Revision cf486b0d

Added by Leszek Koltunski over 2 years ago

Progress with new UI.

View differences:

src/main/java/org/distorted/objects/RubikObject.java
37 37
import org.distorted.objectlib.json.JsonWriter;
38 38
import org.distorted.objectlib.main.ObjectType;
39 39
import org.distorted.patterns.RubikPatternList;
40
import org.distorted.solvers.ImplementedSolversList;
40 41

  
41 42
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
42 43
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
......
55 56
  private int mMeshState;
56 57
  private int mExtrasOrdinal;
57 58
  private Drawable mStaticIconD, mRescaledIconD;
59
  private final int mSignature;
58 60

  
59 61
///////////////////////////////////////////////////////////////////////////////////////////////////
60 62

  
61 63
  RubikObject(ObjectType type)
62 64
    {
63
    int ordinal= type.ordinal();
65
    mSignature   = type.ordinal();
64 66

  
65 67
    mUpperName   = type.name();
66 68
    mLowerName   = type.name().toLowerCase(Locale.ENGLISH);
67 69
    mNumScramble = type.getNumScramble();
68 70

  
69 71
    mIconID      = type.getIconID();
70
    mJsonID      = ObjectJson.getObjectJsonID(ordinal);
71
    mMeshID      = ObjectMesh.getMeshID(ordinal);
72
    mExtrasID    = ObjectJson.getExtrasJsonID(ordinal);
72
    mJsonID      = ObjectJson.getObjectJsonID(mSignature);
73
    mMeshID      = ObjectMesh.getMeshID(mSignature);
74
    mExtrasID    = ObjectJson.getExtrasJsonID(mSignature);
73 75

  
74
    int patternOrdinal  = RubikPatternList.getOrdinal(ordinal);
76
    int patternOrdinal  = RubikPatternList.getOrdinal(mSignature);
75 77
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
76 78

  
77 79
    mMeshState = MESH_NICE;
......
104 106
    mJsonID        = -1;
105 107
    mExtrasID      = -1;
106 108
    mIconID        = -1;
109
    mSignature     = -1;
107 110
    }
108 111

  
109 112
///////////////////////////////////////////////////////////////////////////////////////////////////
......
212 215
    return mUpperName;
213 216
    }
214 217

  
218
///////////////////////////////////////////////////////////////////////////////////////////////////
219

  
220
  public int getSignature()
221
    {
222
    return mSignature;
223
    }
224

  
215 225
///////////////////////////////////////////////////////////////////////////////////////////////////
216 226

  
217 227
  public int getNumScramble()
......
305 315
    return mExtrasID!=0;
306 316
    }
307 317

  
318
///////////////////////////////////////////////////////////////////////////////////////////////////
319
// a downloaded object (signature<0) for sure does not have a solver.
320

  
321
  public boolean hasSolver()
322
    {
323
    return ImplementedSolversList.isImplemented(mSignature);
324
    }
325

  
308 326
///////////////////////////////////////////////////////////////////////////////////////////////////
309 327

  
310 328
  public String[][] getPatterns()
src/main/java/org/distorted/solvers/ImplementedSolversList.java
45 45
      }
46 46
    }
47 47

  
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49

  
50
  public static boolean isImplemented(int signature)
51
    {
52
    for(int i=0; i<NUM_OBJECTS; i++)
53
      {
54
      if( signature==objects[i].mObject ) return true;
55
      }
56
    return false;
57
    }
58

  
48 59
///////////////////////////////////////////////////////////////////////////////////////////////////
49 60

  
50 61
  public static int getObject(int ordinal)

Also available in: Unified diff