16 |
16 |
import android.content.SharedPreferences;
|
17 |
17 |
|
18 |
18 |
import org.distorted.external.RubikFiles;
|
19 |
|
//import org.distorted.external.RubikScores;
|
|
19 |
import org.distorted.external.RubikScores;
|
20 |
20 |
import org.distorted.main.RubikActivity;
|
21 |
21 |
import org.distorted.objectlib.main.ObjectSignatures;
|
22 |
22 |
import org.distorted.objectlib.main.ObjectType;
|
... | ... | |
24 |
24 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
|
25 |
25 |
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS;
|
26 |
26 |
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
|
27 |
|
//import static org.distorted.main.RubikActivity.SHOW_SOLVED_DEBUG;
|
28 |
27 |
import static org.distorted.screens.RubikScreenPlay.LEVELS_SHOWN;
|
29 |
28 |
|
30 |
29 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
156 |
155 |
}
|
157 |
156 |
|
158 |
157 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
159 |
|
/*
|
|
158 |
|
160 |
159 |
private static void restoreFreedObjects(SharedPreferences preferences)
|
161 |
160 |
{
|
|
161 |
/*
|
162 |
162 |
mFreeSolvedObjects = preferences.getString("rol_freeSolved", "");
|
163 |
163 |
mFreeBoughtObjects = preferences.getString("rol_freeBought", "");
|
164 |
164 |
|
... | ... | |
201 |
201 |
if( o!=null ) o.markFree();
|
202 |
202 |
}
|
203 |
203 |
}
|
|
204 |
*/
|
204 |
205 |
}
|
205 |
206 |
|
206 |
207 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
207 |
208 |
|
208 |
209 |
private static int getNumUnclaimedSolves()
|
209 |
210 |
{
|
|
211 |
/*
|
210 |
212 |
RubikScores scores = RubikScores.getInstance();
|
211 |
213 |
int numMAXes = scores.numberOfSolvedMAXes();
|
212 |
214 |
return numMAXes-mNumFreeSolved;
|
|
215 |
*/
|
|
216 |
|
|
217 |
return 0;
|
213 |
218 |
}
|
214 |
219 |
|
215 |
220 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
218 |
223 |
{
|
219 |
224 |
RubikScores scores = RubikScores.getInstance();
|
220 |
225 |
int numObjects = RubikObjectList.getNumObjects();
|
221 |
|
int level = LEVELS_SHOWN;
|
222 |
226 |
int ret = 0;
|
223 |
227 |
|
224 |
228 |
for(int obj=0; obj<numObjects; obj++)
|
225 |
229 |
{
|
226 |
230 |
RubikObject object = getObject(obj);
|
227 |
231 |
|
228 |
|
if( object!=null && !object.isFree() && scores.isSolved(obj,level) )
|
|
232 |
if( object!=null && !object.isFree() && scores.isSolved(obj,LEVELS_SHOWN) )
|
229 |
233 |
{
|
230 |
234 |
solveObject(object.getUpperName());
|
231 |
235 |
ret++;
|
... | ... | |
257 |
261 |
|
258 |
262 |
public static boolean solveObject(RubikObject object, String shortName)
|
259 |
263 |
{
|
|
264 |
/*
|
260 |
265 |
if( object!=null && !object.isFree() )
|
261 |
266 |
{
|
262 |
267 |
if( SHOW_SOLVED_DEBUG ) android.util.Log.e("D", "object "+shortName+" marked as solved");
|
... | ... | |
266 |
271 |
mNumFreeSolved++;
|
267 |
272 |
return true;
|
268 |
273 |
}
|
269 |
|
|
|
274 |
*/
|
270 |
275 |
return false;
|
271 |
276 |
}
|
272 |
|
*/
|
|
277 |
|
273 |
278 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
274 |
279 |
// PUBLIC API
|
275 |
280 |
|
... | ... | |
358 |
363 |
}
|
359 |
364 |
}
|
360 |
365 |
}
|
361 |
|
/*
|
|
366 |
|
362 |
367 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
363 |
368 |
|
364 |
369 |
public static boolean allAlreadyBought()
|
365 |
370 |
{
|
366 |
|
return mFreeBoughtObjects.equals("*");
|
|
371 |
//return mFreeBoughtObjects.equals("*");
|
|
372 |
return false;
|
367 |
373 |
}
|
368 |
374 |
|
369 |
375 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
391 |
397 |
|
392 |
398 |
public static void buyAll()
|
393 |
399 |
{
|
|
400 |
/*
|
394 |
401 |
mFreeBoughtObjects = "*";
|
395 |
402 |
if( SHOW_SOLVED_DEBUG ) android.util.Log.e("D", "all objects marked as bought");
|
396 |
403 |
|
... | ... | |
399 |
406 |
RubikObject o = mObjects.get(i);
|
400 |
407 |
o.markFree();
|
401 |
408 |
}
|
|
409 |
*/
|
402 |
410 |
}
|
403 |
411 |
|
404 |
412 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
405 |
413 |
|
406 |
414 |
public static boolean buyObject(String shortName)
|
407 |
415 |
{
|
|
416 |
/*
|
408 |
417 |
RubikObject o = getObject(shortName);
|
409 |
418 |
|
410 |
419 |
if( o!=null && !o.isFree() )
|
... | ... | |
415 |
424 |
mFreeBoughtObjects += add;
|
416 |
425 |
return true;
|
417 |
426 |
}
|
418 |
|
|
|
427 |
*/
|
419 |
428 |
return false;
|
420 |
429 |
}
|
421 |
430 |
|
... | ... | |
426 |
435 |
RubikObject object = getObject(shortName);
|
427 |
436 |
return solveObject(object,shortName);
|
428 |
437 |
}
|
429 |
|
*/
|
|
438 |
|
430 |
439 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
431 |
440 |
|
432 |
441 |
public static void savePreferences(SharedPreferences.Editor editor)
|
... | ... | |
531 |
540 |
mObject = getOrdinal(objName);
|
532 |
541 |
if( mObject<0 || mObject>=mNumObjects ) mObject = DEF_OBJECT;
|
533 |
542 |
|
534 |
|
// if( justStarted) restoreFreedObjects(preferences);
|
|
543 |
if( justStarted) restoreFreedObjects(preferences);
|
535 |
544 |
}
|
536 |
545 |
|
537 |
546 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
552 |
561 |
}
|
553 |
562 |
|
554 |
563 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
555 |
|
/*
|
|
564 |
|
556 |
565 |
public static void setObjectFreeState()
|
557 |
566 |
{
|
558 |
567 |
int numUnclaimed = getNumUnclaimedSolves();
|
... | ... | |
564 |
573 |
if( stillUnclaimed>0) markAsFree(stillUnclaimed);
|
565 |
574 |
}
|
566 |
575 |
}
|
567 |
|
*/
|
|
576 |
|
568 |
577 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
569 |
578 |
|
570 |
579 |
public static boolean setCurrObject(int ordinal)
|
Reinstall the latest Android Studio, latest gradle; reconfigure all project to match and compile.