forked from CidWB/COMP3607_Jeopardy_Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutputEventLogger.java
More file actions
52 lines (35 loc) · 1.33 KB
/
OutputEventLogger.java
File metadata and controls
52 lines (35 loc) · 1.33 KB
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
public class OutputEventLogger implements GameObserver {
private GameEventLog log;
@Override
public void update(GameEventLog eventLog) {
this.log = eventLog;
displayLog();
}
public void displayLog() {
if(log == null) {
System.out.println("No event log to display.");
return;
}
System.out.println("----- Game Event Log -----");
System.out.println("Case ID: " + log.getCaseId());
System.out.println("Timestamp: " + log.getTimestamp());
System.out.println("Activity: " + log.getActivity());
if (log.getCategory() != null) {
System.out.println("Category: " + log.getCategory());
}
if (log.getQuestionValue() > 0) {
System.out.println("Value: " + log.getQuestionValue());
}
if (log.getContent() != null) {
System.out.println("Question: " + log.getContent());
}
if (log.getAnswer() != null) {
System.out.println("Answer: " + log.getAnswer());
System.out.println("Correct: " + log.isCorrect());
}
if (log.getNewScore() >= 0) {
System.out.println("Score After: " + log.getNewScore());
}
System.out.println("--------------------------");
}
}