Project

General

Profile

« Previous | Next » 

Revision dd1a65c1

Added by Leszek Koltunski over 2 years ago

Move ObjectControl, the next big chunk of code, to objectlib.

View differences:

src/main/java/org/distorted/main/RubikObjectStateActioner.java
39 39
import org.distorted.dialogs.RubikDialogSolved;
40 40
import org.distorted.network.RubikScores;
41 41
import org.distorted.screens.RubikScreenPlay;
42
import org.distorted.screens.RubikScreenReady;
43
import org.distorted.screens.RubikScreenSolver;
42 44
import org.distorted.screens.RubikScreenSolving;
43 45
import org.distorted.screens.ScreenList;
46
import org.distorted.solvers.SolverMain;
44 47

  
45 48
///////////////////////////////////////////////////////////////////////////////////////////////////
46 49

  
......
217 220
       });
218 221
     }
219 222

  
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224

  
225
   public void onFinishRotation(TwistyActivity act, int axis, int row, int angle)
226
     {
227
     if( ScreenList.getCurrentScreen()== ScreenList.SOLV )
228
       {
229
       RubikScreenSolving solv = (RubikScreenSolving) ScreenList.SOLV.getScreenClass();
230
       solv.addMove(act, axis, row, angle);
231
       }
232
     if( ScreenList.getCurrentScreen()== ScreenList.PLAY )
233
       {
234
       RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
235
       play.addMove(act, axis, row, angle);
236
       }
237
     }
238

  
239
///////////////////////////////////////////////////////////////////////////////////////////////////
240

  
241
   public void onBeginRotation(TwistyActivity act)
242
     {
243
     if( ScreenList.getCurrentScreen()== ScreenList.READ )
244
       {
245
       RubikScreenSolving solving = (RubikScreenSolving) ScreenList.SOLV.getScreenClass();
246
       solving.resetElapsed();
247
       RubikActivity ract = (RubikActivity)act;
248

  
249
       ract.runOnUiThread(new Runnable()
250
         {
251
         @Override
252
         public void run()
253
           {
254
           ScreenList.switchScreen( ract, ScreenList.SOLV);
255
           }
256
         });
257
       }
258
     }
259

  
260
///////////////////////////////////////////////////////////////////////////////////////////////////
261

  
262
    public void failedToDrag(TwistyActivity act)
263
      {
264
      ScreenList curr = ScreenList.getCurrentScreen();
265

  
266
      if( curr==ScreenList.PLAY )
267
        {
268
        RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
269
        play.reddenLock(act);
270
        }
271
      else if( curr==ScreenList.READ )
272
        {
273
        RubikScreenReady read = (RubikScreenReady) ScreenList.READ.getScreenClass();
274
        read.reddenLock(act);
275
        }
276
      else if( curr==ScreenList.SOLV )
277
        {
278
        RubikScreenSolving solv = (RubikScreenSolving) ScreenList.SOLV.getScreenClass();
279
        solv.reddenLock(act);
280
        }
281
      }
282

  
220 283
///////////////////////////////////////////////////////////////////////////////////////////////////
221 284

  
222 285
   public void onSolved()
......
237 300
          }
238 301
        }
239 302
     }
303

  
304
///////////////////////////////////////////////////////////////////////////////////////////////////
305

  
306
   public int getCurrentColor()
307
     {
308
     RubikScreenSolver solver = (RubikScreenSolver) ScreenList.SVER.getScreenClass();
309
     return solver.getCurrentColor();
310
     }
311

  
312
///////////////////////////////////////////////////////////////////////////////////////////////////
313

  
314
   public int cubitIsLocked(ObjectType type, int cubit)
315
     {
316
     return SolverMain.cubitIsLocked(type,cubit);
317
     }
240 318
}

Also available in: Unified diff