Project

General

Profile

« Previous | Next » 

Revision 96ae36f2

Added by Leszek Koltunski about 3 years ago

New way to store records, comopletely independent on the number of scrambles.
Do away with the weird 'getDBLevel' thing.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectType.java
23 23

  
24 24
public enum ObjectType
25 25
  {
26
  CUBE_2 ( TwistyCuboid.class        , 12, R.drawable.cube_2, true, new InitData(new int[] {2,2,2})),
27
  CUBE_3 ( TwistyCuboid.class        , 17, R.drawable.cube_3, true, new InitData(new int[] {3,3,3})),
28
  CUBE_4 ( TwistyCuboid.class        , 24, R.drawable.cube_4, true, new InitData(new int[] {4,4,4})),
29
  CUBE_5 ( TwistyCuboid.class        , 28, R.drawable.cube_5, true, new InitData(new int[] {5,5,5})),
30
  CUBE_6 ( TwistyCuboid.class        , 35, R.drawable.cube_6, true, new InitData(new int[] {6,6,6})),
31

  
32
  CUBE_7 ( TwistyCuboid.class        , 42, R.drawable.cube_7, true, new InitData(new int[] {7,7,7})),
33
  FISH_3 ( TwistyFisher.class        , 24, R.drawable.fish_3, true, new InitData(new int[] {3,3,3})),
34
  WIND_3 ( TwistyWindmill.class      , 24, R.drawable.wind_3, true, new InitData(new int[] {3,3,3})),
35
  AXIS_3 ( TwistyAxis.class          , 24, R.drawable.axis_3, true, new InitData(new int[] {3,3,3})),
36
  VOID_3 ( TwistyVoid.class          , 17, R.drawable.void_3, true, new InitData(new int[] {3,3,3})),
37

  
38
  BAN1_3 ( TwistyBandagedCuboid.class, 16, R.drawable.ban1_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_1)),
39
  BAN2_3 ( TwistyBandagedCuboid.class, 20, R.drawable.ban2_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_2)),
40
  BAN3_3 ( TwistyBandagedCuboid.class, 16, R.drawable.ban3_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_3)),
41
  BAN4_3 ( TwistyBandagedCuboid.class, 22, R.drawable.ban4_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_4)),
26
  CUBE_2 ( TwistyCuboid.class        , 12, 12, R.drawable.cube_2, true, new InitData(new int[] {2,2,2})),
27
  CUBE_3 ( TwistyCuboid.class        , 17, 17, R.drawable.cube_3, true, new InitData(new int[] {3,3,3})),
28
  CUBE_4 ( TwistyCuboid.class        , 24, 24, R.drawable.cube_4, true, new InitData(new int[] {4,4,4})),
29
  CUBE_5 ( TwistyCuboid.class        , 28, 28, R.drawable.cube_5, true, new InitData(new int[] {5,5,5})),
30
  CUBE_6 ( TwistyCuboid.class        , 35, 35, R.drawable.cube_6, true, new InitData(new int[] {6,6,6})),
31

  
32
  CUBE_7 ( TwistyCuboid.class        , 42, 42, R.drawable.cube_7, true, new InitData(new int[] {7,7,7})),
33
  FISH_3 ( TwistyFisher.class        , 24, 24, R.drawable.fish_3, true, new InitData(new int[] {3,3,3})),
34
  WIND_3 ( TwistyWindmill.class      , 24, 24, R.drawable.wind_3, true, new InitData(new int[] {3,3,3})),
35
  AXIS_3 ( TwistyAxis.class          , 24, 24, R.drawable.axis_3, true, new InitData(new int[] {3,3,3})),
36
  VOID_3 ( TwistyVoid.class          , 17, 17, R.drawable.void_3, true, new InitData(new int[] {3,3,3})),
37

  
38
  BAN1_3 ( TwistyBandagedCuboid.class, 16, 16, R.drawable.ban1_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_1)),
39
  BAN2_3 ( TwistyBandagedCuboid.class, 20, 20, R.drawable.ban2_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_2)),
40
  BAN3_3 ( TwistyBandagedCuboid.class, 16, 16, R.drawable.ban3_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_3)),
