Revision da57afae
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/main/RubikActivity.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
import org.distorted.library.main.DistortedScreen; |
42 | 42 |
import org.distorted.messaging.RubikInAppMessanging; |
43 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
43 | 44 |
import org.distorted.objectlib.main.InitAssets; |
44 | 45 |
import org.distorted.objectlib.main.ObjectControl; |
45 | 46 |
import org.distorted.objectlib.main.TwistyObject; |
... | ... | |
51 | 52 |
import org.distorted.external.RubikNetwork; |
52 | 53 |
import org.distorted.objects.RubikObject; |
53 | 54 |
import org.distorted.objects.RubikObjectList; |
55 |
import org.distorted.os.OSInterface; |
|
54 | 56 |
import org.distorted.purchase.PurchaseActivity; |
55 | 57 |
import org.distorted.screens.RubikScreenSolving; |
56 | 58 |
import org.distorted.screens.ScreenList; |
... | ... | |
613 | 615 |
InputStream jsonStream = object==null ? null : object.getObjectStream(this); |
614 | 616 |
InputStream meshStream = object==null ? null : object.getMeshStream(this); |
615 | 617 |
String name = object==null ? "NULL" : object.getUpperName(); |
616 |
InitAssets asset = new InitAssets(jsonStream,meshStream,getResources()); |
|
618 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
619 |
OSInterface os = view.getInterface(); |
|
620 |
InitAssets asset = new InitAssets(jsonStream,meshStream,os); |
|
617 | 621 |
|
618 | 622 |
control.changeIfDifferent(ordinal,name,meshState,iconMode,asset); |
619 | 623 |
} |
... | ... | |
736 | 740 |
int iconMode = TwistyObject.MODE_NORM; |
737 | 741 |
InputStream jsonStream = object.getObjectStream(this); |
738 | 742 |
InputStream meshStream = object.getMeshStream(this); |
739 |
InitAssets asset = new InitAssets(jsonStream,meshStream,getResources()); |
|
740 |
ObjectControl control = getControl(); |
|
743 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
744 |
OSInterface os = view.getInterface(); |
|
745 |
InitAssets asset = new InitAssets(jsonStream,meshStream,os); |
|
746 |
ObjectControl control = getControl(); |
|
741 | 747 |
control.changeObject(-1,meshState,iconMode,asset); |
742 | 748 |
} |
743 | 749 |
} |
... | ... | |
757 | 763 |
return mSolverIndex; |
758 | 764 |
} |
759 | 765 |
|
766 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
767 |
|
|
768 |
public OperatingSystemInterface getInterface() |
|
769 |
{ |
|
770 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
771 |
return view.getInterface(); |
|
772 |
} |
|
760 | 773 |
} |
src/main/java/org/distorted/main/RubikSurfaceView.java | ||
---|---|---|
91 | 91 |
return mRenderer; |
92 | 92 |
} |
93 | 93 |
|
94 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
95 |
|
|
96 |
OSInterface getInterface() |
|
97 |
{ |
|
98 |
return mInterface; |
|
99 |
} |
|
100 |
|
|
94 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
95 | 102 |
|
96 | 103 |
ObjectControl getObjectControl() |
src/main/java/org/distorted/screens/RubikScreenSolver.java | ||
---|---|---|
318 | 318 |
{ |
319 | 319 |
mSolving = true; |
320 | 320 |
TwistyObject object = act.getObject(); |
321 |
SolverMain solver = new SolverMain( act.getResources(), object ); |
|
321 |
SolverMain solver = new SolverMain( act.getInterface(), act.getResources(), object );
|
|
322 | 322 |
solver.start(); |
323 | 323 |
} |
324 | 324 |
} |
src/main/java/org/distorted/solvers/SolverCube2.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
140 | 141 |
|
141 | 142 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
142 | 143 |
|
143 |
public SolverCube2(Resources res, TwistyObject object) |
|
144 |
public SolverCube2(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
144 | 145 |
{ |
145 |
super(res,object); |
|
146 |
super(os,res,object);
|
|
146 | 147 |
mFaceColors = new int[6]; |
147 | 148 |
} |
148 | 149 |
|
... | ... | |
283 | 284 |
|
284 | 285 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
285 | 286 |
|
286 |
public int[][] solution(int index, Resources res)
|
|
287 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
287 | 288 |
{ |
288 | 289 |
if( mSolver==null ) |
289 | 290 |
{ |
290 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.CUBE_2);
|
|
291 |
mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.CUBE_2);
|
|
291 | 292 |
} |
292 | 293 |
|
293 | 294 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverCuboid232.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
222 | 223 |
|
223 | 224 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
224 | 225 |
|
225 |
public SolverCuboid232(Resources res, TwistyObject object) |
|
226 |
public SolverCuboid232(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
226 | 227 |
{ |
227 |
super(res,object); |
|
228 |
super(os,res,object);
|
|
228 | 229 |
mFaceColors = new int[6]; |
229 | 230 |
} |
230 | 231 |
|
... | ... | |
404 | 405 |
|
405 | 406 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
406 | 407 |
|
407 |
public int[][] solution(int index, Resources res)
|
|
408 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
408 | 409 |
{ |
409 | 410 |
if( mSolver==null ) |
410 | 411 |
{ |
411 |
mSolver = ImplementedTablebasesList.createPacked(res, ObjectSignatures.CU_232);
|
|
412 |
mSolver = ImplementedTablebasesList.createPacked(os, ObjectSignatures.CU_232);
|
|
412 | 413 |
} |
413 | 414 |
|
414 | 415 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverDino4.java | ||
---|---|---|
14 | 14 |
import android.content.res.Resources; |
15 | 15 |
|
16 | 16 |
import org.distorted.main.R; |
17 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
17 | 18 |
import org.distorted.objectlib.main.ObjectSignatures; |
18 | 19 |
import org.distorted.objectlib.main.TwistyObject; |
19 | 20 |
import org.distorted.objectlib.shape.ShapeHexahedron; |
... | ... | |
31 | 32 |
|
32 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
33 | 34 |
|
34 |
public SolverDino4(Resources res, TwistyObject object) |
|
35 |
public SolverDino4(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
35 | 36 |
{ |
36 |
super(res,object); |
|
37 |
super(os, res,object);
|
|
37 | 38 |
} |
38 | 39 |
|
39 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
172 | 173 |
|
173 | 174 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
174 | 175 |
|
175 |
public int[][] solution(int index, Resources res)
|
|
176 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
176 | 177 |
{ |
177 | 178 |
if( mSolver==null ) |
178 | 179 |
{ |
179 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.DIN4_3);
|
|
180 |
mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.DIN4_3);
|
|
180 | 181 |
} |
181 | 182 |
|
182 | 183 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverDino6.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
42 | 43 |
|
43 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
44 | 45 |
|
45 |
public SolverDino6(Resources res, TwistyObject object) |
|
46 |
public SolverDino6(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
46 | 47 |
{ |
47 |
super(res,object); |
|
48 |
super(os,res,object);
|
|
48 | 49 |
mFaceColors = new int[6]; |
49 | 50 |
} |
50 | 51 |
|
... | ... | |
437 | 438 |
|
438 | 439 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
439 | 440 |
|
440 |
public int[][] solution(int index, Resources res)
|
|
441 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
441 | 442 |
{ |
442 | 443 |
if( mSolver==null ) |
443 | 444 |
{ |
444 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.DINO_3);
|
|
445 |
mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.DINO_3);
|
|
445 | 446 |
} |
446 | 447 |
|
447 | 448 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverIvyCube.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
172 | 173 |
|
173 | 174 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
174 | 175 |
|
175 |
public SolverIvyCube(Resources res, TwistyObject object) |
|
176 |
public SolverIvyCube(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
176 | 177 |
{ |
177 |
super(res,object); |
|
178 |
super(os,res,object);
|
|
178 | 179 |
} |
179 | 180 |
|
180 | 181 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
240 | 241 |
|
241 | 242 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
242 | 243 |
|
243 |
public int[][] solution(int index, Resources res)
|
|
244 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
244 | 245 |
{ |
245 | 246 |
if( mSolver==null ) |
246 | 247 |
{ |
247 |
mSolver = ImplementedTablebasesList.createPacked(res, ObjectSignatures.IVY_2);
|
|
248 |
mSolver = ImplementedTablebasesList.createPacked(os, ObjectSignatures.IVY_2);
|
|
248 | 249 |
} |
249 | 250 |
|
250 | 251 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverJing.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
51 | 52 |
|
52 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
53 | 54 |
|
54 |
public SolverJing(Resources res, TwistyObject object) |
|
55 |
public SolverJing(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
55 | 56 |
{ |
56 |
super(res,object); |
|
57 |
super(os,res,object);
|
|
57 | 58 |
} |
58 | 59 |
|
59 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
522 | 523 |
|
523 | 524 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
524 | 525 |
|
525 |
public int[][] solution(int index, Resources res)
|
|
526 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
526 | 527 |
{ |
527 | 528 |
if( mSolver==null ) |
528 | 529 |
{ |
529 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.JING_2);
|
|
530 |
mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.JING_2);
|
|
530 | 531 |
} |
531 | 532 |
|
532 | 533 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverMain.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
14 | 15 |
import org.distorted.objectlib.main.ObjectSignatures; |
15 | 16 |
import org.distorted.objectlib.main.TwistyObject; |
16 | 17 |
|
... | ... | |
23 | 24 |
public class SolverMain implements Runnable |
24 | 25 |
{ |
25 | 26 |
private final Resources mRes; |
27 |
private final OperatingSystemInterface mOS; |
|
26 | 28 |
private final long mSignature; |
27 | 29 |
private final TwistyObject mObject; |
28 | 30 |
|
29 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 | 32 |
|
31 |
public SolverMain(Resources res, TwistyObject object) |
|
33 |
public SolverMain(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
32 | 34 |
{ |
33 | 35 |
mRes = res; |
36 |
mOS = os; |
|
34 | 37 |
mObject = object; |
35 | 38 |
long[] sig = object.getSignature().getArray(); |
36 | 39 |
mSignature = sig[sig.length-1]; |
... | ... | |
78 | 81 |
} |
79 | 82 |
else if( mSignature==ObjectSignatures.PDUO_2 ) |
80 | 83 |
{ |
81 |
SolverTablebase solver = new SolverPyraminxDuo(mRes,mObject); |
|
84 |
SolverTablebase solver = new SolverPyraminxDuo(mOS,mRes,mObject);
|
|
82 | 85 |
solver.solve(screen); |
83 | 86 |
} |
84 | 87 |
else if( mSignature==ObjectSignatures.IVY_2 ) |
85 | 88 |
{ |
86 |
SolverTablebase solver = new SolverIvyCube(mRes,mObject); |
|
89 |
SolverTablebase solver = new SolverIvyCube(mOS,mRes,mObject);
|
|
87 | 90 |
solver.solve(screen); |
88 | 91 |
} |
89 | 92 |
else if( mSignature==ObjectSignatures.CU_232 ) |
90 | 93 |
{ |
91 |
SolverTablebase solver = new SolverCuboid232(mRes,mObject); |
|
94 |
SolverTablebase solver = new SolverCuboid232(mOS,mRes,mObject);
|
|
92 | 95 |
solver.solve(screen); |
93 | 96 |
} |
94 | 97 |
else if( mSignature==ObjectSignatures.PYRA_3 ) |
95 | 98 |
{ |
96 |
SolverTablebase solver = new SolverPyraminx(mRes,mObject); |
|
99 |
SolverTablebase solver = new SolverPyraminx(mOS,mRes,mObject);
|
|
97 | 100 |
solver.solve(screen); |
98 | 101 |
} |
99 | 102 |
else if( mSignature==ObjectSignatures.DIAM_2 ) |
100 | 103 |
{ |
101 |
SolverTablebase solver = new SolverSkewbDiamond(mRes,mObject); |
|
104 |
SolverTablebase solver = new SolverSkewbDiamond(mOS,mRes,mObject);
|
|
102 | 105 |
solver.solve(screen); |
103 | 106 |
} |
104 | 107 |
else if( mSignature==ObjectSignatures.CUBE_2 ) |
105 | 108 |
{ |
106 |
SolverTablebase solver = new SolverCube2(mRes,mObject); |
|
109 |
SolverTablebase solver = new SolverCube2(mOS,mRes,mObject);
|
|
107 | 110 |
solver.solve(screen); |
108 | 111 |
} |
109 | 112 |
else if( mSignature==ObjectSignatures.JING_2 ) |
110 | 113 |
{ |
111 |
SolverTablebase solver = new SolverJing(mRes,mObject); |
|
114 |
SolverTablebase solver = new SolverJing(mOS,mRes,mObject);
|
|
112 | 115 |
solver.solve(screen); |
113 | 116 |
} |
114 | 117 |
else if( mSignature==ObjectSignatures.SKEW_2 ) |
115 | 118 |
{ |
116 |
SolverTablebase solver = new SolverSkewb(mRes,mObject); |
|
119 |
SolverTablebase solver = new SolverSkewb(mOS,mRes,mObject);
|
|
117 | 120 |
solver.solve(screen); |
118 | 121 |
} |
119 | 122 |
else if( mSignature==ObjectSignatures.DINO_3 ) |
120 | 123 |
{ |
121 |
SolverTablebase solver = new SolverDino6(mRes,mObject); |
|
124 |
SolverTablebase solver = new SolverDino6(mOS,mRes,mObject);
|
|
122 | 125 |
solver.solve(screen); |
123 | 126 |
} |
124 | 127 |
else if( mSignature==ObjectSignatures.DIN4_3 ) |
125 | 128 |
{ |
126 |
SolverTablebase solver = new SolverDino4(mRes,mObject); |
|
129 |
SolverTablebase solver = new SolverDino4(mOS,mRes,mObject);
|
|
127 | 130 |
solver.solve(screen); |
128 | 131 |
} |
129 | 132 |
else if( mSignature==ObjectSignatures.PDIA_3 ) |
130 | 133 |
{ |
131 |
SolverTablebase solver = new SolverPyraminxDiamond(mRes,mObject); |
|
134 |
SolverTablebase solver = new SolverPyraminxDiamond(mOS,mRes,mObject);
|
|
132 | 135 |
solver.solve(screen); |
133 | 136 |
} |
134 | 137 |
else |
src/main/java/org/distorted/solvers/SolverPyraminx.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
245 | 246 |
|
246 | 247 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
247 | 248 |
|
248 |
public SolverPyraminx(Resources res, TwistyObject object) |
|
249 |
public SolverPyraminx(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
249 | 250 |
{ |
250 |
super(res,object); |
|
251 |
super(os,res,object);
|
|
251 | 252 |
} |
252 | 253 |
|
253 | 254 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
535 | 536 |
|
536 | 537 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
537 | 538 |
|
538 |
public int[][] solution(int index, Resources res)
|
|
539 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
539 | 540 |
{ |
540 | 541 |
if( mSolver==null ) |
541 | 542 |
{ |
542 |
mSolver = ImplementedTablebasesList.createPacked(res, ObjectSignatures.PYRA_3);
|
|
543 |
mSolver = ImplementedTablebasesList.createPacked(os, ObjectSignatures.PYRA_3);
|
|
543 | 544 |
} |
544 | 545 |
|
545 | 546 |
return mSolver!=null ? mSolver.solution(index,mCornerTwist) : null; |
src/main/java/org/distorted/solvers/SolverPyraminxDiamond.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
46 | 47 |
|
47 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 49 |
|
49 |
public SolverPyraminxDiamond(Resources res, TwistyObject object) |
|
50 |
public SolverPyraminxDiamond(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
50 | 51 |
{ |
51 |
super(res,object); |
|
52 |
super(os,res,object);
|
|
52 | 53 |
mFaceColors = new int[8]; |
53 | 54 |
} |
54 | 55 |
|
... | ... | |
361 | 362 |
|
362 | 363 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
363 | 364 |
|
364 |
public int[][] solution(int index, Resources res)
|
|
365 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
365 | 366 |
{ |
366 | 367 |
if( mSolver==null ) |
367 | 368 |
{ |
368 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.PDIA_3);
|
|
369 |
mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.PDIA_3);
|
|
369 | 370 |
} |
370 | 371 |
|
371 | 372 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverPyraminxDuo.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
195 | 196 |
|
196 | 197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
197 | 198 |
|
198 |
public SolverPyraminxDuo(Resources res, TwistyObject object) |
|
199 |
public SolverPyraminxDuo(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
199 | 200 |
{ |
200 |
super(res,object); |
|
201 |
super(os,res,object);
|
|
201 | 202 |
} |
202 | 203 |
|
203 | 204 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
285 | 286 |
|
286 | 287 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
287 | 288 |
|
288 |
public int[][] solution(int index, Resources res)
|
|
289 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
289 | 290 |
{ |
290 | 291 |
if( mSolver==null ) |
291 | 292 |
{ |
292 |
mSolver = ImplementedTablebasesList.createPacked(res, ObjectSignatures.PDUO_2);
|
|
293 |
mSolver = ImplementedTablebasesList.createPacked(os, ObjectSignatures.PDUO_2);
|
|
293 | 294 |
} |
294 | 295 |
|
295 | 296 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverSkewb.java | ||
---|---|---|
14 | 14 |
import android.content.res.Resources; |
15 | 15 |
|
16 | 16 |
import org.distorted.main.R; |
17 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
17 | 18 |
import org.distorted.objectlib.main.ObjectSignatures; |
18 | 19 |
import org.distorted.objectlib.main.TwistyObject; |
19 | 20 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
51 | 52 |
|
52 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
53 | 54 |
|
54 |
public SolverSkewb(Resources res, TwistyObject object) |
|
55 |
public SolverSkewb(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
55 | 56 |
{ |
56 |
super(res,object); |
|
57 |
super(os,res,object);
|
|
57 | 58 |
mFaceColors = new int[6]; |
58 | 59 |
} |
59 | 60 |
|
... | ... | |
384 | 385 |
|
385 | 386 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
386 | 387 |
|
387 |
public int[][] solution(int index, Resources res)
|
|
388 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
388 | 389 |
{ |
389 | 390 |
if( mSolver==null ) |
390 | 391 |
{ |
391 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.SKEW_2);
|
|
392 |
mSolver = ImplementedTablebasesList.createPacked(os,ObjectSignatures.SKEW_2);
|
|
392 | 393 |
} |
393 | 394 |
|
394 | 395 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverSkewbDiamond.java | ||
---|---|---|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 | 14 |
import org.distorted.main.R; |
15 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
15 | 16 |
import org.distorted.objectlib.main.ObjectSignatures; |
16 | 17 |
import org.distorted.objectlib.main.TwistyObject; |
17 | 18 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
... | ... | |
50 | 51 |
|
51 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 53 |
|
53 |
public SolverSkewbDiamond(Resources res, TwistyObject object) |
|
54 |
public SolverSkewbDiamond(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
54 | 55 |
{ |
55 |
super(res,object); |
|
56 |
super(os,res,object);
|
|
56 | 57 |
mFaceColors = new int[8]; |
57 | 58 |
} |
58 | 59 |
|
... | ... | |
486 | 487 |
|
487 | 488 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
488 | 489 |
|
489 |
public int[][] solution(int index, Resources res)
|
|
490 |
public int[][] solution(int index, OperatingSystemInterface os)
|
|
490 | 491 |
{ |
491 | 492 |
if( mSolver==null ) |
492 | 493 |
{ |
493 |
mSolver = ImplementedTablebasesList.createPacked(res, ObjectSignatures.DIAM_2);
|
|
494 |
mSolver = ImplementedTablebasesList.createPacked(os, ObjectSignatures.DIAM_2);
|
|
494 | 495 |
} |
495 | 496 |
|
496 | 497 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
src/main/java/org/distorted/solvers/SolverTablebase.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import android.content.res.Resources; |
13 | 13 |
|
14 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
14 | 15 |
import org.distorted.objectlib.main.TwistyObject; |
15 | 16 |
import org.distorted.screens.RubikScreenSolver; |
16 | 17 |
|
... | ... | |
18 | 19 |
|
19 | 20 |
public abstract class SolverTablebase |
20 | 21 |
{ |
22 |
private final OperatingSystemInterface mOS; |
|
21 | 23 |
private final Resources mRes; |
22 | 24 |
private final TwistyObject mObject; |
23 | 25 |
|
... | ... | |
25 | 27 |
|
26 | 28 |
public abstract int tablebaseIndex(TwistyObject object); |
27 | 29 |
public abstract String error(int index, Resources res); |
28 |
public abstract int[][] solution(int index, Resources res);
|
|
30 |
public abstract int[][] solution(int index, OperatingSystemInterface os);
|
|
29 | 31 |
|
30 | 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
31 | 33 |
// PUBLIC API |
32 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
33 | 35 |
|
34 |
public SolverTablebase(Resources res, TwistyObject object) |
|
36 |
public SolverTablebase(OperatingSystemInterface os, Resources res, TwistyObject object)
|
|
35 | 37 |
{ |
38 |
mOS = os; |
|
36 | 39 |
mRes = res; |
37 | 40 |
mObject= object; |
38 | 41 |
} |
... | ... | |
45 | 48 |
|
46 | 49 |
if( index>=0 ) |
47 | 50 |
{ |
48 |
int[][] moves = solution(index,mRes);
|
|
51 |
int[][] moves = solution(index,mOS);
|
|
49 | 52 |
screen.setSolved(moves); |
50 | 53 |
} |
51 | 54 |
else |
src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
---|---|---|
33 | 33 |
import org.distorted.dialogs.RubikDialogError; |
34 | 34 |
import org.distorted.objects.RubikObject; |
35 | 35 |
import org.distorted.objects.RubikObjectList; |
36 |
import org.distorted.os.OSInterface; |
|
36 | 37 |
import org.distorted.purchase.PurchaseActivity; |
37 | 38 |
|
38 | 39 |
import static org.distorted.objectlib.main.TwistyObject.MESH_NICE; |
... | ... | |
226 | 227 |
InputStream jsonStream = object==null ? null : object.getObjectStream(this); |
227 | 228 |
InputStream meshStream = object==null ? null : object.getMeshStream(this); |
228 | 229 |
String name = object==null ? "NULL" : object.getUpperName(); |
229 |
InitAssets asset = new InitAssets(jsonStream,meshStream,getResources()); |
|
230 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
|
231 |
OSInterface os = view.getInterface(); |
|
232 |
InitAssets asset = new InitAssets(jsonStream,meshStream,os); |
|
230 | 233 |
control.changeIfDifferent(ordinal,name,meshState,iconMode,asset); |
231 | 234 |
} |
232 | 235 |
|
src/main/java/org/distorted/tutorials/TutorialSurfaceView.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import com.google.firebase.crashlytics.FirebaseCrashlytics; |
20 | 20 |
|
21 |
import org.distorted.objectlib.helpers.OperatingSystemInterface; |
|
21 | 22 |
import org.distorted.objectlib.main.ObjectControl; |
22 | 23 |
import org.distorted.objectlib.main.TwistyObjectNode; |
23 | 24 |
import org.distorted.os.OSInterface; |
... | ... | |
72 | 73 |
return mObjectController; |
73 | 74 |
} |
74 | 75 |
|
76 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
77 |
|
|
78 |
OSInterface getInterface() |
|
79 |
{ |
|
80 |
return mInterface; |
|
81 |
} |
|
82 |
|
|
75 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
76 | 84 |
// PUBLIC API |
77 | 85 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Move opening local files to the OSInterface