Project

General

Profile

« Previous | Next » 

Revision 9c7d220a

Added by Leszek Koltunski about 2 months ago

Save the colors and sticker properties to Preferences.

View differences:

src/main/java/org/distorted/objectlib/main/TwistyObject.java
1474 1474
    {
1475 1475
    String key = getShortName();
1476 1476
    for(int i=0; i<mNumCubits; i++) mCubits[i].savePreferences(key,os);
1477

  
1478
    os.putFloat(key+"_border", mTextureBorderMultiplier);
1479
    os.putFloat(key+"_corner", mTextureCornerMultiplier);
1480
    os.putString(key+"_colors", createColors(mColorTable) );
1477 1481
    }
1478 1482

  
1479 1483
///////////////////////////////////////////////////////////////////////////////////////////////////
......
1482 1486
    {
1483 1487
    String key = getShortName();
1484 1488
    for(int i=0; i<mNumCubits; i++) mCubits[i].removePreferences(key,os);
1489

  
1490
    os.remove(key+"_border");
1491
    os.remove(key+"_corner");
1492
    os.remove(key+"_colors");
1493
    }
1494

  
1495
///////////////////////////////////////////////////////////////////////////////////////////////////
1496

  
1497
  private String createColors(int[] table)
1498
    {
1499
    StringBuilder sb = new StringBuilder();
1500
    int len = table!=null ? table.length : 0;
1501

  
1502
    for(int i=0; i<len; i++)
1503
      {
1504
      sb.append(table[i]);
1505
      sb.append(',');
1506
      }
1507

  
1508
    return sb.toString();
1485 1509
    }
1486 1510

  
1487 1511
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff