mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-01-23 10:35:44 +00:00
68 lines
1.3 KiB
Go
68 lines
1.3 KiB
Go
package api
|
|
|
|
import "github.com/giongto35/cloud-game/v3/pkg/network"
|
|
|
|
type GameInfo struct {
|
|
Name string `json:"name"`
|
|
Base string `json:"base"`
|
|
Path string `json:"path"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
type (
|
|
ChangePlayerRequest = struct {
|
|
StatefulRoom
|
|
Index int `json:"index"`
|
|
}
|
|
ChangePlayerResponse int
|
|
GameQuitRequest struct {
|
|
StatefulRoom
|
|
}
|
|
LoadGameRequest struct {
|
|
StatefulRoom
|
|
}
|
|
LoadGameResponse string
|
|
SaveGameRequest struct {
|
|
StatefulRoom
|
|
}
|
|
SaveGameResponse string
|
|
StartGameRequest struct {
|
|
StatefulRoom
|
|
Record bool
|
|
RecordUser string
|
|
Game GameInfo `json:"game"`
|
|
PlayerIndex int `json:"player_index"`
|
|
}
|
|
StartGameResponse struct {
|
|
Room
|
|
Record bool
|
|
}
|
|
RecordGameRequest struct {
|
|
StatefulRoom
|
|
Active bool `json:"active"`
|
|
User string `json:"user"`
|
|
}
|
|
RecordGameResponse string
|
|
TerminateSessionRequest struct {
|
|
Stateful
|
|
}
|
|
ToggleMultitapRequest struct {
|
|
StatefulRoom
|
|
}
|
|
WebrtcAnswerRequest struct {
|
|
Stateful
|
|
Sdp string `json:"sdp"`
|
|
}
|
|
WebrtcIceCandidateRequest struct {
|
|
Stateful
|
|
Candidate string `json:"candidate"`
|
|
}
|
|
WebrtcInitRequest struct {
|
|
Stateful
|
|
}
|
|
WebrtcInitResponse string
|
|
)
|
|
|
|
func NewWebrtcIceCandidateRequest(id network.Uid, can string) (PT, any) {
|
|
return WebrtcIce, WebrtcIceCandidateRequest{Stateful: Stateful{id}, Candidate: can}
|
|
}
|