feat: 新增 指挥官-战地 模式命令解析

main
NorthLan 2 years ago
parent 0621d663e0
commit 4c342aa491

@ -17,11 +17,6 @@ type (
ConsumerGroup string ConsumerGroup string
} }
Game struct {
// Commands 命令列表
Commands []string
}
config struct { config struct {
// Log 日志配置 // Log 日志配置
Log struct { Log struct {
@ -47,13 +42,57 @@ type (
} }
// Zhg 指挥官PvP模式 // Zhg 指挥官PvP模式
Zhg struct { Zhg struct {
Commands []string Commands []string // 指令集
OutbreakCount int64 // 每次暴兵数量 OutbreakCount int64 // 每次暴兵数量
OutbreakBaseCost int64 // 默认每次暴兵消耗积分(不限兵种) OutbreakBaseCost int64 // 默认每次暴兵消耗积分(不限兵种)
OutbreakCostDict map[int]int64 // 暴兵消耗积分表 OutbreakCostDict map[int]int64 // 暴兵消耗积分表
} }
Zhghz Game // 指挥官海战模式 // Zhghz 指挥官海战模式
Zhgfb Game // 指挥官副本模式 Zhghz struct {
Commands []string
}
// Zhgfb 指挥官副本模式
Zhgfb struct {
Commands []string
}
// Zhgzd 指挥官阵地模式
Zhgzd struct {
Commands []string // 指令集
// CommandUnitDict 命令单位ID字典
CommandUnitDict map[string]string
// CommandCostDict 命令战略点消耗
CommandCostDict map[string]struct {
Common int32 // 通用消耗
Units map[string]int32 // 单位消耗
}
// 战略暴兵数量(兵种相关)
DispatchCountDict map[string]int32
// 礼物效果配置
GiftEffect struct {
// StrategicMaximal 战略点上限配置
StrategicMaximal struct {
GiftIds []int64 // 对应礼物ID列表
Addon int32 // 增加上限值
Limit int32 // 次数限制
}
// StrategicRecover 战略点回复速度
StrategicRecover struct {
GiftIds []int64 // 对应礼物ID
Addon int32 // 增加速度值 x每秒
Duration int32 // 持续时间 秒
Limit int32 // 次数限制
}
// SupportSkill
SupportSkill []struct {
GiftIds []int64 // 对应礼物ID列表 (每次匹配一个)
SkillIds []string // 技能ID列表
}
}
}
} }
// RPC // RPC

