Project

General

Profile

« Previous | Next » 

Revision 988e3d33

Added by Leszek Koltunski about 2 months ago

Objects can support or not changing colors of their stickers.

View differences:

src/main/java/org/distorted/objects/RubikObjectList.java
37 37
  public static class DownloadedObject
38 38
    {
39 39
    String shortName;
40
    boolean icon,object,extras;
40
    boolean icon,object,extras,adjColors;
41 41
    int numScrambles, objectVersion, extrasVersion, price;
42 42
    int category, year;
43 43
    float difficulty;
44 44
    String author;
45 45

  
46 46
    DownloadedObject(String sName, int scrambles, int pr, int oVersion, int eVersion, boolean i,
47
                     boolean o, boolean e, float diff, int cat, int y, String a)
47
                     boolean o, boolean e, float diff, int cat, int y, String a, boolean c)
48 48
      {
49 49
      shortName     = sName;
50 50
      numScrambles  = scrambles;
......
55 55
      category      = cat;
56 56
      year          = y;
57 57
      author        = a;
58
      adjColors     = c;
58 59

  
59 60
      icon   = i;
60 61
      object = o;
......
194 195
// PUBLIC API
195 196

  
196 197
  public static boolean addDownloadedObject(Context context, String shortName, int numScrambles, int price, int objectVersion,
197
                                         int extrasVersion, boolean icon, boolean object, boolean extras, float diff, int category, int year, String author)
198
                                         int extrasVersion, boolean icon, boolean object, boolean extras, float diff,
199
                                         int category, int year, String author, boolean adjColors)
198 200
    {
199 201
    if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "New downloaded object "+shortName+" icon="+icon+" object="+object+" extras="+extras);
200 202

  
......
221 223
    if( !object ) objectVersion=-1;
222 224
    if( !extras ) extrasVersion=-1;
223 225

  
224
    DownloadedObject obj = new DownloadedObject(shortName,numScrambles,price,objectVersion,extrasVersion,icon,object,extras,diff,category,year,author);
226
    DownloadedObject obj = new DownloadedObject(shortName,numScrambles,price,objectVersion,extrasVersion,icon,object,extras,diff,category,year,author,adjColors);
225 227
    if ( internalAddDownloadedObject(obj) )
226 228
      {
227 229
      if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Adding new downloaded object "+shortName+" icon="+obj.icon+" object="+obj.object+" extras="+obj.extras);
......
327 329
        downloadedObjects.append(object.author.replace(' ','_'));
328 330
        downloadedObjects.append(' ');
329 331
        downloadedObjects.append(object.price);
332
        downloadedObjects.append(' ');
333
        downloadedObjects.append(object.adjColors ? "1":"0");
330 334
        }
331 335

  
332 336
      String objects = downloadedObjects.toString();
......
379 383
          String extr = parts[6];
380 384

  
381 385
          int price=0,category=0,year=0;
386
          boolean supportsAdjColors=true;
382 387
          float diff=0.0f;
383 388
          String author="";
384 389

  
......
396 401
            else if( c=='f' ) price = ListObjects.DEFAULT_PRICE_OF_OLD_OBJECTS;
397 402
            else              price = Integer.parseInt(parts[11]);
398 403
            }
404
          if( length>=13 )
405
            {
406
            char s = parts[12].charAt(0);
407
            supportsAdjColors = (s=='1');
408
            }
399 409

  
400 410
          int scrambles = Integer.parseInt(scra);
401 411
          int oVersion  = Integer.parseInt(objV);
......
405 415
          boolean bObje = obje.equals("1");
406 416
          boolean bExtr = extr.equals("1");
407 417

  
408
          addDownloadedObject(context,name,scrambles,price,oVersion,eVersion,bIcon,bObje,bExtr,diff,category,year,author);
418
          addDownloadedObject(context,name,scrambles,price,oVersion,eVersion,bIcon,bObje,bExtr,diff,category,year,author,supportsAdjColors);
409 419
          }
410 420
        }
411 421
      }

Also available in: Unified diff