41
  BAN4_3 ( TwistyBandagedCuboid.class, 22, 22, R.drawable.ban4_3, true, new InitData(new int[] {3,3,3}, TwistyBandagedCuboid.POS_4)),
42 42
  // bandaged creator goes here
43 43

  
44
  CU_323 ( TwistyCuboid.class        , 15, R.drawable.cu_323, true, new InitData(new int[] {3,2,3})),
45
  CU_232 ( TwistyCuboid.class        , 16, R.drawable.cu_232, true, new InitData(new int[] {2,3,2})),
46
  CU_343 ( TwistyCuboid.class        , 23, R.drawable.cu_343, true, new InitData(new int[] {3,4,3})),
47
  SQU1_3 ( TwistySquare1.class       , 24, R.drawable.squ1_3, true, new InitData(new int[] {3,2,3})),
48
  SQU2_3 ( TwistySquare2.class       , 24, R.drawable.squ2_3, true, new InitData(new int[] {3,2,3})),
49

  
50
  MORP_2 ( TwistyMorphix.class       , 12, R.drawable.morp_2, true, new InitData(new int[] {2,2,2})),
51
  JING_2 ( TwistyJing.class          , 11, R.drawable.jing_2, true, new InitData(new int[] {2,2,2,2})),
52
  PYRA_3 ( TwistyPyraminx.class      , 10, R.drawable.pyra_3, true, new InitData(new int[] {3,3,3,3})),
53
  PYRA_4 ( TwistyPyraminx.class      , 17, R.drawable.pyra_4, true, new InitData(new int[] {4,4,4,4})),
54
  PYRA_5 ( TwistyPyraminx.class      , 23, R.drawable.pyra_5, true, new InitData(new int[] {5,5,5,5})),
55

  
56
  TRAJ_3 ( TwistyTrajber.class       , 17, R.drawable.traj_3, true, new InitData(new int[] {3,3,3})),
57
  TRAJ_4 ( TwistyTrajber.class       , 24, R.drawable.traj_4, true, new InitData(new int[] {4,4,4})),
58
  DIAM_2 ( TwistyDiamond.class       , 12, R.drawable.diam_2, true, new InitData(new int[] {2,2,2,2})),
59
  DIAM_3 ( TwistyDiamond.class       , 24, R.drawable.diam_3, true, new InitData(new int[] {3,3,3,3})),
60
  DIAM_4 ( TwistyDiamond.class       , 32, R.drawable.diam_4, true, new InitData(new int[] {4,4,4,4})),
61

  
62
  ULTI_2 ( TwistyUltimate.class      , 18, R.drawable.ulti_2, true, new InitData(new int[] {2,2,2,2})),
63
  KILO_3 ( TwistyKilominx.class      , 18, R.drawable.kilo_3, true, new InitData(new int[] {3,3,3,3,3,3})),
64
  MEGA_3 ( TwistyMegaminx.class      , 21, R.drawable.mega_3, true, new InitData(new int[] {3,3,3,3,3,3})),
65
  KILO_5 ( TwistyKilominx.class      , 33, R.drawable.kilo_5, true, new InitData(new int[] {5,5,5,5,5,5})),
66
  MEGA_5 ( TwistyMegaminx.class      , 37, R.drawable.mega_5, true, new InitData(new int[] {5,5,5,5,5,5})),
67

  
68
  CRYS_3 ( TwistyCrystal.class       , 27, R.drawable.crys_3, true, new InitData(new int[] {3,3,3,3,3,3})),
69
  STAR_3 ( TwistyStarminx.class      , 27, R.drawable.star_3, true, new InitData(new int[] {3,3,3,3,3,3})),
70
  PENT_2 ( TwistyPentultimate.class  , 21, R.drawable.pent_2, true, new InitData(new int[] {2,2,2,2,2,2})),
71
  DINO_3 ( TwistyDino6.class         , 10, R.drawable.dino_3, true, new InitData(new int[] {3,3,3,3})),
72
  DIN4_3 ( TwistyDino4.class         ,  9, R.drawable.din4_3, true, new InitData(new int[] {3,3,3,3})),
