Revision 714292f1
Added by Leszek Koltunski over 5 years ago
| src/main/java/org/distorted/dialog/RubikDialogScoresPagerAdapter.java | ||
|---|---|---|
| 27 | 27 |
import android.view.ViewGroup; |
| 28 | 28 |
import android.widget.LinearLayout; |
| 29 | 29 |
|
| 30 |
import org.distorted.magic.R; |
|
| 30 | 31 |
import org.distorted.scores.RubikScoresDownloader; |
| 31 | 32 |
import org.distorted.object.RubikObjectList; |
| 32 | 33 |
|
| ... | ... | |
| 165 | 166 |
if( allCreated ) |
| 166 | 167 |
{
|
| 167 | 168 |
RubikScoresDownloader downloader = new RubikScoresDownloader(); |
| 168 |
downloader.download(this, "distorted", "1.0.0", 1); // TODO |
|
| 169 |
downloader.download( this, |
|
| 170 |
"distorted", // TODO |
|
| 171 |
mAct.getString(R.string.app_version), |
|
| 172 |
1 ); // TODO |
|
| 169 | 173 |
} |
| 170 | 174 |
|
| 171 | 175 |
return mViews[position]; |
| src/main/java/org/distorted/magic/RubikRenderer.java | ||
|---|---|---|
| 264 | 264 |
if( RubikState.getCurrentState()==RubikState.SOLV ) |
| 265 | 265 |
{
|
| 266 | 266 |
RubikStateSolving solving = (RubikStateSolving)RubikState.SOLV.getStateClass(); |
| 267 |
long time = solving.stopCounting(); |
|
| 268 |
android.util.Log.e("renderer", "solving time: "+time+" milliseconds");
|
|
| 267 |
solving.stopCounting(); |
|
| 269 | 268 |
} |
| 270 | 269 |
|
| 271 | 270 |
mCanDrag = true; |
| src/main/java/org/distorted/scores/RubikScores.java | ||
|---|---|---|
| 32 | 32 |
public class RubikScores |
| 33 | 33 |
{
|
| 34 | 34 |
private static final long NO_RECORD = Integer.MAX_VALUE; |
| 35 |
private static RubikScores mThis; |
|
| 36 |
|
|
| 35 | 37 |
private long[][][] mRecords; |
| 36 | 38 |
|
| 37 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 38 | 40 |
|
| 39 |
public RubikScores()
|
|
| 41 |
private RubikScores()
|
|
| 40 | 42 |
{
|
| 41 | 43 |
mRecords = new long[NUM_OBJECTS][MAX_SIZE][MAX_SCRAMBLE]; |
| 42 | 44 |
|
| ... | ... | |
| 48 | 50 |
} |
| 49 | 51 |
} |
| 50 | 52 |
|
| 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 54 |
|
|
| 55 |
public static RubikScores getInstance() |
|
| 56 |
{
|
|
| 57 |
if( mThis==null ) |
|
| 58 |
{
|
|
| 59 |
mThis = new RubikScores(); |
|
| 60 |
} |
|
| 61 |
|
|
| 62 |
return mThis; |
|
| 63 |
} |
|
| 64 |
|
|
| 51 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 52 | 66 |
|
| 53 | 67 |
public void savePreferences(SharedPreferences.Editor editor) |
| ... | ... | |
| 148 | 162 |
if( mRecords[object][size][scramble-1]> timeTaken ) |
| 149 | 163 |
{
|
| 150 | 164 |
mRecords[object][size][scramble-1] = timeTaken; |
| 151 |
android.util.Log.e("solv","new record!");
|
|
| 165 |
android.util.Log.e("RubikScores","new record: ("+object+","+size+","+scramble+") ="+timeTaken);
|
|
| 152 | 166 |
} |
| 153 | 167 |
} |
| 154 | 168 |
} |
| 169 |
|
|
| 170 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 171 |
|
|
| 172 |
public long getRecord(int object, int size, int scramble) |
|
| 173 |
{
|
|
| 174 |
int maxsize = RubikObjectList.getObject(object).getSizes().length; |
|
| 175 |
|
|
| 176 |
if( object>=0 && object<NUM_OBJECTS && size>=0 && size<maxsize && scramble>=1 && scramble<=MAX_SCRAMBLE ) |
|
| 177 |
{
|
|
| 178 |
return mRecords[object][size][scramble]; |
|
| 179 |
} |
|
| 180 |
|
|
| 181 |
return -1; |
|
| 182 |
} |
|
| 155 | 183 |
} |
| src/main/java/org/distorted/uistate/RubikStateSolving.java | ||
|---|---|---|
| 47 | 47 |
|
| 48 | 48 |
RubikStateSolving() |
| 49 | 49 |
{
|
| 50 |
mScores = new RubikScores();
|
|
| 50 |
mScores = RubikScores.getInstance();
|
|
| 51 | 51 |
} |
| 52 | 52 |
|
| 53 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Minor.