This repository has been archived by the owner on Mar 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHandler.java
92 lines (88 loc) · 2.51 KB
/
Handler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
public class Handler{
private game Game;
private Level level;
private String username;
private int medals;
public Handler(game Game){
this.Game = Game;
}
public Database getDatabase(){
return Game.getDatabase();
}
public void updateHighscore(int count, long invyScore){
long total = count;
total *= getLevel().getTimer().getTimeLeft();
total += getLevel().getTimer().getTimeLeft() * 10;
total += invyScore;
System.out.println("total : "+ total);
//getDatabase().update(total,username);
if(getDatabase().getCurrentScore(getLevel().getLevelIndex()) < total){
updateHighscore(total);
}
}
public void updateHighscore(){
int count = getLevel().getEntityManager().getPlayer().getInventory().getCount(4);
medals = getLevel().getEntityManager().getPlayer().getInventory().getMedals();
long invyScore = getLevel().getEntityManager().getPlayer().getInventory().getScore();
long total = count;
total *= getLevel().getTimer().getTimeLeft();
total += getLevel().getTimer().getTimeLeft() * 10;
total += invyScore;
System.out.println("total : "+ total);
//getDatabase().update(total,username);
if(getDatabase().getCurrentScore(getLevel().getLevelIndex()) < total){
updateHighscore(total);
}
}
private void updateHighscore(long score){
getDatabase().updateHighscore(score,getLevel().getTimer().getTimeEllapsed(), getLevel().getLevelIndex(),medals,username);
}
public game getGame(){
return Game;
}
public GameCamera getCamera(){
return Game.getCamera();
}
public keyManager getKeyManager(){
return Game.getKeyManager();
}
public MouseManager getMouseManager(){
return Game.getMouseManager();
}
public Level getLevel(){
return level;
}
public void setGame(game Game){
this.Game = Game;
}
public void setLevel(Level level){
this.level = level;
}
public int getWidth(){
return Game.width;
}
public int getHeight(){
return Game.height;
}
public Notification getNotification(){
return Game.getNotification();
}
public void setNotification(String message){
Game.setNotification(message);
}
public void setNotification(String message, int time){
Game.setNotification(message, time);
}
public long getScore(){
return level.getTimer().getScore();
}
public void setUsername(String username){
this.username = username;
}
public String getUsername(){
return username;
}
public void setMedals(int medals){
this.medals = medals;
}
}