73

  
74
  MIRR_2 ( TwistyMirror.class        , 12, R.drawable.mirr_2, true, new InitData(new int[] {2,2,2})),
75
  MIRR_3 ( TwistyMirror.class        , 17, R.drawable.mirr_3, true, new InitData(new int[] {3,3,3})),
76
  MIRR_4 ( TwistyMirror.class        , 24, R.drawable.mirr_4, true, new InitData(new int[] {4,4,4})),
77
  IVY_2  ( TwistyIvy.class           ,  9, R.drawable.ivy_2 , true, new InitData(new int[] {2,2,2,2})),
78
  REX_3  ( TwistyRex.class           , 19, R.drawable.rex_3 , true, new InitData(new int[] {3,3,3,3})),
79

  
80
  REDI_3 ( TwistyRedi.class          , 16, R.drawable.redi_3, true, new InitData(new int[] {3,3,3,3})),
81
  HELI_3 ( TwistyHelicopter.class    , 20, R.drawable.heli_3, true, new InitData(new int[] {3,3,3,3,3,3})),
82
  SKEW_2 ( TwistySkewb.class         , 11, R.drawable.skew_2, true, new InitData(new int[] {2,2,2,2})),
83
  SKEW_3 ( TwistySkewb.class         , 21, R.drawable.skew_3, true, new InitData(new int[] {3,3,3,3})),
84
  CONT_2 ( TwistyContainer.class     , 12, R.drawable.cont_2, true, new InitData(new int[] {2,2,2,2})),
85

  
86
  MIXU_3 ( TwistyMixup3x3.class      , 24, R.drawable.mixu_3, true, new InitData(new int[] {3,3,3})),   // wasDownloadableButNowIsBuiltIn()
87
  MIXP_3 ( TwistyMixup3x3Plus.class  , 28, R.drawable.mixp_3, true, new InitData(new int[] {3,3,3})),
88
  CRA1_2 ( TwistyCrazy2x2.class      , 16, R.drawable.cra1_2, false, new InitData(new int[] {2,2,2})),
89
  CRA1_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra1_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.CRAZY  )),
90
  CRA2_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra2_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.MERCURY)),
91
  CRA3_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra3_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.VENUS  )),
92
  CRA4_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra4_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.EARTH  )),
93
  CRA5_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra5_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.MARS   )),
94
  CRA6_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra6_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.JUPITER)),
95
  CRA7_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra7_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.SATURN )),
96
  CRA8_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra8_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.URANUS )),
97
  CRA9_3 ( TwistyCrazy3x3.class      , 22, R.drawable.cra9_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.NEPTUNE)),
44
  CU_323 ( TwistyCuboid.class        , 15, 15, R.drawable.cu_323, true, new InitData(new int[] {3,2,3})),
45
  CU_232 ( TwistyCuboid.class        , 16, 16, R.drawable.cu_232, true, new InitData(new int[] {2,3,2})),
46
  CU_343 ( TwistyCuboid.class        , 23, 23, R.drawable.cu_343, true, new InitData(new int[] {3,4,3})),
47
  SQU1_3 ( TwistySquare1.class       , 24, 24, R.drawable.squ1_3, true, new InitData(new int[] {3,2,3})),
48
  SQU2_3 ( TwistySquare2.class       , 24, 24, R.drawable.squ2_3, true, new InitData(new int[] {3,2,3})),
49

  
50
  MORP_2 ( TwistyMorphix.class       , 12, 12, R.drawable.morp_2, true, new InitData(new int[] {2,2,2})),
51
  JING_2 ( TwistyJing.class          , 11, 11, R.drawable.jing_2, true, new InitData(new int[] {2,2,2,2})),
52
  PYRA_3 ( TwistyPyraminx.class      , 10, 10, R.drawable.pyra_3, true, new InitData(new int[] {3,3,3,3})),
53
  PYRA_4 ( TwistyPyraminx.class      , 17, 17, R.drawable.pyra_4, true, new InitData(new int[] {4,4,4,4})),
