Merge branch 'develop' into release
This commit is contained in:
commit
4ce799b314
|
@ -0,0 +1,45 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
func RegisterBoardCastHandler() {
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &protocol.SSPacketBroadcast{}, BroadcastHandler)
|
||||
}
|
||||
|
||||
func BroadcastHandler(s *netlib.Session, packetId int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
if bcss := sp.GetBcss(); bcss != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetId int, data interface{}) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketBroadcast{
|
||||
SessParam: sp,
|
||||
PacketId: proto.Int(packetId),
|
||||
}
|
||||
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetId, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Warnf("CreateBroadcastPacket err:%v", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return pack, nil
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
func RegisterMulticastHandler() {
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &protocol.SSPacketMulticast{}, MulticastHandler)
|
||||
}
|
||||
|
||||
func MulticastHandler(s *netlib.Session, packetId int, data interface{}) error {
|
||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||
pd := mp.GetData()
|
||||
sis := mp.GetSessions()
|
||||
for _, si := range sis {
|
||||
ss := si.GetMcss()
|
||||
if ss != nil {
|
||||
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
||||
if ns != nil {
|
||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateMulticastPacket(packetId int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketMulticast{
|
||||
Sessions: sis,
|
||||
PacketId: proto.Int(packetId),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetId, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Errorf("CreateMulticastPacket err:%v", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return pack, nil
|
||||
}
|
Binary file not shown.
BIN
data/DB_Skin.dat
BIN
data/DB_Skin.dat
Binary file not shown.
|
@ -45,9 +45,9 @@
|
|||
"SkinPic": "icon_300003",
|
||||
"SkinName": "活力-粉",
|
||||
"SkinType": "mg_02",
|
||||
"UnlockType": 3,
|
||||
"UnlockType": 2,
|
||||
"UnlockItem": {
|
||||
"5": 0
|
||||
"310003": 20
|
||||
},
|
||||
"SkinSkillName": "活力满满",
|
||||
"SkinSkillIcon": "SkillIcon-30003",
|
||||
|
@ -66,9 +66,9 @@
|
|||
"SkinPic": "icon_300004",
|
||||
"SkinName": "活力-青",
|
||||
"SkinType": "mg_03",
|
||||
"UnlockType": 3,
|
||||
"UnlockType": 2,
|
||||
"UnlockItem": {
|
||||
"2": 0
|
||||
"310004": 20
|
||||
},
|
||||
"SkinSkillName": "金币满满",
|
||||
"SkinSkillIcon": "SkillIcon-30004",
|
||||
|
|
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
BIN
data/DB_VIP.dat
BIN
data/DB_VIP.dat
Binary file not shown.
|
@ -30,6 +30,7 @@
|
|||
"更多VIP功能正待开发"
|
||||
],
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -70,6 +71,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 1,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -110,6 +112,8 @@
|
|||
],
|
||||
"MatchFreeTimes": 2,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -150,6 +154,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 3,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -190,6 +195,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 4,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -230,6 +236,8 @@
|
|||
],
|
||||
"MatchFreeTimes": 5,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -270,6 +278,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 6,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -310,6 +319,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 7,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -350,6 +360,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 8,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -390,6 +401,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 9,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -430,6 +442,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 10,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -470,6 +483,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 11,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -510,6 +524,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 12,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -550,6 +565,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 13,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -590,6 +606,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 14,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -630,6 +647,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 15,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
@ -670,6 +688,7 @@
|
|||
],
|
||||
"MatchFreeTimes": 16,
|
||||
"Privilege9": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
|
||||
罘
|
||||
荅
|
||||
荅
|
||||
罘
|
|
@ -2,11 +2,11 @@
|
|||
"Arr": [
|
||||
{
|
||||
"Id": 1,
|
||||
"SkinId": 300003
|
||||
"SkinId": 300004
|
||||
},
|
||||
{
|
||||
"Id": 2,
|
||||
"SkinId": 300004,
|
||||
"SkinId": 300003,
|
||||
"VIPLevel": 3
|
||||
}
|
||||
]
|
||||
|
|
|
@ -576,6 +576,7 @@ func init() {
|
|||
return nil
|
||||
}))
|
||||
|
||||
common.RegisterMulticastHandler()
|
||||
//玩家离开
|
||||
netlib.Register(int(server.SSPacketID_PACKET_WG_PlayerLEAVE), server.WGPlayerLeave{}, HandleWGPlayerLeave)
|
||||
//同步记牌器过期时间
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package base
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
var (
|
||||
BroadcastMaker = &BroadcastPacketFactory{}
|
||||
)
|
||||
|
||||
type BroadcastPacketFactory struct {
|
||||
}
|
||||
|
||||
type BroadcastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketBroadcast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketBroadcast{
|
||||
SessParam: sp,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
if bcss := sp.GetBcss(); bcss != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package base
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
var (
|
||||
MulticastMaker = &MulticastPacketFactory{}
|
||||
)
|
||||
|
||||
type MulticastPacketFactory struct {
|
||||
}
|
||||
|
||||
type MulticastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &MulticastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), MulticastMaker)
|
||||
}
|
||||
|
||||
func (this *MulticastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketMulticast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *MulticastPacketFactory) CreateMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketMulticast{
|
||||
Sessions: sis,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Info("MulticastPacketFactory.CreateMulticastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||
pd := mp.GetData()
|
||||
sis := mp.GetSessions()
|
||||
for _, si := range sis {
|
||||
ss := si.GetMcss()
|
||||
if ss != nil {
|
||||
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
||||
if ns != nil {
|
||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -158,7 +158,7 @@ func (this *PlayerMgr) BroadcastMessage(packetid int, rawpack interface{}) bool
|
|||
sc := &protocol.BCSessionUnion{
|
||||
Bccs: &protocol.BCClientSession{},
|
||||
}
|
||||
pack, err := BroadcastMaker.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||
pack, err := common.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||
if err == nil && pack != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
return true
|
||||
|
|
|
@ -893,7 +893,7 @@ func (this *Scene) Broadcast(packetid int, msg rawproto.Message, excludeSid int6
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
@ -917,7 +917,7 @@ func (this *Scene) RobotBroadcast(packetid int, msg rawproto.Message) {
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
@ -941,7 +941,7 @@ func (this *Scene) BroadcastToAudience(packetid int, msg rawproto.Message) {
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
|
|
@ -195,7 +195,7 @@ func (this *SceneMgr) JackPotSync(platform string, gameIds ...int32) {
|
|||
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
cPack, err := MulticastMaker.CreateMulticastPacket(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, v...)
|
||||
cPack, err := common.CreateMulticastPacket(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(cPack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), cPack)
|
||||
|
|
|
@ -1458,7 +1458,7 @@ func (this *FishingSceneData) BroadCastMessage(packetid int, msg proto.Message,
|
|||
if gateSess == nil || len(v) == 0 {
|
||||
continue
|
||||
}
|
||||
pack, err := base.MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
|
|
@ -1,56 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
var (
|
||||
BroadcastMaker = &BroadcastPacketFactory{}
|
||||
)
|
||||
|
||||
type BroadcastPacketFactory struct {
|
||||
}
|
||||
|
||||
type BroadcastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
// 给所有玩家或某个类型的所有服务发消息
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &protocol.SSPacketBroadcast{}, BroadcastHandler)
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketBroadcast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketBroadcast{
|
||||
SessParam: sp,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
func BroadcastHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
|
|
|
@ -1,61 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
var (
|
||||
MulticastMaker = &MulticastPacketFactory{}
|
||||
)
|
||||
|
||||
type MulticastPacketFactory struct {
|
||||
}
|
||||
|
||||
type MulticastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
// 给某些玩家和某些服务发消息
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &MulticastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), MulticastMaker)
|
||||
netlib.Register(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &protocol.SSPacketMulticast{}, MulticastHandler)
|
||||
}
|
||||
|
||||
func (this *MulticastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketMulticast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *MulticastPacketFactory) CreateMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketMulticast{
|
||||
Sessions: sis,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Info("MulticastPacketFactory.CreateMulticastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
func MulticastHandler(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||
pd := mp.GetData()
|
||||
sis := mp.GetSessions()
|
||||
for _, si := range sis {
|
||||
ns := this.getSession(si)
|
||||
ns := getSession(si)
|
||||
if ns != nil {
|
||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||
}
|
||||
|
@ -64,7 +24,7 @@ func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data inte
|
|||
return nil
|
||||
}
|
||||
|
||||
func (this *MulticastHandler) getSession(su *protocol.MCSessionUnion) *netlib.Session {
|
||||
func getSession(su *protocol.MCSessionUnion) *netlib.Session {
|
||||
cs := su.GetMccs()
|
||||
if cs != nil {
|
||||
return srvlib.ClientSessionMgrSington.GetSession(cs.GetSId())
|
||||
|
|
|
@ -1,61 +1,9 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
"mongo.games.com/game/common"
|
||||
)
|
||||
|
||||
var (
|
||||
BroadcastMaker = &BroadcastPacketFactory{}
|
||||
)
|
||||
|
||||
type BroadcastPacketFactory struct {
|
||||
}
|
||||
|
||||
type BroadcastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketBroadcast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketBroadcast{
|
||||
SessParam: sp,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
if bcss := sp.GetBcss(); bcss != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
common.RegisterBoardCastHandler()
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ func SrvCtrlNotice(rw http.ResponseWriter, data []byte) {
|
|||
sc := &protocol.BCSessionUnion{
|
||||
Bccs: &protocol.BCClientSession{},
|
||||
}
|
||||
broadcast, err := BroadcastMaker.CreateBroadcastPacket(sc, int(msg_proto.MSGPacketID_PACKET_SC_NOTICE), noticePacket)
|
||||
broadcast, err := common.CreateBroadcastPacket(sc, int(msg_proto.MSGPacketID_PACKET_SC_NOTICE), noticePacket)
|
||||
if err != nil || broadcast == nil {
|
||||
pack.Tag = webapi.TagCode_FAILED
|
||||
pack.Msg = "send notice failed(inner error)"
|
||||
|
|
|
@ -1866,6 +1866,7 @@ type MatchInfo struct {
|
|||
TotalRound int32 `protobuf:"varint,5,opt,name=TotalRound,proto3" json:"TotalRound,omitempty"` // 总轮数
|
||||
RemainNum int32 `protobuf:"varint,6,opt,name=RemainNum,proto3" json:"RemainNum,omitempty"` // 剩余人数
|
||||
Players []*MatchPlayer `protobuf:"bytes,7,rep,name=Players,proto3" json:"Players,omitempty"` // 玩家列表
|
||||
Icon string `protobuf:"bytes,8,opt,name=Icon,proto3" json:"Icon,omitempty"` // 比赛图标
|
||||
}
|
||||
|
||||
func (x *MatchInfo) Reset() {
|
||||
|
@ -1949,6 +1950,13 @@ func (x *MatchInfo) GetPlayers() []*MatchPlayer {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *MatchInfo) GetIcon() string {
|
||||
if x != nil {
|
||||
return x.Icon
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SCTMMatchList struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
@ -2414,7 +2422,7 @@ var file_tournament_proto_rawDesc = []byte{
|
|||
0x55, 0x73, 0x65, 0x53, 0x6b, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61, 0x6e,
|
||||
0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x52, 0x61, 0x6e, 0x6b, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x63,
|
||||
0x6f, 0x72, 0x65, 0x22, 0xe0, 0x01, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x72, 0x65, 0x22, 0xf4, 0x01, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x49,
|
||||
0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
|
@ -2428,84 +2436,86 @@ var file_tournament_proto_rawDesc = []byte{
|
|||
0x4e, 0x75, 0x6d, 0x12, 0x31, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x07,
|
||||
0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x6e,
|
||||
0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x07, 0x50,
|
||||
0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x22, 0x64, 0x0a, 0x0d, 0x53, 0x43, 0x54, 0x4d, 0x4d, 0x61,
|
||||
0x74, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18,
|
||||
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x54, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0x2c, 0x0a, 0x0a,
|
||||
0x43, 0x53, 0x52, 0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0xc6, 0x01, 0x0a, 0x09, 0x4d,
|
||||
0x61, 0x74, 0x63, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x6f, 0x6f, 0x6d,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e,
|
||||
0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,
|
||||
0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x52, 0x6f,
|
||||
0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64,
|
||||
0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x6e, 0x64,
|
||||
0x12, 0x31, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x17, 0x2e, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4d,
|
||||
0x61, 0x74, 0x63, 0x68, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x07, 0x50, 0x6c, 0x61, 0x79,
|
||||
0x65, 0x72, 0x73, 0x22, 0x57, 0x0a, 0x0a, 0x53, 0x43, 0x52, 0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x15, 0x2e, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x61, 0x74,
|
||||
0x63, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02,
|
||||
0x54, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x2a, 0xc7, 0x04, 0x0a,
|
||||
0x0c, 0x54, 0x4f, 0x55, 0x52, 0x4e, 0x41, 0x4d, 0x45, 0x4e, 0x54, 0x49, 0x44, 0x12, 0x12, 0x0a,
|
||||
0x0e, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10,
|
||||
0x00, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43,
|
||||
0x53, 0x54, 0x4d, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xb4, 0x15, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41,
|
||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x73, 0x10, 0xb5, 0x15, 0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54,
|
||||
0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb6,
|
||||
0x15, 0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53,
|
||||
0x43, 0x54, 0x4d, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb7, 0x15, 0x12, 0x19,
|
||||
0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x53, 0x69,
|
||||
0x67, 0x6e, 0x52, 0x61, 0x63, 0x65, 0x10, 0xb8, 0x15, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43,
|
||||
0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x63,
|
||||
0x65, 0x10, 0xb9, 0x15, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54,
|
||||
0x4d, 0x5f, 0x53, 0x43, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x4e, 0x75, 0x6d, 0x10,
|
||||
0xba, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f,
|
||||
0x53, 0x43, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10,
|
||||
0xbb, 0x15, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f,
|
||||
0x53, 0x43, 0x54, 0x4d, 0x53, 0x74, 0x61, 0x72, 0x74, 0x10, 0xbc, 0x15, 0x12, 0x1d, 0x0a, 0x18,
|
||||
0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x49, 0x63, 0x6f, 0x6e, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x49, 0x63, 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x0d, 0x53, 0x43,
|
||||
0x54, 0x4d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x75, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49,
|
||||
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70,
|
||||
0x22, 0x2c, 0x0a, 0x0a, 0x43, 0x53, 0x52, 0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x54, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70, 0x22, 0xc6,
|
||||
0x01, 0x0a, 0x09, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x52, 0x6f,
|
||||
0x6f, 0x6d, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x12, 0x1e,
|
||||
0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x52,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x6f, 0x75,
|
||||
0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52,
|
||||
0x6f, 0x75, 0x6e, 0x64, 0x12, 0x31, 0x0a, 0x07, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18,
|
||||
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x6e, 0x74, 0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x07,
|
||||
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x22, 0x57, 0x0a, 0x0a, 0x53, 0x43, 0x52, 0x6f, 0x6f,
|
||||
0x6d, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x2e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x54, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x54, 0x70,
|
||||
0x2a, 0xc7, 0x04, 0x0a, 0x0c, 0x54, 0x4f, 0x55, 0x52, 0x4e, 0x41, 0x4d, 0x45, 0x4e, 0x54, 0x49,
|
||||
0x44, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x5a,
|
||||
0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
||||
0x54, 0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xb4, 0x15, 0x12, 0x18,
|
||||
0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x73, 0x10, 0xb5, 0x15, 0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x10, 0xb6, 0x15, 0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
||||
0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x52, 0x61, 0x6e, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x10,
|
||||
0xb7, 0x15, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f,
|
||||
0x43, 0x53, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x63, 0x65, 0x10, 0xb8, 0x15, 0x12, 0x19, 0x0a,
|
||||
0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x53, 0x69, 0x67,
|
||||
0x6e, 0x52, 0x61, 0x63, 0x65, 0x10, 0xb9, 0x15, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x4e, 0x75, 0x6d, 0x10, 0xba, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x10, 0xbb, 0x15, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x53, 0x74, 0x61, 0x72, 0x74, 0x10, 0xbc, 0x15,
|
||||
0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53,
|
||||
0x54, 0x4d, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xbf, 0x15, 0x12,
|
||||
0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54,
|
||||
0x4d, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xc0, 0x15, 0x12, 0x1d,
|
||||
0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d,
|
||||
0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x10, 0xc1, 0x15, 0x12, 0x1d, 0x0a,
|
||||
0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x53,
|
||||
0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x10, 0xc2, 0x15, 0x12, 0x1e, 0x0a, 0x19,
|
||||
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d, 0x53, 0x65,
|
||||
0x61, 0x73, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xbf, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x50,
|
||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x53, 0x65, 0x61,
|
||||
0x73, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x10, 0xc0, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41,
|
||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d, 0x53, 0x65, 0x61, 0x73,
|
||||
0x6f, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x10, 0xc1, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43,
|
||||
0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x53, 0x65, 0x61, 0x73, 0x6f,
|
||||
0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x10, 0xc2, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x54, 0x4d, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e,
|
||||
0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0xc3, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e,
|
||||
0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0xc4, 0x15, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x10, 0xc5, 0x15, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54,
|
||||
0x4d, 0x5f, 0x53, 0x43, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc6, 0x15,
|
||||
0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53,
|
||||
0x52, 0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc7, 0x15, 0x12, 0x19, 0x0a, 0x14, 0x50,
|
||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x52, 0x6f, 0x6f, 0x6d, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x10, 0xc8, 0x15, 0x2a, 0xa2, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x52,
|
||||
0x61, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f,
|
||||
0x53, 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43,
|
||||
0x5f, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52,
|
||||
0x43, 0x5f, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52,
|
||||
0x43, 0x5f, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x4f, 0x50,
|
||||
0x52, 0x43, 0x5f, 0x54, 0x69, 0x6d, 0x65, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x4f, 0x50, 0x52,
|
||||
0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43,
|
||||
0x5f, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x10, 0x06, 0x12, 0x0d, 0x0a, 0x09, 0x4f, 0x50,
|
||||
0x52, 0x43, 0x5f, 0x46, 0x72, 0x65, 0x65, 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52,
|
||||
0x43, 0x5f, 0x4e, 0x6f, 0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0x08, 0x42, 0x2a, 0x5a, 0x28, 0x6d,
|
||||
0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67,
|
||||
0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x74, 0x6f, 0x75,
|
||||
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x61, 0x73, 0x6f, 0x6e, 0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0xc3, 0x15, 0x12, 0x1e, 0x0a, 0x19,
|
||||
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x54, 0x4d, 0x53, 0x65,
|
||||
0x61, 0x73, 0x6f, 0x6e, 0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0xc4, 0x15, 0x12, 0x1a, 0x0a, 0x15,
|
||||
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x43, 0x53, 0x4d, 0x61, 0x74, 0x63,
|
||||
0x68, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc5, 0x15, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x10, 0xc6, 0x15, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54,
|
||||
0x4d, 0x5f, 0x43, 0x53, 0x52, 0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc7, 0x15, 0x12,
|
||||
0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x4d, 0x5f, 0x53, 0x43, 0x52,
|
||||
0x6f, 0x6f, 0x6d, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xc8, 0x15, 0x2a, 0xa2, 0x01, 0x0a, 0x0c, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x52, 0x61, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f,
|
||||
0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b,
|
||||
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x10, 0x01, 0x12, 0x0e, 0x0a,
|
||||
0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x10, 0x02, 0x12, 0x0f, 0x0a,
|
||||
0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x4e, 0x6f, 0x49, 0x74, 0x65, 0x6d, 0x10, 0x03, 0x12, 0x0d,
|
||||
0x0a, 0x09, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x54, 0x69, 0x6d, 0x65, 0x10, 0x04, 0x12, 0x0d, 0x0a,
|
||||
0x09, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x10, 0x05, 0x12, 0x10, 0x0a, 0x0c,
|
||||
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x10, 0x06, 0x12, 0x0d,
|
||||
0x0a, 0x09, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x46, 0x72, 0x65, 0x65, 0x10, 0x07, 0x12, 0x10, 0x0a,
|
||||
0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x4e, 0x6f, 0x41, 0x77, 0x61, 0x72, 0x64, 0x10, 0x08, 0x42,
|
||||
0x2a, 0x5a, 0x28, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
|
||||
0x2f, 0x74, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -218,6 +218,7 @@ message MatchInfo{
|
|||
int32 TotalRound = 5; // 总轮数
|
||||
int32 RemainNum = 6; // 剩余人数
|
||||
repeated MatchPlayer Players = 7; // 玩家列表
|
||||
string Icon = 8; // 比赛图标
|
||||
}
|
||||
|
||||
message SCTMMatchList{
|
||||
|
|
2
public
2
public
|
@ -1 +1 @@
|
|||
Subproject commit 07c189d652b84910258fa33eb3214d39c53edec4
|
||||
Subproject commit fc20f707697bffbac116ad93e1c94cc530fd0cf3
|
|
@ -789,6 +789,9 @@ func (this *CSAccountInvalidHandler) Process(s *netlib.Session, packetid int, da
|
|||
}
|
||||
|
||||
func init() {
|
||||
common.RegisterBoardCastHandler()
|
||||
common.RegisterMulticastHandler()
|
||||
|
||||
common.RegisterHandler(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdHandler{})
|
||||
netlib.RegisterFactory(int(playerproto.PlayerPacketID_PACKET_CS_PMCMD), &CSPMCmdPacketFactory{})
|
||||
|
||||
|
|
|
@ -123,10 +123,11 @@ func CSMatchList(s *netlib.Session, packetId int, data interface{}, sid int64) e
|
|||
d := &tournament.MatchInfo{
|
||||
MatchId: int64(v.TMId),
|
||||
InstanceId: v.SortId,
|
||||
Name: v.gmd.MatchName,
|
||||
Name: v.gmd.GetMatchName(),
|
||||
Round: round,
|
||||
TotalRound: v.GetTotalRound(),
|
||||
RemainNum: TournamentMgr.GetRemainNum(v.SortId),
|
||||
Icon: v.gmd.GetTitleURL(),
|
||||
}
|
||||
for _, v := range TournamentMgr.GetRemainPlayer(v.SortId) {
|
||||
var name, headUrl string
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
var (
|
||||
BroadcastMaker = &BroadcastPacketFactory{}
|
||||
)
|
||||
|
||||
type BroadcastPacketFactory struct {
|
||||
}
|
||||
|
||||
type BroadcastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), &BroadcastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_BROADCAST), BroadcastMaker)
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketBroadcast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *BroadcastPacketFactory) CreateBroadcastPacket(sp *protocol.BCSessionUnion, packetid int, data interface{}) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketBroadcast{
|
||||
SessParam: sp,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Warn("BroadcastPacketFactory.CreateBroadcastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *BroadcastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if bp, ok := data.(*protocol.SSPacketBroadcast); ok {
|
||||
pd := bp.GetData()
|
||||
sp := bp.GetSessParam()
|
||||
if bcss := sp.GetBcss(); bcss != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(bp.GetPacketId()), pd, int(bcss.GetSArea()), int(bcss.GetSType()))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -75,7 +75,7 @@ func (gsm *GameStateManager) BrodcastGameState(gameId int32, platform string, pa
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packid, pack, v...)
|
||||
pack, err := common.CreateMulticastPacket(packid, pack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
rawproto "google.golang.org/protobuf/proto"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
"mongo.games.com/goserver/srvlib/protocol"
|
||||
)
|
||||
|
||||
var (
|
||||
MulticastMaker = &MulticastPacketFactory{}
|
||||
)
|
||||
|
||||
type MulticastPacketFactory struct {
|
||||
}
|
||||
|
||||
type MulticastHandler struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
netlib.RegisterHandler(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), &MulticastHandler{})
|
||||
netlib.RegisterFactory(int(protocol.SrvlibPacketID_PACKET_SS_MULTICAST), MulticastMaker)
|
||||
}
|
||||
|
||||
func (this *MulticastPacketFactory) CreatePacket() interface{} {
|
||||
pack := &protocol.SSPacketMulticast{}
|
||||
return pack
|
||||
}
|
||||
|
||||
func (this *MulticastPacketFactory) CreateMulticastPacket(packetid int, data interface{}, sis ...*protocol.MCSessionUnion) (rawproto.Message, error) {
|
||||
pack := &protocol.SSPacketMulticast{
|
||||
Sessions: sis,
|
||||
PacketId: proto.Int(packetid),
|
||||
}
|
||||
if byteData, ok := data.([]byte); ok {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
byteData, err := netlib.MarshalPacket(packetid, data)
|
||||
if err == nil {
|
||||
pack.Data = byteData
|
||||
} else {
|
||||
logger.Logger.Info("MulticastPacketFactory.CreateMulticastPacket err:", err)
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
proto.SetDefaults(pack)
|
||||
return pack, nil
|
||||
}
|
||||
|
||||
func (this *MulticastHandler) Process(s *netlib.Session, packetid int, data interface{}) error {
|
||||
if mp, ok := data.(*protocol.SSPacketMulticast); ok {
|
||||
pd := mp.GetData()
|
||||
sis := mp.GetSessions()
|
||||
for _, si := range sis {
|
||||
ss := si.GetMcss()
|
||||
if ss != nil {
|
||||
ns := srvlib.ServerSessionMgrSington.GetSession(int(ss.GetSArea()), int(ss.GetSType()), int(ss.GetSId()))
|
||||
if ns != nil {
|
||||
ns.Send(int(mp.GetPacketId()), pd /*, s.GetSessionConfig().IsInnerLink*/)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -10,6 +10,7 @@ import (
|
|||
"mongo.games.com/goserver/core/utils"
|
||||
srvlibproto "mongo.games.com/goserver/srvlib/protocol"
|
||||
|
||||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/proto"
|
||||
hallproto "mongo.games.com/game/protocol/gamehall"
|
||||
|
@ -302,7 +303,7 @@ func (pm *PlatformMgr) Broadcast(packetid int, packet interface{}, players map[i
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, packet, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, packet, v...)
|
||||
if err == nil {
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"math/rand"
|
||||
"mongo.games.com/game/worldsrv/internal"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core/basic"
|
||||
|
@ -16,7 +15,8 @@ import (
|
|||
"mongo.games.com/game/common"
|
||||
"mongo.games.com/game/model"
|
||||
"mongo.games.com/game/proto"
|
||||
server_proto "mongo.games.com/game/protocol/server"
|
||||
serverproto "mongo.games.com/game/protocol/server"
|
||||
"mongo.games.com/game/worldsrv/internal"
|
||||
)
|
||||
|
||||
var PlayerMgrSington = &PlayerMgr{
|
||||
|
@ -292,7 +292,7 @@ func (this *PlayerMgr) BroadcastMessage(packetid int, rawpack interface{}) bool
|
|||
sc := &srvproto.BCSessionUnion{
|
||||
Bccs: &srvproto.BCClientSession{},
|
||||
}
|
||||
pack, err := BroadcastMaker.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||
pack, err := common.CreateBroadcastPacket(sc, packetid, rawpack)
|
||||
if err == nil && pack != nil {
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(srvproto.SrvlibPacketID_PACKET_SS_BROADCAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
return true
|
||||
|
@ -318,7 +318,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatform(platform string, packetid int,
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
@ -345,7 +345,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformByFunc(platform string, packeti
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
@ -378,7 +378,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformWithHall(platform string, snid
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
@ -391,7 +391,7 @@ func (this *PlayerMgr) BroadcastMessageToPlatformWithHall(platform string, snid
|
|||
|
||||
// BroadcastMessageToGroup 发送群组消息
|
||||
func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}, tags []string) bool {
|
||||
pack := &server_proto.SSCustomTagMulticast{
|
||||
pack := &serverproto.SSCustomTagMulticast{
|
||||
Tags: tags,
|
||||
}
|
||||
if byteData, ok := rawpack.([]byte); ok {
|
||||
|
@ -405,7 +405,7 @@ func (this *PlayerMgr) BroadcastMessageToGroup(packetid int, rawpack interface{}
|
|||
return false
|
||||
}
|
||||
}
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(server_proto.SSPacketID_PACKET_SS_CUSTOMTAG_MULTICAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
srvlib.ServerSessionMgrSington.Broadcast(int(serverproto.SSPacketID_PACKET_SS_CUSTOMTAG_MULTICAST), pack, common.GetSelfAreaId(), srvlib.GateServerType)
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ func (this *PlayerMgr) BroadcastMessageToTarget(platform string, target []int32,
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, rawpack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
|
|
@ -1159,7 +1159,7 @@ func (this *Scene) Broadcast(packetid int, msg rawproto.Message, excludeSid int6
|
|||
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetid, msg, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetid, msg, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvlibproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
|
|
@ -107,7 +107,7 @@ func (tm *TmMatch) BroadcastMessage(packetId int, rawPack interface{}) {
|
|||
}
|
||||
for gateSess, v := range mgs {
|
||||
if gateSess != nil && len(v) != 0 {
|
||||
pack, err := MulticastMaker.CreateMulticastPacket(packetId, rawPack, v...)
|
||||
pack, err := common.CreateMulticastPacket(packetId, rawPack, v...)
|
||||
if err == nil {
|
||||
proto.SetDefaults(pack)
|
||||
gateSess.Send(int(srvproto.SrvlibPacketID_PACKET_SS_MULTICAST), pack)
|
||||
|
|
|
@ -220,6 +220,21 @@ func (this *Tournament) GetRemainPlayer(sortId int64) []*MatchPlayerInfo {
|
|||
|
||||
robotPlayer := func(n int) {
|
||||
for _, v := range tm.robotGrades[n] {
|
||||
if v.copySnid == 0 {
|
||||
for _, vv := range tm.TmPlayer {
|
||||
p := PlayerMgrSington.GetPlayerBySnId(vv.SnId)
|
||||
if p != nil {
|
||||
ret = append(ret, &MatchPlayerInfo{
|
||||
SnId: vv.SnId,
|
||||
RoleId: p.GetRoleId(),
|
||||
SkinId: p.Skin.ModId,
|
||||
Grade: v.grade,
|
||||
})
|
||||
}
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
ret = append(ret, &MatchPlayerInfo{
|
||||
SnId: v.copySnid,
|
||||
RoleId: v.copyRoleId,
|
||||
|
|
Binary file not shown.
BIN
xlsx/DB_VIP.xlsx
BIN
xlsx/DB_VIP.xlsx
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue