Project

General

Profile

« Previous | Next » 

Revision c02235d5

Added by Leszek Koltunski 6 months ago

progress

View differences:

src/main/java/org/distorted/objects/RubikObjectList.java
17 17

  
18 18
import org.distorted.external.RubikFiles;
19 19
import org.distorted.external.RubikScores;
20
import org.distorted.objectlib.signature.ObjectConstants;
21 20
import org.distorted.objectlib.main.ObjectType;
22 21

  
23 22
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS;
......
30 29
  public static final boolean SHOW_IAP_DEBUG        = false;
31 30
  public static final boolean USE_IAP               = false;
32 31

  
33
  public static final int DEF_OBJECT= ObjectConstants.CUBE_3;
34 32
  private static RubikObjectList mThis;
35 33
  private static int mNumObjects;
36 34
  private static int mNumExtras;
37 35
  private static ArrayList<RubikObject> mObjects;
38
  private static int mObject = DEF_OBJECT;
39 36

  
40 37
  public static class DownloadedObject
41 38
    {
......
58 55
    }
59 56

  
60 57
  private static ArrayList<DownloadedObject> mDownloadedObjects;
61

  
62 58
  private static String mBoughtObjects;
63 59

  
64 60
///////////////////////////////////////////////////////////////////////////////////////////////////
......
285 281

  
286 282
  public static void savePreferences(SharedPreferences.Editor editor)
287 283
    {
288
    RubikObject obj = getObject(mObject);
289
    if( obj!=null ) editor.putString("rol_objName", obj.getUpperName() );
290

  
291 284
    int numDownloaded = mDownloadedObjects.size();
292 285

  
293 286
    if( numDownloaded>0 )
......
336 329
      }
337 330
    }
338 331

  
339
///////////////////////////////////////////////////////////////////////////////////////////////////
340

  
341
  public static void savePreferencesMinimal(SharedPreferences.Editor editor)
342
    {
343
    RubikObject obj = getObject(mObject);
344
    if( obj!=null ) editor.putString("rol_objName", obj.getUpperName() );
345
    }
346

  
347 332
///////////////////////////////////////////////////////////////////////////////////////////////////
348 333

  
349 334
  public static void restorePreferences(Context context, SharedPreferences preferences, boolean justStarted)
......
397 382
        }
398 383
      }
399 384

  
400
    RubikObject object = getObject(DEF_OBJECT);
401
    String defName = object==null ? "CUBE_3" : object.getUpperName();
402
    String objName= preferences.getString("rol_objName",defName);
403
    mObject = getOrdinal(objName);
404
    if( mObject<0 || mObject>=mNumObjects ) mObject = DEF_OBJECT;
405

  
406 385
    if( USE_IAP && justStarted ) restoreFreedObjects(preferences);
407 386
    }
408 387

  
......
473 452
    mBoughtObjects += add;
474 453
    }
475 454

  
476
///////////////////////////////////////////////////////////////////////////////////////////////////
477

  
478
  public static boolean setCurrObject(int ordinal)
479
    {
480
    if( mObject!=ordinal )
481
      {
482
      mObject = ordinal;
483
      return true;
484
      }
485

  
486
    return false;
487
    }
488

  
489
///////////////////////////////////////////////////////////////////////////////////////////////////
490

  
491
  public static int getCurrObject()
492
    {
493
    return mObject;
494
    }
495

  
496
///////////////////////////////////////////////////////////////////////////////////////////////////
497

  
498
  public static String getCurrentName()
499
    {
500
    RubikObject object = mObjects.get(mObject);
501
    return object==null ? "" : object.getUpperName();
502
    }
503

  
504 455
///////////////////////////////////////////////////////////////////////////////////////////////////
505 456

  
506 457
  public static RubikObject getObject(int ordinal)

Also available in: Unified diff