@ -0,0 +1,221 @@
package live_logic
import (
"dcg/config"
"dcg/game/manager"
pbCommon "dcg/game/pb/common"
pbGameZhgzd "dcg/game/pb/game/zhgzd"
pbMq "dcg/game/pb/mq"
pbRoom "dcg/game/pb/room"
"dcg/game/svc"
"dcg/pkg/cmd"
"math/rand"
"time"
)
type ZhgzdGameLogic struct {
svcCtx *svc.ServiceContext
*LiveGameLogic
}
func NewZhgzdLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic {
resp := &ZhgzdGameLogic{
svcCtx: svcCtx,
LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHGZD, cmd.NewCMDParser(false, config.Config.Game.Zhgzd.Commands...)),
}
resp.RegisterCMDHandler(resp.handleJoinGame, "j", "加入", "加入游戏")
resp.RegisterCMDHandler(resp.handleDispatch, "s1", "s2", "s3", "s4")
resp.RegisterCMDHandler(resp.handleChangeUnit, "c1", "c2", "c3", "c4")
resp.RegisterCMDHandler(resp.handleOutbreak, "s")
resp.RegisterCMDHandler(resp.handlePosition, "p0", "p1", "p2", "p3", "p4", "p5")
resp.RegisterCMDHandler(resp.handleWhere, "w", "我在哪")
resp.RegisterCMDHandler(resp.handleMode, "r1", "r2", "r3", "r4")
// gift
resp.RegisterGiftHandler(resp.handleGift)
return resp.LiveGameLogic
}
func (h *ZhgzdGameLogic) handleJoinGame(roomId int64, _ string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
room.Broadcast("game.join", &pbGameZhgzd.JoinGame{User: user})
}
func (h *ZhgzdGameLogic) handleDispatch(roomId int64, cmd string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
cmdRune := []rune(cmd)
if len(cmdRune) < 2 {
return
}
cmdType := string(cmdRune[0])
unitType := string(cmdRune[1])
cfg := config.Config.Game.Zhgzd
unitId := cfg.CommandUnitDict[unitType]
count := cfg.DispatchCountDict[unitType]
var costSp int32
if costCfg, ok := cfg.CommandCostDict[cmdType]; ok {
costSp = costCfg.Units[unitType]
}
room.Broadcast("game.unit.dispatch", &pbGameZhgzd.DispatchUnit{
User: user,
CostSp: costSp,
Id: unitId,
Count: count,
})
}
func (h *ZhgzdGameLogic) handleChangeUnit(roomId int64, cmd string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
cmdRune := []rune(cmd)
if len(cmdRune) < 2 {
return
}
cmdType := string(cmdRune[0])
unitType := string(cmdRune[1])
cfg := config.Config.Game.Zhgzd
unitId := cfg.CommandUnitDict[unitType]
var costSp int32
if costCfg, ok := cfg.CommandCostDict[cmdType]; ok {
costSp = costCfg.Common
}
room.Broadcast("game.unit.change", &pbGameZhgzd.ChangeUnit{
User: user,
CostSp: costSp,
Id: unitId,
})
}
func (h *ZhgzdGameLogic) handleOutbreak(roomId int64, cmd string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
cmdRune := []rune(cmd)
if len(cmdRune) < 1 {
return
}
cmdType := string(cmdRune[0])
cfg := config.Config.Game.Zhgzd
var costSp int32
if costCfg, ok := cfg.CommandCostDict[cmdType]; ok {
costSp = costCfg.Common
}
room.Broadcast("game.outbreak", &pbGameZhgzd.Outbreak{
User: user,
CostSp: costSp,
})
}
func (h *ZhgzdGameLogic) handlePosition(roomId int64, cmd string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
if len(cmd) < 2 {
return
}
pos := cmd[1]
room.Broadcast("game.pos", &pbGameZhgzd.Position{
User: user,
Position: string(pos),
})
}
func (h *ZhgzdGameLogic) handleWhere(roomId int64, _ string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
room.Broadcast("game.where", &pbGameZhgzd.Where{User: user})
}
func (h *ZhgzdGameLogic) handleMode(roomId int64, cmd string, user *pbCommon.PbUser) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
cmdRune := []rune(cmd)
if len(cmdRune) < 1 {
return
}
cmdType := string(cmdRune[0])
cfg := config.Config.Game.Zhgzd
var costSp int32
if costCfg, ok := cfg.CommandCostDict[cmdType]; ok {
costSp = costCfg.Common
}
room.Broadcast("game.mode", &pbGameZhgzd.PlayerMode{
User: user,
Mode: string(cmdRune[1]),
CostSp: costSp,
})
}
func (h *ZhgzdGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) {
room, err := manager.GameManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
cfg := config.Config.Game.Zhgzd.GiftEffect
// 战略点回复速度
for _, id := range cfg.StrategicRecover.GiftIds {
if gift.GiftId == id {
room.Broadcast("game.sp", &pbGameZhgzd.StrategicPoint{
User: user,
AddSpeed: cfg.StrategicRecover.Addon,
AddSpeedDuration: cfg.StrategicRecover.Duration,
})
break
}
}
// 战略点上限
for _, id := range cfg.StrategicMaximal.GiftIds {
if gift.GiftId == id {
room.Broadcast("game.sp", &pbGameZhgzd.StrategicPoint{
User: user,
AddLimit: cfg.StrategicMaximal.Addon,
})
break
}
}
// 支援技能
for _, sCfg := range cfg.SupportSkill {
for _, id := range sCfg.GiftIds {
if gift.GiftId == id && len(sCfg.SkillIds) > 0 {
// skill 随机
tmpSkill := sCfg.SkillIds[0]
if len(sCfg.SkillIds) > 1 {
rand.Seed(time.Now().UnixNano())
tmpSkill = sCfg.SkillIds[rand.Intn(len(sCfg.SkillIds))]
}
room.Broadcast("game.support", &pbGameZhgzd.SupportSkill{
User: user,
Id: tmpSkill,
})
break
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,806 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc v3.19.4
// source: game/zhgzd/command.proto
package pbGameZhgzd
import (
common "dcg/game/pb/common"
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)
)
// 加入游戏 push -> game.join -> j
type JoinGame struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *JoinGame) Reset() {
*x = JoinGame{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *JoinGame) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JoinGame) ProtoMessage() {}
func (x *JoinGame) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_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 JoinGame.ProtoReflect.Descriptor instead.
func (*JoinGame) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{0}
}
func (x *JoinGame) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
// 战略出兵 push -> game.unit.dispatch -> s1/s2/s3/s4
type DispatchUnit struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
CostSp int32 `protobuf:"varint,2,opt,name=costSp,proto3" json:"costSp,omitempty"` // 消耗战略点量
Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` // 0001-步兵0004-骑兵0003-弓箭手0006-法师
Count int32 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` // 出兵数量
}
func (x *DispatchUnit) Reset() {
*x = DispatchUnit{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DispatchUnit) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DispatchUnit) ProtoMessage() {}
func (x *DispatchUnit) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_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 DispatchUnit.ProtoReflect.Descriptor instead.
func (*DispatchUnit) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{1}
}
func (x *DispatchUnit) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *DispatchUnit) GetCostSp() int32 {
if x != nil {
return x.CostSp
}
return 0
}
func (x *DispatchUnit) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DispatchUnit) GetCount() int32 {
if x != nil {
return x.Count
}
return 0
}
// 修改当前兵种 push -> game.unit.change -> c1/c2/c3/c4
type ChangeUnit struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
CostSp int32 `protobuf:"varint,2,opt,name=costSp,proto3" json:"costSp,omitempty"` // 消耗战略点量
Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` // 0001-步兵0004-骑兵0003-弓箭手0006-法师
}
func (x *ChangeUnit) Reset() {
*x = ChangeUnit{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ChangeUnit) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ChangeUnit) ProtoMessage() {}
func (x *ChangeUnit) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_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 ChangeUnit.ProtoReflect.Descriptor instead.
func (*ChangeUnit) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{2}
}
func (x *ChangeUnit) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *ChangeUnit) GetCostSp() int32 {
if x != nil {
return x.CostSp
}
return 0
}
func (x *ChangeUnit) GetId() string {
if x != nil {
return x.Id
}
return ""
}
// 暴兵(征召模式) push -> game.outbreak -> s
type Outbreak struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
CostSp int32 `protobuf:"varint,2,opt,name=costSp,proto3" json:"costSp,omitempty"` // 消耗战略点量
}
func (x *Outbreak) Reset() {
*x = Outbreak{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Outbreak) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Outbreak) ProtoMessage() {}
func (x *Outbreak) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_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 Outbreak.ProtoReflect.Descriptor instead.
func (*Outbreak) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{3}
}
func (x *Outbreak) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *Outbreak) GetCostSp() int32 {
if x != nil {
return x.CostSp
}
return 0
}
// 移动自己位置 push -> game.pos -> p1/p2/p3/p4/p5
type Position struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
CostSp int32 `protobuf:"varint,2,opt,name=costSp,proto3" json:"costSp,omitempty"` // 消耗战略点量
Position string `protobuf:"bytes,3,opt,name=position,proto3" json:"position,omitempty"` // 1-上兵营2-中兵营3-下兵营4-上前哨战5-下前哨战
}
func (x *Position) Reset() {
*x = Position{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Position) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Position) ProtoMessage() {}
func (x *Position) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_proto_msgTypes[4]
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 Position.ProtoReflect.Descriptor instead.
func (*Position) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{4}
}
func (x *Position) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *Position) GetCostSp() int32 {
if x != nil {
return x.CostSp
}
return 0
}
func (x *Position) GetPosition() string {
if x != nil {
return x.Position
}
return ""
}
// 查询位置 push -> game.where -> w
type Where struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *Where) Reset() {
*x = Where{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Where) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Where) ProtoMessage() {}
func (x *Where) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_proto_msgTypes[5]
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 Where.ProtoReflect.Descriptor instead.
func (*Where) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{5}
}
func (x *Where) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
// 玩家模式 push -> game.mode -> r1/r2/r3/r4
type PlayerMode struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
CostSp int32 `protobuf:"varint,2,opt,name=costSp,proto3" json:"costSp,omitempty"` // 消耗战略点量
Mode string `protobuf:"bytes,3,opt,name=mode,proto3" json:"mode,omitempty"` // 模式
}
func (x *PlayerMode) Reset() {
*x = PlayerMode{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PlayerMode) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PlayerMode) ProtoMessage() {}
func (x *PlayerMode) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_proto_msgTypes[6]
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 PlayerMode.ProtoReflect.Descriptor instead.
func (*PlayerMode) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{6}
}
func (x *PlayerMode) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *PlayerMode) GetCostSp() int32 {
if x != nil {
return x.CostSp
}
return 0
}
func (x *PlayerMode) GetMode() string {
if x != nil {
return x.Mode
}
return ""
}
// 战略点调整 push -> game.sp -> 礼物效果
type StrategicPoint struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
AddLimit int32 `protobuf:"varint,2,opt,name=addLimit,proto3" json:"addLimit,omitempty"` // 提高上限N点
AddSpeed int32 `protobuf:"varint,3,opt,name=addSpeed,proto3" json:"addSpeed,omitempty"` // 提高每秒恢复速度 N(整数)
AddSpeedDuration int32 `protobuf:"varint,4,opt,name=addSpeedDuration,proto3" json:"addSpeedDuration,omitempty"` // 提高每秒恢复速度 (N秒)
}
func (x *StrategicPoint) Reset() {
*x = StrategicPoint{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StrategicPoint) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StrategicPoint) ProtoMessage() {}
func (x *StrategicPoint) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_proto_msgTypes[7]
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 StrategicPoint.ProtoReflect.Descriptor instead.
func (*StrategicPoint) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{7}
}
func (x *StrategicPoint) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *StrategicPoint) GetAddLimit() int32 {
if x != nil {
return x.AddLimit
}
return 0
}
func (x *StrategicPoint) GetAddSpeed() int32 {
if x != nil {
return x.AddSpeed
}
return 0
}
func (x *StrategicPoint) GetAddSpeedDuration() int32 {
if x != nil {
return x.AddSpeedDuration
}
return 0
}
// 支援技能 push -> game.support -> 礼物效果
type SupportSkill struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // 技能ID S0001/S0002/S0003/S0005
}
func (x *SupportSkill) Reset() {
*x = SupportSkill{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhgzd_command_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SupportSkill) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SupportSkill) ProtoMessage() {}
func (x *SupportSkill) ProtoReflect() protoreflect.Message {
mi := &file_game_zhgzd_command_proto_msgTypes[8]
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 SupportSkill.ProtoReflect.Descriptor instead.
func (*SupportSkill) Descriptor() ([]byte, []int) {
return file_game_zhgzd_command_proto_rawDescGZIP(), []int{8}
}
func (x *SupportSkill) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *SupportSkill) GetId() string {
if x != nil {
return x.Id
}
return ""
}
var File_game_zhgzd_command_proto protoreflect.FileDescriptor
var file_game_zhgzd_command_proto_rawDesc = []byte{
0x0a, 0x18, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x7a, 0x64, 0x2f, 0x63, 0x6f, 0x6d,
0x6d, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x70, 0x62, 0x2e, 0x67,
0x61, 0x6d, 0x65, 0x2e, 0x7a, 0x68, 0x67, 0x7a, 0x64, 0x1a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x31,
0x0a, 0x08, 0x4a, 0x6f, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65,
0x72, 0x22, 0x73, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x55, 0x6e, 0x69,
0x74, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73,
0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x73, 0x74,
0x53, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x73, 0x74, 0x53, 0x70,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5b, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x55, 0x6e, 0x69, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50,
0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x63,
0x6f, 0x73, 0x74, 0x53, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x73,
0x74, 0x53, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x22, 0x49, 0x0a, 0x08, 0x4f, 0x75, 0x74, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x12,
0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72,
0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x73, 0x74, 0x53, 0x70,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x22, 0x65,
0x0a, 0x08, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65,
0x72, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
0x05, 0x52, 0x06, 0x63, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x2e, 0x0a, 0x05, 0x57, 0x68, 0x65, 0x72, 0x65, 0x12, 0x25,
0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52,
0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x5f, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d,
0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62,
0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f,
0x73, 0x74, 0x53, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x73, 0x74,
0x53, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x72, 0x61, 0x74,
0x65, 0x67, 0x69, 0x63, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65,
0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72,
0x12, 0x1a, 0x0a, 0x08, 0x61, 0x64, 0x64, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x61, 0x64, 0x64, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08,
0x61, 0x64, 0x64, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x61, 0x64, 0x64, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x61, 0x64, 0x64, 0x53,
0x70, 0x65, 0x65, 0x64, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
0x28, 0x05, 0x52, 0x10, 0x61, 0x64, 0x64, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x75, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x53,
0x6b, 0x69, 0x6c, 0x6c, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50,
0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x24, 0x5a, 0x22, 0x64,
0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f,
0x7a, 0x68, 0x67, 0x7a, 0x64, 0x3b, 0x70, 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x7a,
0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_game_zhgzd_command_proto_rawDescOnce sync.Once
file_game_zhgzd_command_proto_rawDescData = file_game_zhgzd_command_proto_rawDesc
)
func file_game_zhgzd_command_proto_rawDescGZIP() []byte {
file_game_zhgzd_command_proto_rawDescOnce.Do(func() {
file_game_zhgzd_command_proto_rawDescData = protoimpl.X.CompressGZIP(file_game_zhgzd_command_proto_rawDescData)
})
return file_game_zhgzd_command_proto_rawDescData
}
var file_game_zhgzd_command_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_game_zhgzd_command_proto_goTypes = []interface{}{
(*JoinGame)(nil), // 0: pb.game.zhgzd.JoinGame
(*DispatchUnit)(nil), // 1: pb.game.zhgzd.DispatchUnit
(*ChangeUnit)(nil), // 2: pb.game.zhgzd.ChangeUnit
(*Outbreak)(nil), // 3: pb.game.zhgzd.Outbreak
(*Position)(nil), // 4: pb.game.zhgzd.Position
(*Where)(nil), // 5: pb.game.zhgzd.Where
(*PlayerMode)(nil), // 6: pb.game.zhgzd.PlayerMode
(*StrategicPoint)(nil), // 7: pb.game.zhgzd.StrategicPoint
(*SupportSkill)(nil), // 8: pb.game.zhgzd.SupportSkill
(*common.PbUser)(nil), // 9: pb.common.PbUser
}
var file_game_zhgzd_command_proto_depIdxs = []int32{
9, // 0: pb.game.zhgzd.JoinGame.user:type_name -> pb.common.PbUser
9, // 1: pb.game.zhgzd.DispatchUnit.user:type_name -> pb.common.PbUser
9, // 2: pb.game.zhgzd.ChangeUnit.user:type_name -> pb.common.PbUser
9, // 3: pb.game.zhgzd.Outbreak.user:type_name -> pb.common.PbUser
9, // 4: pb.game.zhgzd.Position.user:type_name -> pb.common.PbUser
9, // 5: pb.game.zhgzd.Where.user:type_name -> pb.common.PbUser
9, // 6: pb.game.zhgzd.PlayerMode.user:type_name -> pb.common.PbUser
9, // 7: pb.game.zhgzd.StrategicPoint.user:type_name -> pb.common.PbUser
9, // 8: pb.game.zhgzd.SupportSkill.user:type_name -> pb.common.PbUser
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
}
func init() { file_game_zhgzd_command_proto_init() }
func file_game_zhgzd_command_proto_init() {
if File_game_zhgzd_command_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_game_zhgzd_command_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JoinGame); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DispatchUnit); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ChangeUnit); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Outbreak); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Position); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Where); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PlayerMode); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StrategicPoint); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhgzd_command_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SupportSkill); 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_game_zhgzd_command_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_game_zhgzd_command_proto_goTypes,
DependencyIndexes: file_game_zhgzd_command_proto_depIdxs,
MessageInfos: file_game_zhgzd_command_proto_msgTypes,
}.Build()
File_game_zhgzd_command_proto = out.File
file_game_zhgzd_command_proto_rawDesc = nil
file_game_zhgzd_command_proto_goTypes = nil
file_game_zhgzd_command_proto_depIdxs = nil
}

@ -0,0 +1,73 @@
syntax = "proto3";
package pb.game.zhgzd;
import "common/common.proto";
option go_package = "dcg/game/pb/game/zhgzd;pbGameZhgzd";
// push -> game.join -> j
message JoinGame {
pb.common.PbUser user = 1;
}
// push -> game.unit.dispatch -> s1/s2/s3/s4
message DispatchUnit {
pb.common.PbUser user = 1;
int32 costSp = 2; //
string id = 3; // 0001-0004-0003-0006-
int32 count = 4; //
}
// push -> game.unit.change -> c1/c2/c3/c4
message ChangeUnit {
pb.common.PbUser user = 1;
int32 costSp = 2; //
string id = 3; // 0001-0004-0003-0006-
}
// () push -> game.outbreak -> s
message Outbreak {
pb.common.PbUser user = 1;
int32 costSp = 2; //
}
// push -> game.pos -> p1/p2/p3/p4/p5
message Position {
pb.common.PbUser user = 1;
int32 costSp = 2; //
string position = 3;// 1-2-3-4-5-
}
// push -> game.where -> w
message Where {
pb.common.PbUser user = 1;
}
// push -> game.mode -> r1/r2/r3/r4
message PlayerMode {
pb.common.PbUser user = 1;
int32 costSp = 2; //
string mode = 3; //
}
///////////////////
// push -> game.sp ->
message StrategicPoint {
pb.common.PbUser user = 1;
int32 addLimit = 2; // N
int32 addSpeed = 3; // N()
int32 addSpeedDuration = 4; // (N)
}
// push -> game.support ->
message SupportSkill {
pb.common.PbUser user = 1;
string id = 2; // ID S0001/S0002/S0003/S0005
}

@ -0,0 +1 @@
protoc --csharp_out=. --proto_path=. --proto_path=../../ *.proto
Loading…
Cancel
Save