| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- package gamelogic
- import (
- "bet24.com/log"
- )
- type PlayerInfo struct {
- IsValid bool // 是否有效玩家
- AutoOut bool // 托管标志
- HandCards []int // 手牌
- Score int // 携带分
- Status int // 玩家状态
- EndScore int // 结算分
- RobScore int // 抢庄分
- CardType int // 牌型
- LastAction int // 上个动作
- Param int // 动作参数
- Experience int // 玩家经验值
- ChangeScore int // 小局输赢变化值
- userID int // 玩家ID
- isRobot bool // 是否机器人
- robotType int // 机器人类型
- isEndToStart bool
- }
- func (p *PlayerInfo) initData(userId, enterGold int) {
- p.IsValid = false
- p.isRobot = false
- p.userID = userId
- p.Score = enterGold
- p.EndScore = 0
- p.Experience = 0
- p.gameInit()
- }
- func (p *PlayerInfo) gameInit() {
- p.HandCards = []int{}
- p.Status = Player_Status_Free
- p.AutoOut = false
- p.RobScore = 0
- p.LastAction = -1
- p.ChangeScore = 0
- p.Param = -1
- }
- func (p *PlayerInfo) setLastData(action, param int) {
- p.LastAction = action
- p.Param = param
- }
- func (p *PlayerInfo) hideSecretData() {
- for i := 0; i < len(p.HandCards); i++ {
- p.HandCards[i] = CARD_COUNT
- }
- }
- func (p *PlayerInfo) dump(chairId int) {
- robot := ""
- if p.isRobot {
- robot = "ROBOT"
- }
- log.Release(" ----Player[%d] Chair[%d] IsValid[%v] %s RobotType[%d]", p.userID, chairId, p.IsValid, robot, p.robotType)
- log.Release(" HandCards%s CardType[%d] ", getCardsHex(p.HandCards), p.CardType)
- log.Release(" AutoOut[%v] Score[%d] Status[%d] EndScore[%d] RobScore[%d] LastAction[%d], Param[%d]",
- p.AutoOut, p.Score, p.Status, p.EndScore, p.RobScore, p.LastAction, p.Param)
- log.Release(" Experience[%v] ChangeScore[%d]", p.Experience, p.ChangeScore)
- log.Release(" +++++++++++++++++")
- }
|