42 |
42 |
{5 , 24, R.raw.cube5, R.drawable.ui_small_cube5, R.drawable.ui_medium_cube5, R.drawable.ui_big_cube5, R.drawable.ui_huge_cube5}
|
43 |
43 |
},
|
44 |
44 |
RubikCube.class,
|
45 |
|
new RubikMovementCube()
|
|
45 |
new RubikMovementCube(),
|
|
46 |
0
|
46 |
47 |
),
|
47 |
48 |
|
48 |
49 |
PYRA (
|
... | ... | |
52 |
53 |
{5 , 20, R.raw.pyra5, R.drawable.ui_small_pyra5, R.drawable.ui_medium_pyra5, R.drawable.ui_big_pyra5, R.drawable.ui_huge_pyra5}
|
53 |
54 |
},
|
54 |
55 |
RubikPyraminx.class,
|
55 |
|
new RubikMovementPyraminx()
|
|
56 |
new RubikMovementPyraminx(),
|
|
57 |
1
|
56 |
58 |
),
|
57 |
59 |
|
58 |
60 |
DINO (
|
... | ... | |
60 |
62 |
{3 , 10, R.raw.dino, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
|
61 |
63 |
},
|
62 |
64 |
RubikDino.class,
|
63 |
|
new RubikMovementDino()
|
|
65 |
new RubikMovementDino(),
|
|
66 |
2
|
64 |
67 |
),
|
65 |
68 |
;
|
66 |
69 |
|
... | ... | |
72 |
75 |
private final int[] mObjectSizes, mMaxLevels, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
|
73 |
76 |
private final Class<? extends RubikObject> mObjectClass;
|
74 |
77 |
private final RubikMovement mObjectMovementClass;
|
|
78 |
private final int mColumn, mNumSizes;
|
|
79 |
|
75 |
80 |
private static final RubikObjectList[] objects;
|
76 |
81 |
private static int mNumAll;
|
77 |
82 |
private static int[] mIndices;
|
|
83 |
private static int mColCount, mRowCount;
|
78 |
84 |
|
79 |
85 |
static
|
80 |
86 |
{
|
... | ... | |
85 |
91 |
int maxLevel= Integer.MIN_VALUE;
|
86 |
92 |
int maxSize = Integer.MIN_VALUE;
|
87 |
93 |
|
88 |
|
mIndices = new int[] {0,1,2};
|
89 |
|
|
90 |
94 |
for(RubikObjectList object: RubikObjectList.values())
|
91 |
95 |
{
|
92 |
96 |
objects[i] = object;
|
... | ... | |
108 |
112 |
}
|
109 |
113 |
|
110 |
114 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
111 |
|
// TODO
|
|
115 |
|
|
116 |
private static void setUpColAndRow()
|
|
117 |
{
|
|
118 |
mIndices = new int[NUM_OBJECTS];
|
|
119 |
mColCount= 0;
|
|
120 |
|
|
121 |
for(int obj=0; obj<NUM_OBJECTS; obj++)
|
|
122 |
{
|
|
123 |
mIndices[obj] = objects[obj].mColumn;
|
|
124 |
if( mIndices[obj]>=mColCount ) mColCount = mIndices[obj]+1;
|
|
125 |
}
|
|
126 |
|
|
127 |
mRowCount = 0;
|
|
128 |
|
|
129 |
for(int col=0; col<mColCount; col++)
|
|
130 |
{
|
|
131 |
int numObjects = computeNumObjectsInColumn(col);
|
|
132 |
if( numObjects>mRowCount ) mRowCount = numObjects;
|
|
133 |
}
|
|
134 |
}
|
|
135 |
|
|
136 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
137 |
|
|
138 |
private static int computeNumObjectsInColumn(int column)
|
|
139 |
{
|
|
140 |
int num=0;
|
|
141 |
|
|
142 |
for(int object=0; object<NUM_OBJECTS; object++)
|
|
143 |
{
|
|
144 |
if( objects[object].mColumn == column )
|
|
145 |
{
|
|
146 |
num += objects[object].mNumSizes;
|
|
147 |
}
|
|
148 |
}
|
|
149 |
|
|
150 |
return num;
|
|
151 |
}
|
|
152 |
|
|
153 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
154 |
|
112 |
155 |
public static int getColumnCount()
|
113 |
156 |
{
|
114 |
|
return 3;
|
|
157 |
if( mIndices==null ) setUpColAndRow();
|
|
158 |
|
|
159 |
return mColCount;
|
115 |
160 |
}
|
116 |
161 |
|
117 |
162 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
118 |
|
// TODO
|
|
163 |
|
119 |
164 |
public static int getRowCount()
|
120 |
165 |
{
|
121 |
|
return 4;
|
|
166 |
if( mIndices==null ) setUpColAndRow();
|
|
167 |
|
|
168 |
return mRowCount;
|
122 |
169 |
}
|
123 |
170 |
|
124 |
171 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
125 |
|
// TODO
|
|
172 |
|
126 |
173 |
public static int[] getIndices()
|
127 |
174 |
{
|
|
175 |
if( mIndices==null ) setUpColAndRow();
|
|
176 |
|
128 |
177 |
return mIndices;
|
129 |
178 |
}
|
130 |
179 |
|
... | ... | |
307 |
356 |
|
308 |
357 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
309 |
358 |
|
310 |
|
RubikObjectList(int[][] info, Class<? extends RubikObject> object , RubikMovement movement)
|
|
359 |
RubikObjectList(int[][] info, Class<? extends RubikObject> object , RubikMovement movement, int column)
|
311 |
360 |
{
|
312 |
|
int length = info.length;
|
|
361 |
mNumSizes = info.length;
|
313 |
362 |
|
314 |
|
mObjectSizes = new int[length];
|
315 |
|
mMaxLevels = new int[length];
|
316 |
|
mResourceIDs = new int[length];
|
317 |
|
mSmallIconIDs = new int[length];
|
318 |
|
mMediumIconIDs= new int[length];
|
319 |
|
mBigIconIDs = new int[length];
|
320 |
|
mHugeIconIDs = new int[length];
|
|
363 |
mObjectSizes = new int[mNumSizes];
|
|
364 |
mMaxLevels = new int[mNumSizes];
|
|
365 |
mResourceIDs = new int[mNumSizes];
|
|
366 |
mSmallIconIDs = new int[mNumSizes];
|
|
367 |
mMediumIconIDs= new int[mNumSizes];
|
|
368 |
mBigIconIDs = new int[mNumSizes];
|
|
369 |
mHugeIconIDs = new int[mNumSizes];
|
321 |
370 |
|
322 |
|
for(int i=0; i<length; i++)
|
|
371 |
for(int i=0; i<mNumSizes; i++)
|
323 |
372 |
{
|
324 |
373 |
mObjectSizes[i] = info[i][0];
|
325 |
374 |
mMaxLevels[i] = info[i][1];
|
... | ... | |
332 |
381 |
|
333 |
382 |
mObjectClass = object;
|
334 |
383 |
mObjectMovementClass = movement;
|
|
384 |
mColumn = column;
|
335 |
385 |
}
|
336 |
386 |
|
337 |
387 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
Make the ObjectPopup a 2D grid - corrections.