Project

General

Profile

« Previous | Next » 

Revision 4888e97c

Added by Leszek Koltunski about 4 years ago

Major restructuring around making it possible to include different kinds of RubikObjects in the UI.

View differences:

src/main/java/org/distorted/magic/RubikActivity.java
73 73
      restorePreferences();
74 74
      RubikState.setState(this);
75 75
      RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass();
76
      int ordinal = play.getButton();
77
      view.getRenderer().createObject(RubikObjectList.getObject(ordinal));
76

  
77
      int object = play.getObject();
78
      int size   = play.getSize();
79
      RubikObjectList obj = RubikObjectList.getObject(object);
80
      int objectSize = obj.getSizes()[size];
81

  
82
      view.getRenderer().createObject( obj, objectSize );
78 83
      }
79 84
    
80 85
///////////////////////////////////////////////////////////////////////////////////////////////////
......
93 98
      {
94 99
      int id = v.getId();
95 100

  
96
      if( id>=0 && id< RubikObjectList.LENGTH )
101
      if( id>=0 && id< RubikObjectList.getTotal() )
97 102
        {
98
        RubikObjectList object = RubikObjectList.getObject(id);
103
        int object = RubikObjectList.unpackObject(id);
104
        int size= RubikObjectList.unpackSize(id);
105

  
106
        RubikObjectList obj = RubikObjectList.getObject(object);
107
        int objectSize = obj.getSizes()[size];
99 108

  
100 109
        RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
101
        boolean success = view.getRenderer().createObject(object);
110
        boolean success = view.getRenderer().createObject(obj,objectSize);
102 111

  
103 112
        if( success )
104 113
          {
105 114
          RubikStatePlay play = (RubikStatePlay)RubikState.PLAY.getStateClass();
106
          play.markButton(this,id);
115
          play.markButton(this,object,size);
107 116
          }
108 117
        }
109 118

  
......
181 190
    public void Scores(View v)
182 191
      {
183 192
      RubikStatePlay play = (RubikStatePlay) RubikState.PLAY.getStateClass();
184
      int tab = play.getButton();
193
      int object = play.getObject();
194
      int size   = play.getSize();
185 195

  
186 196
      Bundle bundle = new Bundle();
187
      bundle.putInt("tab", tab);
197
      bundle.putInt("tab", RubikObjectList.pack(object,size) );
188 198

  
189 199
      RubikDialogScores scores = new RubikDialogScores();
190 200
      scores.setArguments(bundle);

Also available in: Unified diff