Project

General

Profile

« Previous | Next » 

Revision 5c4ed8ed

Added by Leszek Koltunski over 2 years ago

Make the ShapeChanging the default TouchControl during MODE_REPLACE.

View differences:

src/main/java/org/distorted/main/RubikObjectLibInterface.java
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
}
src/main/java/org/distorted/tutorials/TutorialObjectLibInterface.java
46 46
  public void onBeginRotation() { }
47 47
  public void onSolved() { }
48 48
  public void onObjectCreated(long time) { }
49
  public int getCurrentColor() { return 0; }
50
  public int cubitIsLocked(int cubit) { return 0; }
49
  public void onReplaceModeDown(int cubit, int face) { }
50
  public void onReplaceModeUp() { }
51 51

  
52 52
///////////////////////////////////////////////////////////////////////////////////////////////////
53 53

  

Also available in: Unified diff