Revision 97201782
Added by Leszek Koltunski almost 2 years ago
| src/main/java/org/distorted/bandaged/BandagedActivity.java | ||
|---|---|---|
| 313 | 313 |
public void playObject(String name) |
| 314 | 314 |
{
|
| 315 | 315 |
Intent intent = new Intent(this, PlayActivity.class); |
| 316 |
intent.putExtra("level", 0);
|
|
| 316 |
intent.putExtra("level", -1);
|
|
| 317 | 317 |
intent.putExtra("name", name);
|
| 318 | 318 |
intent.putExtra("scrambles", NUM_SCRAMBLES);
|
| 319 | 319 |
intent.putExtra("local", true);
|
| 320 | 320 |
intent.putExtra("ordinal", 0);
|
| 321 |
intent.putExtra("free", true);
|
|
| 322 | 321 |
startActivity(intent); |
| 323 | 322 |
} |
| 324 | 323 |
|
| src/main/java/org/distorted/external/RubikScores.java | ||
|---|---|---|
| 35 | 35 |
public static final int RECORD_NOT_NEW = 2; |
| 36 | 36 |
|
| 37 | 37 |
public static final int MAX_RECORD = 10; |
| 38 |
public static final int MULT = 1000000;
|
|
| 38 |
private static final int MULT = 1000000;
|
|
| 39 | 39 |
public static final int NO_RECORD = Integer.MAX_VALUE; |
| 40 | 40 |
private static RubikScores mThis; |
| 41 | 41 |
|
| ... | ... | |
| 83 | 83 |
|
| 84 | 84 |
private int mapKey(int object,int level) |
| 85 | 85 |
{
|
| 86 |
return object*MULT + level;
|
|
| 86 |
return object*MULT + (level<0 ? MULT-1 : level);
|
|
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 | 89 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 151 | 151 |
for(int key: mMap.keySet()) |
| 152 | 152 |
{
|
| 153 | 153 |
MapValue value = mMap.get(key); |
| 154 |
int level = key%MULT; |
|
| 154 | 155 |
|
| 155 |
if( value!=null && !value.submitted && value.record<NO_RECORD) |
|
| 156 |
if( level<MULT-1 && value!=null && !value.submitted && value.record<NO_RECORD)
|
|
| 156 | 157 |
{
|
| 157 | 158 |
if( !first ) |
| 158 | 159 |
{
|
| ... | ... | |
| 167 | 168 |
if( object!=null ) |
| 168 | 169 |
{
|
| 169 | 170 |
builderObj.append(object.getUpperName()); |
| 170 |
builderLvl.append(key%MULT);
|
|
| 171 |
builderLvl.append(level);
|
|
| 171 | 172 |
builderTim.append(value.record); |
| 172 | 173 |
} |
| 173 | 174 |
} |
| 174 | 175 |
} |
| 175 | 176 |
|
| 176 |
return strObj+builderObj.toString()+strLvl+builderLvl.toString()+strTim+builderTim.toString();
|
|
| 177 |
return strObj+builderObj+strLvl+builderLvl+strTim+builderTim;
|
|
| 177 | 178 |
} |
| 178 | 179 |
|
| 179 | 180 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/main/MainActivity.java | ||
|---|---|---|
| 406 | 406 |
|
| 407 | 407 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 408 | 408 |
|
| 409 |
public void switchToPlay(RubikObject object, int scrambles, boolean free, int level)
|
|
| 409 |
public void switchToPlay(RubikObject object, int scrambles, int level) |
|
| 410 | 410 |
{
|
| 411 | 411 |
Intent intent = new Intent(this, PlayActivity.class); |
| 412 | 412 |
intent.putExtra("level", level);
|
| ... | ... | |
| 414 | 414 |
intent.putExtra("scrambles", scrambles);
|
| 415 | 415 |
intent.putExtra("local", object.isLocal() );
|
| 416 | 416 |
intent.putExtra("ordinal", object.getObjectOrdinal() );
|
| 417 |
intent.putExtra("free", free );
|
|
| 418 | 417 |
startActivity(intent); |
| 419 | 418 |
} |
| 420 | 419 |
|
| src/main/java/org/distorted/main/MainObjectPopup.java | ||
|---|---|---|
| 199 | 199 |
level[l].setLayoutParams(params); |
| 200 | 200 |
level[l].setPadding(0,0,0,0); |
| 201 | 201 |
|
| 202 |
boolean isSolved = scores.isSolved(mObjectOrdinal,l); |
|
| 202 |
final int ll=l-1; |
|
| 203 |
boolean isSolved = scores.isSolved(mObjectOrdinal,ll); |
|
| 203 | 204 |
level[l].setBackgroundTintList( isSolved ? colorG : colorD); |
| 204 |
|
|
| 205 |
final int ll=l; |
|
| 206 |
boolean free = l==0; |
|
| 207 | 205 |
int scrambles = (l>0 && l<min) ? l : numScramble; |
| 208 | 206 |
|
| 209 | 207 |
level[l].setOnClickListener( new View.OnClickListener() |
| ... | ... | |
| 212 | 210 |
public void onClick(View v) |
| 213 | 211 |
{
|
| 214 | 212 |
mPopup.dismiss(); |
| 215 |
if( ll==0 ) scores.setRecord(mObjectOrdinal,0,0); // remember we've entered the 'Free'
|
|
| 213 |
if( ll<0 ) scores.setRecord(mObjectOrdinal,ll,0); // remember we've entered the 'Free'
|
|
| 216 | 214 |
// so that the button turns green |
| 217 |
act.switchToPlay(object,scrambles,free,ll);
|
|
| 215 |
act.switchToPlay(object,scrambles,ll); |
|
| 218 | 216 |
} |
| 219 | 217 |
}); |
| 220 | 218 |
} |
| src/main/java/org/distorted/playui/PlayActivity.java | ||
|---|---|---|
| 85 | 85 |
mNumScrambles = b.getInt("scrambles");
|
| 86 | 86 |
mObjectLocal = b.getBoolean("local");
|
| 87 | 87 |
mObjectOrdinal = b.getInt("ordinal");
|
| 88 |
mModeFree = b.getBoolean("free");
|
|
| 89 | 88 |
} |
| 90 | 89 |
else |
| 91 | 90 |
{
|
| 92 |
mLevel = 0;
|
|
| 91 |
mLevel = -1;
|
|
| 93 | 92 |
mObjectName = ""; |
| 94 | 93 |
mNumScrambles = 0; |
| 95 | 94 |
mObjectLocal = true; |
| 96 | 95 |
mObjectOrdinal = 0; |
| 97 |
mModeFree = true; |
|
| 98 | 96 |
} |
| 99 | 97 |
|
| 98 |
mModeFree = (mLevel<0); |
|
| 99 |
|
|
| 100 | 100 |
DisplayMetrics displaymetrics = new DisplayMetrics(); |
| 101 | 101 |
getWindowManager().getDefaultDisplay().getRealMetrics(displaymetrics); |
| 102 | 102 |
mScreenWidth =displaymetrics.widthPixels; |
Also available in: Unified diff
bugfixes