Project

General

Profile

« Previous | Next » 

Revision fa18f764

Added by Leszek Koltunski over 1 year ago

Unlock downloaded objects on download if we have everything in the app unlocked!

View differences:

src/main/java/org/distorted/objects/RubikObjectList.java
22 22
import org.distorted.objectlib.main.ObjectType;
23 23

  
24 24
import static org.distorted.main.RubikActivity.SHOW_IAP_DEBUG;
25
import static org.distorted.main.RubikActivity.USE_IAP;
25 26
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
26 27
import static org.distorted.objectlib.main.ObjectType.NUM_OBJECTS;
27 28
import static org.distorted.main.RubikActivity.SHOW_DOWNLOADED_DEBUG;
......
74 75
    createBuiltinObjects();
75 76
    }
76 77

  
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

  
80
  private static boolean allObjectsUnlocked()
81
    {
82
    return mBoughtObjects!=null       &&
83
           mBoughtObjects.length()>0  &&
84
           mBoughtObjects.charAt(0)=='*';
85
    }
86

  
77 87
///////////////////////////////////////////////////////////////////////////////////////////////////
78 88

  
79 89
  private void createBuiltinObjects()
......
117 127
    mObjects.add(obj);
118 128
    mNumObjects++;
119 129

  
130
    if( USE_IAP && !obj.isFree() && allObjectsUnlocked() )
131
      {
132
      if( SHOW_IAP_DEBUG ) android.util.Log.e("D", "everything unlocked, so setting downloaded object free: "+obj.getUpperName() );
133
      obj.markFree();
134
      }
135

  
120 136
    if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "creating downloaded object "+obj.getUpperName() );
121 137

  
122 138
    if( obj.hasExtras() )
......
257 273
      }
258 274
    }
259 275

  
260
///////////////////////////////////////////////////////////////////////////////////////////////////
261

  
262
  public static boolean allAlreadyBought()
263
    {
264
    return mBoughtObjects.equals("*");
265
    }
266

  
267 276
///////////////////////////////////////////////////////////////////////////////////////////////////
268 277

  
269 278
  public static boolean thereAreLockedObjects()
......
358 367
      editor.putString("rol_downloaded", "" );
359 368
      }
360 369

  
361
    if( RubikActivity.USE_IAP )
370
    if( USE_IAP )
362 371
      {
363 372
      editor.putString("rol_bought", mBoughtObjects);
364 373

  
......
436 445
    mObject = getOrdinal(objName);
437 446
    if( mObject<0 || mObject>=mNumObjects ) mObject = DEF_OBJECT;
438 447

  
439
    if( RubikActivity.USE_IAP && justStarted ) restoreFreedObjects(preferences);
448
    if( USE_IAP && justStarted ) restoreFreedObjects(preferences);
440 449
    }
441 450

  
442 451
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff