Project

General

Profile

« Previous | Next » 

Revision a8295031

Added by Leszek Koltunski almost 2 years ago

Introduce InitData, a data structure used to initialize a TwistyObject.
Current (optional) members: int[] numLayers, int param [intended: type of the Crazy 3x3 planet], float[][] pos [position of a bandaged cube] )

View differences:

src/main/java/org/distorted/objectlib/main/ObjectType.java
33 33

  
34 34
public enum ObjectType
35 35
  {
36
  CUBE_2 ( TwistyCuboid.class        , new int[] {2,2,2}      , 12, R.drawable.cube_2, true),
37
  CUBE_3 ( TwistyCuboid.class        , new int[] {3,3,3}      , 17, R.drawable.cube_3, true),
38
  CUBE_4 ( TwistyCuboid.class        , new int[] {4,4,4}      , 24, R.drawable.cube_4, true),
39
  CUBE_5 ( TwistyCuboid.class        , new int[] {5,5,5}      , 28, R.drawable.cube_5, true),
40
  CUBE_6 ( TwistyCuboid.class        , new int[] {6,6,6}      , 35, R.drawable.cube_6, true),
41
  CUBE_7 ( TwistyCuboid.class        , new int[] {7,7,7}      , 42, R.drawable.cube_7, true),
42
  BAN1_3 ( TwistyBandagedFused.class , new int[] {3,3,3}      , 16, R.drawable.ban1_3, true),
43
  BAN2_3 ( TwistyBandaged2Bar.class  , new int[] {3,3,3}      , 20, R.drawable.ban2_3, true),
44
  BAN3_3 ( TwistyBandaged3Plate.class, new int[] {3,3,3}      , 16, R.drawable.ban3_3, true),
45
  BAN4_3 ( TwistyBandagedBiCube.class, new int[] {3,3,3}      , 22, R.drawable.ban4_3, true),
46
  CU_323 ( TwistyCuboid.class        , new int[] {3,2,3}      , 15, R.drawable.cu_323, true),
47
  CU_232 ( TwistyCuboid.class        , new int[] {2,3,2}      , 16, R.drawable.cu_232, true),
48
  CU_343 ( TwistyCuboid.class        , new int[] {3,4,3}      , 23, R.drawable.cu_343, true),
49
  SQU1_3 ( TwistySquare1.class       , new int[] {3,2,3}      , 24, R.drawable.squ1_3, true),
50
  SQU2_3 ( TwistySquare2.class       , new int[] {3,2,3}      , 24, R.drawable.squ2_3, true),
51
  ULTI_2 ( TwistyUltimate.class      , new int[] {2,2,2,2}    , 18, R.drawable.ulti_2, true),
52
  KILO_3 ( TwistyKilominx.class      , new int[] {3,3,3,3,3,3}, 18, R.drawable.kilo_3, true),
53
  MEGA_3 ( TwistyMegaminx.class      , new int[] {3,3,3,3,3,3}, 21, R.drawable.mega_3, true),
54
  KILO_5 ( TwistyKilominx.class      , new int[] {5,5,5,5,5,5}, 33, R.drawable.kilo_5, true),
55
  MEGA_5 ( TwistyMegaminx.class      , new int[] {5,5,5,5,5,5}, 37, R.drawable.mega_5, true),
56
  MORP_2 ( TwistyMorphix.class       , new int[] {2,2,2}      , 12, R.drawable.morp_2, true),
57
  JING_2 ( TwistyJing.class          , new int[] {2,2,2,2}    , 11, R.drawable.jing_2, true),
58
  PYRA_3 ( TwistyPyraminx.class      , new int[] {3,3,3,3}    , 10, R.drawable.pyra_3, true),
59
  PYRA_4 ( TwistyPyraminx.class      , new int[] {4,4,4,4}    , 17, R.drawable.pyra_4, true),
60
  PYRA_5 ( TwistyPyraminx.class      , new int[] {5,5,5,5}    , 23, R.drawable.pyra_5, true),
61
  TRAJ_3 ( TwistyTrajber.class       , new int[] {3,3,3}      , 17, R.drawable.traj_3, true),
62
  TRAJ_4 ( TwistyTrajber.class       , new int[] {4,4,4}      , 24, R.drawable.traj_4, true),
63
  DIAM_2 ( TwistyDiamond.class       , new int[] {2,2,2,2}    , 12, R.drawable.diam_2, true),
64
  DIAM_3 ( TwistyDiamond.class       , new int[] {3,3,3,3}    , 24, R.drawable.diam_3, true),
65
  DIAM_4 ( TwistyDiamond.class       , new int[] {4,4,4,4}    , 32, R.drawable.diam_4, true),
66
  DINO_3 ( TwistyDino6.class         , new int[] {3,3,3,3}    , 10, R.drawable.dino_3, true),
67
  DIN4_3 ( TwistyDino4.class         , new int[] {3,3,3,3}    ,  7, R.drawable.din4_3, true),
68
  MIRR_2 ( TwistyMirror.class        , new int[] {2,2,2}      , 12, R.drawable.mirr_2, true),
69
  MIRR_3 ( TwistyMirror.class        , new int[] {3,3,3}      , 17, R.drawable.mirr_3, true),
70
  MIRR_4 ( TwistyMirror.class        , new int[] {4,4,4}      , 24, R.drawable.mirr_4, true),
71
  FISH_3 ( TwistyFisher.class        , new int[] {3,3,3}      , 24, R.drawable.fish_3, true),
72
  WIND_3 ( TwistyWindmill.class      , new int[] {3,3,3}      , 24, R.drawable.wind_3, true),
73
  AXIS_3 ( TwistyAxis.class          , new int[] {3,3,3}      , 24, R.drawable.axis_3, true),
74
  IVY_2  ( TwistyIvy.class           , new int[] {2,2,2,2}    ,  8, R.drawable.ivy_2 , true),
75
  REX_3  ( TwistyRex.class           , new int[] {3,3,3,3}    , 19, R.drawable.rex_3 , true),
76
  REDI_3 ( TwistyRedi.class          , new int[] {3,3,3,3}    , 16, R.drawable.redi_3, true),
77
  HELI_3 ( TwistyHelicopter.class    , new int[] {3,3,3,3,3,3}, 20, R.drawable.heli_3, true),
78
  SKEW_2 ( TwistySkewb.class         , new int[] {2,2,2,2}    , 11, R.drawable.skew_2, true),
79
  SKEW_3 ( TwistySkewb.class         , new int[] {3,3,3,3}    , 21, R.drawable.skew_3, true),
80
  CONT_2 ( TwistyContainer.class     , new int[] {2,2,2,2}    , 12, R.drawable.cont_2, true),
81

  
82
  CRA1_3 ( TwistyCrazy.class         , new int[] {3,3,3}      , 22, R.drawable.cra1_3, true),
83

  
84
  VOID_3 ( TwistyVoid.class          , new int[] {3,3,3}      , 17, R.drawable.void_3, false),  // wasDownloadableButNowIsBuiltIn()
85
  CRYS_3 ( TwistyCrystal.class       , new int[] {3,3,3,3,3,3}, 27, R.drawable.crys_3, false),  // function!
86
  STAR_3 ( TwistyStarminx.class      , new int[] {3,3,3,3,3,3}, 27, R.drawable.star_3, false),
87
  PENT_2 ( TwistyPentultimate.class  , new int[] {2,2,2,2,2,2}, 21, R.drawable.pent_2, false),
88
  MIXU_3 ( TwistyMixup3x3.class      , new int[] {3,3,3}      , 24, R.drawable.mixu_3, false),
89
  MIXP_3 ( TwistyMixup3x3Plus.class  , new int[] {3,3,3}      , 28, R.drawable.mixp_3, false),
36
  CUBE_2 ( TwistyCuboid.class        , 12, R.drawable.cube_2, true, new InitData(new int[] {2,2,2})),
37
  CUBE_3 ( TwistyCuboid.class        , 17, R.drawable.cube_3, true, new InitData(new int[] {3,3,3})),
38
  CUBE_4 ( TwistyCuboid.class        , 24, R.drawable.cube_4, true, new InitData(new int[] {4,4,4})),
39
  CUBE_5 ( TwistyCuboid.class        , 28, R.drawable.cube_5, true, new InitData(new int[] {5,5,5})),
40
  CUBE_6 ( TwistyCuboid.class        , 35, R.drawable.cube_6, true, new InitData(new int[] {6,6,6})),
41
  CUBE_7 ( TwistyCuboid.class        , 42, R.drawable.cube_7, true, new InitData(new int[] {7,7,7})),
42
  BAN1_3 ( TwistyBandagedFused.class , 16, R.drawable.ban1_3, true, new InitData(new int[] {3,3,3})),
43
  BAN2_3 ( TwistyBandaged2Bar.class  , 20, R.drawable.ban2_3, true, new InitData(new int[] {3,3,3})),
44
  BAN3_3 ( TwistyBandaged3Plate.class, 16, R.drawable.ban3_3, true, new InitData(new int[] {3,3,3})),
45
  BAN4_3 ( TwistyBandagedBiCube.class, 22, R.drawable.ban4_3, true, new InitData(new int[] {3,3,3})),
46
  CU_323 ( TwistyCuboid.class        , 15, R.drawable.cu_323, true, new InitData(new int[] {3,2,3})),
47
  CU_232 ( TwistyCuboid.class        , 16, R.drawable.cu_232, true, new InitData(new int[] {2,3,2})),
48
  CU_343 ( TwistyCuboid.class        , 23, R.drawable.cu_343, true, new InitData(new int[] {3,4,3})),
49
  SQU1_3 ( TwistySquare1.class       , 24, R.drawable.squ1_3, true, new InitData(new int[] {3,2,3})),
50
  SQU2_3 ( TwistySquare2.class       , 24, R.drawable.squ2_3, true, new InitData(new int[] {3,2,3})),
51
  ULTI_2 ( TwistyUltimate.class      , 18, R.drawable.ulti_2, true, new InitData(new int[] {2,2,2,2})),
52
  KILO_3 ( TwistyKilominx.class      , 18, R.drawable.kilo_3, true, new InitData(new int[] {3,3,3,3,3,3})),
53
  MEGA_3 ( TwistyMegaminx.class      , 21, R.drawable.mega_3, true, new InitData(new int[] {3,3,3,3,3,3})),
54
  KILO_5 ( TwistyKilominx.class      , 33, R.drawable.kilo_5, true, new InitData(new int[] {5,5,5,5,5,5})),
55
  MEGA_5 ( TwistyMegaminx.class      , 37, R.drawable.mega_5, true, new InitData(new int[] {5,5,5,5,5,5})),
56
  MORP_2 ( TwistyMorphix.class       , 12, R.drawable.morp_2, true, new InitData(new int[] {2,2,2})),
57
  JING_2 ( TwistyJing.class          , 11, R.drawable.jing_2, true, new InitData(new int[] {2,2,2,2})),
58
  PYRA_3 ( TwistyPyraminx.class      , 10, R.drawable.pyra_3, true, new InitData(new int[] {3,3,3,3})),
59
  PYRA_4 ( TwistyPyraminx.class      , 17, R.drawable.pyra_4, true, new InitData(new int[] {4,4,4,4})),
60
  PYRA_5 ( TwistyPyraminx.class      , 23, R.drawable.pyra_5, true, new InitData(new int[] {5,5,5,5})),
61
  TRAJ_3 ( TwistyTrajber.class       , 17, R.drawable.traj_3, true, new InitData(new int[] {3,3,3})),
62
  TRAJ_4 ( TwistyTrajber.class       , 24, R.drawable.traj_4, true, new InitData(new int[] {4,4,4})),
63
  DIAM_2 ( TwistyDiamond.class       , 12, R.drawable.diam_2, true, new InitData(new int[] {2,2,2,2})),
64
  DIAM_3 ( TwistyDiamond.class       , 24, R.drawable.diam_3, true, new InitData(new int[] {3,3,3,3})),
65
  DIAM_4 ( TwistyDiamond.class       , 32, R.drawable.diam_4, true, new InitData(new int[] {4,4,4,4})),
66
  DINO_3 ( TwistyDino6.class         , 10, R.drawable.dino_3, true, new InitData(new int[] {3,3,3,3})),
67
  DIN4_3 ( TwistyDino4.class         ,  7, R.drawable.din4_3, true, new InitData(new int[] {3,3,3,3})),
68
  MIRR_2 ( TwistyMirror.class        , 12, R.drawable.mirr_2, true, new InitData(new int[] {2,2,2})),
69
  MIRR_3 ( TwistyMirror.class        , 17, R.drawable.mirr_3, true, new InitData(new int[] {3,3,3})),
70
  MIRR_4 ( TwistyMirror.class        , 24, R.drawable.mirr_4, true, new InitData(new int[] {4,4,4})),
71
  FISH_3 ( TwistyFisher.class        , 24, R.drawable.fish_3, true, new InitData(new int[] {3,3,3})),
72
  WIND_3 ( TwistyWindmill.class      , 24, R.drawable.wind_3, true, new InitData(new int[] {3,3,3})),
73
  AXIS_3 ( TwistyAxis.class          , 24, R.drawable.axis_3, true, new InitData(new int[] {3,3,3})),
74
  IVY_2  ( TwistyIvy.class           ,  8, R.drawable.ivy_2 , true, new InitData(new int[] {2,2,2,2})),
75
  REX_3  ( TwistyRex.class           , 19, R.drawable.rex_3 , true, new InitData(new int[] {3,3,3,3})),
76
  REDI_3 ( TwistyRedi.class          , 16, R.drawable.redi_3, true, new InitData(new int[] {3,3,3,3})),
77
  HELI_3 ( TwistyHelicopter.class    , 20, R.drawable.heli_3, true, new InitData(new int[] {3,3,3,3,3,3})),
78
  SKEW_2 ( TwistySkewb.class         , 11, R.drawable.skew_2, true, new InitData(new int[] {2,2,2,2})),
79
  SKEW_3 ( TwistySkewb.class         , 21, R.drawable.skew_3, true, new InitData(new int[] {3,3,3,3})),
80
  CONT_2 ( TwistyContainer.class     , 12, R.drawable.cont_2, true, new InitData(new int[] {2,2,2,2})),
81

  
82
  CRA1_3 ( TwistyCrazy.class         , 22, R.drawable.cra1_3, true, new InitData(new int[] {3,3,3})),
83

  
84
  VOID_3 ( TwistyVoid.class          , 17, R.drawable.void_3, false, new InitData(new int[] {3,3,3})),        // wasDownloadableButNowIsBuiltIn()
85
  CRYS_3 ( TwistyCrystal.class       , 27, R.drawable.crys_3, false, new InitData(new int[] {3,3,3,3,3,3})),  // function!
86
  STAR_3 ( TwistyStarminx.class      , 27, R.drawable.star_3, false, new InitData(new int[] {3,3,3,3,3,3})),
87
  PENT_2 ( TwistyPentultimate.class  , 21, R.drawable.pent_2, false, new InitData(new int[] {2,2,2,2,2,2})),
88
  MIXU_3 ( TwistyMixup3x3.class      , 24, R.drawable.mixu_3, false, new InitData(new int[] {3,3,3})),
89
  MIXP_3 ( TwistyMixup3x3Plus.class  , 28, R.drawable.mixp_3, false, new InitData(new int[] {3,3,3})),
90 90
  ;
91 91

  
92 92
  public static int NUM_OBJECTS;
93 93
  private static final ObjectType[] objects;
94 94

  
95
  private final int[] mNumLayers;
95
  private final InitData mInitData;
96 96
  private final int mNumScrambles;
97 97
  private final int mIcon;
98 98
  private final boolean mExportToApp;
......
110 110

  
111 111
///////////////////////////////////////////////////////////////////////////////////////////////////
112 112

  
113
  ObjectType(Class<? extends TwistyObject> clazz, int[] numLayers, int scrambles, int icon, boolean export)
113
  ObjectType(Class<? extends TwistyObject> clazz, int scrambles, int icon, boolean export, InitData data)
114 114
    {
115 115
    mClass       = clazz;
116
    mNumLayers   = numLayers;
116
    mInitData    = data;
117 117
    mNumScrambles= scrambles;
118 118
    mIcon        = icon;
119 119
    mExportToApp = export;
......
167 167

  
168 168
  public static TwistyObject create(int ordinal, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream meshStream)
169 169
    {
170
    int[] numL= objects[ordinal].mNumLayers;
171 170
    Class<? extends TwistyObject> clazz = objects[ordinal].mClass;
172 171

  
173 172
    try
......
176 175

  
177 176
      if( cons.length==1 )
178 177
        {
179
        Object[] parameters = new Object[] { numL,meshState,iconMode,quat,move,scale,meshStream };
178
        InitData data = objects[ordinal].mInitData;
179
        Object[] parameters = new Object[] { data,meshState,iconMode,quat,move,scale,meshStream };
180 180
        return (TwistyObject)cons[0].newInstance(parameters);
181 181
        }
182 182
      else

Also available in: Unified diff