1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2020 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.objects;
|
21
|
|
22
|
import android.content.res.Resources;
|
23
|
|
24
|
import org.distorted.library.main.DistortedEffects;
|
25
|
import org.distorted.library.main.DistortedTexture;
|
26
|
import org.distorted.library.mesh.MeshSquare;
|
27
|
import org.distorted.library.type.Static4D;
|
28
|
import org.distorted.main.R;
|
29
|
import org.distorted.main.RubikActivity;
|
30
|
|
31
|
import java.lang.reflect.Field;
|
32
|
|
33
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
34
|
|
35
|
public enum ObjectList
|
36
|
{
|
37
|
///////////////////// Size // DB Level // NumScrambles // Mesh // small icon // medium icon // big icon // huge icon
|
38
|
|
39
|
CUBE (
|
40
|
new int[][] {
|
41
|
{2 , 12, 12, R.raw.cube2, R.drawable.ui_small_cube2, R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2} ,
|
42
|
{3 , 16, 17, R.raw.cube3, R.drawable.ui_small_cube3, R.drawable.ui_medium_cube3, R.drawable.ui_big_cube3, R.drawable.ui_huge_cube3} ,
|
43
|
{4 , 20, 24, R.raw.cube4, R.drawable.ui_small_cube4, R.drawable.ui_medium_cube4, R.drawable.ui_big_cube4, R.drawable.ui_huge_cube4} ,
|
44
|
{5 , 24, 28, R.raw.cube5, R.drawable.ui_small_cube5, R.drawable.ui_medium_cube5, R.drawable.ui_big_cube5, R.drawable.ui_huge_cube5}
|
45
|
},
|
46
|
TwistyCube.class,
|
47
|
new MovementCube(),
|
48
|
0,
|
49
|
60
|
50
|
),
|
51
|
|
52
|
JING (
|
53
|
new int[][] {
|
54
|
{2 , 11, 11, R.raw.jing, R.drawable.ui_small_jing2, R.drawable.ui_medium_jing2, R.drawable.ui_big_jing2, R.drawable.ui_huge_jing2} ,
|
55
|
},
|
56
|
TwistyJing.class,
|
57
|
new MovementJing(),
|
58
|
1,
|
59
|
30
|
60
|
),
|
61
|
|
62
|
PYRA (
|
63
|
new int[][] {
|
64
|
{3 , 10, 10, R.raw.pyra3, R.drawable.ui_small_pyra3, R.drawable.ui_medium_pyra3, R.drawable.ui_big_pyra3, R.drawable.ui_huge_pyra3} ,
|
65
|
{4 , 15, 17, R.raw.pyra4, R.drawable.ui_small_pyra4, R.drawable.ui_medium_pyra4, R.drawable.ui_big_pyra4, R.drawable.ui_huge_pyra4} ,
|
66
|
{5 , 20, 23, R.raw.pyra5, R.drawable.ui_small_pyra5, R.drawable.ui_medium_pyra5, R.drawable.ui_big_pyra5, R.drawable.ui_huge_pyra5}
|
67
|
},
|
68
|
TwistyPyraminx.class,
|
69
|
new MovementPyraminx(),
|
70
|
1,
|
71
|
30
|
72
|
),
|
73
|
|
74
|
KILO (
|
75
|
new int[][] {
|
76
|
{3 , 18, 18, R.raw.kilo3, R.drawable.ui_small_kilo3, R.drawable.ui_medium_kilo3, R.drawable.ui_big_kilo3, R.drawable.ui_huge_kilo3} ,
|
77
|
{5 , 33, 33, R.raw.kilo5, R.drawable.ui_small_kilo5, R.drawable.ui_medium_kilo5, R.drawable.ui_big_kilo5, R.drawable.ui_huge_kilo5} ,
|
78
|
},
|
79
|
TwistyKilominx.class,
|
80
|
new MovementMinx(),
|
81
|
2,
|
82
|
30
|
83
|
),
|
84
|
|
85
|
MEGA (
|
86
|
new int[][] {
|
87
|
{3 , 21, 21, R.raw.mega3, R.drawable.ui_small_mega3, R.drawable.ui_medium_mega3, R.drawable.ui_big_mega3, R.drawable.ui_huge_mega3} ,
|
88
|
{5 , 35, 37, R.raw.mega5, R.drawable.ui_small_mega5, R.drawable.ui_medium_mega5, R.drawable.ui_big_mega5, R.drawable.ui_huge_mega5} ,
|
89
|
},
|
90
|
TwistyMegaminx.class,
|
91
|
new MovementMinx(),
|
92
|
2,
|
93
|
30
|
94
|
),
|
95
|
|
96
|
ULTI (
|
97
|
new int[][] {
|
98
|
{2 , 18, 18, R.raw.ulti, R.drawable.ui_small_ulti, R.drawable.ui_medium_ulti, R.drawable.ui_big_ulti, R.drawable.ui_huge_ulti} ,
|
99
|
},
|
100
|
TwistyUltimate.class,
|
101
|
new MovementUltimate(),
|
102
|
3,
|
103
|
30
|
104
|
),
|
105
|
|
106
|
DIAM (
|
107
|
new int[][] {
|
108
|
{2 , 10, 12, R.raw.diam2, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
|
109
|
{3 , 18, 24, R.raw.diam3, R.drawable.ui_small_diam3, R.drawable.ui_medium_diam3, R.drawable.ui_big_diam3, R.drawable.ui_huge_diam3} ,
|
110
|
{4 , 32, 32, R.raw.diam4, R.drawable.ui_small_diam4, R.drawable.ui_medium_diam4, R.drawable.ui_big_diam4, R.drawable.ui_huge_diam4} ,
|
111
|
},
|
112
|
TwistyDiamond.class,
|
113
|
new MovementDiamond(),
|
114
|
3,
|
115
|
60
|
116
|
),
|
117
|
|
118
|
DINO (
|
119
|
new int[][] {
|
120
|
{3 , 10, 10, R.raw.dino, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
|
121
|
},
|
122
|
TwistyDino6.class,
|
123
|
new MovementDino(),
|
124
|
4,
|
125
|
60
|
126
|
),
|
127
|
|
128
|
DIN4 (
|
129
|
new int[][] {
|
130
|
{3 , 7, 7, R.raw.dino, R.drawable.ui_small_din4, R.drawable.ui_medium_din4, R.drawable.ui_big_din4, R.drawable.ui_huge_din4} ,
|
131
|
},
|
132
|
TwistyDino4.class,
|
133
|
new MovementDino(),
|
134
|
4,
|
135
|
60
|
136
|
),
|
137
|
|
138
|
REDI (
|
139
|
new int[][] {
|
140
|
{3 , 14, 16, R.raw.redi, R.drawable.ui_small_redi, R.drawable.ui_medium_redi, R.drawable.ui_big_redi, R.drawable.ui_huge_redi} ,
|
141
|
},
|
142
|
TwistyRedi.class,
|
143
|
new MovementRedi(),
|
144
|
4,
|
145
|
60
|
146
|
),
|
147
|
|
148
|
HELI (
|
149
|
new int[][] {
|
150
|
{3 , 18, 20, R.raw.heli, R.drawable.ui_small_heli, R.drawable.ui_medium_heli, R.drawable.ui_big_heli, R.drawable.ui_huge_heli} ,
|
151
|
},
|
152
|
TwistyHelicopter.class,
|
153
|
new MovementHelicopter(),
|
154
|
4,
|
155
|
60
|
156
|
),
|
157
|
|
158
|
SKEW (
|
159
|
new int[][] {
|
160
|
{2 , 11, 11, R.raw.skew2, R.drawable.ui_small_skewb, R.drawable.ui_medium_skewb, R.drawable.ui_big_skewb, R.drawable.ui_huge_skewb} ,
|
161
|
{3 , 17, 21, R.raw.skew3, R.drawable.ui_small_skewm, R.drawable.ui_medium_skewm, R.drawable.ui_big_skewm, R.drawable.ui_huge_skewm} ,
|
162
|
},
|
163
|
TwistySkewb.class,
|
164
|
new MovementSkewb(),
|
165
|
5,
|
166
|
60
|
167
|
),
|
168
|
|
169
|
IVY (
|
170
|
new int[][] {
|
171
|
{2 , 8, 8, R.raw.ivy, R.drawable.ui_small_ivy, R.drawable.ui_medium_ivy, R.drawable.ui_big_ivy, R.drawable.ui_huge_ivy} ,
|
172
|
},
|
173
|
TwistyIvy.class,
|
174
|
new MovementIvy(),
|
175
|
5,
|
176
|
60
|
177
|
),
|
178
|
|
179
|
REX (
|
180
|
new int[][] {
|
181
|
{3 , 16, 19, R.raw.rex, R.drawable.ui_small_rex, R.drawable.ui_medium_rex, R.drawable.ui_big_rex, R.drawable.ui_huge_rex} ,
|
182
|
},
|
183
|
TwistyRex.class,
|
184
|
new MovementRex(),
|
185
|
5,
|
186
|
60
|
187
|
),
|
188
|
|
189
|
BAN1 (
|
190
|
new int[][] {
|
191
|
{3 , 16, 16, R.raw.ban1, R.drawable.ui_small_ban1, R.drawable.ui_medium_ban1, R.drawable.ui_big_ban1, R.drawable.ui_huge_ban1} ,
|
192
|
},
|
193
|
TwistyBandagedFused.class,
|
194
|
new MovementCube(),
|
195
|
6,
|
196
|
60
|
197
|
),
|
198
|
|
199
|
BAN2 (
|
200
|
new int[][] {
|
201
|
{3 , 16, 16, R.raw.ban2, R.drawable.ui_small_ban2, R.drawable.ui_medium_ban2, R.drawable.ui_big_ban2, R.drawable.ui_huge_ban2} ,
|
202
|
},
|
203
|
TwistyBandaged2Bar.class,
|
204
|
new MovementCube(),
|
205
|
6,
|
206
|
60
|
207
|
),
|
208
|
|
209
|
BAN3 (
|
210
|
new int[][] {
|
211
|
{3 , 16, 16, R.raw.ban3, R.drawable.ui_small_ban3, R.drawable.ui_medium_ban3, R.drawable.ui_big_ban3, R.drawable.ui_huge_ban3} ,
|
212
|
},
|
213
|
TwistyBandaged3Plate.class,
|
214
|
new MovementCube(),
|
215
|
6,
|
216
|
60
|
217
|
),
|
218
|
|
219
|
BAN4 (
|
220
|
new int[][] {
|
221
|
{3 , 16, 16, R.raw.ban4, R.drawable.ui_small_ban4, R.drawable.ui_medium_ban4, R.drawable.ui_big_ban4, R.drawable.ui_huge_ban4} ,
|
222
|
},
|
223
|
TwistyBandagedEvil.class,
|
224
|
new MovementCube(),
|
225
|
6,
|
226
|
60
|
227
|
),
|
228
|
|
229
|
SQU1 (
|
230
|
new int[][] {
|
231
|
{3 , 24, 24, R.raw.square1, R.drawable.ui_small_square1, R.drawable.ui_medium_square1, R.drawable.ui_big_square1, R.drawable.ui_huge_square1} ,
|
232
|
},
|
233
|
TwistySquare1.class,
|
234
|
new MovementSquare(),
|
235
|
7,
|
236
|
60
|
237
|
),
|
238
|
|
239
|
SQU2 (
|
240
|
new int[][] {
|
241
|
{3 , 24, 24, R.raw.square2, R.drawable.ui_small_square2, R.drawable.ui_medium_square2, R.drawable.ui_big_square2, R.drawable.ui_huge_square2} ,
|
242
|
},
|
243
|
TwistySquare2.class,
|
244
|
new MovementSquare(),
|
245
|
7,
|
246
|
60
|
247
|
),
|
248
|
|
249
|
;
|
250
|
|
251
|
public static final int NUM_OBJECTS = values().length;
|
252
|
public static final int MAX_NUM_OBJECTS;
|
253
|
public static final int MAX_LEVEL;
|
254
|
public static final int MAX_SCRAMBLE;
|
255
|
public static final int MAX_OBJECT_SIZE;
|
256
|
|
257
|
private final int[] mObjectSizes, mDBLevels, mNumScrambles, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
|
258
|
private final Class<? extends TwistyObject> mObjectClass;
|
259
|
private final Movement mObjectMovementClass;
|
260
|
private final int mRow, mNumSizes;
|
261
|
private final int mFOV;
|
262
|
|
263
|
private static final ObjectList[] objects;
|
264
|
private static int mNumAll;
|
265
|
private static int[] mIndices;
|
266
|
private static int mColCount, mRowCount;
|
267
|
|
268
|
static
|
269
|
{
|
270
|
mNumAll = 0;
|
271
|
int num, i = 0;
|
272
|
objects = new ObjectList[NUM_OBJECTS];
|
273
|
int maxNum = Integer.MIN_VALUE;
|
274
|
int maxLevel = Integer.MIN_VALUE;
|
275
|
int maxScramble= Integer.MIN_VALUE;
|
276
|
int maxSize = Integer.MIN_VALUE;
|
277
|
|
278
|
for(ObjectList object: ObjectList.values())
|
279
|
{
|
280
|
objects[i] = object;
|
281
|
i++;
|
282
|
num = object.mObjectSizes.length;
|
283
|
mNumAll += num;
|
284
|
if( num> maxNum ) maxNum = num;
|
285
|
|
286
|
for(int j=0; j<num; j++)
|
287
|
{
|
288
|
if( object.mNumScrambles[j]> maxScramble ) maxScramble= object.mNumScrambles[j];
|
289
|
if( object.mDBLevels[j] > maxLevel ) maxLevel = object.mDBLevels[j];
|
290
|
if( object.mObjectSizes[j] > maxSize ) maxSize = object.mObjectSizes[j];
|
291
|
}
|
292
|
}
|
293
|
|
294
|
MAX_NUM_OBJECTS = maxNum;
|
295
|
MAX_LEVEL = maxLevel;
|
296
|
MAX_SCRAMBLE = maxScramble;
|
297
|
MAX_OBJECT_SIZE = maxSize;
|
298
|
}
|
299
|
|
300
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
301
|
|
302
|
private static void setUpColAndRow()
|
303
|
{
|
304
|
mIndices = new int[NUM_OBJECTS];
|
305
|
mRowCount= 0;
|
306
|
|
307
|
for(int obj=0; obj<NUM_OBJECTS; obj++)
|
308
|
{
|
309
|
mIndices[obj] = objects[obj].mRow;
|
310
|
if( mIndices[obj]>=mRowCount ) mRowCount = mIndices[obj]+1;
|
311
|
}
|
312
|
|
313
|
mColCount = 0;
|
314
|
|
315
|
for(int row=0; row<mRowCount; row++)
|
316
|
{
|
317
|
int numObjects = computeNumObjectsInRow(row);
|
318
|
if( numObjects>mColCount ) mColCount = numObjects;
|
319
|
}
|
320
|
}
|
321
|
|
322
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
323
|
|
324
|
private static int computeNumObjectsInRow(int row)
|
325
|
{
|
326
|
int num=0;
|
327
|
|
328
|
for(int object=0; object<NUM_OBJECTS; object++)
|
329
|
{
|
330
|
if( objects[object].mRow == row )
|
331
|
{
|
332
|
num += objects[object].mNumSizes;
|
333
|
}
|
334
|
}
|
335
|
|
336
|
return num;
|
337
|
}
|
338
|
|
339
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
340
|
|
341
|
public static int getColumnCount()
|
342
|
{
|
343
|
if( mIndices==null ) setUpColAndRow();
|
344
|
|
345
|
return mColCount;
|
346
|
}
|
347
|
|
348
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
349
|
|
350
|
public static int getRowCount()
|
351
|
{
|
352
|
if( mIndices==null ) setUpColAndRow();
|
353
|
|
354
|
return mRowCount;
|
355
|
}
|
356
|
|
357
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
358
|
|
359
|
public static int[] getIndices()
|
360
|
{
|
361
|
if( mIndices==null ) setUpColAndRow();
|
362
|
|
363
|
return mIndices;
|
364
|
}
|
365
|
|
366
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
367
|
|
368
|
public static ObjectList getObject(int ordinal)
|
369
|
{
|
370
|
return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal] : CUBE;
|
371
|
}
|
372
|
|
373
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
374
|
|
375
|
public static int pack(int object, int sizeIndex)
|
376
|
{
|
377
|
int ret = 0;
|
378
|
for(int i=0; i<object; i++) ret += objects[i].mObjectSizes.length;
|
379
|
|
380
|
return ret+sizeIndex;
|
381
|
}
|
382
|
|
383
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
384
|
|
385
|
public static int unpackSizeIndex(int number)
|
386
|
{
|
387
|
int num;
|
388
|
|
389
|
for(int i=0; i<NUM_OBJECTS; i++)
|
390
|
{
|
391
|
num = objects[i].mObjectSizes.length;
|
392
|
if( number<num ) return number;
|
393
|
number -= num;
|
394
|
}
|
395
|
|
396
|
return -1;
|
397
|
}
|
398
|
|
399
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
400
|
|
401
|
public static int unpackObject(int number)
|
402
|
{
|
403
|
int num;
|
404
|
|
405
|
for(int i=0; i<NUM_OBJECTS; i++)
|
406
|
{
|
407
|
num = objects[i].mObjectSizes.length;
|
408
|
if( number<num ) return i;
|
409
|
number -= num;
|
410
|
}
|
411
|
|
412
|
return -1;
|
413
|
}
|
414
|
|
415
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
416
|
|
417
|
public static int unpackObjectFromString(String obj)
|
418
|
{
|
419
|
int u = obj.indexOf('_');
|
420
|
int l = obj.length();
|
421
|
|
422
|
if( u>0 )
|
423
|
{
|
424
|
String name = obj.substring(0,u);
|
425
|
int size = Integer.parseInt( obj.substring(u+1,l) );
|
426
|
|
427
|
for(int i=0; i<NUM_OBJECTS; i++)
|
428
|
{
|
429
|
if( objects[i].name().equals(name) )
|
430
|
{
|
431
|
int sizeIndex = getSizeIndex(i,size);
|
432
|
return pack(i,sizeIndex);
|
433
|
}
|
434
|
}
|
435
|
}
|
436
|
|
437
|
return -1;
|
438
|
}
|
439
|
|
440
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
441
|
|
442
|
public static String getObjectList()
|
443
|
{
|
444
|
String name;
|
445
|
StringBuilder list = new StringBuilder();
|
446
|
int len;
|
447
|
int[] sizes;
|
448
|
|
449
|
for(int i=0; i<NUM_OBJECTS; i++)
|
450
|
{
|
451
|
sizes = objects[i].mObjectSizes;
|
452
|
len = sizes.length;
|
453
|
name = objects[i].name();
|
454
|
|
455
|
for(int j=0; j<len; j++)
|
456
|
{
|
457
|
if( i>0 || j>0 ) list.append(',');
|
458
|
list.append(name);
|
459
|
list.append('_');
|
460
|
list.append(sizes[j]);
|
461
|
}
|
462
|
}
|
463
|
|
464
|
return list.toString();
|
465
|
}
|
466
|
|
467
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
468
|
|
469
|
public static int getTotal()
|
470
|
{
|
471
|
return mNumAll;
|
472
|
}
|
473
|
|
474
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
475
|
|
476
|
public static int getDBLevel(int ordinal, int sizeIndex)
|
477
|
{
|
478
|
if( ordinal>=0 && ordinal<NUM_OBJECTS )
|
479
|
{
|
480
|
int num = objects[ordinal].mObjectSizes.length;
|
481
|
return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mDBLevels[sizeIndex] : 0;
|
482
|
}
|
483
|
|
484
|
return 0;
|
485
|
}
|
486
|
|
487
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
488
|
|
489
|
public static int getNumScramble(int ordinal, int sizeIndex)
|
490
|
{
|
491
|
if( ordinal>=0 && ordinal<NUM_OBJECTS )
|
492
|
{
|
493
|
int num = objects[ordinal].mObjectSizes.length;
|
494
|
return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mNumScrambles[sizeIndex] : 0;
|
495
|
}
|
496
|
|
497
|
return 0;
|
498
|
}
|
499
|
|
500
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
501
|
|
502
|
public static int getOrdinal(String name)
|
503
|
{
|
504
|
for(int i=0; i<NUM_OBJECTS; i++)
|
505
|
{
|
506
|
if(objects[i].name().equals(name)) return i;
|
507
|
}
|
508
|
|
509
|
return -1;
|
510
|
}
|
511
|
|
512
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
513
|
|
514
|
public static int getSizeIndex(int ordinal, int size)
|
515
|
{
|
516
|
if( ordinal>=0 && ordinal<NUM_OBJECTS )
|
517
|
{
|
518
|
int[] sizes = objects[ordinal].getSizes();
|
519
|
int len = sizes.length;
|
520
|
|
521
|
for(int i=0; i<len; i++)
|
522
|
{
|
523
|
if( sizes[i]==size ) return i;
|
524
|
}
|
525
|
}
|
526
|
|
527
|
return -1;
|
528
|
}
|
529
|
|
530
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
531
|
|
532
|
public static int[] retFaceColors(ObjectList object)
|
533
|
{
|
534
|
Field field;
|
535
|
int[] faceColors=null;
|
536
|
|
537
|
try
|
538
|
{
|
539
|
field = object.mObjectClass.getDeclaredField("FACE_COLORS");
|
540
|
field.setAccessible(true);
|
541
|
Object obj = field.get(null);
|
542
|
faceColors = (int[]) obj;
|
543
|
}
|
544
|
catch(NoSuchFieldException ex)
|
545
|
{
|
546
|
android.util.Log.e("RubikObjectList", object.mObjectClass.getSimpleName()+": no such field exception getting field: "+ex.getMessage());
|
547
|
}
|
548
|
catch(IllegalAccessException ex)
|
549
|
{
|
550
|
android.util.Log.e("RubikObjectList", object.mObjectClass.getSimpleName()+": illegal access exception getting field: "+ex.getMessage());
|
551
|
}
|
552
|
|
553
|
return faceColors;
|
554
|
}
|
555
|
|
556
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
557
|
|
558
|
ObjectList(int[][] info, Class<? extends TwistyObject> object , Movement movement, int row, int fov)
|
559
|
{
|
560
|
mNumSizes = info.length;
|
561
|
|
562
|
mObjectSizes = new int[mNumSizes];
|
563
|
mDBLevels = new int[mNumSizes];
|
564
|
mNumScrambles = new int[mNumSizes];
|
565
|
mResourceIDs = new int[mNumSizes];
|
566
|
mSmallIconIDs = new int[mNumSizes];
|
567
|
mMediumIconIDs= new int[mNumSizes];
|
568
|
mBigIconIDs = new int[mNumSizes];
|
569
|
mHugeIconIDs = new int[mNumSizes];
|
570
|
|
571
|
for(int i=0; i<mNumSizes; i++)
|
572
|
{
|
573
|
mObjectSizes[i] = info[i][0];
|
574
|
mDBLevels[i] = info[i][1];
|
575
|
mNumScrambles[i] = info[i][2];
|
576
|
mResourceIDs[i] = info[i][3];
|
577
|
mSmallIconIDs[i] = info[i][4];
|
578
|
mMediumIconIDs[i]= info[i][5];
|
579
|
mBigIconIDs[i] = info[i][6];
|
580
|
mHugeIconIDs[i] = info[i][7];
|
581
|
}
|
582
|
|
583
|
mObjectClass = object;
|
584
|
mObjectMovementClass = movement;
|
585
|
mRow = row;
|
586
|
mFOV = fov;
|
587
|
}
|
588
|
|
589
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
590
|
|
591
|
public int[] getSizes()
|
592
|
{
|
593
|
return mObjectSizes;
|
594
|
}
|
595
|
|
596
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
597
|
|
598
|
public int[] getDBLevels()
|
599
|
{
|
600
|
return mDBLevels;
|
601
|
}
|
602
|
|
603
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
604
|
|
605
|
public int[] getNumScrambles()
|
606
|
{
|
607
|
return mNumScrambles;
|
608
|
}
|
609
|
|
610
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
611
|
|
612
|
public int getFOV()
|
613
|
{
|
614
|
return mFOV;
|
615
|
}
|
616
|
|
617
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
618
|
|
619
|
public int[] getIconIDs()
|
620
|
{
|
621
|
int size = RubikActivity.getDrawableSize();
|
622
|
|
623
|
switch(size)
|
624
|
{
|
625
|
case 0 : return mSmallIconIDs;
|
626
|
case 1 : return mMediumIconIDs;
|
627
|
case 2 : return mBigIconIDs;
|
628
|
default: return mHugeIconIDs;
|
629
|
}
|
630
|
}
|
631
|
|
632
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
633
|
|
634
|
public int[] getResourceIDs()
|
635
|
{
|
636
|
return mResourceIDs;
|
637
|
}
|
638
|
|
639
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
640
|
|
641
|
public int getNumVariants()
|
642
|
{
|
643
|
return mObjectSizes.length;
|
644
|
}
|
645
|
|
646
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
647
|
|
648
|
public TwistyObject create(int size, Static4D quat, int[][] moves, Resources res, int scrWidth)
|
649
|
{
|
650
|
DistortedTexture texture = new DistortedTexture();
|
651
|
DistortedEffects effects = new DistortedEffects();
|
652
|
MeshSquare mesh = new MeshSquare(20,20); // mesh of the node, not of the cubits
|
653
|
|
654
|
switch(ordinal())
|
655
|
{
|
656
|
case 0: return new TwistyCube (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
657
|
case 1: return new TwistyJing (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
658
|
case 2: return new TwistyPyraminx (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
659
|
case 3: return new TwistyKilominx (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
660
|
case 4: return new TwistyMegaminx (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
661
|
case 5: return new TwistyUltimate (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
662
|
case 6: return new TwistyDiamond (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
663
|
case 7: return new TwistyDino6 (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
664
|
case 8: return new TwistyDino4 (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
665
|
case 9: return new TwistyRedi (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
666
|
case 10: return new TwistyHelicopter (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
667
|
case 11: return new TwistySkewb (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
668
|
case 12: return new TwistyIvy (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
669
|
case 13: return new TwistyRex (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
670
|
case 14: return new TwistyBandagedFused (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
671
|
case 15: return new TwistyBandaged2Bar (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
672
|
case 16: return new TwistyBandaged3Plate(size, quat, texture, mesh, effects, moves, res, scrWidth);
|
673
|
case 17: return new TwistyBandagedEvil (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
674
|
case 18: return new TwistySquare1 (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
675
|
case 19: return new TwistySquare2 (size, quat, texture, mesh, effects, moves, res, scrWidth);
|
676
|
}
|
677
|
|
678
|
return null;
|
679
|
}
|
680
|
|
681
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
682
|
|
683
|
public Movement getObjectMovementClass()
|
684
|
{
|
685
|
return mObjectMovementClass;
|
686
|
}
|
687
|
}
|