@@ -5,18 +5,27 @@ import (
55 "time"
66)
77
8+ // UiProtocolType represents the type of a protocol entry
89type UiProtocolType string
910
1011const (
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
1623 UiProtocolGameEventIgnored UiProtocolType = "ignoredGameEvent"
17- UiProtocolModify UiProtocolType = "modify"
24+ // UiProtocolModify represents a manual modification on the state
25+ UiProtocolModify UiProtocolType = "modify"
1826)
1927
28+ // UiProtocolEntry represents a single protocol entry as should be displayed in the UI table
2029type UiProtocolEntry struct {
2130 Timestamp int64 `json:"timestamp"`
2231 StageTime time.Duration `json:"stageTime"`
@@ -26,6 +35,7 @@ type UiProtocolEntry struct {
2635 Description string `json:"description"`
2736}
2837
38+ // LogGameEvent adds a game event to the protocol
2939func (e * Engine ) LogGameEvent (event GameEvent ) {
3040 entry := UiProtocolEntry {
3141 Timestamp : e .TimeProvider ().UnixNano (),
@@ -38,6 +48,7 @@ func (e *Engine) LogGameEvent(event GameEvent) {
3848 e .UiProtocol = append (e .UiProtocol , entry )
3949}
4050
51+ // LogIgnoredGameEvent adds an ignored game event to the protocol
4152func (e * Engine ) LogIgnoredGameEvent (event GameEvent ) {
4253 entry := UiProtocolEntry {
4354 Timestamp : e .TimeProvider ().UnixNano (),
@@ -50,6 +61,7 @@ func (e *Engine) LogIgnoredGameEvent(event GameEvent) {
5061 e .UiProtocol = append (e .UiProtocol , entry )
5162}
5263
64+ // LogCommand adds a command to the protocol
5365func (e * Engine ) LogCommand () {
5466 entry := UiProtocolEntry {
5567 Timestamp : e .TimeProvider ().UnixNano (),
@@ -61,6 +73,7 @@ func (e *Engine) LogCommand() {
6173 e .UiProtocol = append (e .UiProtocol , entry )
6274}
6375
76+ // LogCard adds a card to the protocol
6477func (e * Engine ) LogCard (card * EventCard ) {
6578 entry := UiProtocolEntry {
6679 Timestamp : e .TimeProvider ().UnixNano (),
@@ -72,6 +85,7 @@ func (e *Engine) LogCard(card *EventCard) {
7285 e .UiProtocol = append (e .UiProtocol , entry )
7386}
7487
88+ // LogTime adds a time event (like stage time ends or card time ends) to the protocol
7589func (e * Engine ) LogTime (description string , forTeam Team ) {
7690 entry := UiProtocolEntry {
7791 Timestamp : e .TimeProvider ().UnixNano (),
@@ -83,6 +97,7 @@ func (e *Engine) LogTime(description string, forTeam Team) {
8397 e .UiProtocol = append (e .UiProtocol , entry )
8498}
8599
100+ // LogStage adds a stage change to the protocol
86101func (e * Engine ) LogStage (stage Stage ) {
87102 entry := UiProtocolEntry {
88103 Timestamp : e .TimeProvider ().UnixNano (),
@@ -93,6 +108,7 @@ func (e *Engine) LogStage(stage Stage) {
93108 e .UiProtocol = append (e .UiProtocol , entry )
94109}
95110
111+ // LogModify adds a modification to the protocol
96112func (e * Engine ) LogModify (m EventModifyValue ) {
97113 entry := UiProtocolEntry {
98114 Timestamp : e .TimeProvider ().UnixNano (),
0 commit comments