xxl 优化+测试

This commit is contained in:
meixiongfeng 2023-10-19 22:12:58 +08:00
parent c1c2790ddd
commit 236875a380
10 changed files with 736 additions and 654 deletions

View File

@ -112,7 +112,7 @@ const (
ModuleVenture core.M_Modules = "venture" //7日签到 ModuleVenture core.M_Modules = "venture" //7日签到
ModuleAchieve core.M_Modules = "achieve" //全局成就 ModuleAchieve core.M_Modules = "achieve" //全局成就
ModuleJielong core.M_Modules = "jielong" //接龙 ModuleJielong core.M_Modules = "jielong" //接龙
ModuleEntertainment core.M_Modules = "entertainment" //消消乐 ModuleEntertainment core.M_Modules = "entertain" //消消乐
ModuleDcolor core.M_Modules = "dcolor" //猜颜色 ModuleDcolor core.M_Modules = "dcolor" //猜颜色
) )

View File

@ -24,37 +24,42 @@ func (this *apiComp) Match(session comm.IUserSession, req *pb.EntertainMatchReq)
s2 comm.IUserSession s2 comm.IUserSession
p1 *pb.PlayerData // 玩家1 p1 *pb.PlayerData // 玩家1
p2 *pb.PlayerData // 玩家2 p2 *pb.PlayerData // 玩家2
roomid string
) )
if users, err := this.module.ModuleUser.UserOnlineList(); err == nil { // 暂时只做机器人
if len(users) > 0 { if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil {
bMatch = true if len(robots) > 0 {
s2, bMatch = this.module.GetUserSession(users[0].Uid)
p2 = &pb.PlayerData{ p2 = &pb.PlayerData{
Uid: s2.GetUserId(), Uid: "999", // AI uid 暂定
Name: "", Name: robots[0].Name,
Score: 0, Score: 0,
Ps: 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 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{ session.SendMsg(string(this.module.GetType()), "match", &pb.EntertainMatchResp{
Maych: bMatch, Maych: bMatch,
Player: p2, Player: p2,
Roomid: roomid,
}) })
return return
} }

View File

@ -0,0 +1,24 @@
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)
return
}

View File

@ -28,13 +28,14 @@ func (this *gameMgrComp) Init(service core.IService, module core.IModule, comp c
return 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 := new(Room) //初始化房间
room.InitRoom(this.module, s1, s2, p1, p2) room.InitRoom(this.module, s1, s2, p1, p2)
this.lock.Lock() this.lock.Lock()
this.rooms[room.Id] = room this.rooms[room.Id] = room
this.lock.Unlock() this.lock.Unlock()
return room.Id
} }
func (this *gameMgrComp) CloseRoom(id string) { func (this *gameMgrComp) CloseRoom(id string) {

View File

@ -5,7 +5,6 @@ import (
"go_dreamfactory/lego/sys/timewheel" "go_dreamfactory/lego/sys/timewheel"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"time" "time"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
@ -48,18 +47,18 @@ func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) {
this.GameOver() this.GameOver()
} }
this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) // 开启新的定时器 this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) // 开启新的定时器
this.module.Debugf("超时%d", configure.Now().Unix()) //this.module.Debugf("超时%d", configure.Now().Unix())
} }
func (this *Room) InitRoom(module *Entertainment, s1 comm.IUserSession, s2 comm.IUserSession, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room { 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 = new(MapData)
this.chessboard.InitMap() // 初始化棋盘 this.chessboard.InitMap() // 初始化棋盘
defer this.StartGame()
this.szSession = append(this.szSession, s1) this.szSession = append(this.szSession, s1)
if p2.Uid != "" { // 是否是机器人 if p2.Uid != "" { // 是否是机器人
this.szSession = append(this.szSession, s2) this.szSession = append(this.szSession, s2)
} }
this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut)
return &Room{ return &Room{
ModuleBase: modules.ModuleBase{}, ModuleBase: modules.ModuleBase{},
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
@ -102,18 +101,21 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
} else { // err 未知权限 } else { // err 未知权限
return return
} }
// 交换元素 // 交换元素
this.chessboard.SwapGirde(req.Curid, req.Targetid) // 交换格子 this.chessboard.SwapGirde(req.Curid, req.Targetid) // 交换格子
szMap = append(szMap, &pb.MapData{ szMap = append(szMap, &pb.MapData{
Data: this.chessboard.Data, Data: this.chessboard.Plat,
}) })
this.chessboard.CheckMap() this.chessboard.CheckMap()
if score, m := this.chessboard.DropGirde(); score > 0 { if score, m := this.chessboard.DropGirde(); score > 0 {
curScore += score curScore += score
szMap = append(szMap, m...) szMap = append(szMap, m...)
} }
// 开启新的定时器
if this.operatetimer != nil {
timewheel.Remove(this.operatetimer)
}
this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) // 开启新的定时器
// 操作消息返回 // 操作消息返回
session.SendMsg(string(this.module.GetType()), "operator", &pb.EntertainOperatorResp{ session.SendMsg(string(this.module.GetType()), "operator", &pb.EntertainOperatorResp{
Success: true, Success: true,
@ -128,6 +130,9 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
}, this.szSession...); err != nil { }, this.szSession...); err != nil {
this.Errorln(err) this.Errorln(err)
} }
case "ready":
this.StartGame()
this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut)
} }
return return
@ -144,10 +149,10 @@ func (this *Room) Opertor(uid string, iType int32, old int32, new int32) (errdat
func (this *Room) StartGame() (errdata *pb.ErrorData) { func (this *Room) StartGame() (errdata *pb.ErrorData) {
if err := this.SendMsgToSession(string(this.module.GetType()), "startgame", &pb.EntertainStartGamePush{ if err := this.SendMsgToSession(string(this.module.GetType()), "startgame", &pb.EntertainStartGamePush{
User1: this.player1, User1: this.player1,
User2: this.player2, User2: this.player2,
Mpadata: &pb.MapData{ Mpadata: &pb.MapData{
Data: this.chessboard.Data, //Data: this.chessboard.Data,
}, },
Power: this.power, Power: this.power,
Round: this.round, Round: this.round,
@ -161,10 +166,10 @@ func (this *Room) StartGame() (errdata *pb.ErrorData) {
func (this *Room) GameOver() (errdata *pb.ErrorData) { func (this *Room) GameOver() (errdata *pb.ErrorData) {
this.SendMsgToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{ this.SendMsgToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{
User1: this.player1, User1: this.player1,
User2: this.player2, User2: this.player2,
Mpadata: &pb.MapData{ Mpadata: &pb.MapData{
Data: this.chessboard.Data, //Data: this.chessboard.Data,
}, },
Power: "", Power: "",
Round: this.round, Round: this.round,

View File

@ -0,0 +1,384 @@
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 // 能否交换
)
if oldId+1 < Total && oldId+1 == newId ||
oldId%Height > 0 && oldId%Height == 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, 0, 5, 1, 5, 2,
3, 1, 5, 4, 2, 4, 4,
4, 4, 0, 1, 6, 4, 1,
6, 3, 1, 1, 3, 6, 3,
6, 3, 0, 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
}
// 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) {
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
}
}
}
szMap = append(szMap, &pb.MapData{
Data: this.Plat,
})
this.Debugf()
return
}

View File

@ -71,7 +71,11 @@ func Test_Main(t *testing.T) {
m := new(entertainment.MapData) m := new(entertainment.MapData)
m.InitMap() m.InitMap()
m.SetMap()
m.SwapGirde(1, 8)
m.DropGirde()
m.CheckMap()
m.SwapGirde(1, 11) m.SwapGirde(1, 11)
fmt.Printf("得分:%d\n", m.CheckMap()) fmt.Printf("得分:%d\n", m.CheckMap())
m.DropGirde() m.DropGirde()

View File

@ -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
// }

View File

@ -26,7 +26,7 @@ type MapData struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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"` // 地图数据
} }
func (x *MapData) Reset() { func (x *MapData) Reset() {
@ -61,7 +61,7 @@ func (*MapData) Descriptor() ([]byte, []int) {
return file_entertain_entertain_db_proto_rawDescGZIP(), []int{0} return file_entertain_entertain_db_proto_rawDescGZIP(), []int{0}
} }
func (x *MapData) GetData() map[int32]*GirdeData { func (x *MapData) GetData() []*GirdeData {
if x != nil { if x != nil {
return x.Data return x.Data
} }
@ -74,12 +74,11 @@ type GirdeData struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x"` Oid int32 `protobuf:"varint,1,opt,name=oid,proto3" json:"oid"` // 唯一id
Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y"` Color int32 `protobuf:"varint,2,opt,name=color,proto3" json:"color"` //
Id int32 `protobuf:"varint,3,opt,name=id,proto3" json:"id"` Cid int32 `protobuf:"varint,3,opt,name=cid,proto3" json:"cid"` // 配置表id
Itype int32 `protobuf:"varint,4,opt,name=itype,proto3" json:"itype"` // 对应配置表color Score int32 `protobuf:"varint,4,opt,name=score,proto3" json:"score"` // 对应的积分
Cid int32 `protobuf:"varint,5,opt,name=cid,proto3" json:"cid"` // 配置表id Special int32 `protobuf:"varint,5,opt,name=special,proto3" json:"special"` // 消除特效: 1 消除这一列所有方块 2 消除这一行所有方块
Score int32 `protobuf:"varint,7,opt,name=score,proto3" json:"score"` // 对应的积分
} }
func (x *GirdeData) Reset() { func (x *GirdeData) Reset() {
@ -114,30 +113,16 @@ func (*GirdeData) Descriptor() ([]byte, []int) {
return file_entertain_entertain_db_proto_rawDescGZIP(), []int{1} return file_entertain_entertain_db_proto_rawDescGZIP(), []int{1}
} }
func (x *GirdeData) GetX() int32 { func (x *GirdeData) GetOid() int32 {
if x != nil { if x != nil {
return x.X return x.Oid
} }
return 0 return 0
} }
func (x *GirdeData) GetY() int32 { func (x *GirdeData) GetColor() int32 {
if x != nil { if x != nil {
return x.Y return x.Color
}
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 0 return 0
} }
@ -156,6 +141,13 @@ func (x *GirdeData) GetScore() int32 {
return 0 return 0
} }
func (x *GirdeData) GetSpecial() int32 {
if x != nil {
return x.Special
}
return 0
}
type PlayerData struct { type PlayerData struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -239,30 +231,26 @@ var File_entertain_entertain_db_proto protoreflect.FileDescriptor
var file_entertain_entertain_db_proto_rawDesc = []byte{ var file_entertain_entertain_db_proto_rawDesc = []byte{
0x0a, 0x1c, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x6e, 0x74, 0x65, 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, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29,
0x0a, 0x07, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44,
0x61, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x75, 0x0a, 0x09, 0x47, 0x69, 0x72,
0x61, 0x1a, 0x43, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6f, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f,
0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x10,
0x0a, 0x2e, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x75, 0x0a, 0x09, 0x47, 0x69, 0x72, 0x64, 0x65, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
0x61, 0x74, 0x61, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61,
0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x12, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x70, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10,
0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20,
0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x70, 0x0a, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x73,
0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x72, 0x64, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x72, 0x64,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x6f, 0x33,
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 ( var (
@ -277,21 +265,19 @@ func file_entertain_entertain_db_proto_rawDescGZIP() []byte {
return file_entertain_entertain_db_proto_rawDescData 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{}{ var file_entertain_entertain_db_proto_goTypes = []interface{}{
(*MapData)(nil), // 0: MapData (*MapData)(nil), // 0: MapData
(*GirdeData)(nil), // 1: GirdeData (*GirdeData)(nil), // 1: GirdeData
(*PlayerData)(nil), // 2: PlayerData (*PlayerData)(nil), // 2: PlayerData
nil, // 3: MapData.DataEntry
} }
var file_entertain_entertain_db_proto_depIdxs = []int32{ var file_entertain_entertain_db_proto_depIdxs = []int32{
3, // 0: MapData.data:type_name -> MapData.DataEntry 1, // 0: MapData.data:type_name -> GirdeData
1, // 1: MapData.DataEntry.value:type_name -> GirdeData 1, // [1:1] is the sub-list for method output_type
2, // [2:2] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type
2, // [2:2] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee
2, // [2:2] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name
0, // [0:2] is the sub-list for field type_name
} }
func init() { file_entertain_entertain_db_proto_init() } func init() { file_entertain_entertain_db_proto_init() }
@ -343,7 +329,7 @@ func file_entertain_entertain_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_entertain_entertain_db_proto_rawDesc, RawDescriptor: file_entertain_entertain_db_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 4, NumMessages: 3,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -76,6 +76,7 @@ type EntertainMatchResp struct {
Maych bool `protobuf:"varint,1,opt,name=maych,proto3" json:"maych"` // 匹配成功 Maych bool `protobuf:"varint,1,opt,name=maych,proto3" json:"maych"` // 匹配成功
Player *PlayerData `protobuf:"bytes,2,opt,name=player,proto3" json:"player"` // 玩家信息 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() { func (x *EntertainMatchResp) Reset() {
@ -124,6 +125,108 @@ func (x *EntertainMatchResp) GetPlayer() *PlayerData {
return nil 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 { type EntertainStartGamePush struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -135,12 +238,13 @@ type EntertainStartGamePush struct {
Mpadata *MapData `protobuf:"bytes,3,opt,name=mpadata,proto3" json:"mpadata"` // 地图数据 Mpadata *MapData `protobuf:"bytes,3,opt,name=mpadata,proto3" json:"mpadata"` // 地图数据
Power string `protobuf:"bytes,4,opt,name=power,proto3" json:"power"` // 操作权 Power string `protobuf:"bytes,4,opt,name=power,proto3" json:"power"` // 操作权
Round int32 `protobuf:"varint,5,opt,name=round,proto3" json:"round"` // 回合数 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() { func (x *EntertainStartGamePush) Reset() {
*x = EntertainStartGamePush{} *x = EntertainStartGamePush{}
if protoimpl.UnsafeEnabled { 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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -153,7 +257,7 @@ func (x *EntertainStartGamePush) String() string {
func (*EntertainStartGamePush) ProtoMessage() {} func (*EntertainStartGamePush) ProtoMessage() {}
func (x *EntertainStartGamePush) ProtoReflect() protoreflect.Message { 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 { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -166,7 +270,7 @@ func (x *EntertainStartGamePush) ProtoReflect() protoreflect.Message {
// Deprecated: Use EntertainStartGamePush.ProtoReflect.Descriptor instead. // Deprecated: Use EntertainStartGamePush.ProtoReflect.Descriptor instead.
func (*EntertainStartGamePush) Descriptor() ([]byte, []int) { 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 { func (x *EntertainStartGamePush) GetUser1() *PlayerData {
@ -204,6 +308,13 @@ func (x *EntertainStartGamePush) GetRound() int32 {
return 0 return 0
} }
func (x *EntertainStartGamePush) GetRoomid() string {
if x != nil {
return x.Roomid
}
return ""
}
// 操作 // 操作
type EntertainOperatorReq struct { type EntertainOperatorReq struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -219,7 +330,7 @@ type EntertainOperatorReq struct {
func (x *EntertainOperatorReq) Reset() { func (x *EntertainOperatorReq) Reset() {
*x = EntertainOperatorReq{} *x = EntertainOperatorReq{}
if protoimpl.UnsafeEnabled { 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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -232,7 +343,7 @@ func (x *EntertainOperatorReq) String() string {
func (*EntertainOperatorReq) ProtoMessage() {} func (*EntertainOperatorReq) ProtoMessage() {}
func (x *EntertainOperatorReq) ProtoReflect() protoreflect.Message { 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 { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -245,7 +356,7 @@ func (x *EntertainOperatorReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use EntertainOperatorReq.ProtoReflect.Descriptor instead. // Deprecated: Use EntertainOperatorReq.ProtoReflect.Descriptor instead.
func (*EntertainOperatorReq) Descriptor() ([]byte, []int) { 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 { func (x *EntertainOperatorReq) GetRoomid() string {
@ -288,7 +399,7 @@ type EntertainOperatorResp struct {
func (x *EntertainOperatorResp) Reset() { func (x *EntertainOperatorResp) Reset() {
*x = EntertainOperatorResp{} *x = EntertainOperatorResp{}
if protoimpl.UnsafeEnabled { 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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -301,7 +412,7 @@ func (x *EntertainOperatorResp) String() string {
func (*EntertainOperatorResp) ProtoMessage() {} func (*EntertainOperatorResp) ProtoMessage() {}
func (x *EntertainOperatorResp) ProtoReflect() protoreflect.Message { 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 { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -314,7 +425,7 @@ func (x *EntertainOperatorResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use EntertainOperatorResp.ProtoReflect.Descriptor instead. // Deprecated: Use EntertainOperatorResp.ProtoReflect.Descriptor instead.
func (*EntertainOperatorResp) Descriptor() ([]byte, []int) { 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 { func (x *EntertainOperatorResp) GetSuccess() bool {
@ -339,7 +450,7 @@ type EntertainOperatorRstPush struct {
func (x *EntertainOperatorRstPush) Reset() { func (x *EntertainOperatorRstPush) Reset() {
*x = EntertainOperatorRstPush{} *x = EntertainOperatorRstPush{}
if protoimpl.UnsafeEnabled { 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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -352,7 +463,7 @@ func (x *EntertainOperatorRstPush) String() string {
func (*EntertainOperatorRstPush) ProtoMessage() {} func (*EntertainOperatorRstPush) ProtoMessage() {}
func (x *EntertainOperatorRstPush) ProtoReflect() protoreflect.Message { 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 { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -365,7 +476,7 @@ func (x *EntertainOperatorRstPush) ProtoReflect() protoreflect.Message {
// Deprecated: Use EntertainOperatorRstPush.ProtoReflect.Descriptor instead. // Deprecated: Use EntertainOperatorRstPush.ProtoReflect.Descriptor instead.
func (*EntertainOperatorRstPush) Descriptor() ([]byte, []int) { 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 { func (x *EntertainOperatorRstPush) GetMpadata() []*MapData {
@ -412,7 +523,7 @@ type EntertainGameOverPush struct {
func (x *EntertainGameOverPush) Reset() { func (x *EntertainGameOverPush) Reset() {
*x = EntertainGameOverPush{} *x = EntertainGameOverPush{}
if protoimpl.UnsafeEnabled { 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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -425,7 +536,7 @@ func (x *EntertainGameOverPush) String() string {
func (*EntertainGameOverPush) ProtoMessage() {} func (*EntertainGameOverPush) ProtoMessage() {}
func (x *EntertainGameOverPush) ProtoReflect() protoreflect.Message { 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 { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -438,7 +549,7 @@ func (x *EntertainGameOverPush) ProtoReflect() protoreflect.Message {
// Deprecated: Use EntertainGameOverPush.ProtoReflect.Descriptor instead. // Deprecated: Use EntertainGameOverPush.ProtoReflect.Descriptor instead.
func (*EntertainGameOverPush) Descriptor() ([]byte, []int) { 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 { func (x *EntertainGameOverPush) GetUser1() *PlayerData {
@ -485,54 +596,63 @@ var file_entertain_entertain_msg_proto_rawDesc = []byte{
0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 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, 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, 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, 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, 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, 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, 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, 0x61, 0x74, 0x61, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x72,
0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x47, 0x61, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f,
0x6d, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x6d, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x11, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x52, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d,
0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64,
0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x22, 0x2a, 0x0a, 0x12, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x52, 0x65, 0x61,
0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x64, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18,
0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x22, 0xc6, 0x01, 0x0a,
0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x16, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x47,
0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x61, 0x6d, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31,
0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x76, 0x0a, 0x14, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73,
0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x65, 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79,
0x72, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08,
0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74,
0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x05, 0x52, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64,
0x65, 0x74, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, 0x0a,
0x65, 0x74, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72,
0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x22, 0x76, 0x0a, 0x14, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61,
0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a,
0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x74, 0x65, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72,
0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x73, 0x74, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02,
0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x75, 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x75, 0x72, 0x69,
0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x64, 0x18, 0x04, 0x20,
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x64, 0x22, 0x31, 0x0a,
0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x45, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x22, 0x80, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70,
0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x73, 0x74, 0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a,
0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08,
0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65,
0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a,
0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f,
0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x75, 0x6e, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69,
0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a,
0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -547,32 +667,34 @@ func file_entertain_entertain_msg_proto_rawDescGZIP() []byte {
return file_entertain_entertain_msg_proto_rawDescData 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{}{ var file_entertain_entertain_msg_proto_goTypes = []interface{}{
(*EntertainMatchReq)(nil), // 0: EntertainMatchReq (*EntertainMatchReq)(nil), // 0: EntertainMatchReq
(*EntertainMatchResp)(nil), // 1: EntertainMatchResp (*EntertainMatchResp)(nil), // 1: EntertainMatchResp
(*EntertainStartGamePush)(nil), // 2: EntertainStartGamePush (*EntertainReadyReq)(nil), // 2: EntertainReadyReq
(*EntertainOperatorReq)(nil), // 3: EntertainOperatorReq (*EntertainReadyResp)(nil), // 3: EntertainReadyResp
(*EntertainOperatorResp)(nil), // 4: EntertainOperatorResp (*EntertainStartGamePush)(nil), // 4: EntertainStartGamePush
(*EntertainOperatorRstPush)(nil), // 5: EntertainOperatorRstPush (*EntertainOperatorReq)(nil), // 5: EntertainOperatorReq
(*EntertainGameOverPush)(nil), // 6: EntertainGameOverPush (*EntertainOperatorResp)(nil), // 6: EntertainOperatorResp
(*PlayerData)(nil), // 7: PlayerData (*EntertainOperatorRstPush)(nil), // 7: EntertainOperatorRstPush
(*MapData)(nil), // 8: MapData (*EntertainGameOverPush)(nil), // 8: EntertainGameOverPush
(*PlayerData)(nil), // 9: PlayerData
(*MapData)(nil), // 10: MapData
} }
var file_entertain_entertain_msg_proto_depIdxs = []int32{ var file_entertain_entertain_msg_proto_depIdxs = []int32{
7, // 0: EntertainMatchResp.player:type_name -> PlayerData 9, // 0: EntertainMatchResp.player:type_name -> PlayerData
7, // 1: EntertainStartGamePush.user1:type_name -> PlayerData 9, // 1: EntertainStartGamePush.user1:type_name -> PlayerData
7, // 2: EntertainStartGamePush.user2:type_name -> PlayerData 9, // 2: EntertainStartGamePush.user2:type_name -> PlayerData
8, // 3: EntertainStartGamePush.mpadata:type_name -> MapData 10, // 3: EntertainStartGamePush.mpadata:type_name -> MapData
8, // 4: EntertainOperatorRstPush.mpadata:type_name -> MapData 10, // 4: EntertainOperatorRstPush.mpadata:type_name -> MapData
7, // 5: EntertainGameOverPush.user1:type_name -> PlayerData 9, // 5: EntertainGameOverPush.user1:type_name -> PlayerData
7, // 6: EntertainGameOverPush.user2:type_name -> PlayerData 9, // 6: EntertainGameOverPush.user2:type_name -> PlayerData
8, // 7: EntertainGameOverPush.mpadata:type_name -> MapData 10, // 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 output_type
8, // [8:8] is the sub-list for method input_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 type_name
8, // [8:8] is the sub-list for extension extendee 8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name 0, // [0:8] is the sub-list for field type_name
} }
func init() { file_entertain_entertain_msg_proto_init() } func init() { file_entertain_entertain_msg_proto_init() }
@ -607,7 +729,7 @@ func file_entertain_entertain_msg_proto_init() {
} }
} }
file_entertain_entertain_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { 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: case 0:
return &v.state return &v.state
case 1: case 1:
@ -619,7 +741,7 @@ func file_entertain_entertain_msg_proto_init() {
} }
} }
file_entertain_entertain_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { 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: case 0:
return &v.state return &v.state
case 1: case 1:
@ -631,7 +753,7 @@ func file_entertain_entertain_msg_proto_init() {
} }
} }
file_entertain_entertain_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { 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: case 0:
return &v.state return &v.state
case 1: case 1:
@ -643,7 +765,7 @@ func file_entertain_entertain_msg_proto_init() {
} }
} }
file_entertain_entertain_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { 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: case 0:
return &v.state return &v.state
case 1: case 1:
@ -655,6 +777,30 @@ func file_entertain_entertain_msg_proto_init() {
} }
} }
file_entertain_entertain_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { 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 { switch v := v.(*EntertainGameOverPush); i {
case 0: case 0:
return &v.state return &v.state
@ -673,7 +819,7 @@ func file_entertain_entertain_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_entertain_entertain_msg_proto_rawDesc, RawDescriptor: file_entertain_entertain_msg_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 7, NumMessages: 9,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },