Revision 4888e97c
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/network/RubikScoresDownloader.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.network; |
21 | 21 |
|
22 |
import org.distorted.object.RubikObjectList; |
|
23 |
|
|
22 | 24 |
import java.io.InputStream; |
23 | 25 |
import java.net.HttpURLConnection; |
24 | 26 |
import java.net.URL; |
25 | 27 |
import java.net.UnknownHostException; |
26 | 28 |
|
27 |
import static org.distorted.object.RubikObjectList.LENGTH; |
|
28 | 29 |
import static org.distorted.uistate.RubikStatePlay.MAX_SCRAMBLE; |
29 | 30 |
|
30 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
86 | 87 |
private static String mUserName, mVersion; |
87 | 88 |
private static int mNumRuns; |
88 | 89 |
|
90 |
private static int mTotal = RubikObjectList.getTotal(); |
|
89 | 91 |
private static String mScores = ""; |
90 |
private static String[][][] mCountry = new String[LENGTH][MAX_SCRAMBLE][MAX_PLACES];
|
|
91 |
private static String[][][] mName = new String[LENGTH][MAX_SCRAMBLE][MAX_PLACES];
|
|
92 |
private static String[][][] mTime = new String[LENGTH][MAX_SCRAMBLE][MAX_PLACES];
|
|
92 |
private static String[][][] mCountry = new String[mTotal][MAX_SCRAMBLE][MAX_PLACES];
|
|
93 |
private static String[][][] mName = new String[mTotal][MAX_SCRAMBLE][MAX_PLACES];
|
|
94 |
private static String[][][] mTime = new String[mTotal][MAX_SCRAMBLE][MAX_PLACES];
|
|
93 | 95 |
|
94 |
private static int[][] mPlaces = new int[LENGTH][MAX_SCRAMBLE];
|
|
96 |
private static int[][] mPlaces = new int[mTotal][MAX_SCRAMBLE];
|
|
95 | 97 |
|
96 | 98 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
97 | 99 |
|
... | ... | |
99 | 101 |
{ |
100 | 102 |
int begin=-1 ,end, len = mScores.length(); |
101 | 103 |
|
102 |
for(int i=0; i<LENGTH; i++)
|
|
104 |
for(int i=0; i<mTotal; i++)
|
|
103 | 105 |
for(int j=0; j<MAX_SCRAMBLE; j++) |
104 | 106 |
{ |
105 | 107 |
mPlaces[i][j] = 0; |
... | ... | |
127 | 129 |
|
128 | 130 |
if( s5>s4 && s4>s3 && s3>s2 && s2>s1 && s1>0 ) |
129 | 131 |
{ |
130 |
int size = Integer.valueOf( row.substring(0,s1) );
|
|
132 |
int size = Integer.parseInt( row.substring(0,s1) );
|
|
131 | 133 |
|
132 |
if( size>=0 && size<LENGTH )
|
|
134 |
if( size>=0 && size<mTotal )
|
|
133 | 135 |
{ |
134 |
int level = Integer.valueOf( row.substring(s1+1,s2) );
|
|
135 |
int place = Integer.valueOf( row.substring(s2+1,s3) );
|
|
136 |
int level = Integer.parseInt( row.substring(s1+1,s2) );
|
|
137 |
int place = Integer.parseInt( row.substring(s2+1,s3) );
|
|
136 | 138 |
String name = row.substring(s3+1, s4); |
137 |
int time = Integer.valueOf( row.substring(s4+1,s5) );
|
|
139 |
int time = Integer.parseInt( row.substring(s4+1,s5) );
|
|
138 | 140 |
String country = row.substring(s5+1, s6); |
139 | 141 |
String realTime= String.valueOf(time/10.0f); |
140 | 142 |
|
Also available in: Unified diff
Major restructuring around making it possible to include different kinds of RubikObjects in the UI.