54
  PYRA_5 ( TwistyPyraminx.class      , 23, 23, R.drawable.pyra_5, true, new InitData(new int[] {5,5,5,5})),
55

  
56
  TRAJ_3 ( TwistyTrajber.class       , 17, 17, R.drawable.traj_3, true, new InitData(new int[] {3,3,3})),
57
  TRAJ_4 ( TwistyTrajber.class       , 24, 24, R.drawable.traj_4, true, new InitData(new int[] {4,4,4})),
58
  DIAM_2 ( TwistyDiamond.class       , 12, 12, R.drawable.diam_2, true, new InitData(new int[] {2,2,2,2})),
59
  DIAM_3 ( TwistyDiamond.class       , 24, 24, R.drawable.diam_3, true, new InitData(new int[] {3,3,3,3})),
60
  DIAM_4 ( TwistyDiamond.class       , 32, 32, R.drawable.diam_4, true, new InitData(new int[] {4,4,4,4})),
61

  
62
  ULTI_2 ( TwistyUltimate.class      , 18, 18, R.drawable.ulti_2, true, new InitData(new int[] {2,2,2,2})),
63
  KILO_3 ( TwistyKilominx.class      , 18, 18, R.drawable.kilo_3, true, new InitData(new int[] {3,3,3,3,3,3})),
64
  MEGA_3 ( TwistyMegaminx.class      , 21, 21, R.drawable.mega_3, true, new InitData(new int[] {3,3,3,3,3,3})),
65
  KILO_5 ( TwistyKilominx.class      , 33, 33, R.drawable.kilo_5, true, new InitData(new int[] {5,5,5,5,5,5})),
66
  MEGA_5 ( TwistyMegaminx.class      , 37, 37, R.drawable.mega_5, true, new InitData(new int[] {5,5,5,5,5,5})),
67

  
68
  CRYS_3 ( TwistyCrystal.class       , 27, 27, R.drawable.crys_3, true, new InitData(new int[] {3,3,3,3,3,3})),
69
  STAR_3 ( TwistyStarminx.class      , 27, 27, R.drawable.star_3, true, new InitData(new int[] {3,3,3,3,3,3})),
70
  PENT_2 ( TwistyPentultimate.class  , 21, 21, R.drawable.pent_2, true, new InitData(new int[] {2,2,2,2,2,2})),
71
  DINO_3 ( TwistyDino6.class         , 10, 10, R.drawable.dino_3, true, new InitData(new int[] {3,3,3,3})),
72
  DIN4_3 ( TwistyDino4.class         ,  9,  9, R.drawable.din4_3, true, new InitData(new int[] {3,3,3,3})),
73

  
74
  MIRR_2 ( TwistyMirror.class        , 12, 12, R.drawable.mirr_2, true, new InitData(new int[] {2,2,2})),
75
  MIRR_3 ( TwistyMirror.class        , 17, 17, R.drawable.mirr_3, true, new InitData(new int[] {3,3,3})),
76
  MIRR_4 ( TwistyMirror.class        , 24, 24, R.drawable.mirr_4, true, new InitData(new int[] {4,4,4})),
77
  IVY_2  ( TwistyIvy.class           ,  9,  9, R.drawable.ivy_2 , true, new InitData(new int[] {2,2,2,2})),
78
  REX_3  ( TwistyRex.class           , 19, 19, R.drawable.rex_3 , true, new InitData(new int[] {3,3,3,3})),
79

  
80
  REDI_3 ( TwistyRedi.class          , 16, 16, R.drawable.redi_3, true, new InitData(new int[] {3,3,3,3})),
81
  HELI_3 ( TwistyHelicopter.class    , 20, 20, R.drawable.heli_3, true, new InitData(new int[] {3,3,3,3,3,3})),
82
  SKEW_2 ( TwistySkewb.class         , 11, 11, R.drawable.skew_2, true, new InitData(new int[] {2,2,2,2})),
83
  SKEW_3 ( TwistySkewb.class         , 21, 21, R.drawable.skew_3, true, new InitData(new int[] {3,3,3,3})),
