Project

General

Profile

« Previous | Next » 

Revision d433b50e

Added by Leszek Koltunski over 2 years ago

In the 'magic' app, ObjectType is now only used in RubikObject and RubikObjectList classes and nowhere else.
This is a major step towards being able to download objects from an online repository.

View differences:

src/main/java/org/distorted/main/RubikActivity.java
49 49

  
50 50
import org.distorted.objectlib.main.ObjectControl;
51 51
import org.distorted.objectlib.main.TwistyObject;
52
import org.distorted.objectlib.main.ObjectType;
53 52
import org.distorted.objectlib.effects.BaseEffect;
54 53

  
55 54
import org.distorted.dialogs.RubikDialogError;
56 55
import org.distorted.dialogs.RubikDialogPrivacy;
57 56
import org.distorted.network.RubikScores;
58 57
import org.distorted.network.RubikNetwork;
58
import org.distorted.objects.RubikObject;
59
import org.distorted.objects.RubikObjectList;
59 60
import org.distorted.screens.ScreenList;
60 61
import org.distorted.screens.RubikScreenPlay;
61 62
import org.distorted.tutorials.TutorialActivity;
......
256 257
        }
257 258

  
258 259
      RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass();
259
      ObjectType object = play.getObject();
260
      int object = play.getObject();
260 261
      changeIfDifferent(object,view.getObjectControl());
261 262

  
262 263
      if( mIsChinese && !mPolicyAccepted ) PrivacyPolicy();
......
438 439

  
439 440
///////////////////////////////////////////////////////////////////////////////////////////////////
440 441

  
441
    public void changeObject(ObjectType newObject, boolean reportChange)
442
    public void changeObject(int newObject, boolean reportChange)
442 443
      {
443 444
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
444 445
      ObjectControl control = view.getObjectControl();
......
447 448

  
448 449
      if( reportChange && oldObject!=null )
449 450
        {
451
        RubikObject robject = RubikObjectList.getObject(newObject);
452
        String newName = robject==null ? "NULL" : robject.getName();
450 453
        float fps = view.getRenderer().getFPS();
451 454
        fps = (int)(fps+0.5f);
452 455
        StringBuilder name = new StringBuilder();
......
454 457
        name.append(' ');
455 458
        name.append(fps);
456 459
        name.append(" --> ");
457
        name.append(newObject.name());
460
        name.append(newName);
458 461

  
459 462
        if( BuildConfig.DEBUG )
460 463
          {
......
476 479

  
477 480
///////////////////////////////////////////////////////////////////////////////////////////////////
478 481

  
479
    public void changeIfDifferent(ObjectType type,ObjectControl control)
482
    public void changeIfDifferent(int ordinal, ObjectControl control)
480 483
      {
481
      InputStream jsonStream = ObjectJson.getStream(type,this);
482
      InputStream meshStream = ObjectMesh.getStream(type,this);
483
      control.changeIfDifferent(type.ordinal(),jsonStream,meshStream);
484
      InputStream jsonStream = ObjectJson.getStream(this,ordinal);
485
      InputStream meshStream = ObjectMesh.getStream(this,ordinal);
486
      control.changeIfDifferent(ordinal,jsonStream,meshStream);
484 487
      }
485 488

  
486 489
///////////////////////////////////////////////////////////////////////////////////////////////////
......
584 587

  
585 588
///////////////////////////////////////////////////////////////////////////////////////////////////
586 589

  
587
    public void switchTutorial(String url, ObjectType object)
590
    public void switchTutorial(String url, int objectOrdinal)
588 591
      {
589 592
      Intent myIntent = new Intent(this, TutorialActivity.class);
590 593
      myIntent.putExtra("url", url);
591
      myIntent.putExtra("obj", object.ordinal());
594
      myIntent.putExtra("obj", objectOrdinal);
592 595
      startActivity(myIntent);
593 596
      }
594 597

  
595 598
///////////////////////////////////////////////////////////////////////////////////////////////////
596 599

  
597
    public void switchConfig(ObjectType object)
600
    public void switchConfig(int objectOrdinal)
598 601
      {
599 602
      Intent myIntent = new Intent(this, ConfigActivity.class);
600
      myIntent.putExtra("obj", object.ordinal());
603
      myIntent.putExtra("obj", objectOrdinal);
601 604
      startActivity(myIntent);
602 605
      }
603 606
}

Also available in: Unified diff