game_def.go
1.28 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package common
import (
"net"
"sync"
)
type PlayerGameActionType int
const (
Enum_Game_Action_None PlayerGameActionType = iota
Enum_Game_Action_ResetAction
Enum_Game_Action_Check
Enum_Game_Action_Fold
Enum_Game_Action_Call
Enum_Game_Action_Bet
Enum_Game_Action_Raise
Enum_Game_Action_Allin
Enum_Game_Action_Show
Enum_Game_Action_Muck
Enum_Game_Action_Sitout
Enum_Game_Action_Back
)
type SchedAction struct {
valid bool
amount int
action PlayerGameActionType
}
type GamePlayer struct {
UID int
Conn net.Conn
ConnLocker *sync.RWMutex //conn设置保护
OutChannel chan []byte
OutDone chan bool
ConnSeq uint32
ConningSeq uint32
}
func (player *GamePlayer) UpdateConn(conn net.Conn) {
player.ConnLocker.Lock()
defer player.ConnLocker.Unlock()
player.Conn = conn
}
type GameType int32
const (
Enum_Game_Type_None GameType = 0
Enum_Game_Type_Normal GameType = 1
Enum_Game_Type_Club GameType = 2
Enum_Game_Type_Special_Club GameType = 3
)
type GameMode int32
const (
Enum_Game_Mode_None GameMode = 0
Enum_Game_Mode_Normal GameMode = 1
Enum_Game_Mode_Match GameMode = 2
Enum_Game_Mode_Other GameMode = 3
)
type PlayerRemark struct {
Uid uint32 `json:"uid"`
Type int32 `json:"type"`
Remarks string `json:"remark"`
}