diff --git a/comm/const.go b/comm/const.go index e6b6f8ed0..b5926f44e 100644 --- a/comm/const.go +++ b/comm/const.go @@ -112,7 +112,7 @@ const ( ModuleVenture core.M_Modules = "venture" //7日签到 ModuleAchieve core.M_Modules = "achieve" //全局成就 ModuleJielong core.M_Modules = "jielong" //接龙 - ModuleEntertainment core.M_Modules = "entertainment" //消消乐 + ModuleEntertainment core.M_Modules = "entertain" //消消乐 ModuleDcolor core.M_Modules = "dcolor" //猜颜色 ) diff --git a/modules/entertainment/api_match.go b/modules/entertainment/api_match.go index db42bc668..e5227ef3f 100644 --- a/modules/entertainment/api_match.go +++ b/modules/entertainment/api_match.go @@ -20,41 +20,55 @@ func (this *apiComp) MatchCheck(session comm.IUserSession, req *pb.EntertainMatc func (this *apiComp) Match(session comm.IUserSession, req *pb.EntertainMatchReq) (errdata *pb.ErrorData) { // 随便找个在线的人 var ( - bMatch bool + //bMatch bool s2 comm.IUserSession p1 *pb.PlayerData // 玩家1 p2 *pb.PlayerData // 玩家2 + roomid string ) - if users, err := this.module.ModuleUser.UserOnlineList(); err == nil { - if len(users) > 0 { - bMatch = true - s2, bMatch = this.module.GetUserSession(users[0].Uid) + // 暂时只做机器人 + if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil { + if len(robots) > 0 { p2 = &pb.PlayerData{ - Uid: s2.GetUserId(), - Name: "", + Uid: "999", // AI uid 暂定 + Name: robots[0].Name, Score: 0, Ps: 0, - Cardid: req.Idcard, + Cardid: "27000001", // 机器人临时数据 } - } else { // 测试用 - if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil { - if len(robots) > 0 { - p2 = &pb.PlayerData{ - Uid: "999", // AI uid 暂定 - Name: robots[0].Name, - Score: 0, - Ps: 0, - Cardid: "27000001", // 机器人临时数据 - } - } - } - } - this.module.gameMgr.CreateRoom(session, s2, p1, p2) } + if u, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { + p1 = &pb.PlayerData{ + Uid: session.GetUserId(), // AI uid 暂定 + Name: u.Name, + Score: 0, + Ps: 0, + Cardid: "27000001", // 机器人临时数据 + } + } + + // if users, err := this.module.ModuleUser.UserOnlineList(); err == nil { + // if len(users) > 0 { + // bMatch = true + // s2, bMatch = this.module.GetUserSession(users[0].Uid) + // p2 = &pb.PlayerData{ + // Uid: s2.GetUserId(), + // Name: "", + // Score: 0, + // Ps: 0, + // Cardid: req.Idcard, + // } + // } else { // 测试用 + + // } + // + // } + roomid = this.module.gameMgr.CreateRoom(session, s2, p1, p2) session.SendMsg(string(this.module.GetType()), "match", &pb.EntertainMatchResp{ - Maych: bMatch, + Maych: true, Player: p2, + Roomid: roomid, }) return } diff --git a/modules/entertainment/api_operator.go b/modules/entertainment/api_operator.go index faec3cc45..d2a766e7c 100644 --- a/modules/entertainment/api_operator.go +++ b/modules/entertainment/api_operator.go @@ -18,7 +18,10 @@ func (this *apiComp) OperatorCheck(session comm.IUserSession, req *pb.EntertainO func (this *apiComp) Operator(session comm.IUserSession, req *pb.EntertainOperatorReq) (errdata *pb.ErrorData) { - this.module.gameMgr.RoomDistribute(req.Roomid, session, "opertor", req) - + this.module.gameMgr.RoomDistribute(req.Roomid, session, "operator", req) + // 操作消息返回 + session.SendMsg(string(this.module.GetType()), "operator", &pb.EntertainOperatorResp{ + Success: true, + }) return } diff --git a/modules/entertainment/api_ready.go b/modules/entertainment/api_ready.go new file mode 100644 index 000000000..8d7ca02fb --- /dev/null +++ b/modules/entertainment/api_ready.go @@ -0,0 +1,26 @@ +package entertainment + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +//参数校验 +func (this *apiComp) ReadyCheck(session comm.IUserSession, req *pb.EntertainReadyReq) (errdata *pb.ErrorData) { + if req.Roomid == "" { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + } + return +} + +func (this *apiComp) Ready(session comm.IUserSession, req *pb.EntertainReadyReq) (errdata *pb.ErrorData) { + + this.module.gameMgr.RoomDistribute(req.Roomid, session, "ready", req) + session.SendMsg(string(this.module.GetType()), "ready", &pb.EntertainReadyResp{ + Ready: true, + }) + return +} diff --git a/modules/entertainment/gamemgr.go b/modules/entertainment/gamemgr.go index 642575f47..2548324ec 100644 --- a/modules/entertainment/gamemgr.go +++ b/modules/entertainment/gamemgr.go @@ -28,13 +28,14 @@ func (this *gameMgrComp) Init(service core.IService, module core.IModule, comp c return } -func (this *gameMgrComp) CreateRoom(s1 comm.IUserSession, s2 comm.IUserSession, p1 *pb.PlayerData, p2 *pb.PlayerData) { +func (this *gameMgrComp) CreateRoom(s1 comm.IUserSession, s2 comm.IUserSession, p1 *pb.PlayerData, p2 *pb.PlayerData) (roomid string) { room := new(Room) //初始化房间 - room.InitRoom(this.module, s1, s2, p1, p2) + room = room.InitRoom(this.module, s1, s2, p1, p2) this.lock.Lock() this.rooms[room.Id] = room this.lock.Unlock() + return room.Id } func (this *gameMgrComp) CloseRoom(id string) { diff --git a/modules/entertainment/module.go b/modules/entertainment/module.go index fc4e87be2..c0cf03f95 100644 --- a/modules/entertainment/module.go +++ b/modules/entertainment/module.go @@ -50,14 +50,7 @@ func (this *Entertainment) Start() (err error) { if err = this.ModuleBase.Start(); err != nil { return } - // var s1 comm.IUserSession - // var s2 comm.IUserSession - // this.gameMgr.CreateRoom(s1, s2) - // this.xxl = new(MapData) - // this.xxl.InitMap() - // this.xxl.SwapGirde(1, 0) - // this.xxl.CheckMap() - // this.xxl.DropGirde() + return } diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index 45f8e2eca..58ec18ba2 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -5,7 +5,6 @@ import ( "go_dreamfactory/lego/sys/timewheel" "go_dreamfactory/modules" "go_dreamfactory/pb" - "go_dreamfactory/sys/configure" "time" "go.mongodb.org/mongo-driver/bson/primitive" @@ -13,8 +12,9 @@ import ( ) const ( - MaxPs = 2 // 最大体力 - MaxRound = 7 // 最大回合数 + MaxPs = 2 // 最大体力 + MaxRound = 7 // 最大回合数 + MaxTime = 180 // 游戏操作时间 ) //游戏房间 @@ -29,6 +29,7 @@ type Room struct { power string // 谁的权限 round int32 // 轮数 operatetimer *timewheel.Task //操作倒计时定时器 + aiTimer *timewheel.Task //AI操作随机做个延时 } func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) { @@ -47,19 +48,33 @@ func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) { if this.round > MaxRound*2 { // 游戏结束 this.GameOver() } - this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) // 开启新的定时器 - this.module.Debugf("超时%d", configure.Now().Unix()) + this.operatetimer = timewheel.Add(time.Second*MaxTime, this.operateTimeOut) // 开启新的定时器 + var szMap []*pb.MapData + szMap = append(szMap, &pb.MapData{ + Data: this.chessboard.Plat, + }) + //this.module.Debugf("超时%d", configure.Now().Unix()) + if err := this.SendMsgToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ + Mpadata: szMap, + Power: this.power, + Score: 0, + Round: this.round, + User1: this.player1, + User2: this.player2, + }, this.szSession...); err != nil { + this.Errorln(err) + } } func (this *Room) InitRoom(module *Entertainment, s1 comm.IUserSession, s2 comm.IUserSession, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room { this.chessboard = new(MapData) this.chessboard.InitMap() // 初始化棋盘 - defer this.StartGame() - this.szSession = append(this.szSession, s1) - if p2.Uid != "" { // 是否是机器人 - this.szSession = append(this.szSession, s2) + + this.szSession = append(this.szSession, s1.Clone()) + if p2.Uid != "999" { // 是否是机器人 + this.szSession = append(this.szSession, s2.Clone()) } - this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) + return &Room{ ModuleBase: modules.ModuleBase{}, Id: primitive.NewObjectID().Hex(), @@ -69,12 +84,60 @@ func (this *Room) InitRoom(module *Entertainment, s1 comm.IUserSession, s2 comm. module: module, power: s1.GetUserId(), round: 1, + szSession: this.szSession, + } +} + +// AI 操作了 +func (this *Room) AiTimeOut(task *timewheel.Task, args ...interface{}) { + var ( + curScore int32 + szMap []*pb.MapData + ) + this.player2.Ps-- + if this.player2.Ps <= 0 { // 权限给下一个人 + this.power = this.player1.Uid + this.round++ + } + this.player1.Ps = MaxPs + if this.aiTimer != nil { + timewheel.Remove(this.aiTimer) + } + // 交换元素 + bSwap := this.chessboard.AiSwapGirde() // 交换格子 + if !bSwap { + this.module.Errorf("AiSwapGirde fialed") + } + szMap = append(szMap, &pb.MapData{ + Data: this.chessboard.Plat, + }) + if score, m := this.chessboard.CheckMap(); score > 0 { + curScore += score + szMap = append(szMap, m...) + } + this.player2.Score += curScore + + // 清理旧的计时器 开启一个新的 + if this.operatetimer != nil { + timewheel.Remove(this.operatetimer) + } + this.operatetimer = timewheel.Add(time.Second*MaxTime, this.operateTimeOut) // 开启新的定时器 + // 广播消息 + if err := this.SendMsgToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ + Mpadata: szMap, + Power: this.power, + Score: curScore, + Round: this.round, + User1: this.player1, + User2: this.player2, + }, this.szSession...); err != nil { + this.Errorln(err) } } func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg proto.Message) (errdata *pb.ErrorData) { switch stype { - case "opertor": // 操作消息 + case "operator": // 操作消息 var ( curScore int32 ) @@ -84,15 +147,43 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr if session.GetUserId() != this.power { // 校验是不是你的权限 return } + if this.operatetimer != nil { + timewheel.Remove(this.operatetimer) + } + // 交换元素 + this.chessboard.SwapGirde(req.Curid, req.Targetid) // 交换格子 + szMap = append(szMap, &pb.MapData{ + Data: this.chessboard.Plat, + }) + if score, m := this.chessboard.CheckMap(); score > 0 { + curScore += score + szMap = append(szMap, m...) + } + //this.player2.Score += curScore + // 开启新的定时器 + if this.operatetimer != nil { + timewheel.Remove(this.operatetimer) + } + this.operatetimer = timewheel.Add(time.Second*MaxTime, this.operateTimeOut) // 开启新的定时器 if this.power == this.player1.Uid { //权限校验 + this.player1.Score += curScore this.player1.Ps-- if this.player1.Ps <= 0 { // 权限给下一个人 this.power = this.player2.Uid + + if len(this.szSession) == 1 { // 校验2号玩家是不是AI + // 起一个定时器 + if this.aiTimer != nil { + timewheel.Remove(this.aiTimer) + } + this.aiTimer = timewheel.Add(time.Second*MaxTime, this.AiTimeOut) + } this.round++ } this.player2.Ps = MaxPs } else if this.power == this.player2.Uid { + this.player2.Score += curScore this.player2.Ps-- if this.player2.Ps <= 0 { // 权限给下一个人 this.power = this.player1.Uid @@ -103,31 +194,21 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr return } - // 交换元素 - this.chessboard.SwapGirde(req.Curid, req.Targetid) // 交换格子 - szMap = append(szMap, &pb.MapData{ - Data: this.chessboard.Data, - }) - this.chessboard.CheckMap() - if score, m := this.chessboard.DropGirde(); score > 0 { - curScore += score - szMap = append(szMap, m...) - } - - // 操作消息返回 - session.SendMsg(string(this.module.GetType()), "operator", &pb.EntertainOperatorResp{ - Success: true, - }) - // 广播消息 if err := this.SendMsgToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ Mpadata: szMap, Power: this.power, Score: curScore, Round: this.round, + User1: this.player1, + User2: this.player2, }, this.szSession...); err != nil { this.Errorln(err) } + case "ready": + this.StartGame() + + this.operatetimer = timewheel.Add(time.Second*MaxTime, this.operateTimeOut) } return @@ -147,7 +228,7 @@ func (this *Room) StartGame() (errdata *pb.ErrorData) { User1: this.player1, User2: this.player2, Mpadata: &pb.MapData{ - Data: this.chessboard.Data, + Data: this.chessboard.Plat, }, Power: this.power, Round: this.round, @@ -159,12 +240,17 @@ func (this *Room) StartGame() (errdata *pb.ErrorData) { // 游戏结束 func (this *Room) GameOver() (errdata *pb.ErrorData) { - + if this.aiTimer != nil { + timewheel.Remove(this.aiTimer) + } + if this.operatetimer != nil { + timewheel.Remove(this.operatetimer) + } this.SendMsgToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{ User1: this.player1, User2: this.player2, Mpadata: &pb.MapData{ - Data: this.chessboard.Data, + Data: this.chessboard.Plat, }, Power: "", Round: this.round, diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go new file mode 100644 index 000000000..793c35c17 --- /dev/null +++ b/modules/entertainment/xxlPlat.go @@ -0,0 +1,377 @@ +package entertainment + +import ( + "crypto/rand" + "fmt" + "go_dreamfactory/lego/core" + "go_dreamfactory/pb" + "math/big" +) + +const ( + Width = 7 + Height = 7 + Total = Width * Height +) + +// type Girde struct { +// X int32 // x +// Y int32 +// ID int32 +// Itype int32 +// } + +type Girde struct { + oid int32 // 唯一ID + color int32 // 颜色 + cid int32 // 配置表id + score int32 // 分数 + special int32 // 消除特效 +} + +//地图数据 +type MapData struct { + //Data map[int32]*pb.GirdeData // 地图数据 + + Plat []*pb.GirdeData // 地图 + + oid int32 // 唯一id +} + +func (this *MapData) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + // this.Data = make(map[int32]*pb.GirdeData, Width*Height) + this.Plat = make([]*pb.GirdeData, Width*Height) + return +} + +// 1~6随机一个数 +func GetRandType() int32 { + n, _ := rand.Int(rand.Reader, big.NewInt(6)) + return int32(n.Int64() + 1) +} + +func (this *MapData) CreateGride(index int32) *pb.GirdeData { + t := GetRandType() + fmt.Printf("create=====index: %d, color:%d \n", index, t) + this.oid++ + return &pb.GirdeData{ + Oid: this.oid, + Color: t, + Cid: GetRandType(), + Score: 1, + Special: 1, + } +} + +// 初始化地图数据 +func (this *MapData) InitMap() { + this.oid = 1000 // 方便观察 从1000开始 + this.Plat = make([]*pb.GirdeData, Width*Height) + for i := 0; i < Width*Height; i++ { + + this.Plat[i] = this.CreateGride(int32(i)) //(int32(i/Width), int32(i%Height)) + } + + //this.Debugf() +} + +// 交换2个元素(参数 oid ) +func (this *MapData) SwapGirde(oldId, newId int32) bool { + var ( + bSwap bool // 能否交换 + ) + // x = int32(i/Width), y = int32(i%Height) + if (oldId%Height != Total-1 && oldId+1 == newId) || + (oldId%Height > 0 && oldId-1 == newId) || + (oldId+Width < Total && oldId+Width == newId) || + (oldId-Width > 0 && oldId-Width == newId) { + bSwap = true + tmp := new(pb.GirdeData) + *tmp = *this.Plat[newId] + this.Plat[newId] = this.Plat[oldId] + this.Plat[oldId] = tmp + } + + this.Debugf() + return bSwap +} + +func (this *MapData) SetMap() { + sz2 := []int32{ + 5, 1, 2, 5, 1, 5, 2, + 3, 1, 5, 4, 2, 4, 4, + 4, 4, 2, 1, 6, 4, 1, + 6, 3, 1, 4, 3, 6, 3, + 6, 3, 3, 1, 1, 6, 1, + 5, 6, 5, 5, 1, 3, 1, + 6, 5, 5, 1, 2, 1, 4, + } + var pos int + for index := Width - 1; index >= 0; index-- { + for j := 0; j < Height; j++ { + this.Plat[index+j*Height].Color = sz2[pos] + pos++ + //fmt.Printf(" x:%d y:%d c:%d ", this.Plat[index+j*7].X, this.Plat[index+j*7].Y, this.Plat[index+j*7].Color) + //fmt.Printf("%d ", this.Plat[index+j*7].Color) + } + //fmt.Printf("\n") + } + this.Debugf() +} +func (this *MapData) Debugf() { + fmt.Printf("================\n") + for index := Width - 1; index >= 0; index-- { + + for j := 0; j < Height; j++ { + fmt.Printf("%d:%d ", this.Plat[index+j*Height].Oid, this.Plat[index+j*Height].Color) + } + fmt.Printf("\n") + } + +} + +// 检查5消 +func (this *MapData) Check5X() (bEliminate bool, score int32) { + for k, v := range this.Plat { + if v.Color == 0 { + continue + } + x := int32(k % Height) // x + if x+4 < Height { + k1 := this.Plat[k].Color + k2 := this.Plat[k+1].Color + k3 := this.Plat[k+2].Color + k4 := this.Plat[k+3].Color + k5 := this.Plat[k+4].Color + if k5 == 0 || k2 == 0 || k3 == 0 || k4 == 0 { + continue + } + if k1 == k2 && k3 == k4 && k5 == k1 && k2 == k3 { + score += this.Plat[k].Score + score += this.Plat[k+1].Score + score += this.Plat[k+2].Score + score += this.Plat[k+3].Score + score += this.Plat[k+4].Score + this.Plat[k] = &pb.GirdeData{} + this.Plat[k+1] = &pb.GirdeData{} + this.Plat[k+2] = &pb.GirdeData{} + this.Plat[k+3] = &pb.GirdeData{} + this.Plat[k+4] = &pb.GirdeData{} + bEliminate = true + + } + } + if k+4*Width < Total { + k1 := this.Plat[k].Color + k2 := this.Plat[k+Width].Color + k3 := this.Plat[k+2*Width].Color + k4 := this.Plat[k+3*Width].Color + k5 := this.Plat[k+4*Width].Color + if k5 == 0 || k2 == 0 || k3 == 0 || k4 == 0 { + continue + } + if k1 == k2 && k3 == k4 && k5 == k1 && k2 == k3 { + score += this.Plat[k].Score + score += this.Plat[k+Width].Score + score += this.Plat[k+2*Width].Score + score += this.Plat[k+3*Width].Score + score += this.Plat[k+4*Width].Score + this.Plat[k] = &pb.GirdeData{} + this.Plat[k+Width] = &pb.GirdeData{} + this.Plat[k+2*Width] = &pb.GirdeData{} + this.Plat[k+3*Width] = &pb.GirdeData{} + this.Plat[k+4*Width] = &pb.GirdeData{} + bEliminate = true + } + } + } + + return +} + +func (this *MapData) Check4X() (bEliminate bool, score int32) { + for k, v := range this.Plat { + if v.Color == 0 { + continue + } + x := int32(k % Height) // x + + if x+3 < Height { + k1 := this.Plat[x].Color + k2 := this.Plat[x+1].Color + k3 := this.Plat[x+2].Color + k4 := this.Plat[x+3].Color + if k2 == 0 || k3 == 0 || k4 == 0 { + continue + } + if k1 == k2 && k3 == k4 && k2 == k3 { + score += this.Plat[x].Score + score += this.Plat[x+1].Score + score += this.Plat[x+2].Score + score += this.Plat[x+3].Score + this.Plat[x] = &pb.GirdeData{} + this.Plat[x+1] = &pb.GirdeData{} + this.Plat[x+2] = &pb.GirdeData{} + this.Plat[x+3] = &pb.GirdeData{} + bEliminate = true + } + } + if k+3*Width < Total { + k1 := this.Plat[k].Color + k2 := this.Plat[k+Width].Color + k3 := this.Plat[k+2*Width].Color + k4 := this.Plat[k+3*Width].Color + if k2 == 0 || k3 == 0 || k4 == 0 { + continue + } + if k1 == k2 && k3 == k4 && k2 == k3 { + score += this.Plat[k].Score + score += this.Plat[k+Width].Score + score += this.Plat[k+2*Width].Score + score += this.Plat[k+3*Width].Score + + this.Plat[k] = &pb.GirdeData{} + this.Plat[k+Width] = &pb.GirdeData{} + this.Plat[k+2*Width] = &pb.GirdeData{} + this.Plat[k+3*Width] = &pb.GirdeData{} + bEliminate = true + } + } + } + return +} + +func (this *MapData) Check3X() (bEliminate bool, score int32) { + for k, v := range this.Plat { + if v.Color == 0 { + continue + } + x := int32(k % Height) // x + + if x+2 < Height { + k1 := this.Plat[k].Color + k2 := this.Plat[k+1].Color + k3 := this.Plat[k+2].Color + if k2 == 0 || k3 == 0 { + continue + } + if k1 == k2 && k2 == k3 { + score += this.Plat[k].Score + score += this.Plat[k+1].Score + score += this.Plat[k+2].Score + this.Plat[k] = &pb.GirdeData{} + this.Plat[k+1] = &pb.GirdeData{} + this.Plat[k+2] = &pb.GirdeData{} + bEliminate = true + } + } + + if k+2*Width < Total { + k1 := this.Plat[k].Color + k2 := this.Plat[k+Width].Color + k3 := this.Plat[k+2*Width].Color + if k2 == 0 || k3 == 0 { + continue + } + if k1 == k2 && k2 == k3 { + score += this.Plat[k].Score + score += this.Plat[k+Width].Score + score += this.Plat[k+2*Width].Score + + this.Plat[k] = &pb.GirdeData{} + this.Plat[k+Width] = &pb.GirdeData{} + this.Plat[k+2*Width] = &pb.GirdeData{} + bEliminate = true + } + } + } + return +} + +// 校验地图可消除的 判断各组上面2个和右边两个是否三个相等 +func (this *MapData) CheckMap() (score int32, szMap []*pb.MapData) { + for { + var curScore int32 + if bRet, s := this.Check5X(); !bRet { + fmt.Printf("=====检测消除5x===========\n") + curScore += s + } + if bRet, s := this.Check4X(); !bRet { + fmt.Printf("=====检测消除4x===========\n") + curScore += s + } + if bRet, s := this.Check3X(); !bRet { + fmt.Printf("=====检测消除3x===========\n") + curScore += s + } + score += curScore // 总分 + if curScore == 0 { + break + } + //szMap = append(szMap, this.DropGirde()...) + this.DropGirde() + + szMap = append(szMap, &pb.MapData{ + Data: this.Plat, + CurSocre: curScore, + }) + } + + //this.Debugf() + return +} + +// 下落 生成新的格子 (返回掉落所获得的分数) +func (this *MapData) DropGirde() { + + for i := 0; i < Width; i++ { + for j := 0; j < Height; j++ { + index := i*Width + j + if this.Plat[index].Color == 0 { // 说明这列有空 + var add int + for m := j + 1; m < Height; m++ { + k1 := i*Width + m + if this.Plat[k1].Color != 0 { + this.Plat[index] = this.Plat[k1] + index++ + add++ + } + // if this.Plat[k1].Color != 0 { + // tmp := new(pb.GirdeData) + // *tmp = *this.Plat[k1] + // sz = append(sz, tmp) + // } + } + for m := j + add; m < Height; m++ { + k1 := i*Width + m + this.Plat[k1] = this.CreateGride(int32(k1)) + } + break + } + } + } + + this.Debugf() + return +} +func (this *MapData) AiSwapGirde() bool { + var ( + bSwap bool // 能否交换 + ) + for pos := 0; pos < Total; pos++ { + y := pos % Height + if y < Height-1 { + if this.SwapGirde(int32(pos), int32(pos+1)) { + bSwap = true + break + } + } + if pos/Width+1 < Width { + if this.SwapGirde(int32(pos), int32(pos+1)) { + bSwap = true + break + } + } + } + return bSwap +} diff --git a/modules/entertainment/xxl_test.go b/modules/entertainment/xxl_test.go index be490e3b6..a2cb089f6 100644 --- a/modules/entertainment/xxl_test.go +++ b/modules/entertainment/xxl_test.go @@ -71,9 +71,13 @@ func Test_Main(t *testing.T) { m := new(entertainment.MapData) m.InitMap() + m.SetMap() + m.SwapGirde(1, 8) + m.DropGirde() + m.CheckMap() m.SwapGirde(1, 11) - fmt.Printf("得分:%d\n", m.CheckMap()) + //fmt.Printf("得分:%d\n", m.CheckMap()) m.DropGirde() flag.Parse() diff --git a/modules/entertainment/xxlmap.go b/modules/entertainment/xxlmap.go deleted file mode 100644 index 9b0a01c54..000000000 --- a/modules/entertainment/xxlmap.go +++ /dev/null @@ -1,473 +0,0 @@ -package entertainment - -import ( - "crypto/rand" - "fmt" - "go_dreamfactory/lego/core" - "go_dreamfactory/pb" - "math/big" -) - -const ( - Width = 7 - Height = 7 -) - -// type Girde struct { -// X int32 // x -// Y int32 -// ID int32 -// Itype int32 -// } - -//地图数据 -type MapData struct { - Data map[int32]*pb.GirdeData // 地图数据 -} - -func (this *MapData) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.Data = make(map[int32]*pb.GirdeData, Width*Height) - return -} - -// 1~6随机一个数 -func GetRandType() int32 { - n, _ := rand.Int(rand.Reader, big.NewInt(6)) - return int32(n.Int64() + 1) -} -func (this *MapData) GetKeyType(key int32) int32 { - var itype int32 - if v, ok := this.Data[key]; ok { - itype = v.Itype - } - return itype -} - -func (this *MapData) GetKeyData(key int32) (data *pb.GirdeData) { - if v, ok := this.Data[key]; ok { - return v - } - return -} - -// 初始化地图数据 -func (this *MapData) InitMap() { - this.Data = make(map[int32]*pb.GirdeData, Width*Height) - for i := 0; i < Width; i++ { - for j := 0; j < Height; j++ { - tmp := GetRandType() - key := int32(i*10 + j) - bOk := true // OK 的 - this.Data[key] = &pb.GirdeData{ - X: int32(i), - Y: int32(j), - Id: key, - Itype: tmp, - Cid: tmp, - Score: 1, - } - // 校验 检查格子的左边的左边 和下边和下下边 - if j-2 >= 0 { - i1 := this.GetKeyType(int32(i*10 + j - 1)) - i2 := this.GetKeyType(int32(i*10 + j - 2)) - if i1 == i2 && tmp == i1 { - bOk = false - } - } - if i-2 >= 0 { - i1 := this.GetKeyType(int32((i-1)*10 + j)) - i2 := this.GetKeyType(int32((i-2)*10 + j)) - if i1 == i2 && tmp == i1 { - bOk = false - } - } - if !bOk { - for i := 0; i < Width*Height; i++ { - itype := GetRandType() - if tmp != itype { - tmp = itype - break - } - } - this.Data[key].Itype = tmp - } - } - } - // 测试地图数据 - sz2 := []int32{ - 5, 1, 3, 5, 1, 5, 2, - 3, 1, 5, 4, 2, 4, 4, - 4, 4, 1, 5, 6, 4, 1, - 6, 3, 1, 1, 3, 6, 3, - 6, 3, 5, 2, 4, 6, 1, - 5, 6, 5, 5, 1, 3, 1, - 6, 5, 5, 1, 2, 1, 4, - } - var index = 0 - for j := Height - 1; j >= 0; j-- { - for i := 0; i < Width; i++ { - key := int32(i*10 + j) - this.Data[key].Itype = sz2[index] - index++ - } - } - this.Debugf() -} - -// 交换2个元素(参数 id ) -func (this *MapData) SwapGirde(i, j int32) bool { - var ( - bSwap bool // 能否交换 - tmp *pb.GirdeData - ) - g1 := this.GetKeyData(i) - g2 := this.GetKeyData(j) - if g1 == nil || g2 == nil { - return bSwap - } - // 校验是不是挨着的 - if g1.X-1 == g2.X || g1.X+1 == g2.X || g1.Y+1 == g2.Y || g1.Y-1 == g2.Y { - bSwap = true - // 更新地图数据 - tmp = &pb.GirdeData{ - X: g1.X, - Y: g1.Y, - Id: g1.Id, - Itype: g1.Itype, - Cid: g1.Cid, - Score: g1.Score, - } - this.Data[i] = g2 - this.Data[j] = tmp - if !this.CheckSwape(i, j) { // 交换后不能消除 - this.Data[i] = tmp - this.Data[j] = g2 - bSwap = false - } - } - this.Debugf() - return bSwap -} - -func (this *MapData) Debugf() { - fmt.Printf("================\n") - for j := Height - 1; j >= 0; j-- { - for i := 0; i < Width; i++ { - key := int32(i*10 + j) - fmt.Printf("%d ", this.Data[key].Itype) - } - fmt.Printf("\n") - } -} - -// 检查5消 -func (this *MapData) Check5X() (bEliminate bool, score int32) { - m := make(map[int32]struct{}, 5) - bEliminate = true - del := make(map[int32]int32) - for i := 0; i < Width; i++ { - for j := 0; j < Height; j++ { - m = make(map[int32]struct{}, 0) - key := int32(i*10 + j) - iType := this.GetKeyType(key) - if iType == 0 { - continue - } - curKey := this.Data[key].Itype - if curKey == 0 { - continue - } - m[curKey] = struct{}{} - if i+4 < Width { - i1 := this.Data[int32((i+1)*10+j)] - i2 := this.Data[int32((i+2)*10+j)] - i3 := this.Data[int32((i+3)*10+j)] - i4 := this.Data[int32((i+4)*10+j)] - - m[i1.Itype] = struct{}{} - m[i2.Itype] = struct{}{} - m[i3.Itype] = struct{}{} - m[i4.Itype] = struct{}{} - - if len(m) == 1 { - del[int32((i+1)*10+j)] = i1.Score - del[int32((i+2)*10+j)] = i2.Score - del[int32((i+3)*10+j)] = i3.Score - del[int32((i+4)*10+j)] = i4.Score - del[key] = this.Data[key].Score - } - } - m = map[int32]struct{}{} - if j+4 < Height { - i1 := this.Data[int32(i*10+j+1)] - i2 := this.Data[int32(i*10+j+2)] - i3 := this.Data[int32(i*10+j+3)] - i4 := this.Data[int32(i*10+j+4)] - m[i1.Itype] = struct{}{} - m[i2.Itype] = struct{}{} - m[i3.Itype] = struct{}{} - m[i4.Itype] = struct{}{} - if len(m) == 1 { // 1 2 3 4 5 - del[int32(i*10+j+1)] = i1.Score - del[int32(i*10+j+2)] = i2.Score - del[int32(i*10+j+3)] = i3.Score - del[int32(i*10+j+4)] = i4.Score - del[key] = this.Data[key].Score - } - } - } - } - // 顺着删除列表删除各组 - for k, v := range del { - this.Data[k].Itype = 0 - score += v - } - if len(del) > 0 { - bEliminate = false - fmt.Printf("5x消除格子===del:%v\n", del) - } - - return -} -func (this *MapData) Check4X() (bEliminate bool, score int32) { - bEliminate = true - del := make(map[int32]int32) - for i := 0; i < Width; i++ { - for j := 0; j < Height; j++ { - key := int32(i*10 + j) - iType := this.GetKeyType(key) - if iType == 0 { - continue - } - if i+3 < Width { - i1 := this.Data[int32((i+1)*10+j)] - i2 := this.Data[int32((i+2)*10+j)] - i3 := this.Data[int32((i+3)*10+j)] - if i1.Itype == i2.Itype && i2.Itype == i3.Itype && i1.Itype == iType { - del[int32((i+1)*10+j)] = i1.Score - del[int32((i+2)*10+j)] = i2.Score - del[int32((i+3)*10+j)] = i3.Score - del[key] = this.Data[key].Score - - } - } - if j+3 < Height { - i1 := this.Data[int32(i*10+j+1)] - i2 := this.Data[int32(i*10+j+2)] - i3 := this.Data[int32(i*10+j+3)] - if i1.Itype == i2.Itype && i2.Itype == i3.Itype && i1.Itype == iType { - del[int32(i*10+j+1)] = i1.Score - del[int32(i*10+j+2)] = i2.Score - del[int32(i*10+j+3)] = i3.Score - del[key] = this.Data[key].Score - - } - } - } - } - // 顺着删除列表删除各组 - for k, v := range del { - this.Data[k].Itype = 0 - score += v - } - if len(del) > 0 { - bEliminate = false - fmt.Printf("4x消除格子===del:%v\n", del) - } - - return -} - -func (this *MapData) Check3X() (bEliminate bool, score int32) { - bEliminate = true - del := make(map[int32]int32) - for i := 0; i < Width; i++ { - for j := 0; j < Height; j++ { - key := int32(i*10 + j) - iType := this.GetKeyType(key) - if iType == 0 { - continue - } - - if i+2 < Width { - i1 := this.Data[int32((i+1)*10+j)] - i2 := this.Data[int32((i+2)*10+j)] - if i1.Itype == i2.Itype && i1.Itype == iType { - del[int32((i+1)*10+j)] = i1.Score - del[int32((i+2)*10+j)] = i1.Score - del[key] = i1.Score - } - } - if j+2 < Height { - i1 := this.Data[int32(i*10+j+1)] - i2 := this.Data[int32(i*10+j+2)] - if i1.Itype == i2.Itype && i1.Itype == iType { - del[int32(i*10+j+1)] = i1.Score - del[int32(i*10+j+2)] = i1.Score - del[key] = i1.Score - } - } - } - } - // 顺着删除列表删除各组 - for k, v := range del { - this.Data[k].Itype = 0 - score += v - } - if len(del) > 0 { - bEliminate = false - fmt.Printf("3x消除格子===del:%v\n", del) - } - return -} - -func (this *MapData) CheckSwape(g1, g2 int32) (bEliminate bool) { - - for i := 0; i < Width; i++ { - for j := 0; j < Height; j++ { - key := int32(i*10 + j) - iType := this.GetKeyType(key) - if iType == 0 { - continue - } - if j+2 < Height { - k1 := int32((i+1)*10 + j) - k2 := int32((i+2)*10 + j) - i1 := this.Data[k1] - i2 := this.Data[k2] - if i1.Itype == i2.Itype && i1.Itype == iType { - if g1 == key || k1 == g1 || k2 == g1 || - g2 == key || k1 == g2 || k2 == g2 { - return true - } - } - } - if i+2 < Width { - k1 := int32(i*10 + j + 1) - k2 := int32(i*10 + j + 2) - i1 := this.Data[k1] - i2 := this.Data[k2] - if i1.Itype == i2.Itype && i1.Itype == iType { - if g1 == key || k1 == g1 || k2 == g1 || - g2 == key || k1 == g2 || k2 == g2 { - return true - } - } - } - } - } - - return -} - -// 校验地图可消除的 判断各组上面2个和右边两个是否三个相等 -func (this *MapData) CheckMap() (score int32) { - score = 0 - if bRet, s := this.Check5X(); !bRet { - fmt.Printf("=====检测消除5x===========\n") - score += s - } - if bRet, s := this.Check4X(); !bRet { - fmt.Printf("=====检测消除4x===========\n") - score += s - } - if bRet, s := this.Check3X(); !bRet { - fmt.Printf("=====检测消除3x===========\n") - score += s - } - - this.Debugf() - return -} - -// 下落 生成新的格子 (返回掉落所获得的分数) -func (this *MapData) DropGirde() (score int32, szMap []*pb.MapData) { - var bDrop bool - for { - bDrop = false - for _, v := range this.Data { // 校验是否有下落 - if v.Itype == 0 { - fmt.Printf("检测有掉落\n") - bDrop = true // 有空位置 说明可以掉落 - break - } - } - if !bDrop { - break - } - for i := 0; i < Width; i++ { - for j := 0; j < Height; j++ { - key := int32(i*10 + j) - var sz []int32 - var l int // 落下多少个 - if this.GetKeyType(key) == 0 { // 找上面的 - for m := j; m < Height; m++ { - key1 := int32(i*10 + m) - t := this.GetKeyData(key1) - if t.Itype != 0 { - sz = append(sz, t.Itype) - l++ - } - } - for pos, v := range sz { - key := int32(i*10 + j + pos) - this.Data[key].Itype = v - } - - for n := j + l; n < Height; n++ { - key := int32(i*10 + n) - tmp := GetRandType() - this.Data[key].Itype = tmp - } - break // 完成该列 - } - } - } - if s := this.CheckMap(); s > 0 { - fmt.Printf("本次掉落得分:%d\n", s) - score += s - szMap = append(szMap, &pb.MapData{ - Data: this.Data, - }) - } - } - - this.Debugf() - return -} - -// func (this *MapData) AiOperator() bool { -// var ( -// bSwap bool // 能否交换 -// tmp *pb.GirdeData -// ) -// g1 := this.GetKeyData(i) -// g2 := this.GetKeyData(j) -// if g1 == nil || g2 == nil { -// return bSwap -// } -// // 校验是不是挨着的 -// if g1.X-1 == g2.X { -// bSwap = true -// } -// if g1.X+1 == g2.X { -// bSwap = true -// } -// if g1.Y+1 == g2.Y { -// bSwap = true -// } -// if g1.Y-1 == g2.Y { -// bSwap = true -// } -// // 更新地图数据 -// tmp = &pb.GirdeData{ -// X: g1.X, -// Y: g1.Y, -// Id: g1.Id, -// Itype: g1.Itype, -// } -// this.Data[i] = g2 -// this.Data[j] = tmp -// //this.Debugf() -// return bSwap -// } diff --git a/modules/jielong/configure.go b/modules/jielong/configure.go index 1c93bc9bf..8242a32b5 100644 --- a/modules/jielong/configure.go +++ b/modules/jielong/configure.go @@ -57,7 +57,7 @@ func (this *configureComp) getGameFastDataByType(itype int32) (conf map[int32]*c defer this.hlock.RUnlock() if itype == 1 { conf = this.tyep1 - } else if itype == 1 { + } else if itype == 2 { conf = this.tyep2 } if conf == nil { diff --git a/modules/user/api_login.go b/modules/user/api_login.go index 8ab106458..4c048f7a2 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -140,14 +140,14 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { event.TriggerEvent(comm.EventUserLogin, session) - this.module.ModuleFriend.ResetFriend(user.Uid) - this.module.modelSign.UserSign(session) - this.module.ModuleItems.InitItemBagData(session) - this.module.ModuleHero.CheckPeachReward(session, user.Ctime) if len(tasks) > 0 { this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...) } if firstLogin { + this.module.ModuleFriend.ResetFriend(user.Uid) + this.module.modelSign.UserSign(session) + this.module.ModuleHero.CheckPeachReward(session, user.Ctime) + this.module.ModuleItems.InitItemBagData(session) this.module.ModulePrivilege.CheckDailyPrivilegeMail(session) // 检查月卡每日邮件奖励发放 } }) diff --git a/pb/entertain_db.pb.go b/pb/entertain_db.pb.go index 1281c8f6a..3d5be19aa 100644 --- a/pb/entertain_db.pb.go +++ b/pb/entertain_db.pb.go @@ -26,7 +26,8 @@ type MapData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data map[int32]*GirdeData `protobuf:"bytes,1,rep,name=data,proto3" json:"data" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 地图数据 + Data []*GirdeData `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` // 地图数据 + CurSocre int32 `protobuf:"varint,2,opt,name=curSocre,proto3" json:"curSocre"` // 本轮得分 } func (x *MapData) Reset() { @@ -61,25 +62,31 @@ func (*MapData) Descriptor() ([]byte, []int) { return file_entertain_entertain_db_proto_rawDescGZIP(), []int{0} } -func (x *MapData) GetData() map[int32]*GirdeData { +func (x *MapData) GetData() []*GirdeData { if x != nil { return x.Data } return nil } +func (x *MapData) GetCurSocre() int32 { + if x != nil { + return x.CurSocre + } + return 0 +} + // 消消乐 type GirdeData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x"` - Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y"` - Id int32 `protobuf:"varint,3,opt,name=id,proto3" json:"id"` - Itype int32 `protobuf:"varint,4,opt,name=itype,proto3" json:"itype"` // 对应配置表color - Cid int32 `protobuf:"varint,5,opt,name=cid,proto3" json:"cid"` // 配置表id - Score int32 `protobuf:"varint,7,opt,name=score,proto3" json:"score"` // 对应的积分 + Oid int32 `protobuf:"varint,1,opt,name=oid,proto3" json:"oid"` // 唯一id + Color int32 `protobuf:"varint,2,opt,name=color,proto3" json:"color"` // + Cid int32 `protobuf:"varint,3,opt,name=cid,proto3" json:"cid"` // 配置表id + Score int32 `protobuf:"varint,4,opt,name=score,proto3" json:"score"` // 对应的积分 + Special int32 `protobuf:"varint,5,opt,name=special,proto3" json:"special"` // 消除特效: 1 消除这一列所有方块 2 消除这一行所有方块 } func (x *GirdeData) Reset() { @@ -114,30 +121,16 @@ func (*GirdeData) Descriptor() ([]byte, []int) { return file_entertain_entertain_db_proto_rawDescGZIP(), []int{1} } -func (x *GirdeData) GetX() int32 { +func (x *GirdeData) GetOid() int32 { if x != nil { - return x.X + return x.Oid } return 0 } -func (x *GirdeData) GetY() int32 { +func (x *GirdeData) GetColor() int32 { if x != nil { - return x.Y - } - return 0 -} - -func (x *GirdeData) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *GirdeData) GetItype() int32 { - if x != nil { - return x.Itype + return x.Color } return 0 } @@ -156,6 +149,13 @@ func (x *GirdeData) GetScore() int32 { return 0 } +func (x *GirdeData) GetSpecial() int32 { + if x != nil { + return x.Special + } + return 0 +} + type PlayerData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -239,30 +239,27 @@ var File_entertain_entertain_db_proto protoreflect.FileDescriptor var file_entertain_entertain_db_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x6e, 0x74, 0x65, - 0x72, 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x76, - 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, - 0x61, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x1a, 0x43, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0a, 0x2e, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x75, 0x0a, 0x09, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44, - 0x61, 0x74, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, - 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x70, 0x0a, - 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, - 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x42, - 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x45, + 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x75, 0x72, + 0x53, 0x6f, 0x63, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x75, 0x72, + 0x53, 0x6f, 0x63, 0x72, 0x65, 0x22, 0x75, 0x0a, 0x09, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44, 0x61, + 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x03, 0x6f, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, + 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x22, 0x70, 0x0a, 0x0a, + 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -277,21 +274,19 @@ func file_entertain_entertain_db_proto_rawDescGZIP() []byte { return file_entertain_entertain_db_proto_rawDescData } -var file_entertain_entertain_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_entertain_entertain_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_entertain_entertain_db_proto_goTypes = []interface{}{ (*MapData)(nil), // 0: MapData (*GirdeData)(nil), // 1: GirdeData (*PlayerData)(nil), // 2: PlayerData - nil, // 3: MapData.DataEntry } var file_entertain_entertain_db_proto_depIdxs = []int32{ - 3, // 0: MapData.data:type_name -> MapData.DataEntry - 1, // 1: MapData.DataEntry.value:type_name -> GirdeData - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 1, // 0: MapData.data:type_name -> GirdeData + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_entertain_entertain_db_proto_init() } @@ -343,7 +338,7 @@ func file_entertain_entertain_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_entertain_entertain_db_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/entertain_msg.pb.go b/pb/entertain_msg.pb.go index 5b5217bdb..a07ffc2d3 100644 --- a/pb/entertain_msg.pb.go +++ b/pb/entertain_msg.pb.go @@ -76,6 +76,7 @@ type EntertainMatchResp struct { Maych bool `protobuf:"varint,1,opt,name=maych,proto3" json:"maych"` // 匹配成功 Player *PlayerData `protobuf:"bytes,2,opt,name=player,proto3" json:"player"` // 玩家信息 + Roomid string `protobuf:"bytes,3,opt,name=roomid,proto3" json:"roomid"` // 房间id } func (x *EntertainMatchResp) Reset() { @@ -124,6 +125,108 @@ func (x *EntertainMatchResp) GetPlayer() *PlayerData { return nil } +func (x *EntertainMatchResp) GetRoomid() string { + if x != nil { + return x.Roomid + } + return "" +} + +// 进入场景发送准备 +type EntertainReadyReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Roomid string `protobuf:"bytes,1,opt,name=roomid,proto3" json:"roomid"` // 房间id +} + +func (x *EntertainReadyReq) Reset() { + *x = EntertainReadyReq{} + if protoimpl.UnsafeEnabled { + mi := &file_entertain_entertain_msg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EntertainReadyReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntertainReadyReq) ProtoMessage() {} + +func (x *EntertainReadyReq) ProtoReflect() protoreflect.Message { + mi := &file_entertain_entertain_msg_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EntertainReadyReq.ProtoReflect.Descriptor instead. +func (*EntertainReadyReq) Descriptor() ([]byte, []int) { + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{2} +} + +func (x *EntertainReadyReq) GetRoomid() string { + if x != nil { + return x.Roomid + } + return "" +} + +type EntertainReadyResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ready bool `protobuf:"varint,1,opt,name=ready,proto3" json:"ready"` // 对家是否准备完成 +} + +func (x *EntertainReadyResp) Reset() { + *x = EntertainReadyResp{} + if protoimpl.UnsafeEnabled { + mi := &file_entertain_entertain_msg_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EntertainReadyResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntertainReadyResp) ProtoMessage() {} + +func (x *EntertainReadyResp) ProtoReflect() protoreflect.Message { + mi := &file_entertain_entertain_msg_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EntertainReadyResp.ProtoReflect.Descriptor instead. +func (*EntertainReadyResp) Descriptor() ([]byte, []int) { + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{3} +} + +func (x *EntertainReadyResp) GetReady() bool { + if x != nil { + return x.Ready + } + return false +} + // 游戏开始 type EntertainStartGamePush struct { state protoimpl.MessageState @@ -135,12 +238,13 @@ type EntertainStartGamePush struct { Mpadata *MapData `protobuf:"bytes,3,opt,name=mpadata,proto3" json:"mpadata"` // 地图数据 Power string `protobuf:"bytes,4,opt,name=power,proto3" json:"power"` // 操作权 Round int32 `protobuf:"varint,5,opt,name=round,proto3" json:"round"` // 回合数 + Roomid string `protobuf:"bytes,6,opt,name=roomid,proto3" json:"roomid"` // 房间id } func (x *EntertainStartGamePush) Reset() { *x = EntertainStartGamePush{} if protoimpl.UnsafeEnabled { - mi := &file_entertain_entertain_msg_proto_msgTypes[2] + mi := &file_entertain_entertain_msg_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -153,7 +257,7 @@ func (x *EntertainStartGamePush) String() string { func (*EntertainStartGamePush) ProtoMessage() {} func (x *EntertainStartGamePush) ProtoReflect() protoreflect.Message { - mi := &file_entertain_entertain_msg_proto_msgTypes[2] + mi := &file_entertain_entertain_msg_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -166,7 +270,7 @@ func (x *EntertainStartGamePush) ProtoReflect() protoreflect.Message { // Deprecated: Use EntertainStartGamePush.ProtoReflect.Descriptor instead. func (*EntertainStartGamePush) Descriptor() ([]byte, []int) { - return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{2} + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{4} } func (x *EntertainStartGamePush) GetUser1() *PlayerData { @@ -204,6 +308,13 @@ func (x *EntertainStartGamePush) GetRound() int32 { return 0 } +func (x *EntertainStartGamePush) GetRoomid() string { + if x != nil { + return x.Roomid + } + return "" +} + // 操作 type EntertainOperatorReq struct { state protoimpl.MessageState @@ -219,7 +330,7 @@ type EntertainOperatorReq struct { func (x *EntertainOperatorReq) Reset() { *x = EntertainOperatorReq{} if protoimpl.UnsafeEnabled { - mi := &file_entertain_entertain_msg_proto_msgTypes[3] + mi := &file_entertain_entertain_msg_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -232,7 +343,7 @@ func (x *EntertainOperatorReq) String() string { func (*EntertainOperatorReq) ProtoMessage() {} func (x *EntertainOperatorReq) ProtoReflect() protoreflect.Message { - mi := &file_entertain_entertain_msg_proto_msgTypes[3] + mi := &file_entertain_entertain_msg_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -245,7 +356,7 @@ func (x *EntertainOperatorReq) ProtoReflect() protoreflect.Message { // Deprecated: Use EntertainOperatorReq.ProtoReflect.Descriptor instead. func (*EntertainOperatorReq) Descriptor() ([]byte, []int) { - return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{3} + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{5} } func (x *EntertainOperatorReq) GetRoomid() string { @@ -288,7 +399,7 @@ type EntertainOperatorResp struct { func (x *EntertainOperatorResp) Reset() { *x = EntertainOperatorResp{} if protoimpl.UnsafeEnabled { - mi := &file_entertain_entertain_msg_proto_msgTypes[4] + mi := &file_entertain_entertain_msg_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -301,7 +412,7 @@ func (x *EntertainOperatorResp) String() string { func (*EntertainOperatorResp) ProtoMessage() {} func (x *EntertainOperatorResp) ProtoReflect() protoreflect.Message { - mi := &file_entertain_entertain_msg_proto_msgTypes[4] + mi := &file_entertain_entertain_msg_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -314,7 +425,7 @@ func (x *EntertainOperatorResp) ProtoReflect() protoreflect.Message { // Deprecated: Use EntertainOperatorResp.ProtoReflect.Descriptor instead. func (*EntertainOperatorResp) Descriptor() ([]byte, []int) { - return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{4} + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{6} } func (x *EntertainOperatorResp) GetSuccess() bool { @@ -330,16 +441,18 @@ type EntertainOperatorRstPush struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Mpadata []*MapData `protobuf:"bytes,1,rep,name=mpadata,proto3" json:"mpadata"` // 地图数据 - Power string `protobuf:"bytes,2,opt,name=power,proto3" json:"power"` // 该谁操作了 - Score int32 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` // 获得积分 - Round int32 `protobuf:"varint,4,opt,name=round,proto3" json:"round"` // 轮数 + Mpadata []*MapData `protobuf:"bytes,1,rep,name=mpadata,proto3" json:"mpadata"` // 地图数据 + Power string `protobuf:"bytes,2,opt,name=power,proto3" json:"power"` // 该谁操作了 + Score int32 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` // 获得积分 + Round int32 `protobuf:"varint,4,opt,name=round,proto3" json:"round"` // 轮数 + User1 *PlayerData `protobuf:"bytes,5,opt,name=user1,proto3" json:"user1"` // 玩家数据也需要同步 + User2 *PlayerData `protobuf:"bytes,6,opt,name=user2,proto3" json:"user2"` } func (x *EntertainOperatorRstPush) Reset() { *x = EntertainOperatorRstPush{} if protoimpl.UnsafeEnabled { - mi := &file_entertain_entertain_msg_proto_msgTypes[5] + mi := &file_entertain_entertain_msg_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -352,7 +465,7 @@ func (x *EntertainOperatorRstPush) String() string { func (*EntertainOperatorRstPush) ProtoMessage() {} func (x *EntertainOperatorRstPush) ProtoReflect() protoreflect.Message { - mi := &file_entertain_entertain_msg_proto_msgTypes[5] + mi := &file_entertain_entertain_msg_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -365,7 +478,7 @@ func (x *EntertainOperatorRstPush) ProtoReflect() protoreflect.Message { // Deprecated: Use EntertainOperatorRstPush.ProtoReflect.Descriptor instead. func (*EntertainOperatorRstPush) Descriptor() ([]byte, []int) { - return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{5} + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{7} } func (x *EntertainOperatorRstPush) GetMpadata() []*MapData { @@ -396,6 +509,20 @@ func (x *EntertainOperatorRstPush) GetRound() int32 { return 0 } +func (x *EntertainOperatorRstPush) GetUser1() *PlayerData { + if x != nil { + return x.User1 + } + return nil +} + +func (x *EntertainOperatorRstPush) GetUser2() *PlayerData { + if x != nil { + return x.User2 + } + return nil +} + // 游戏结束推送 type EntertainGameOverPush struct { state protoimpl.MessageState @@ -412,7 +539,7 @@ type EntertainGameOverPush struct { func (x *EntertainGameOverPush) Reset() { *x = EntertainGameOverPush{} if protoimpl.UnsafeEnabled { - mi := &file_entertain_entertain_msg_proto_msgTypes[6] + mi := &file_entertain_entertain_msg_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -425,7 +552,7 @@ func (x *EntertainGameOverPush) String() string { func (*EntertainGameOverPush) ProtoMessage() {} func (x *EntertainGameOverPush) ProtoReflect() protoreflect.Message { - mi := &file_entertain_entertain_msg_proto_msgTypes[6] + mi := &file_entertain_entertain_msg_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -438,7 +565,7 @@ func (x *EntertainGameOverPush) ProtoReflect() protoreflect.Message { // Deprecated: Use EntertainGameOverPush.ProtoReflect.Descriptor instead. func (*EntertainGameOverPush) Descriptor() ([]byte, []int) { - return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{6} + return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{8} } func (x *EntertainGameOverPush) GetUser1() *PlayerData { @@ -485,54 +612,67 @@ var file_entertain_entertain_msg_proto_rawDesc = []byte{ 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x11, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0x4f, 0x0a, 0x12, 0x45, 0x6e, + 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0x67, 0x0a, 0x12, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x79, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x61, 0x79, 0x63, 0x68, 0x12, 0x23, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, - 0x61, 0x74, 0x61, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x22, 0xae, 0x01, 0x0a, 0x16, - 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x47, 0x61, - 0x6d, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, - 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, - 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, - 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x76, 0x0a, 0x14, - 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, - 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x74, 0x65, - 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x73, 0x74, - 0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, - 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x45, - 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, - 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, - 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, - 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, - 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x74, 0x61, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, + 0x6d, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x11, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, + 0x52, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, + 0x22, 0x2a, 0x0a, 0x12, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x61, + 0x64, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x22, 0xc6, 0x01, 0x0a, + 0x16, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x47, + 0x61, 0x6d, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, + 0x65, 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, + 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, + 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x22, 0x76, 0x0a, 0x14, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, + 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, + 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, + 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x75, 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x75, 0x72, 0x69, + 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x64, 0x22, 0x31, 0x0a, + 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x22, 0xc6, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x73, 0x74, 0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a, + 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, + 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, + 0x75, 0x6e, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x45, 0x6e, + 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x50, + 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, + 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, + 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, + 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -547,32 +687,36 @@ func file_entertain_entertain_msg_proto_rawDescGZIP() []byte { return file_entertain_entertain_msg_proto_rawDescData } -var file_entertain_entertain_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_entertain_entertain_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_entertain_entertain_msg_proto_goTypes = []interface{}{ (*EntertainMatchReq)(nil), // 0: EntertainMatchReq (*EntertainMatchResp)(nil), // 1: EntertainMatchResp - (*EntertainStartGamePush)(nil), // 2: EntertainStartGamePush - (*EntertainOperatorReq)(nil), // 3: EntertainOperatorReq - (*EntertainOperatorResp)(nil), // 4: EntertainOperatorResp - (*EntertainOperatorRstPush)(nil), // 5: EntertainOperatorRstPush - (*EntertainGameOverPush)(nil), // 6: EntertainGameOverPush - (*PlayerData)(nil), // 7: PlayerData - (*MapData)(nil), // 8: MapData + (*EntertainReadyReq)(nil), // 2: EntertainReadyReq + (*EntertainReadyResp)(nil), // 3: EntertainReadyResp + (*EntertainStartGamePush)(nil), // 4: EntertainStartGamePush + (*EntertainOperatorReq)(nil), // 5: EntertainOperatorReq + (*EntertainOperatorResp)(nil), // 6: EntertainOperatorResp + (*EntertainOperatorRstPush)(nil), // 7: EntertainOperatorRstPush + (*EntertainGameOverPush)(nil), // 8: EntertainGameOverPush + (*PlayerData)(nil), // 9: PlayerData + (*MapData)(nil), // 10: MapData } var file_entertain_entertain_msg_proto_depIdxs = []int32{ - 7, // 0: EntertainMatchResp.player:type_name -> PlayerData - 7, // 1: EntertainStartGamePush.user1:type_name -> PlayerData - 7, // 2: EntertainStartGamePush.user2:type_name -> PlayerData - 8, // 3: EntertainStartGamePush.mpadata:type_name -> MapData - 8, // 4: EntertainOperatorRstPush.mpadata:type_name -> MapData - 7, // 5: EntertainGameOverPush.user1:type_name -> PlayerData - 7, // 6: EntertainGameOverPush.user2:type_name -> PlayerData - 8, // 7: EntertainGameOverPush.mpadata:type_name -> MapData - 8, // [8:8] is the sub-list for method output_type - 8, // [8:8] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 9, // 0: EntertainMatchResp.player:type_name -> PlayerData + 9, // 1: EntertainStartGamePush.user1:type_name -> PlayerData + 9, // 2: EntertainStartGamePush.user2:type_name -> PlayerData + 10, // 3: EntertainStartGamePush.mpadata:type_name -> MapData + 10, // 4: EntertainOperatorRstPush.mpadata:type_name -> MapData + 9, // 5: EntertainOperatorRstPush.user1:type_name -> PlayerData + 9, // 6: EntertainOperatorRstPush.user2:type_name -> PlayerData + 9, // 7: EntertainGameOverPush.user1:type_name -> PlayerData + 9, // 8: EntertainGameOverPush.user2:type_name -> PlayerData + 10, // 9: EntertainGameOverPush.mpadata:type_name -> MapData + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_entertain_entertain_msg_proto_init() } @@ -607,7 +751,7 @@ func file_entertain_entertain_msg_proto_init() { } } file_entertain_entertain_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EntertainStartGamePush); i { + switch v := v.(*EntertainReadyReq); i { case 0: return &v.state case 1: @@ -619,7 +763,7 @@ func file_entertain_entertain_msg_proto_init() { } } file_entertain_entertain_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EntertainOperatorReq); i { + switch v := v.(*EntertainReadyResp); i { case 0: return &v.state case 1: @@ -631,7 +775,7 @@ func file_entertain_entertain_msg_proto_init() { } } file_entertain_entertain_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EntertainOperatorResp); i { + switch v := v.(*EntertainStartGamePush); i { case 0: return &v.state case 1: @@ -643,7 +787,7 @@ func file_entertain_entertain_msg_proto_init() { } } file_entertain_entertain_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EntertainOperatorRstPush); i { + switch v := v.(*EntertainOperatorReq); i { case 0: return &v.state case 1: @@ -655,6 +799,30 @@ func file_entertain_entertain_msg_proto_init() { } } file_entertain_entertain_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EntertainOperatorResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entertain_entertain_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EntertainOperatorRstPush); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entertain_entertain_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EntertainGameOverPush); i { case 0: return &v.state @@ -673,7 +841,7 @@ func file_entertain_entertain_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_entertain_entertain_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 0, },