1
1
package com .snatik .matches .engine ;
2
2
3
- import java .util .ArrayList ;
4
- import java .util .Collections ;
5
- import java .util .HashMap ;
6
- import java .util .List ;
7
-
8
3
import android .graphics .Bitmap ;
9
4
import android .graphics .drawable .BitmapDrawable ;
10
5
import android .graphics .drawable .Drawable ;
16
11
import com .snatik .matches .R ;
17
12
import com .snatik .matches .common .Memory ;
18
13
import com .snatik .matches .common .Music ;
14
+ import com .snatik .matches .common .SQLiteDB ;
19
15
import com .snatik .matches .common .Shared ;
20
16
import com .snatik .matches .engine .ScreenController .Screen ;
21
17
import com .snatik .matches .events .EventObserverAdapter ;
39
35
import com .snatik .matches .utils .Clock ;
40
36
import com .snatik .matches .utils .Utils ;
41
37
38
+ import java .util .ArrayList ;
39
+ import java .util .Collections ;
40
+ import java .util .HashMap ;
41
+ import java .util .List ;
42
+
42
43
public class Engine extends EventObserverAdapter {
43
44
44
45
private static Engine mInstance = null ;
@@ -242,6 +243,7 @@ public void run() {
242
243
mPlayingGame .gameState = gameState ;
243
244
// remained seconds
244
245
gameState .remainedSeconds = totalTime - passedSeconds ;
246
+ gameState .passedSeconds = passedSeconds ;
245
247
246
248
// calc stars
247
249
if (passedSeconds <= totalTime / 2 ) {
@@ -256,9 +258,15 @@ public void run() {
256
258
257
259
// calc score
258
260
gameState .achievedScore = mPlayingGame .boardConfiguration .difficulty * gameState .remainedSeconds * mPlayingGame .theme .id ;
261
+ System .out .println (passedSeconds );
259
262
260
263
// save to memory
261
264
Memory .save (mPlayingGame .theme .id , mPlayingGame .boardConfiguration .difficulty , gameState .achievedStars );
265
+ SQLiteDB db = new SQLiteDB (Shared .context ,null ,null ,1 );
266
+ db .saveToTable (mPlayingGame .theme .id ,mPlayingGame .boardConfiguration
267
+ .difficulty ,mPlayingGame .gameState .passedSeconds );
268
+
269
+
262
270
263
271
Shared .eventBus .notify (new GameWonEvent (gameState ), 1200 );
264
272
}
0 commit comments