Revision d36d8517
Added by Leszek Koltunski almost 4 years ago
| src/main/java/org/distorted/config/ConfigActivity.java | ||
|---|---|---|
| 180 | 180 |
if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() ) |
| 181 | 181 |
{
|
| 182 | 182 |
RubikObject object = RubikObjectList.getObject(mObjectOrdinal); |
| 183 |
changeIfDifferent(object,view.getObjectControl()); |
|
| 183 |
changeIfDifferent(object,mObjectOrdinal,view.getObjectControl());
|
|
| 184 | 184 |
} |
| 185 | 185 |
} |
| 186 | 186 |
|
| ... | ... | |
| 203 | 203 |
|
| 204 | 204 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 205 | 205 |
|
| 206 |
private void changeIfDifferent(RubikObject object,ObjectControl control) |
|
| 206 |
private void changeIfDifferent(RubikObject object,int ordinal,ObjectControl control)
|
|
| 207 | 207 |
{
|
| 208 | 208 |
if( object!=null ) |
| 209 | 209 |
{
|
| 210 |
int ordinal = object.getOrdinal(); |
|
| 211 | 210 |
int meshState = object.getMeshState(); |
| 212 | 211 |
InputStream jsonStream = object.getObjectStream(this); |
| 213 | 212 |
InputStream meshStream = object.getMeshStream(this); |
| ... | ... | |
| 226 | 225 |
RubikObject object = RubikObjectList.getObject(ordinal); |
| 227 | 226 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
| 228 | 227 |
ObjectControl control = view.getObjectControl(); |
| 229 |
changeIfDifferent(object,control); |
|
| 228 |
changeIfDifferent(object,ordinal,control);
|
|
| 230 | 229 |
} |
| 231 | 230 |
|
| 232 | 231 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 233 | 232 |
|
| 234 |
public void changeMeshState(RubikObject object) |
|
| 233 |
public void changeMeshState(RubikObject object, int ordinal)
|
|
| 235 | 234 |
{
|
| 236 | 235 |
if( object!=null ) |
| 237 | 236 |
{
|
| 238 | 237 |
ConfigSurfaceView view = findViewById(R.id.configSurfaceView); |
| 239 | 238 |
ObjectControl control = view.getObjectControl(); |
| 240 | 239 |
|
| 241 |
int ordinal = object.getOrdinal(); |
|
| 242 | 240 |
int meshState = object.getMeshState(); |
| 243 | 241 |
InputStream jsonStream = object.getObjectStream(this); |
| 244 | 242 |
InputStream meshStream = object.getMeshStream(this); |
| src/main/java/org/distorted/config/ConfigScreenPane.java | ||
|---|---|---|
| 63 | 63 |
{
|
| 64 | 64 |
RubikObjectList.setMeshState(mObjectOrdinal,meshState); |
| 65 | 65 |
RubikObject object = RubikObjectList.getObject(mObjectOrdinal); |
| 66 |
act.changeMeshState(object); |
|
| 66 |
act.changeMeshState(object,mObjectOrdinal);
|
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/objects/RubikObject.java | ||
|---|---|---|
| 40 | 40 |
{
|
| 41 | 41 |
private final String mName; |
| 42 | 42 |
private final int mNumScramble; |
| 43 |
private final int mOrdinal; |
|
| 44 | 43 |
private final int mJsonID, mMeshID, mExtrasID; |
| 45 | 44 |
private final int mIconID; |
| 46 | 45 |
private final String[][] mPatterns; |
| ... | ... | |
| 53 | 52 |
|
| 54 | 53 |
RubikObject(ObjectType type) |
| 55 | 54 |
{
|
| 55 |
int ordinal= type.ordinal(); |
|
| 56 |
|
|
| 56 | 57 |
mName = type.name(); |
| 57 | 58 |
mNumScramble = type.getNumScramble(); |
| 58 |
mOrdinal = type.ordinal(); |
|
| 59 | 59 |
|
| 60 | 60 |
mIconID = type.getIconID(); |
| 61 |
mJsonID = ObjectJson.getObjectJsonID(mOrdinal);
|
|
| 62 |
mMeshID = ObjectMesh.getMeshID(mOrdinal);
|
|
| 63 |
mExtrasID = ObjectJson.getExtrasJsonID(mOrdinal);
|
|
| 61 |
mJsonID = ObjectJson.getObjectJsonID(ordinal);
|
|
| 62 |
mMeshID = ObjectMesh.getMeshID(ordinal);
|
|
| 63 |
mExtrasID = ObjectJson.getExtrasJsonID(ordinal);
|
|
| 64 | 64 |
|
| 65 |
int patternOrdinal = RubikPatternList.getOrdinal(mOrdinal);
|
|
| 65 |
int patternOrdinal = RubikPatternList.getOrdinal(ordinal);
|
|
| 66 | 66 |
mPatterns = RubikPatternList.getPatterns(patternOrdinal); |
| 67 | 67 |
|
| 68 | 68 |
mMeshState = MESH_NICE; |
| ... | ... | |
| 76 | 76 |
|
| 77 | 77 |
RubikObject(RubikObjectList.DownloadedObject object) |
| 78 | 78 |
{
|
| 79 |
mName = object.shortName; |
|
| 79 |
mName = object.shortName; |
|
| 80 |
mMeshID = 0; |
|
| 81 |
mPatterns = null; |
|
| 82 |
mMeshState = MESH_NICE; |
|
| 83 |
mExtrasOrdinal = -1; |
|
| 80 | 84 |
|
| 81 |
mNumScramble = type.getNumScramble(); |
|
| 82 |
mOrdinal = type.ordinal(); |
|
| 83 | 85 |
|
| 86 |
|
|
| 87 |
mNumScramble = type.getNumScramble(); |
|
| 84 | 88 |
mObjectMinor = ? |
| 85 | 89 |
mExtrasMinor = ? |
| 86 |
|
|
| 87 | 90 |
mIconID = type.getIconID(); |
| 88 | 91 |
mJsonID = ObjectJson.getObjectJsonID(mOrdinal); |
| 89 | 92 |
mExtrasID = ObjectJson.getExtrasJsonID(mOrdinal); |
| 90 |
|
|
| 91 |
mMeshID = 0; |
|
| 92 |
mPatterns = null; |
|
| 93 |
|
|
| 94 |
mMeshState = MESH_NICE; |
|
| 95 |
mExtrasOrdinal = -1; |
|
| 96 | 93 |
} |
| 97 | 94 |
|
| 98 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 145 | 142 |
return mNumScramble; |
| 146 | 143 |
} |
| 147 | 144 |
|
| 148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 149 |
|
|
| 150 |
public int getOrdinal() |
|
| 151 |
{
|
|
| 152 |
return mOrdinal; |
|
| 153 |
} |
|
| 154 |
|
|
| 155 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 156 | 146 |
|
| 157 | 147 |
public void setIconTo(ImageButton button) |
Also available in: Unified diff
Refactor RubikObject in preparation for creating RubikObjects from DownloadedObjects.