Revision 22d72239
Added by Leszek Koltunski about 2 months ago
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
138 | 138 |
private int[] mColorTable; |
139 | 139 |
private int[] mOriginalColorTable; |
140 | 140 |
private float mTextureBorderMultiplier, mTextureCornerMultiplier; |
141 |
private boolean mCurrentColorSchemeSubmittable; |
|
141 | 142 |
|
142 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
143 | 144 |
|
... | ... | |
286 | 287 |
public void recreateFaceColors() |
287 | 288 |
{ |
288 | 289 |
for(int i=0; i<mNumFaceColors; i++) mColorTable[i] = mOriginalColorTable[i]; |
290 |
mCurrentColorSchemeSubmittable = true; |
|
289 | 291 |
} |
290 | 292 |
|
291 | 293 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
1264 | 1266 |
changeColorInTexture(oldColor,newColor); |
1265 | 1267 |
mColorTable[oldColorIndex] = newColor; |
1266 | 1268 |
setTexture(); |
1269 |
|
|
1270 |
int numOrig = numberOfDifferentColors(mOriginalColorTable); |
|
1271 |
int numNow = numberOfDifferentColors(mColorTable); |
|
1272 |
mCurrentColorSchemeSubmittable = (numOrig==numNow); |
|
1267 | 1273 |
} |
1268 | 1274 |
} |
1269 | 1275 |
|
... | ... | |
1416 | 1422 |
} |
1417 | 1423 |
} |
1418 | 1424 |
|
1425 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1426 |
|
|
1427 |
private int numberOfDifferentColors(int[] table) |
|
1428 |
{ |
|
1429 |
int ret=0; |
|
1430 |
int len = table.length; |
|
1431 |
|
|
1432 |
for(int i=0; i<len; i++) |
|
1433 |
{ |
|
1434 |
boolean increase = true; |
|
1435 |
|
|
1436 |
for(int j=0; j<i; j++) |
|
1437 |
if( table[j]==table[i] ) |
|
1438 |
{ |
|
1439 |
increase = false; |
|
1440 |
break; |
|
1441 |
} |
|
1442 |
|
|
1443 |
if( increase ) ret++; |
|
1444 |
} |
|
1445 |
|
|
1446 |
return ret; |
|
1447 |
} |
|
1448 |
|
|
1419 | 1449 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1420 | 1450 |
|
1421 | 1451 |
private void restoreSti(String key, OperatingSystemInterface os) |
... | ... | |
1432 | 1462 |
createTexture(mTextureBorderMultiplier,mTextureCornerMultiplier); |
1433 | 1463 |
setTexture(); |
1434 | 1464 |
mSolved.setPuzzleFaceColor(mColorTable); |
1465 |
|
|
1466 |
int numOrig = numberOfDifferentColors(mOriginalColorTable); |
|
1467 |
int numNow = numberOfDifferentColors(mColorTable); |
|
1468 |
mCurrentColorSchemeSubmittable = (numOrig==numNow); |
|
1435 | 1469 |
} |
1436 | 1470 |
} |
1437 | 1471 |
|
... | ... | |
2158 | 2192 |
return mMetadata.getSignature(); |
2159 | 2193 |
} |
2160 | 2194 |
|
2195 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
2196 |
|
|
2197 |
public boolean isSubmittable() |
|
2198 |
{ |
|
2199 |
return mCurrentColorSchemeSubmittable; |
|
2200 |
} |
|
2201 |
|
|
2161 | 2202 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
2162 | 2203 |
// for JSON only |
2163 | 2204 |
public abstract int getTouchControlType(); |
Also available in: Unified diff
If an object is re-stickered so that there are less colors on its faces than originally, block submitting records.