diff options
author | Santo Cariotti <santo@dcariotti.me> | 2025-04-27 11:15:11 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2025-04-27 12:24:40 +0200 |
commit | 85a6b4c2915fbfb42978fd7d2e3f7bd67e650314 (patch) | |
tree | eb705d5b97bb515d806049176df149890355e6e9 /pkg/ui/views/play_api.go | |
parent | 6a60cc1c133ccf42dae8498fc40cc3276fc91561 (diff) |
Co-op mode with next player randomly
Diffstat (limited to 'pkg/ui/views/play_api.go')
-rw-r--r-- | pkg/ui/views/play_api.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/pkg/ui/views/play_api.go b/pkg/ui/views/play_api.go index 3846abe..ff38843 100644 --- a/pkg/ui/views/play_api.go +++ b/pkg/ui/views/play_api.go @@ -18,11 +18,12 @@ import ( ) type responseOk struct { - Name string `json:"name"` - Type string `json:"type"` - GameID int `json:"id"` - IP string `json:"ip"` - Port int `json:"int"` + Name string `json:"name"` + Type string `json:"type"` + MoveChoose string `json:"move_choose_type"` + GameID int `json:"id"` + IP string `json:"ip"` + Port int `json:"int"` } // API response types @@ -159,7 +160,7 @@ func (m *PlayModel) handleGamesResponse(msg []database.Game) (tea.Model, tea.Cmd return m, nil } -func (m *PlayModel) newGameCallback(gameType database.GameType) tea.Cmd { +func (m *PlayModel) newGameCallback(gameType database.GameType, moveChooseType database.MoveChooseType) tea.Cmd { return func() tea.Msg { // Get authorization token authorization, err := getAuthorizationToken() @@ -177,8 +178,9 @@ func (m *PlayModel) newGameCallback(gameType database.GameType) tea.Cmd { // Prepare request payload payload, err := json.Marshal(map[string]string{ - "ip": fmt.Sprintf("%s:%d", ip, port), - "type": string(gameType), + "ip": fmt.Sprintf("%s:%d", ip, port), + "type": string(gameType), + "move_choose_type": string(moveChooseType), }) if err != nil { return playResponse{Error: err.Error()} |