Skip to content

Commit ef25cff

Browse files
committed
[feature] Add double touch event to autoRef test client
1 parent 639867d commit ef25cff

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

cmd/ssl-auto-ref-client/main.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,14 @@ func main() {
7777
c.sendBallLeftField()
7878
} else if strings.Compare("botCrashUnique", text) == 0 {
7979
c.sendBotCrashUnique()
80+
} else if strings.Compare("doubleTouch", text) == 0 {
81+
c.sendDoubleTouch()
8082
} else {
8183
fmt.Println("Available commands: ")
8284
fmt.Printf(" %-20s: %s\n", "help", "Show this help text")
8385
fmt.Printf(" %-20s: %s\n", "ballLeftField", "Send game event")
8486
fmt.Printf(" %-20s: %s\n", "botCrashUnique", "Send game event")
87+
fmt.Printf(" %-20s: %s\n", "doubleTouch", "Send game event")
8588
}
8689
}
8790
}
@@ -141,6 +144,22 @@ func (c *Client) sendBallLeftField() {
141144
c.sendRequest(&request, true)
142145
}
143146

147+
func (c *Client) sendDoubleTouch() {
148+
event := refproto.GameEvent_AttackerDoubleTouchedBall_{}
149+
event.AttackerDoubleTouchedBall = new(refproto.GameEvent_AttackerDoubleTouchedBall)
150+
event.AttackerDoubleTouchedBall.ByBot = new(uint32)
151+
*event.AttackerDoubleTouchedBall.ByBot = 2
152+
event.AttackerDoubleTouchedBall.ByTeam = new(refproto.Team)
153+
*event.AttackerDoubleTouchedBall.ByTeam = refproto.Team_BLUE
154+
event.AttackerDoubleTouchedBall.Location = &refproto.Location{X: new(float32), Y: new(float32)}
155+
*event.AttackerDoubleTouchedBall.Location.X = 1
156+
*event.AttackerDoubleTouchedBall.Location.Y = 4.5
157+
gameEvent := refproto.GameEvent{Event: &event, Type: new(refproto.GameEventType)}
158+
*gameEvent.Type = refproto.GameEventType_ATTACKER_DOUBLE_TOUCHED_BALL
159+
request := refproto.AutoRefToController{GameEvent: &gameEvent}
160+
c.sendRequest(&request, true)
161+
}
162+
144163
func (c *Client) sendBotCrashUnique() {
145164
event := refproto.GameEvent_BotCrashUnique_{}
146165
event.BotCrashUnique = new(refproto.GameEvent_BotCrashUnique)
@@ -154,7 +173,7 @@ func (c *Client) sendBotCrashUnique() {
154173
*event.BotCrashUnique.Location.X = 1
155174
*event.BotCrashUnique.Location.Y = 4.5
156175
gameEvent := refproto.GameEvent{Event: &event, Type: new(refproto.GameEventType)}
157-
*gameEvent.Type = refproto.GameEventType_BALL_LEFT_FIELD_TOUCH_LINE
176+
*gameEvent.Type = refproto.GameEventType_BOT_CRASH_UNIQUE
158177
request := refproto.AutoRefToController{GameEvent: &gameEvent}
159178
c.sendRequest(&request, true)
160179
}
@@ -194,6 +213,6 @@ func (c *Client) sendRequest(request *refproto.AutoRefToController, doLog bool)
194213

195214
func logIf(doLog bool, v ...interface{}) {
196215
if doLog {
197-
log.Print(v)
216+
log.Print(v...)
198217
}
199218
}

0 commit comments

Comments
 (0)