Revision c3ffcf58
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/scores/RubikScores.java | ||
---|---|---|
27 | 27 |
import static org.distorted.uistate.RubikStatePlay.MAX_SCRAMBLE; |
28 | 28 |
|
29 | 29 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 |
// hold my own scores |
|
30 |
// hold my own scores, some other statistics.
|
|
31 | 31 |
|
32 | 32 |
public class RubikScores |
33 | 33 |
{ |
... | ... | |
35 | 35 |
private static RubikScores mThis; |
36 | 36 |
|
37 | 37 |
private long[][][] mRecords; |
38 |
private String mName; |
|
39 |
private boolean mNameIsVerified; |
|
40 |
private int mNumRuns; |
|
41 |
private int mNumPlays; |
|
38 | 42 |
|
39 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 44 |
|
... | ... | |
48 | 52 |
{ |
49 | 53 |
mRecords[i][j][k] = NO_RECORD; |
50 | 54 |
} |
55 |
|
|
56 |
mName = ""; |
|
57 |
mNameIsVerified = false; |
|
58 |
mNumPlays= -1; |
|
59 |
mNumRuns = -1; |
|
51 | 60 |
} |
52 | 61 |
|
53 | 62 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
92 | 101 |
} |
93 | 102 |
} |
94 | 103 |
|
95 |
editor.putString("record"+scramble, builder.toString()); |
|
104 |
editor.putString("scores_record"+scramble, builder.toString());
|
|
96 | 105 |
} |
106 |
|
|
107 |
editor.putString("scores_name" , mName ); |
|
108 |
editor.putBoolean("scores_isVerified", mNameIsVerified); |
|
109 |
editor.putInt("scores_numPlays", mNumPlays); |
|
110 |
editor.putInt("scores_numRuns" , mNumRuns); |
|
97 | 111 |
} |
98 | 112 |
|
99 | 113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
107 | 121 |
for(int scramble=0; scramble<MAX_SCRAMBLE; scramble++) |
108 | 122 |
{ |
109 | 123 |
start = end = 0; |
110 |
recordStr = preferences.getString("record"+scramble, ""); |
|
111 |
|
|
112 |
//android.util.Log.e("solving", scramble+" record string: "+recordStr); |
|
124 |
recordStr = preferences.getString("scores_record"+scramble, ""); |
|
113 | 125 |
|
114 | 126 |
while( end!=-1 ) |
115 | 127 |
{ |
... | ... | |
149 | 161 |
} |
150 | 162 |
} |
151 | 163 |
} |
164 |
|
|
165 |
mName = preferences.getString("scores_name" , ""); |
|
166 |
mNameIsVerified = preferences.getBoolean("scores_isVerified", false); |
|
167 |
mNumPlays = preferences.getInt("scores_numPlays", 0); |
|
168 |
mNumRuns = preferences.getInt("scores_numRuns" , 0); |
|
152 | 169 |
} |
153 | 170 |
|
154 | 171 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
155 | 172 |
|
156 |
public void newRecord(int object, int size, int scramble, long timeTaken)
|
|
173 |
public void setRecord(int object, int size, int scramble, long timeTaken)
|
|
157 | 174 |
{ |
158 | 175 |
int maxsize = RubikObjectList.getObject(object).getSizes().length; |
159 | 176 |
|
... | ... | |
167 | 184 |
} |
168 | 185 |
} |
169 | 186 |
|
187 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
188 |
|
|
189 |
public void incrementNumPlays() |
|
190 |
{ |
|
191 |
mNumPlays++; |
|
192 |
} |
|
193 |
|
|
194 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
195 |
|
|
196 |
public void incrementNumRuns() |
|
197 |
{ |
|
198 |
mNumRuns++; |
|
199 |
} |
|
200 |
|
|
201 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
202 |
|
|
203 |
public void setName(String newName) |
|
204 |
{ |
|
205 |
mName = newName; |
|
206 |
} |
|
207 |
|
|
208 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
209 |
|
|
210 |
public void verifyName() |
|
211 |
{ |
|
212 |
mNameIsVerified = true; |
|
213 |
} |
|
214 |
|
|
170 | 215 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
171 | 216 |
|
172 | 217 |
public long getRecord(int object, int size, int scramble) |
... | ... | |
180 | 225 |
|
181 | 226 |
return -1; |
182 | 227 |
} |
228 |
|
|
229 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
230 |
|
|
231 |
public int getNumPlays() |
|
232 |
{ |
|
233 |
return mNumPlays; |
|
234 |
} |
|
235 |
|
|
236 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
237 |
|
|
238 |
public int getNumRuns() |
|
239 |
{ |
|
240 |
return mNumRuns; |
|
241 |
} |
|
242 |
|
|
243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
244 |
|
|
245 |
public String getName() |
|
246 |
{ |
|
247 |
return mName; |
|
248 |
} |
|
249 |
|
|
250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
251 |
|
|
252 |
public boolean isVerified() |
|
253 |
{ |
|
254 |
return mNameIsVerified; |
|
255 |
} |
|
183 | 256 |
} |
Also available in: Unified diff
Progress with saving number of runs, plays, name, verified status.