57 |
57 |
}
|
58 |
58 |
|
59 |
59 |
private static ArrayList<DownloadedObject> mDownloadedObjects;
|
|
60 |
private static String mFreeSolvedObjects;
|
|
61 |
private static String mFreeBoughtObjects;
|
60 |
62 |
|
61 |
63 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
62 |
64 |
|
... | ... | |
204 |
206 |
return (ordinal>=0 && ordinal<mNumObjects) ? mObjects.get(ordinal).getMeshState() : MESH_NICE;
|
205 |
207 |
}
|
206 |
208 |
|
|
209 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
210 |
|
|
211 |
public static void saveMeshState(SharedPreferences.Editor editor)
|
|
212 |
{
|
|
213 |
for(int i=0; i<mNumObjects; i++)
|
|
214 |
{
|
|
215 |
RubikObject obj = getObject(i);
|
|
216 |
|
|
217 |
if( obj!=null )
|
|
218 |
{
|
|
219 |
String name = obj.getUpperName();
|
|
220 |
editor.putInt("rol_"+name, obj.getMeshState() );
|
|
221 |
}
|
|
222 |
}
|
|
223 |
}
|
|
224 |
|
|
225 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
226 |
|
|
227 |
public static void buyAll()
|
|
228 |
{
|
|
229 |
mFreeBoughtObjects = "*";
|
|
230 |
|
|
231 |
for(int i=0; i<mNumObjects; i++)
|
|
232 |
{
|
|
233 |
RubikObject o = mObjects.get(i);
|
|
234 |
o.markFree();
|
|
235 |
}
|
|
236 |
}
|
|
237 |
|
|
238 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
239 |
|
|
240 |
public static boolean buyObject(String shortName)
|
|
241 |
{
|
|
242 |
RubikObject o = getObject(shortName);
|
|
243 |
|
|
244 |
if( o!=null && !o.isFree() )
|
|
245 |
{
|
|
246 |
o.markFree();
|
|
247 |
mFreeBoughtObjects += (","+shortName);
|
|
248 |
return true;
|
|
249 |
}
|
|
250 |
|
|
251 |
return false;
|
|
252 |
}
|
|
253 |
|
|
254 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
255 |
|
|
256 |
public static boolean solveObject(String shortName)
|
|
257 |
{
|
|
258 |
RubikObject o = getObject(shortName);
|
|
259 |
|
|
260 |
if( o!=null && !o.isFree() )
|
|
261 |
{
|
|
262 |
o.markFree();
|
|
263 |
mFreeSolvedObjects += (","+shortName);
|
|
264 |
return true;
|
|
265 |
}
|
|
266 |
|
|
267 |
return false;
|
|
268 |
}
|
|
269 |
|
207 |
270 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
208 |
271 |
|
209 |
272 |
public static void savePreferences(SharedPreferences.Editor editor)
|
... | ... | |
247 |
310 |
{
|
248 |
311 |
editor.putString("rol_downloaded", "" );
|
249 |
312 |
}
|
250 |
|
}
|
251 |
|
|
252 |
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
253 |
313 |
|
254 |
|
public static void saveMeshState(SharedPreferences.Editor editor)
|
255 |
|
{
|
256 |
|
for(int i=0; i<mNumObjects; i++)
|
257 |
|
{
|
258 |
|
RubikObject obj = getObject(i);
|
259 |
|
|
260 |
|
if( obj!=null )
|
261 |
|
{
|
262 |
|
String name = obj.getUpperName();
|
263 |
|
editor.putInt("rol_"+name, obj.getMeshState() );
|
264 |
|
}
|
265 |
|
}
|
|
314 |
editor.putString("rol_freeSolved", mFreeSolvedObjects);
|
|
315 |
editor.putString("rol_freeBought", mFreeBoughtObjects);
|
266 |
316 |
}
|
267 |
317 |
|
268 |
318 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
313 |
363 |
String objName= preferences.getString("rol_objName",defName);
|
314 |
364 |
mObject = getOrdinal(objName);
|
315 |
365 |
if( mObject<0 || mObject>=mNumObjects ) mObject = DEF_OBJECT;
|
|
366 |
|
|
367 |
mFreeSolvedObjects = preferences.getString("rol_freeSolved", "");
|
|
368 |
mFreeBoughtObjects = preferences.getString("rol_freeBought", "");
|
|
369 |
|
|
370 |
if( mFreeBoughtObjects.length()>0 )
|
|
371 |
{
|
|
372 |
if( mFreeBoughtObjects.charAt(0)=='*' )
|
|
373 |
{
|
|
374 |
for(int i=0; i<mNumObjects; i++)
|
|
375 |
{
|
|
376 |
RubikObject o = mObjects.get(i);
|
|
377 |
o.markFree();
|
|
378 |
}
|
|
379 |
}
|
|
380 |
else
|
|
381 |
{
|
|
382 |
String[] objs = mFreeBoughtObjects.split(",");
|
|
383 |
|
|
384 |
for( String obj : objs )
|
|
385 |
{
|
|
386 |
RubikObject o = getObject(obj);
|
|
387 |
if( o!=null ) o.markFree();
|
|
388 |
}
|
|
389 |
}
|
|
390 |
}
|
|
391 |
|
|
392 |
if( mFreeSolvedObjects.length()>0 )
|
|
393 |
{
|
|
394 |
String[] objs = mFreeSolvedObjects.split(",");
|
|
395 |
|
|
396 |
for( String obj : objs )
|
|
397 |
{
|
|
398 |
RubikObject o = getObject(obj);
|
|
399 |
if( o!=null ) o.markFree();
|
|
400 |
}
|
|
401 |
}
|
316 |
402 |
}
|
317 |
403 |
|
318 |
404 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Progress with marking objects as free