@@ -5,18 +5,27 @@ import (
5
5
"time"
6
6
)
7
7
8
+ // UiProtocolType represents the type of a protocol entry
8
9
type UiProtocolType string
9
10
10
11
const (
11
- UiProtocolCommand UiProtocolType = "command"
12
- UiProtocolStage UiProtocolType = "stage"
13
- UiProtocolCard UiProtocolType = "card"
14
- UiProtocolTime UiProtocolType = "time"
15
- UiProtocolGameEvent UiProtocolType = "gameEvent"
12
+ // UiProtocolCommand represents an issued referee command
13
+ UiProtocolCommand UiProtocolType = "command"
14
+ // UiProtocolStage represents a changed stage
15
+ UiProtocolStage UiProtocolType = "stage"
16
+ // UiProtocolCard represents an issued card
17
+ UiProtocolCard UiProtocolType = "card"
18
+ // UiProtocolTime represents an elapsed time, like stage time or card time
19
+ UiProtocolTime UiProtocolType = "time"
20
+ // UiProtocolGameEvent represents an issued game event
21
+ UiProtocolGameEvent UiProtocolType = "gameEvent"
22
+ // UiProtocolGameEventIgnored represents a detected game event that was not issued
16
23
UiProtocolGameEventIgnored UiProtocolType = "ignoredGameEvent"
17
- UiProtocolModify UiProtocolType = "modify"
24
+ // UiProtocolModify represents a manual modification on the state
25
+ UiProtocolModify UiProtocolType = "modify"
18
26
)
19
27
28
+ // UiProtocolEntry represents a single protocol entry as should be displayed in the UI table
20
29
type UiProtocolEntry struct {
21
30
Timestamp int64 `json:"timestamp"`
22
31
StageTime time.Duration `json:"stageTime"`
@@ -26,6 +35,7 @@ type UiProtocolEntry struct {
26
35
Description string `json:"description"`
27
36
}
28
37
38
+ // LogGameEvent adds a game event to the protocol
29
39
func (e * Engine ) LogGameEvent (event GameEvent ) {
30
40
entry := UiProtocolEntry {
31
41
Timestamp : e .TimeProvider ().UnixNano (),
@@ -38,6 +48,7 @@ func (e *Engine) LogGameEvent(event GameEvent) {
38
48
e .UiProtocol = append (e .UiProtocol , entry )
39
49
}
40
50
51
+ // LogIgnoredGameEvent adds an ignored game event to the protocol
41
52
func (e * Engine ) LogIgnoredGameEvent (event GameEvent ) {
42
53
entry := UiProtocolEntry {
43
54
Timestamp : e .TimeProvider ().UnixNano (),
@@ -50,6 +61,7 @@ func (e *Engine) LogIgnoredGameEvent(event GameEvent) {
50
61
e .UiProtocol = append (e .UiProtocol , entry )
51
62
}
52
63
64
+ // LogCommand adds a command to the protocol
53
65
func (e * Engine ) LogCommand () {
54
66
entry := UiProtocolEntry {
55
67
Timestamp : e .TimeProvider ().UnixNano (),
@@ -61,6 +73,7 @@ func (e *Engine) LogCommand() {
61
73
e .UiProtocol = append (e .UiProtocol , entry )
62
74
}
63
75
76
+ // LogCard adds a card to the protocol
64
77
func (e * Engine ) LogCard (card * EventCard ) {
65
78
entry := UiProtocolEntry {
66
79
Timestamp : e .TimeProvider ().UnixNano (),
@@ -72,6 +85,7 @@ func (e *Engine) LogCard(card *EventCard) {
72
85
e .UiProtocol = append (e .UiProtocol , entry )
73
86
}
74
87
88
+ // LogTime adds a time event (like stage time ends or card time ends) to the protocol
75
89
func (e * Engine ) LogTime (description string , forTeam Team ) {
76
90
entry := UiProtocolEntry {
77
91
Timestamp : e .TimeProvider ().UnixNano (),
@@ -83,6 +97,7 @@ func (e *Engine) LogTime(description string, forTeam Team) {
83
97
e .UiProtocol = append (e .UiProtocol , entry )
84
98
}
85
99
100
+ // LogStage adds a stage change to the protocol
86
101
func (e * Engine ) LogStage (stage Stage ) {
87
102
entry := UiProtocolEntry {
88
103
Timestamp : e .TimeProvider ().UnixNano (),
@@ -93,6 +108,7 @@ func (e *Engine) LogStage(stage Stage) {
93
108
e .UiProtocol = append (e .UiProtocol , entry )
94
109
}
95
110
111
+ // LogModify adds a modification to the protocol
96
112
func (e * Engine ) LogModify (m EventModifyValue ) {
97
113
entry := UiProtocolEntry {
98
114
Timestamp : e .TimeProvider ().UnixNano (),
0 commit comments