Project

General

Profile

« Previous | Next » 

Revision 4893ad8a

Added by Leszek Koltunski almost 3 years ago

Include the info about 'numFaces' of a puzzle in the jsons.
Based on this, and the recently introduced 'DEFAULT_ROTs' to the basic Shape classes, rotate each object in the Config so it looks attractive.

View differences:

src/main/java/org/distorted/config/ConfigActivity.java
35 35
import org.distorted.dmesh.ObjectMesh;
36 36
import org.distorted.jsons.ObjectJson;
37 37
import org.distorted.library.main.DistortedLibrary;
38
import org.distorted.library.type.Static4D;
38 39
import org.distorted.main.R;
39 40
import org.distorted.objectlib.main.ObjectControl;
41
import org.distorted.objectlib.main.ShapeDodecahedron;
42
import org.distorted.objectlib.main.ShapeHexahedron;
43
import org.distorted.objectlib.main.ShapeOctahedron;
44
import org.distorted.objectlib.main.ShapeTetrahedron;
40 45
import org.distorted.objects.RubikObject;
41 46
import org.distorted.objects.RubikObjectList;
42 47

  
......
213 218
      errDiag.show(getSupportFragmentManager(), null);
214 219
      }
215 220

  
221
///////////////////////////////////////////////////////////////////////////////////////////////////
222

  
223
    private Static4D getDefaultRotation(int numFaces)
224
      {
225
      switch(numFaces)
226
        {
227
        case  4: return ShapeTetrahedron.DEFAULT_ROT;
228
        case  6: return ShapeHexahedron.DEFAULT_ROT;
229
        case  8: return ShapeOctahedron.DEFAULT_ROT;
230
        case 12: return ShapeDodecahedron.DEFAULT_ROT;
231
        }
232

  
233
      return null;
234
      }
235

  
236
///////////////////////////////////////////////////////////////////////////////////////////////////
237

  
238
    void rotateObject(int numFaces)
239
      {
240
      ConfigSurfaceView view = findViewById(R.id.configSurfaceView);
241
      ObjectControl control = view.getObjectControl();
242
      Static4D rot = getDefaultRotation(numFaces);
243
      
244
      if( rot!=null ) control.rotateNow(rot);
245
      }
246

  
216 247
///////////////////////////////////////////////////////////////////////////////////////////////////
217 248

  
218 249
    private void changeIfDifferent(RubikObject object,ObjectControl control)
src/main/java/org/distorted/config/ConfigScreenPane.java
110 110
    mProgramatic = true;
111 111
    button.setChecked(true);
112 112
    mProgramatic = false;
113

  
114
    int numFaces = mReader.getNumFaces();
115
    act.rotateObject(numFaces);
113 116
    }
114 117

  
115 118
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff