Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / RubikObject.java @ 804293f0

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 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.objects;
21

    
22
import org.distorted.dmesh.ObjectMesh;
23
import org.distorted.jsons.ObjectJson;
24
import org.distorted.objectlib.main.ObjectType;
25
import org.distorted.patterns.RubikPatternList;
26

    
27
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
28

    
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

    
31
public class RubikObject
32
{
33
  private final String mName;
34
  private final int mNumScramble;
35
  private final int mOrdinal;
36
  private final int mJsonID, mMeshID, mTutorialsID;
37
  private final int mIconID;
38
  private final String[][] mPatterns;
39

    
40
  private int mMeshState;
41
  private int mTutorialOrdinal;
42

    
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44

    
45
  RubikObject(ObjectType type)
46
    {
47
    mIconID      = type.getIconID();
48
    mName        = type.name();
49
    mNumScramble = type.getNumScramble();
50
    mOrdinal     = type.ordinal();
51
    mJsonID      = ObjectJson.getObjectJsonID(mOrdinal);
52
    mMeshID      = ObjectMesh.getMeshID(mOrdinal);
53
    mTutorialsID = ObjectJson.getTutorialJsonID(mOrdinal);
54

    
55
    int patternOrdinal  = RubikPatternList.getOrdinal(mOrdinal);
56
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
57

    
58
    mMeshState = MESH_NICE;
59
    mTutorialOrdinal = -1;
60
    }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
  public void setTutorialOrdinal(int ordinal)
65
    {
66
    mTutorialOrdinal = ordinal;
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  public int getTutorialOrdinal()
72
    {
73
    return mTutorialOrdinal;
74
    }
75

    
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

    
78
  public void setMeshState(int state)
79
    {
80
    mMeshState = state;
81
    }
82

    
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

    
85
  public int getMeshState()
86
    {
87
    return mMeshState;
88
    }
89

    
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91
// PUBLIC API
92

    
93
  public String getName()
94
    {
95
    return mName;
96
    }
97

    
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99

    
100
  public int getNumScramble()
101
    {
102
    return mNumScramble;
103
    }
104

    
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106

    
107
  public int getOrdinal()
108
    {
109
    return mOrdinal;
110
    }
111

    
112
///////////////////////////////////////////////////////////////////////////////////////////////////
113

    
114
  public int getIconID()
115
    {
116
    return mIconID;
117
    }
118

    
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

    
121
  public int getJsonID()
122
    {
123
    return mJsonID;
124
    }
125

    
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127

    
128
  public int getMeshID()
129
    {
130
    return mMeshID;
131
    }
132

    
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

    
135
  public int getTutorialJsonID()
136
    {
137
    return mTutorialsID;
138
    }
139

    
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141

    
142
  public String[][] getPatterns()
143
    {
144
    return mPatterns;
145
    }
146
}
(1-1/2)