Revision 5bda8973
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/objects/RubikObjectList.java | ||
---|---|---|
29 | 29 |
public class RubikObjectList |
30 | 30 |
{ |
31 | 31 |
public static final int DEF_OBJECT= ObjectSignatures.CUBE_3; |
32 |
public static int MAX_LEVEL; |
|
33 |
|
|
34 | 32 |
private static RubikObjectList mThis; |
35 | 33 |
private static int mNumObjects; |
36 | 34 |
private static int mNumExtras; |
... | ... | |
59 | 57 |
|
60 | 58 |
private static ArrayList<DownloadedObject> mDownloadedObjects; |
61 | 59 |
|
62 |
static |
|
63 |
{ |
|
64 |
int max = Integer.MIN_VALUE; |
|
65 |
|
|
66 |
for (int i=0; i<NUM_OBJECTS; i++) |
|
67 |
{ |
|
68 |
int cur = getDBLevel(i); |
|
69 |
if( cur>max ) max = cur; |
|
70 |
} |
|
71 |
|
|
72 |
MAX_LEVEL = max; |
|
73 |
} |
|
74 |
|
|
75 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
76 | 61 |
|
77 | 62 |
private RubikObjectList() |
... | ... | |
147 | 132 |
|
148 | 133 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
149 | 134 |
// PUBLIC API |
150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
151 |
// historically older versions of the app had lower 'maxScrambles' in case of several objects and |
|
152 |
// those got remembered in the server-side DB already, so we need to keep using them. This function |
|
153 |
// provides a map between 'maxScramble' of an object and its 'dbLevel'. All new objects will have |
|
154 |
// those two values the same. |
|
155 |
// |
|
156 |
// all of those need to be > RubikStatePlay.LEVELS_SHOWN. |
|
157 |
|
|
158 |
public static int getDBLevel(int ordinal) |
|
159 |
{ |
|
160 |
if( ordinal== ObjectSignatures.CUBE_3 ) return 16; |
|
161 |
if( ordinal== ObjectSignatures.CUBE_4 ) return 20; |
|
162 |
if( ordinal== ObjectSignatures.CUBE_5 ) return 24; |
|
163 |
if( ordinal== ObjectSignatures.BAN2_3 ) return 16; |
|
164 |
if( ordinal== ObjectSignatures.BAN4_3 ) return 16; |
|
165 |
if( ordinal== ObjectSignatures.PYRA_4 ) return 15; |
|
166 |
if( ordinal== ObjectSignatures.PYRA_5 ) return 20; |
|
167 |
if( ordinal== ObjectSignatures.MEGA_5 ) return 35; |
|
168 |
if( ordinal== ObjectSignatures.DIAM_2 ) return 10; |
|
169 |
if( ordinal== ObjectSignatures.DIAM_3 ) return 18; |
|
170 |
if( ordinal== ObjectSignatures.REDI_3 ) return 14; |
|
171 |
if( ordinal== ObjectSignatures.HELI_3 ) return 18; |
|
172 |
if( ordinal== ObjectSignatures.SKEW_3 ) return 17; |
|
173 |
if( ordinal== ObjectSignatures.REX_3 ) return 16; |
|
174 |
if( ordinal== ObjectSignatures.MIRR_3 ) return 16; |
|
175 |
if( ordinal== ObjectSignatures.IVY_2 ) return 9; |
|
176 |
if( ordinal== ObjectSignatures.DIN4_3 ) return 9; |
|
177 |
|
|
178 |
// in 1.9.6 & 1.9.7 there is a bug with downloadable objects (in this very function!): |
|
179 |
// All of those have DBLevel equal to CUBE_3's DBlevel (in 1.9.7!), i.e. 17. |
|
180 |
// This will be a problem when we release a new version of the app which has some of the |
|
181 |
// previously downloadable objects built-in. Thus: in case of those, we need to keep using |
|
182 |
// 17. |
|
183 |
|
|
184 |
if( ObjectType.wasDownloadableButNowIsBuiltIn(ordinal) ) |
|
185 |
{ |
|
186 |
return 17; |
|
187 |
} |
|
188 |
|
|
189 |
return ObjectType.getObject(ordinal).getNumScramble(); |
|
190 |
} |
|
191 |
|
|
192 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
193 | 135 |
|
194 | 136 |
public static boolean addDownloadedObject(Context context, String shortName, int numScrambles, int objectMinor, |
195 | 137 |
int extrasMinor, boolean icon, boolean object, boolean extras) |
Also available in: Unified diff
New way to store records, comopletely independent on the number of scrambles.
Do away with the weird 'getDBLevel' thing.