37 |
37 |
import org.distorted.objectlib.BuildConfig;
|
38 |
38 |
import org.distorted.objectlib.helpers.BlockController;
|
39 |
39 |
import org.distorted.objectlib.helpers.ObjectLibInterface;
|
|
40 |
import org.distorted.objectlib.main.ObjectControl;
|
40 |
41 |
import org.distorted.objectlib.main.ObjectType;
|
41 |
42 |
|
42 |
43 |
import org.distorted.dialogs.RubikDialogNewRecord;
|
... | ... | |
55 |
56 |
|
56 |
57 |
public class RubikObjectLibInterface implements ObjectLibInterface
|
57 |
58 |
{
|
58 |
|
WeakReference<RubikActivity> mAct;
|
|
59 |
private final WeakReference<RubikActivity> mAct;
|
59 |
60 |
private boolean mIsNewRecord;
|
60 |
61 |
private long mNewRecord;
|
|
62 |
private int mLastCubitColor, mLastCubit, mLastCubitFace;
|
61 |
63 |
|
62 |
64 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63 |
65 |
|
64 |
66 |
RubikObjectLibInterface(RubikActivity act)
|
65 |
67 |
{
|
66 |
68 |
mAct = new WeakReference<>(act);
|
|
69 |
mLastCubitColor = -1;
|
67 |
70 |
}
|
68 |
71 |
|
69 |
72 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
415 |
418 |
|
416 |
419 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
417 |
420 |
|
418 |
|
public int getCurrentColor()
|
|
421 |
public void onReplaceModeDown(int cubit, int face)
|
419 |
422 |
{
|
420 |
423 |
RubikScreenSolver solver = (RubikScreenSolver) ScreenList.SVER.getScreenClass();
|
421 |
|
return solver.getCurrentColor();
|
|
424 |
int color = solver.getCurrentColor();
|
|
425 |
RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
|
|
426 |
ObjectType currObject = play.getObject();
|
|
427 |
mLastCubitColor = SolverMain.cubitIsLocked(currObject,cubit);
|
|
428 |
mLastCubit = cubit;
|
|
429 |
mLastCubitFace = face;
|
|
430 |
ObjectControl control = mAct.get().getControl();
|
|
431 |
control.setTextureMap( cubit, face, color );
|
422 |
432 |
}
|
423 |
433 |
|
424 |
434 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
425 |
435 |
|
426 |
|
public int cubitIsLocked(int cubit)
|
|
436 |
public void onReplaceModeUp()
|
427 |
437 |
{
|
428 |
|
RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
|
429 |
|
ObjectType currObject = play.getObject();
|
430 |
|
return SolverMain.cubitIsLocked(currObject,cubit);
|
|
438 |
if( mLastCubitColor>=0 )
|
|
439 |
{
|
|
440 |
ObjectControl control = mAct.get().getControl();
|
|
441 |
control.setTextureMap( mLastCubit, mLastCubitFace, mLastCubitColor );
|
|
442 |
mLastCubitColor = -1;
|
|
443 |
}
|
431 |
444 |
}
|
432 |
445 |
}
|
Make the ShapeChanging the default TouchControl during MODE_REPLACE.