1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2020 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Distorted. //
|
5
|
// //
|
6
|
// Distorted 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
|
// Distorted 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 Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.magic;
|
21
|
|
22
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23
|
|
24
|
import org.distorted.effect.ScrambleEffect;
|
25
|
import org.distorted.effect.SizeChangeEffect;
|
26
|
import org.distorted.effect.SolveEffect;
|
27
|
|
28
|
enum RubikSettingsEnum
|
29
|
{
|
30
|
SIZECHANGE ( 20, 1, R.string.sizechange_effect ),
|
31
|
SOLVE ( 20, 1, R.string.solve_effect ),
|
32
|
SCRAMBLE ( 100, 0, R.string.scramble_effect );
|
33
|
|
34
|
public static final int LENGTH = values().length;
|
35
|
private int mDefaultPos, mDefaultType;
|
36
|
private int mText;
|
37
|
|
38
|
private static final RubikSettingsEnum[] enums; // copy the values() to a local variable so that we
|
39
|
// don't have to keep recreating the array every time
|
40
|
static
|
41
|
{
|
42
|
int i=0;
|
43
|
|
44
|
enums= new RubikSettingsEnum[LENGTH];
|
45
|
|
46
|
for(RubikSettingsEnum name: RubikSettingsEnum.values())
|
47
|
{
|
48
|
enums[i] = name;
|
49
|
i++;
|
50
|
}
|
51
|
}
|
52
|
|
53
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
54
|
|
55
|
RubikSettingsEnum( int dPos, int dType, int text )
|
56
|
{
|
57
|
mDefaultPos = dPos;
|
58
|
mDefaultType = dType;
|
59
|
mText = text;
|
60
|
}
|
61
|
|
62
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63
|
|
64
|
int getDefaultPos()
|
65
|
{
|
66
|
return mDefaultPos;
|
67
|
}
|
68
|
|
69
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
70
|
|
71
|
int getDefaultType()
|
72
|
{
|
73
|
return mDefaultType;
|
74
|
}
|
75
|
|
76
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
77
|
|
78
|
int getText()
|
79
|
{
|
80
|
return mText;
|
81
|
}
|
82
|
|
83
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
84
|
|
85
|
static RubikSettingsEnum getEnum(int ordinal)
|
86
|
{
|
87
|
return enums[ordinal];
|
88
|
}
|
89
|
|
90
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
91
|
|
92
|
static String[] getNames(int ordinal)
|
93
|
{
|
94
|
switch(ordinal)
|
95
|
{
|
96
|
case 0: return SizeChangeEffect.getNames();
|
97
|
case 1: return SolveEffect.getNames();
|
98
|
case 2: return ScrambleEffect.getNames();
|
99
|
}
|
100
|
|
101
|
return null;
|
102
|
}
|
103
|
}
|