Revision 9c2f0c91
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/states/RubikStatePlay.java | ||
---|---|---|
38 | 38 |
import org.distorted.main.R; |
39 | 39 |
import org.distorted.main.RubikActivity; |
40 | 40 |
import org.distorted.main.RubikPreRender; |
41 |
import org.distorted.objects.RubikObject;
|
|
42 |
import org.distorted.objects.RubikObjectList;
|
|
41 |
import org.distorted.objects.TwistyObject;
|
|
42 |
import org.distorted.objects.ObjectList; |
|
43 | 43 |
import org.distorted.scores.RubikScores; |
44 | 44 |
|
45 | 45 |
import java.util.ArrayList; |
... | ... | |
50 | 50 |
{ |
51 | 51 |
private static final int DURATION_MILLIS = 750; |
52 | 52 |
private static final int LEVELS_SHOWN = 10; |
53 |
public static final int DEF_OBJECT= RubikObjectList.CUBE.ordinal();
|
|
53 |
public static final int DEF_OBJECT= ObjectList.CUBE.ordinal(); |
|
54 | 54 |
public static final int DEF_SIZE = 3; |
55 | 55 |
|
56 | 56 |
private static int[] BUTTON_LABELS = { R.string.scores, R.string.patterns, R.string.solver, R.string.about }; |
... | ... | |
103 | 103 |
if( mMoves==null ) mMoves = new ArrayList<>(); |
104 | 104 |
else mMoves.clear(); |
105 | 105 |
|
106 |
mRowCount = RubikObjectList.getRowCount();
|
|
107 |
mColCount = RubikObjectList.getColumnCount();
|
|
106 |
mRowCount = ObjectList.getRowCount(); |
|
107 |
mColCount = ObjectList.getColumnCount(); |
|
108 | 108 |
|
109 | 109 |
// TOP //////////////////////////// |
110 | 110 |
LinearLayout layoutTop = act.findViewById(R.id.upperBar); |
... | ... | |
219 | 219 |
View popupView = mPlayPopup.getContentView(); |
220 | 220 |
popupView.setSystemUiVisibility(RubikActivity.FLAGS); |
221 | 221 |
|
222 |
final int sizeIndex = RubikObjectList.getSizeIndex(mObject,mSize);
|
|
223 |
final int maxLevel = RubikObjectList.getMaxLevel(mObject, sizeIndex);
|
|
222 |
final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize); |
|
223 |
final int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex); |
|
224 | 224 |
final int levelsShown = Math.min(maxLevel,LEVELS_SHOWN); |
225 | 225 |
|
226 | 226 |
mPlayPopup.showAsDropDown(view, margin, margin, Gravity.RIGHT); |
... | ... | |
370 | 370 |
final View layout = layoutInflater.inflate(R.layout.popup_objects, null); |
371 | 371 |
GridLayout objectGrid = layout.findViewById(R.id.objectGrid); |
372 | 372 |
|
373 |
int[] indices = RubikObjectList.getIndices();
|
|
373 |
int[] indices = ObjectList.getIndices(); |
|
374 | 374 |
|
375 | 375 |
GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount]; |
376 | 376 |
GridLayout.Spec[] colSpecs = new GridLayout.Spec[mColCount]; |
... | ... | |
400 | 400 |
int margin = (int)(width*RubikActivity.LARGE_MARGIN); |
401 | 401 |
mObjectSize = (int)(cubeWidth + 2*margin + 0.5f); |
402 | 402 |
|
403 |
for(int object=0; object<RubikObjectList.NUM_OBJECTS; object++)
|
|
403 |
for(int object = 0; object< ObjectList.NUM_OBJECTS; object++)
|
|
404 | 404 |
{ |
405 |
final RubikObjectList list = RubikObjectList.getObject(object);
|
|
405 |
final ObjectList list = ObjectList.getObject(object);
|
|
406 | 406 |
final int[] sizes = list.getSizes(); |
407 | 407 |
int[] icons = list.getIconIDs(); |
408 | 408 |
int len = sizes.length; |
... | ... | |
520 | 520 |
if( numMoves>0 ) |
521 | 521 |
{ |
522 | 522 |
Move move = mMoves.remove(numMoves-1); |
523 |
RubikObject object = pre.getObject();
|
|
523 |
TwistyObject object = pre.getObject();
|
|
524 | 524 |
|
525 | 525 |
int axis = move.mAxis; |
526 | 526 |
int row = (1<<move.mRow); |
... | ... | |
549 | 549 |
case 0: RubikStatePlay play = (RubikStatePlay) RubikState.PLAY.getStateClass(); |
550 | 550 |
int object = play.getObject(); |
551 | 551 |
int size = play.getSize(); |
552 |
int sizeIndex = RubikObjectList.getSizeIndex(object,size);
|
|
552 |
int sizeIndex = ObjectList.getSizeIndex(object,size); |
|
553 | 553 |
|
554 | 554 |
Bundle bundle = new Bundle(); |
555 |
bundle.putInt("tab", RubikObjectList.pack(object,sizeIndex) );
|
|
555 |
bundle.putInt("tab", ObjectList.pack(object,sizeIndex) ); |
|
556 | 556 |
bundle.putBoolean("submitting", false); |
557 | 557 |
|
558 | 558 |
RubikDialogScores scores = new RubikDialogScores(); |
... | ... | |
627 | 627 |
|
628 | 628 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
629 | 629 |
|
630 |
public boolean setObjectAndSize(RubikActivity act, RubikObjectList obj, int size)
|
|
630 |
public boolean setObjectAndSize(RubikActivity act, ObjectList obj, int size) |
|
631 | 631 |
{ |
632 | 632 |
if( mObject!=obj.ordinal() || mSize != size ) |
633 | 633 |
{ |
... | ... | |
658 | 658 |
|
659 | 659 |
private void adjustLevels(final RubikActivity act) |
660 | 660 |
{ |
661 |
int sizeIndex = RubikObjectList.getSizeIndex(mObject,mSize);
|
|
662 |
int maxLevel = RubikObjectList.getMaxLevel(mObject, sizeIndex);
|
|
661 |
int sizeIndex = ObjectList.getSizeIndex(mObject,mSize); |
|
662 |
int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex); |
|
663 | 663 |
String[] levels = new String[maxLevel]; |
664 | 664 |
|
665 | 665 |
for(int i=0; i<maxLevel; i++) |
... | ... | |
682 | 682 |
|
683 | 683 |
mPlayLayout.removeAllViews(); |
684 | 684 |
|
685 |
int realSize= RubikObjectList.getSizeIndex(mObject,mSize);
|
|
685 |
int realSize= ObjectList.getSizeIndex(mObject,mSize); |
|
686 | 686 |
RubikScores scores = RubikScores.getInstance(); |
687 | 687 |
|
688 | 688 |
for(int i=0; i<maxLevel; i++) |
Also available in: Unified diff
Rename some classes.