Project

General

Profile

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

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

1 a7d8c3cd Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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 09cf2a36 Leszek Koltunski
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE;
28 f12e4de9 Leszek Koltunski
29 d433b50e Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
30
31 a7d8c3cd Leszek Koltunski
public class RubikObject
32
{
33
  private final String mName;
34
  private final int mNumScramble;
35
  private final int mOrdinal;
36 804293f0 Leszek Koltunski
  private final int mJsonID, mMeshID, mTutorialsID;
37 6e3fcb91 Leszek Koltunski
  private final int mIconID;
38 a7d8c3cd Leszek Koltunski
  private final String[][] mPatterns;
39
40 f12e4de9 Leszek Koltunski
  private int mMeshState;
41 804293f0 Leszek Koltunski
  private int mTutorialOrdinal;
42 f12e4de9 Leszek Koltunski
43 a7d8c3cd Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
44
45 d433b50e Leszek Koltunski
  RubikObject(ObjectType type)
46 a7d8c3cd Leszek Koltunski
    {
47 6e3fcb91 Leszek Koltunski
    mIconID      = type.getIconID();
48 a7d8c3cd Leszek Koltunski
    mName        = type.name();
49
    mNumScramble = type.getNumScramble();
50 d433b50e Leszek Koltunski
    mOrdinal     = type.ordinal();
51 804293f0 Leszek Koltunski
    mJsonID      = ObjectJson.getObjectJsonID(mOrdinal);
52 d433b50e Leszek Koltunski
    mMeshID      = ObjectMesh.getMeshID(mOrdinal);
53 804293f0 Leszek Koltunski
    mTutorialsID = ObjectJson.getTutorialJsonID(mOrdinal);
54 a7d8c3cd Leszek Koltunski
55 d433b50e Leszek Koltunski
    int patternOrdinal  = RubikPatternList.getOrdinal(mOrdinal);
56 a7d8c3cd Leszek Koltunski
    mPatterns = RubikPatternList.getPatterns(patternOrdinal);
57 f12e4de9 Leszek Koltunski
58
    mMeshState = MESH_NICE;
59 804293f0 Leszek Koltunski
    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 f12e4de9 Leszek Koltunski
    }
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 a7d8c3cd Leszek Koltunski
    }
89
90
///////////////////////////////////////////////////////////////////////////////////////////////////
91
// PUBLIC API
92
93
  public String getName()
94
    {
95
    return mName;
96
    }
97
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99
100 804293f0 Leszek Koltunski
  public int getNumScramble()
101 a7d8c3cd Leszek Koltunski
    {
102 804293f0 Leszek Koltunski
    return mNumScramble;
103 a7d8c3cd Leszek Koltunski
    }
104
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106
107 804293f0 Leszek Koltunski
  public int getOrdinal()
108 a7d8c3cd Leszek Koltunski
    {
109 804293f0 Leszek Koltunski
    return mOrdinal;
110 a7d8c3cd Leszek Koltunski
    }
111
112
///////////////////////////////////////////////////////////////////////////////////////////////////
113
114 804293f0 Leszek Koltunski
  public int getIconID()
115 a7d8c3cd Leszek Koltunski
    {
116 804293f0 Leszek Koltunski
    return mIconID;
117 a7d8c3cd Leszek Koltunski
    }
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 804293f0 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
134
135
  public int getTutorialJsonID()
136
    {
137
    return mTutorialsID;
138
    }
139
140 a7d8c3cd Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
141
142
  public String[][] getPatterns()
143
    {
144
    return mPatterns;
145
    }
146
}