84
  CONT_2 ( TwistyContainer.class     , 12, 12, R.drawable.cont_2, true, new InitData(new int[] {2,2,2,2})),
85

  
86
  MIXU_3 ( TwistyMixup3x3.class      , 24, 24, R.drawable.mixu_3, true, new InitData(new int[] {3,3,3})),
87
  MIXP_3 ( TwistyMixup3x3Plus.class  , 28, 28, R.drawable.mixp_3, true, new InitData(new int[] {3,3,3})),
88
  CRA1_2 ( TwistyCrazy2x2.class      , 16, 16, R.drawable.cra1_2, false, new InitData(new int[] {2,2,2})),
89
  CRA1_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra1_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.CRAZY  )),
90
  CRA2_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra2_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.MERCURY)),
91
  CRA3_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra3_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.VENUS  )),
92
  CRA4_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra4_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.EARTH  )),
93
  CRA5_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra5_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.MARS   )),
94
  CRA6_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra6_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.JUPITER)),
95
  CRA7_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra7_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.SATURN )),
96
  CRA8_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra8_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.URANUS )),
97
  CRA9_3 ( TwistyCrazy3x3.class      , 22, 22, R.drawable.cra9_3, false, new InitData(new int[] {3,3,3}, TwistyCrazy3x3.NEPTUNE)),
98 98
  ;
99 99

  
100 100
  public static int NUM_OBJECTS;
101
  public static final int MAX_SCRAMBLES = 42;  // max scrambles at the time we switched from
102
                                               // remembering the records the old way
101 103
  private static final ObjectType[] objects;
102 104

  
103 105
  private final InitData mInitData;
104 106
  private final int mNumScrambles;
107
  private final int mStaticNumScrambles;
105 108
  private final int mIcon;
106 109
  private final boolean mExportToApp;
107 110
  private final Class<? extends TwistyObject> mClass;
......
118 121

  
119 122
///////////////////////////////////////////////////////////////////////////////////////////////////
120 123

  
121
  ObjectType(Class<? extends TwistyObject> clazz, int scrambles, int icon, boolean export, InitData data)
124
  ObjectType(Class<? extends TwistyObject> clazz, int scrambles, int staticNumScrambles, int icon, boolean export, InitData data)
122 125
    {
123
    mClass       = clazz;
124
    mInitData    = data;
125
    mNumScrambles= scrambles;
126
    mIcon        = icon;
127
    mExportToApp = export;
126
    mClass              = clazz;
127
    mInitData           = data;
128
    mNumScrambles       = scrambles;
129
    mStaticNumScrambles = staticNumScrambles;
130
    mIcon               = icon;
131
    mExportToApp        = export;
128 132
    }
129 133

  
130 134
///////////////////////////////////////////////////////////////////////////////////////////////////
......
135 139
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal] : CUBE_3;
136 140
    }
137 141

  
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139
// This is for the getDBLevel() function in RubikObjectList.
140

  
141
  public static boolean wasDownloadableButNowIsBuiltIn(int ord)
142
    {
143
    return ( ord==MIRR_4.ordinal() || ord==FISH_3.ordinal() ||
144
             ord==MORP_2.ordinal() || ord==CONT_2.ordinal() ||
145
             ord==CRYS_3.ordinal() || ord==STAR_3.ordinal() ||
146
             ord==PENT_2.ordinal() || ord==AXIS_3.ordinal() ||
147
             ord==TRAJ_4.ordinal() || ord==VOID_3.ordinal() ||
148
             ord==MIXU_3.ordinal() || ord== MIXP_3.ordinal() );
149
    }
150

  
151 142
///////////////////////////////////////////////////////////////////////////////////////////////////
152 143

  
153 144
  public static int getOrdinal(String name)
......
174 165
    return mNumScrambles;
175 166
    }
176 167

  
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169

  
170
  public static int getStaticNumScrambles(int ordinal)
171
    {
172
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal].mStaticNumScrambles : 0;
173
    }
174

  
177 175
///////////////////////////////////////////////////////////////////////////////////////////////////
178 176

  
179 177
  public static TwistyObject create(int ordinal, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream meshStream)

Also available in: Unified diff