上传实时竞技场代码
This commit is contained in:
parent
6a7f7159bd
commit
d2512f3d6b
29
modules/realarena/api.go
Normal file
29
modules/realarena/api.go
Normal file
@ -0,0 +1,29 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/modules"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
)
|
||||
|
||||
/*
|
||||
装备模块 API
|
||||
*/
|
||||
type apiComp struct {
|
||||
modules.MCompGate
|
||||
service core.IService
|
||||
module *RealArena
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompGate.Init(service, module, comp, options)
|
||||
this.module = module.(*RealArena)
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
return
|
||||
}
|
45
modules/realarena/api_disableteamhero.go
Normal file
45
modules/realarena/api_disableteamhero.go
Normal file
@ -0,0 +1,45 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
func (this *apiComp) DisableTeamHeroCheck(session comm.IUserSession, req *pb.RealArenaDisableTeamHeroReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//获取基础信息
|
||||
func (this *apiComp) DisableTeamHero(session comm.IUserSession, req *pb.RealArenaDisableTeamHeroReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
room *Room
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
if errdata = this.DisableTeamHeroCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
this.module.lock.RLock()
|
||||
room, ok = this.module.rooms[req.Roomid]
|
||||
this.module.lock.RUnlock()
|
||||
if ok {
|
||||
if err = room.disableheros(session.GetUserId(), req.Index); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: "no found room",
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "disableteamhero", &pb.RealArenaDisableTeamHeroResp{})
|
||||
return
|
||||
}
|
31
modules/realarena/api_info.go
Normal file
31
modules/realarena/api_info.go
Normal file
@ -0,0 +1,31 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.ReddotGetReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//获取基础信息
|
||||
func (this *apiComp) Info(session comm.IUserSession, req *pb.RealArenaInfoReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
info *pb.DBRealArena
|
||||
err error
|
||||
)
|
||||
|
||||
if info, err = this.module.model.getinfo(session); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "info", &pb.RealArenaInfoResp{Info: info})
|
||||
return
|
||||
}
|
38
modules/realarena/api_match.go
Normal file
38
modules/realarena/api_match.go
Normal file
@ -0,0 +1,38 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
func (this *apiComp) MatchCheck(session comm.IUserSession, req *pb.ReddotGetReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//匹配
|
||||
func (this *apiComp) Match(session comm.IUserSession, req *pb.RealArenaMatchReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
info *pb.DBRealArena
|
||||
err error
|
||||
)
|
||||
|
||||
if info, err = this.module.model.getinfo(session); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err = this.module.match.MatchReq(info); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "match", &pb.RealArenaInfoResp{})
|
||||
return
|
||||
}
|
45
modules/realarena/api_selectteamhero.go
Normal file
45
modules/realarena/api_selectteamhero.go
Normal file
@ -0,0 +1,45 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
func (this *apiComp) SelectTeamHeroCheck(session comm.IUserSession, req *pb.RealArenaSelectTeamHeroReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//获取基础信息
|
||||
func (this *apiComp) SelectTeamHero(session comm.IUserSession, req *pb.RealArenaSelectTeamHeroReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
room *Room
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
if errdata = this.SelectTeamHeroCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
this.module.lock.RLock()
|
||||
room, ok = this.module.rooms[req.Roomid]
|
||||
this.module.lock.RUnlock()
|
||||
if ok {
|
||||
if err = room.selectheros(session.GetUserId(), req.Heros); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: "no found room",
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "selectteamhero", &pb.RealArenaSelectTeamHeroResp{})
|
||||
return
|
||||
}
|
45
modules/realarena/api_selectteamleader.go
Normal file
45
modules/realarena/api_selectteamleader.go
Normal file
@ -0,0 +1,45 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
// 参数校验
|
||||
func (this *apiComp) SelectTeamLeaderCheck(session comm.IUserSession, req *pb.RealArenaSelectTeamLeaderReq) (errdata *pb.ErrorData) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//获取基础信息
|
||||
func (this *apiComp) SelectTeamLeader(session comm.IUserSession, req *pb.RealArenaSelectTeamLeaderReq) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
room *Room
|
||||
ok bool
|
||||
err error
|
||||
)
|
||||
if errdata = this.SelectTeamLeaderCheck(session, req); errdata != nil {
|
||||
return
|
||||
}
|
||||
|
||||
this.module.lock.RLock()
|
||||
room, ok = this.module.rooms[req.Roomid]
|
||||
this.module.lock.RUnlock()
|
||||
if ok {
|
||||
if err = room.selectleader(session.GetUserId(), req.Index); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Message: "no found room",
|
||||
}
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "selectteamleader", &pb.RealArenaSelectTeamLeaderResp{})
|
||||
return
|
||||
}
|
1
modules/realarena/core.go
Normal file
1
modules/realarena/core.go
Normal file
@ -0,0 +1 @@
|
||||
package realarena
|
86
modules/realarena/match.go
Normal file
86
modules/realarena/match.go
Normal file
@ -0,0 +1,86 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
)
|
||||
|
||||
/*
|
||||
匹配组件
|
||||
*/
|
||||
type matchComp struct {
|
||||
modules.MCompMatch
|
||||
service core.IService
|
||||
module *RealArena
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *matchComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompMatch.Init(service, module, comp, options)
|
||||
this.module = module.(*RealArena)
|
||||
this.service = service
|
||||
this.PoolName = "realarena"
|
||||
return
|
||||
}
|
||||
|
||||
func (this *matchComp) Start() (err error) {
|
||||
err = this.MCompMatch.Start()
|
||||
return
|
||||
}
|
||||
|
||||
func (this *matchComp) MatchReq(info *pb.DBRealArena) (err error) {
|
||||
data, _ := anypb.New(info)
|
||||
err = this.module.service.RpcCall(
|
||||
context.Background(),
|
||||
comm.Service_Mainte,
|
||||
string(comm.RPC_JoinMatchPools),
|
||||
&pb.JoinMatchPoolReq{
|
||||
Poolname: this.PoolName,
|
||||
Uid: info.Uid,
|
||||
Dan: info.Dan,
|
||||
Data: data,
|
||||
Matchnum: 2,
|
||||
Timeout: 10,
|
||||
},
|
||||
&pb.JoinMatchPoolResp{})
|
||||
if err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
|
||||
var (
|
||||
playerSlice []*pb.DBRealArenaMember
|
||||
red *pb.DBRealArenaMember
|
||||
bule *pb.DBRealArenaMember
|
||||
room *Room
|
||||
)
|
||||
playerSlice = make([]*pb.DBRealArenaMember, 0, len(players))
|
||||
for _, v := range players {
|
||||
playerSlice = append(playerSlice, v.(*pb.DBRealArenaMember))
|
||||
}
|
||||
|
||||
for i, v := range playerSlice {
|
||||
if i%2 == 0 {
|
||||
red = v
|
||||
|
||||
} else {
|
||||
bule = v
|
||||
}
|
||||
}
|
||||
|
||||
if room, err = this.module.createroom(red, bule); err != nil {
|
||||
this.module.Error("createbattle err!", log.Field{Key: "key", Value: err.Error()})
|
||||
}
|
||||
room.init()
|
||||
return
|
||||
}
|
103
modules/realarena/model.go
Normal file
103
modules/realarena/model.go
Normal file
@ -0,0 +1,103 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/mgo"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/db"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
// /装备 数据组件
|
||||
type modelComp struct {
|
||||
modules.MCompModel
|
||||
module *RealArena
|
||||
}
|
||||
|
||||
// 组件初始化接口
|
||||
func (this *modelComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||
this.TableName = comm.TableExclusive
|
||||
this.MCompModel.Init(service, module, comp, opt)
|
||||
this.module = module.(*RealArena)
|
||||
//创建uid索引
|
||||
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 更新埋点数据到db中
|
||||
func (this *modelComp) getmodel(uid string) (model *realArenaModel, err error) {
|
||||
var m *db.DBModel
|
||||
if db.IsCross() {
|
||||
if m, err = this.module.GetDBModelByUid(uid, this.TableName); err != nil {
|
||||
return
|
||||
}
|
||||
model = &realArenaModel{module: this.module, model: m}
|
||||
} else {
|
||||
model = &realArenaModel{module: this.module, model: this.DBModel}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// /查询用户的武器背包
|
||||
func (this *modelComp) getinfo(session comm.IUserSession) (info *pb.DBRealArena, err error) {
|
||||
var (
|
||||
model *realArenaModel
|
||||
)
|
||||
if model, err = this.getmodel(session.GetUserId()); err != nil {
|
||||
return
|
||||
}
|
||||
info, err = model.getinfo(session)
|
||||
return
|
||||
}
|
||||
|
||||
// 埋点专属模型 会封装特殊的数据转换接口
|
||||
type realArenaModel struct {
|
||||
module *RealArena
|
||||
model *db.DBModel
|
||||
}
|
||||
|
||||
// /查询用户的武器背包
|
||||
func (this *realArenaModel) getExclusives(uId string) (list []*pb.DB_Exclusive, err error) {
|
||||
list = make([]*pb.DB_Exclusive, 0)
|
||||
if err = this.model.GetList(uId, &list); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// /查询用户的武器背包
|
||||
func (this *realArenaModel) getinfo(session comm.IUserSession) (info *pb.DBRealArena, err error) {
|
||||
var (
|
||||
user *pb.DBUser
|
||||
)
|
||||
info = &pb.DBRealArena{}
|
||||
if err = this.model.Get(session.GetUserId(), info); err != nil && err != mgo.MongodbNil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
if user, err = this.module.GetUserForSession(session); err != nil {
|
||||
return
|
||||
}
|
||||
info = &pb.DBRealArena{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
Uinfo: comm.GetUserBaseInfo(user),
|
||||
}
|
||||
err = this.model.Add(session.GetUserId(), info)
|
||||
return
|
||||
}
|
||||
|
||||
// /查询用户的武器背包
|
||||
func (this *realArenaModel) getExclusivesByIds(uId string, oid []string) (list []*pb.DB_Exclusive, err error) {
|
||||
list = make([]*pb.DB_Exclusive, 0)
|
||||
if err = this.model.GetListObjs(uId, oid, &list); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
91
modules/realarena/module.go
Normal file
91
modules/realarena/module.go
Normal file
@ -0,0 +1,91 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"sync"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
/*
|
||||
模块名:红点系统
|
||||
描述:统一获取红点信息
|
||||
开发:李伟
|
||||
*/
|
||||
func NewModule() core.IModule {
|
||||
m := new(RealArena)
|
||||
return m
|
||||
}
|
||||
|
||||
type RealArena struct {
|
||||
modules.ModuleBase
|
||||
service base.IRPCXService
|
||||
apicomp *apiComp
|
||||
model *modelComp
|
||||
match *matchComp
|
||||
lock sync.RWMutex
|
||||
rooms map[string]*Room
|
||||
}
|
||||
|
||||
// 模块名
|
||||
func (this *RealArena) GetType() core.M_Modules {
|
||||
return comm.ModuleReddot
|
||||
}
|
||||
|
||||
// 模块初始化接口 注册用户创建角色事件
|
||||
func (this *RealArena) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
if err = this.ModuleBase.Init(service, module, options); err != nil {
|
||||
return
|
||||
}
|
||||
this.service = service.(base.IRPCXService)
|
||||
return
|
||||
}
|
||||
func (this *RealArena) Start() (err error) {
|
||||
if err = this.ModuleBase.Start(); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 装备组件
|
||||
func (this *RealArena) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.apicomp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.model = this.RegisterComp(new(modelComp)).(*modelComp)
|
||||
this.match = this.RegisterComp(new(matchComp)).(*matchComp)
|
||||
}
|
||||
|
||||
//创建房间
|
||||
func (this *RealArena) createroom(red, bule *pb.DBRealArenaMember) (room *Room, err error) {
|
||||
var (
|
||||
session comm.IUserSession
|
||||
ok bool
|
||||
)
|
||||
room = &Room{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
sessions: make([]comm.IUserSession, 0),
|
||||
members: make([]*pb.DBRealArenaMember, 0),
|
||||
}
|
||||
room.members = append(room.members, red, bule)
|
||||
if session, ok = this.GetUserSession(red.User.Uid); ok {
|
||||
room.sessions = append(room.sessions, session)
|
||||
} else {
|
||||
err = fmt.Errorf("player:%s is Offline", red.User.Uid)
|
||||
return
|
||||
}
|
||||
if session, ok = this.GetUserSession(bule.User.Uid); ok {
|
||||
room.sessions = append(room.sessions, session)
|
||||
} else {
|
||||
err = fmt.Errorf("player:%s is Offline", bule.User.Uid)
|
||||
return
|
||||
}
|
||||
this.lock.Lock()
|
||||
this.rooms[room.Id] = room
|
||||
this.lock.Unlock()
|
||||
return
|
||||
}
|
81
modules/realarena/romm.go
Normal file
81
modules/realarena/romm.go
Normal file
@ -0,0 +1,81 @@
|
||||
package realarena
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// /装备 数据组件
|
||||
type Room struct {
|
||||
Id string
|
||||
module *RealArena
|
||||
sessions []comm.IUserSession
|
||||
members []*pb.DBRealArenaMember
|
||||
state int //0 无状态 1选择英雄阶段 2禁用英雄阶段 3选择队长阶段 4战斗中
|
||||
step int //阶段
|
||||
handle string // 操作玩家
|
||||
}
|
||||
|
||||
func (this *Room) init() (err error) {
|
||||
this.PushMessage("matchsucc", &pb.RealArenaMatchSuccPush{
|
||||
Race: &pb.DBRealArenaRace{
|
||||
Id: this.Id,
|
||||
ServicePath: fmt.Sprintf("%s", this.module.service.GetId()),
|
||||
Red: this.members[0],
|
||||
Bule: this.members[1],
|
||||
},
|
||||
})
|
||||
this.handle = this.members[0].User.Uid
|
||||
this.step = 1
|
||||
this.PushMessage("startselecthero", &pb.RealArenaStartSelectHeroPush{
|
||||
Uid: this.members[0].User.Uid,
|
||||
Num: 2,
|
||||
Countdown: 10,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
//选择英雄
|
||||
func (this *Room) selectheros(uid string, heros []string) (err error) {
|
||||
if uid != this.handle {
|
||||
err = fmt.Errorf("cant handle!")
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range this.members {
|
||||
if v.User.Uid == uid {
|
||||
v.Heros = heros
|
||||
} else {
|
||||
this.handle = v.User.Uid
|
||||
}
|
||||
}
|
||||
this.PushMessage("startselecthero", &pb.RealArenaSelectHeroPush{
|
||||
Uid: this.members[0].User.Uid,
|
||||
Heros: heros,
|
||||
})
|
||||
this.PushMessage("startselecthero", &pb.RealArenaStartSelectHeroPush{
|
||||
Uid: this.handle,
|
||||
Num: 2,
|
||||
Countdown: 10,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
//禁用英雄
|
||||
func (this *Room) disableheros(uid string, index int32) (err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//选择队长
|
||||
func (this *Room) selectleader(uid string, index int32) (err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Room) PushMessage(stype string, msg proto.Message) {
|
||||
this.module.SendMsgToSession(string(this.module.GetType()), stype, msg, this.sessions...)
|
||||
}
|
394
pb/realarena_db.pb.go
Normal file
394
pb/realarena_db.pb.go
Normal file
@ -0,0 +1,394 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.20.0
|
||||
// source: realarena/realarena_db.proto
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
//实时竞技场
|
||||
type DBRealArena struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //uid
|
||||
Uinfo *BaseUserInfo `protobuf:"bytes,3,opt,name=uinfo,proto3" json:"uinfo"` //用户基础
|
||||
Dan int32 `protobuf:"varint,4,opt,name=dan,proto3" json:"dan"` //段位
|
||||
Integral int32 `protobuf:"varint,5,opt,name=integral,proto3" json:"integral"` //积分
|
||||
}
|
||||
|
||||
func (x *DBRealArena) Reset() {
|
||||
*x = DBRealArena{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_realarena_realarena_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBRealArena) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBRealArena) ProtoMessage() {}
|
||||
|
||||
func (x *DBRealArena) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realarena_realarena_db_proto_msgTypes[0]
|
||||
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 DBRealArena.ProtoReflect.Descriptor instead.
|
||||
func (*DBRealArena) Descriptor() ([]byte, []int) {
|
||||
return file_realarena_realarena_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *DBRealArena) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBRealArena) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBRealArena) GetUinfo() *BaseUserInfo {
|
||||
if x != nil {
|
||||
return x.Uinfo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBRealArena) GetDan() int32 {
|
||||
if x != nil {
|
||||
return x.Dan
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBRealArena) GetIntegral() int32 {
|
||||
if x != nil {
|
||||
return x.Integral
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//队员信息
|
||||
type DBRealArenaMember struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
User *BaseUserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user"` //发起者信息
|
||||
Dan int32 `protobuf:"varint,2,opt,name=dan,proto3" json:"dan"` //段位
|
||||
Integral int32 `protobuf:"varint,3,opt,name=integral,proto3" json:"integral"` //积分
|
||||
Heros []string `protobuf:"bytes,4,rep,name=heros,proto3" json:"heros"` //队伍
|
||||
Disable int32 `protobuf:"varint,5,opt,name=disable,proto3" json:"disable"` //禁用
|
||||
Leader int32 `protobuf:"varint,6,opt,name=leader,proto3" json:"leader"` //队长
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) Reset() {
|
||||
*x = DBRealArenaMember{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_realarena_realarena_db_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBRealArenaMember) ProtoMessage() {}
|
||||
|
||||
func (x *DBRealArenaMember) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realarena_realarena_db_proto_msgTypes[1]
|
||||
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 DBRealArenaMember.ProtoReflect.Descriptor instead.
|
||||
func (*DBRealArenaMember) Descriptor() ([]byte, []int) {
|
||||
return file_realarena_realarena_db_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) GetUser() *BaseUserInfo {
|
||||
if x != nil {
|
||||
return x.User
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) GetDan() int32 {
|
||||
if x != nil {
|
||||
return x.Dan
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) GetIntegral() int32 {
|
||||
if x != nil {
|
||||
return x.Integral
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) GetHeros() []string {
|
||||
if x != nil {
|
||||
return x.Heros
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) GetDisable() int32 {
|
||||
if x != nil {
|
||||
return x.Disable
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBRealArenaMember) GetLeader() int32 {
|
||||
if x != nil {
|
||||
return x.Leader
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//竞技场比赛对象
|
||||
type DBRealArenaRace struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
|
||||
ServicePath string `protobuf:"bytes,2,opt,name=servicePath,proto3" json:"servicePath"` //比赛所在服务
|
||||
Red *DBRealArenaMember `protobuf:"bytes,3,opt,name=red,proto3" json:"red"`
|
||||
Bule *DBRealArenaMember `protobuf:"bytes,4,opt,name=bule,proto3" json:"bule"`
|
||||
}
|
||||
|
||||
func (x *DBRealArenaRace) Reset() {
|
||||
*x = DBRealArenaRace{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_realarena_realarena_db_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBRealArenaRace) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBRealArenaRace) ProtoMessage() {}
|
||||
|
||||
func (x *DBRealArenaRace) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realarena_realarena_db_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 DBRealArenaRace.ProtoReflect.Descriptor instead.
|
||||
func (*DBRealArenaRace) Descriptor() ([]byte, []int) {
|
||||
return file_realarena_realarena_db_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DBRealArenaRace) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBRealArenaRace) GetServicePath() string {
|
||||
if x != nil {
|
||||
return x.ServicePath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBRealArenaRace) GetRed() *DBRealArenaMember {
|
||||
if x != nil {
|
||||
return x.Red
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBRealArenaRace) GetBule() *DBRealArenaMember {
|
||||
if x != nil {
|
||||
return x.Bule
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_realarena_realarena_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_realarena_realarena_db_proto_rawDesc = []byte{
|
||||
0x0a, 0x1c, 0x72, 0x65, 0x61, 0x6c, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x2f, 0x72, 0x65, 0x61, 0x6c,
|
||||
0x61, 0x72, 0x65, 0x6e, 0x61, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x82, 0x01, 0x0a, 0x0b, 0x44,
|
||||
0x42, 0x52, 0x65, 0x61, 0x6c, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x05,
|
||||
0x75, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61,
|
||||
0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x75, 0x69, 0x6e, 0x66,
|
||||
0x6f, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
|
||||
0x64, 0x61, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22,
|
||||
0xac, 0x01, 0x0a, 0x11, 0x44, 0x42, 0x52, 0x65, 0x61, 0x6c, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x4d,
|
||||
0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x18,
|
||||
0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64,
|
||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x22, 0x91,
|
||||
0x01, 0x0a, 0x0f, 0x44, 0x42, 0x52, 0x65, 0x61, 0x6c, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x52, 0x61,
|
||||
0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||
0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74,
|
||||
0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x50, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x12, 0x2e, 0x44, 0x42, 0x52, 0x65, 0x61, 0x6c, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x4d,
|
||||
0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x03, 0x72, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x04, 0x62, 0x75,
|
||||
0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x44, 0x42, 0x52, 0x65, 0x61,
|
||||
0x6c, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x04, 0x62, 0x75,
|
||||
0x6c, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_realarena_realarena_db_proto_rawDescOnce sync.Once
|
||||
file_realarena_realarena_db_proto_rawDescData = file_realarena_realarena_db_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_realarena_realarena_db_proto_rawDescGZIP() []byte {
|
||||
file_realarena_realarena_db_proto_rawDescOnce.Do(func() {
|
||||
file_realarena_realarena_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_realarena_realarena_db_proto_rawDescData)
|
||||
})
|
||||
return file_realarena_realarena_db_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_realarena_realarena_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_realarena_realarena_db_proto_goTypes = []interface{}{
|
||||
(*DBRealArena)(nil), // 0: DBRealArena
|
||||
(*DBRealArenaMember)(nil), // 1: DBRealArenaMember
|
||||
(*DBRealArenaRace)(nil), // 2: DBRealArenaRace
|
||||
(*BaseUserInfo)(nil), // 3: BaseUserInfo
|
||||
}
|
||||
var file_realarena_realarena_db_proto_depIdxs = []int32{
|
||||
3, // 0: DBRealArena.uinfo:type_name -> BaseUserInfo
|
||||
3, // 1: DBRealArenaMember.user:type_name -> BaseUserInfo
|
||||
1, // 2: DBRealArenaRace.red:type_name -> DBRealArenaMember
|
||||
1, // 3: DBRealArenaRace.bule:type_name -> DBRealArenaMember
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_realarena_realarena_db_proto_init() }
|
||||
func file_realarena_realarena_db_proto_init() {
|
||||
if File_realarena_realarena_db_proto != nil {
|
||||
return
|
||||
}
|
||||
file_comm_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_realarena_realarena_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBRealArena); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_realarena_realarena_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBRealArenaMember); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_realarena_realarena_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBRealArenaRace); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_realarena_realarena_db_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_realarena_realarena_db_proto_goTypes,
|
||||
DependencyIndexes: file_realarena_realarena_db_proto_depIdxs,
|
||||
MessageInfos: file_realarena_realarena_db_proto_msgTypes,
|
||||
}.Build()
|
||||
File_realarena_realarena_db_proto = out.File
|
||||
file_realarena_realarena_db_proto_rawDesc = nil
|
||||
file_realarena_realarena_db_proto_goTypes = nil
|
||||
file_realarena_realarena_db_proto_depIdxs = nil
|
||||
}
|
1206
pb/realarena_msg.pb.go
Normal file
1206
pb/realarena_msg.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user