Revision 1f6d1786
Added by Leszek Koltunski almost 2 years ago
distorted-sokoban/src/main/java/org/distorted/sokoban/SokobanLevel.java | ||
---|---|---|
70 | 70 |
move = (byte)m; |
71 | 71 |
} |
72 | 72 |
} |
73 |
private static Vector<Move> moves = new Vector<Move>();
|
|
73 |
private static Vector<Move> moves = new Vector<>(); |
|
74 | 74 |
|
75 | 75 |
private SokobanRecordInfo[] recordList; |
76 | 76 |
private SokobanRecordInfo recordMine; |
... | ... | |
109 | 109 |
|
110 | 110 |
author = a; |
111 | 111 |
country= c; |
112 |
|
|
113 |
recordMine = new SokobanRecordInfo(mm,mt,SokobanDatabase.getName(),SokobanDatabase.getCountry()); |
|
112 |
|
|
113 |
SokobanDatabase db = SokobanDatabase.getInstance(); |
|
114 |
|
|
115 |
if( db!=null ) |
|
116 |
{ |
|
117 |
recordMine = new SokobanRecordInfo(mm,mt,db.getName(),db.getCountry()); |
|
118 |
} |
|
119 |
else |
|
120 |
{ |
|
121 |
recordMine = new SokobanRecordInfo(mm,mt,"",""); |
|
122 |
} |
|
114 | 123 |
|
115 | 124 |
cutAuthor(); |
116 | 125 |
|
117 | 126 |
cImg = (author==null ? null:SokobanLevels.getInstance().getFlag(c)); |
118 |
|
|
127 |
|
|
119 | 128 |
recordList = new SokobanRecordInfo[mMaxRecords]; |
120 | 129 |
for(int i=0; i<mMaxRecords; i++) recordList[i]=null; |
121 | 130 |
|
... | ... | |
145 | 154 |
|
146 | 155 |
validateScratch = new byte[mRows][mCols]; |
147 | 156 |
cells = new byte[mRows][mCols]; |
148 |
|
|
157 |
|
|
149 | 158 |
recordList = new SokobanRecordInfo[mMaxRecords]; |
150 | 159 |
for(int i=0; i<mMaxRecords; i++) recordList[i]=null; |
151 | 160 |
|
... | ... | |
175 | 184 |
private void cutAuthor() |
176 | 185 |
{ |
177 | 186 |
if( author!=null ) |
178 |
{
|
|
179 |
mPaint.setTextSize(SokobanRecordInfo.getFontSize());
|
|
180 |
|
|
187 |
{ |
|
188 |
mPaint.setTextSize(SokobanRecordInfo.getFontSize()); |
|
189 |
|
|
181 | 190 |
float len2 = mPaint.measureText(strAuthor); |
182 | 191 |
float len1 = mPaint.measureText(author); |
183 | 192 |
int len0 = SokobanLevels.levelInfoW-10-28; |
184 |
|
|
193 |
|
|
185 | 194 |
if( len1+len2>len0 ) |
186 | 195 |
{ |
187 | 196 |
int l = author.length(); |
... | ... | |
193 | 202 |
len1 = mPaint.measureText(author); |
194 | 203 |
} |
195 | 204 |
} |
196 |
}
|
|
205 |
} |
|
197 | 206 |
} |
198 | 207 |
|
199 | 208 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
463 | 472 |
{ |
464 | 473 |
recordId = id; |
465 | 474 |
} |
466 |
|
|
475 |
|
|
467 | 476 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
468 |
|
|
477 |
|
|
469 | 478 |
public int getRecordId() |
470 | 479 |
{ |
471 | 480 |
return recordId; |
472 | 481 |
} |
473 |
|
|
482 |
|
|
474 | 483 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
475 | 484 |
|
476 | 485 |
public void setDirty() |
477 | 486 |
{ |
478 | 487 |
mDirty = true; |
479 | 488 |
} |
480 |
|
|
489 |
|
|
481 | 490 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
482 |
|
|
491 |
|
|
483 | 492 |
public boolean isDirty() |
484 | 493 |
{ |
485 | 494 |
return mDirty; |
486 | 495 |
} |
487 |
|
|
496 |
|
|
488 | 497 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
489 |
|
|
498 |
|
|
490 | 499 |
public void resetPrivate() |
491 |
{ |
|
492 |
recordMine.set(SokobanDatabase.INVALID, SokobanDatabase.INVALID, SokobanDatabase.getName(),SokobanDatabase.getCountry()); |
|
493 |
} |
|
500 |
{ |
|
501 |
SokobanDatabase db = SokobanDatabase.getInstance(); |
|
502 |
recordMine.set(SokobanDatabase.INVALID, SokobanDatabase.INVALID, db.getName(), db.getCountry()); |
|
503 |
} |
|
494 | 504 |
|
495 | 505 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
496 | 506 |
|
Also available in: Unified diff
Lots of progress with the main screen