Project

General

Profile

Download (3.46 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / tutorials / TutorialObjectLibInterface.java @ f08ec48e

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 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.tutorials;
21

    
22
import org.distorted.library.main.DistortedFramebuffer;
23

    
24
import org.distorted.objectlib.helpers.ObjectLibInterface;
25
import org.distorted.objectlib.main.ObjectType;
26

    
27
import java.lang.ref.WeakReference;
28

    
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

    
31
public class TutorialObjectLibInterface implements ObjectLibInterface
32
{
33
   WeakReference<TutorialActivity> mAct;
34

    
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36

    
37
  TutorialObjectLibInterface(TutorialActivity act)
38
    {
39
    mAct = new WeakReference<>(act);
40
    }
41

    
42
   public void onWinEffectFinished(String debug, int scrambleNum) { }
43
   public void onScrambleEffectFinished() { }
44
   public void onBeginRotation() { }
45
   public void onSolved() { }
46
   public int getCurrentColor() { return 0; }
47
   public int cubitIsLocked(ObjectType type, int cubit) { return 0; }
48

    
49
///////////////////////////////////////////////////////////////////////////////////////////////////
50

    
51
   public void onFinishRotation(int axis, int row, int angle)
52
     {
53
     TutorialActivity act = mAct.get();
54
     TutorialScreen state = act.getState();
55
     state.addMove(act, axis, row, angle);
56
     }
57

    
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59

    
60
   public void failedToDrag()
61
     {
62
     TutorialActivity act = mAct.get();
63
     TutorialScreen state = act.getState();
64
     state.reddenLock(act);
65
     }
66

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

    
69
  public DistortedFramebuffer getFramebuffer()
70
    {
71
    TutorialActivity act = mAct.get();
72
    return act.getScreen();
73
    }
74
}
(3-3/7)