Project

General

Profile

Download (7.61 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / tutorial / TutorialList.java @ e314f6ae

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.tutorial;
21

    
22
import org.distorted.objects.ObjectList;
23

    
24
///////////////////////////////////////////////////////////////////////////////////////////////////
25

    
26
public enum TutorialList
27
{
28
  CUBE2 ( ObjectList.CUBE, 2,
29
          new String[][] {
30
                          {"gb","rJlh5p2wAKA","How to Solve a 2x2 Rubik's Cube","Z3"},
31
                         }
32
        ),
33

    
34
  CUBE3 ( ObjectList.CUBE, 3,
35
          new String[][] {
36
                          {"gb","-8ohoCKN0Zw","How to Solve a Rubik's Cube","Z3"},
37
                          {"pl","cBU9Y729nQM","Jak ułożyć kostkę Rubika 3x3x3","DżoDżo"},
38
                         }
39
        ),
40

    
41
  CUBE4 ( ObjectList.CUBE, 4,
42
          new String[][] {
43
                          {"gb","RR77Md71Ymc","How to Solve the 4x4 Rubik's Cube","Z3"},
44
                         }
45
        ),
46

    
47
  CUBE5 ( ObjectList.CUBE, 5,
48
          new String[][] {
49
                          {"gb","zMkNkXHzQts","How to Solve the 5x5 Rubik's Cube","Z3"},
50
                         }
51
        ),
52

    
53
  PYRA3 ( ObjectList.PYRA, 3,
54
          new String[][] {
55
                          {"gb","xIQtn2qazvg","Pyraminx Layer By Layer","Z3"},
56
                         }
57
        ),
58

    
59
  PYRA4 ( ObjectList.PYRA, 4,
60
          new String[][] {
61
                          {"gb","tGQDqDcSa6U","How to Solve the Master (4x4) Pyraminx","Z3"},
62
                         }
63
        ),
64

    
65
  PYRA5 ( ObjectList.PYRA, 5,
66
          new String[][] {
67
                          {"gb","2nsPEECDdN0","Professor Pyraminx Solve","RedKB"},
68
                         }
69
        ),
70

    
71
  DIAM2 ( ObjectList.DIAM, 2,
72
          new String[][] {
73
                          {"gb","R2wrbJJ3izM","How to Solve a Skewb Diamond","Dr. Penguin^3"},
74
                         }
75
        ),
76

    
77
  DINO3 ( ObjectList.DINO, 3,
78
          new String[][] {
79
                          {"gb","puTJZqFBQwo","Dino Skewb Cube Tutorial","Bearded Cubing"},
80
                         }
81
        ),
82

    
83
  REDI3 ( ObjectList.REDI, 3,
84
          new String[][] {
85
                          {"gb","Qn7TJED6O-4","How to Solve the MoYu Redi Cube","Z3"},
86
                         }
87
        ),
88

    
89
  HELI3 ( ObjectList.HELI, 3,
90
          new String[][] {
91
                          {"gb","-suwJpd_PO8","Helicopter Cube Tutorial","Bearded Cubing"},
92
                         }
93
        ),
94

    
95
  SKEW2 ( ObjectList.SKEW, 2,
96
          new String[][] {
97
                          {"gb","I6132yshkeU","How to Solve the Skewb","Z3"},
98
                         }
99
        ),
100

    
101
  SKEW3 ( ObjectList.SKEW, 3,
102
          new String[][] {
103
                          {"gb","Jiuf7zQyPYI","Master Skewb Cube Tutorial","Bearded Cubing"},
104
                         }
105
        ),
106

    
107
  IVY2 ( ObjectList.IVY, 2,
108
          new String[][] {
109
                          {"gb","QMzeJobSu1M","How to Solve the Ivy Cube","Z3"},
110
                         }
111
        );
112

    
113
  public static final int NUM_OBJECTS = values().length;
114
  private ObjectList mObject;
115
  private int mSize;
116
  private String[][] mTutorials;
117
  private int mNumTutorials;
118

    
119
  private static final TutorialList[] objects;
120

    
121
  static
122
    {
123
    objects = new TutorialList[NUM_OBJECTS];
124
    int i=0;
125

    
126
    for(TutorialList object: TutorialList.values())
127
      {
128
      objects[i++] = object;
129
      }
130
    }
131

    
132
///////////////////////////////////////////////////////////////////////////////////////////////////
133

    
134
  TutorialList(ObjectList object, int size, String[][] tutorials)
135
    {
136
    mObject       = object;
137
    mSize         = size;
138
    mTutorials    = tutorials;
139
    mNumTutorials = mTutorials.length;
140
    }
141

    
142
///////////////////////////////////////////////////////////////////////////////////////////////////
143

    
144
  public static TutorialList getObject(int ordinal)
145
    {
146
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal] : CUBE3;
147
    }
148

    
149
///////////////////////////////////////////////////////////////////////////////////////////////////
150

    
151
  public static int getOrdinal(int objectOrdinal, int size)
152
    {
153
    if( objectOrdinal==ObjectList.DIN4.ordinal() )
154
      {
155
      objectOrdinal= ObjectList.DINO.ordinal();
156
      }
157

    
158
    for(int i=0; i<NUM_OBJECTS; i++)
159
      {
160
      if( objects[i].mObject.ordinal() == objectOrdinal && objects[i].mSize == size )
161
        {
162
        return i;
163
        }
164
      }
165

    
166
    return -1;
167
    }
168

    
169
///////////////////////////////////////////////////////////////////////////////////////////////////
170

    
171
  public ObjectList getObjectList()
172
    {
173
    return mObject;
174
    }
175

    
176
///////////////////////////////////////////////////////////////////////////////////////////////////
177

    
178
  public int getSize()
179
    {
180
    return mSize;
181
    }
182

    
183
///////////////////////////////////////////////////////////////////////////////////////////////////
184

    
185
  public int getNumTutorials()
186
    {
187
    return mNumTutorials;
188
    }
189

    
190
///////////////////////////////////////////////////////////////////////////////////////////////////
191

    
192
  public int getIconID()
193
    {
194
    int sizeIndex = ObjectList.getSizeIndex(mObject.ordinal(),mSize);
195
    return mObject.getIconIDs()[sizeIndex];
196
    }
197

    
198
///////////////////////////////////////////////////////////////////////////////////////////////////
199

    
200
  public String getTutorialLanguage(int index)
201
    {
202
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][0] : null;
203
    }
204

    
205
///////////////////////////////////////////////////////////////////////////////////////////////////
206

    
207
  public String getTutorialURL(int index)
208
    {
209
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][1] : null;
210
    }
211

    
212
///////////////////////////////////////////////////////////////////////////////////////////////////
213

    
214
  public String getTutorialDescription(int index)
215
    {
216
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][2] : null;
217
    }
218

    
219
///////////////////////////////////////////////////////////////////////////////////////////////////
220

    
221
  public String getTutorialAuthor(int index)
222
    {
223
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][3] : null;
224
    }
225
}
(2-2/7)