Project

General

Profile

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

magiccube / src / main / java / org / distorted / tutorial / TutorialList.java @ 234a7582

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
                         }
38
        ),
39

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

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

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

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

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

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

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

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

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

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

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

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

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

    
118
  private static final TutorialList[] objects;
119

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

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

    
131
///////////////////////////////////////////////////////////////////////////////////////////////////
132

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

    
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142

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

    
148
///////////////////////////////////////////////////////////////////////////////////////////////////
149

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

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

    
165
    return -1;
166
    }
167

    
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169

    
170
  public int getIconID()
171
    {
172
    int sizeIndex = ObjectList.getSizeIndex(mObject.ordinal(),mSize);
173
    return mObject.getIconIDs()[sizeIndex];
174
    }
175

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

    
178
  public String getTutorialLanguage(int index)
179
    {
180
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][0] : null;
181
    }
182

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

    
185
  public String getTutorialURL(int index)
186
    {
187
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][1] : null;
188
    }
189

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

    
192
  public String getTutorialDescription(int index)
193
    {
194
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][2] : null;
195
    }
196

    
197
///////////////////////////////////////////////////////////////////////////////////////////////////
198

    
199
  public String getTutorialAuthor(int index)
200
    {
201
    return ( index>=0 && index<mNumTutorials ) ? mTutorials[index][3] : null;
202
    }
203
}
(2-2/7)