-
Notifications
You must be signed in to change notification settings - Fork 2
/
events_lobby.go
50 lines (42 loc) · 1.43 KB
/
events_lobby.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
// RoomInList contains short info about room in the lobby.
type RoomInList struct {
Id uint64 `json:"id"`
OwnerId uint64 `json:"ownerId"`
Name string `json:"name"`
GameStatus string `json:"gameStatus"`
MembersNum int `json:"membersNum"`
}
// ClientInList contains short info about client in the lobby.
type ClientInList struct {
Id uint64 `json:"id"`
Nickname string `json:"nickname"`
}
// ClientJoinedEvent contains info for the just connected client.
type ClientJoinedEvent struct {
YourId uint64 `json:"yourId"`
YourNickname string `json:"yourNickname"`
Clients []*ClientInList `json:"clients"`
Rooms []*RoomInList `json:"rooms"`
}
// ClientLeftEvent contains id of client who left lobby.
type ClientLeftEvent struct {
Id uint64 `json:"id"`
}
// ClientBroadCastJoinedEvent contains info for other clients when a new client was connected.
type ClientBroadCastJoinedEvent struct {
Id uint64 `json:"id"`
Nickname string `json:"nickname"`
}
// ClientCreatedRoomEvent contains info of created room.
type ClientCreatedRoomEvent struct {
Room *RoomInList `json:"room"`
}
// RoomInListRemovedEvent contains id of the room which was removed from lobby
type RoomInListRemovedEvent struct {
RoomId uint64 `json:"roomId"`
}
// RoomInListUpdatedEvent contains info about room which was changed
type RoomInListUpdatedEvent struct {
Room *RoomInList `json:"room"`
}