娃娃机获取token修改
This commit is contained in:
parent
fe26aa3d37
commit
6a9c6a988b
|
@ -92,6 +92,7 @@ func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interf
|
|||
}
|
||||
pack := &machine.SMGetToken{}
|
||||
pack.Snid = p.SnId
|
||||
pack.Sid = p.GetSid()
|
||||
|
||||
scene := p.GetScene()
|
||||
if scene == nil {
|
||||
|
@ -122,7 +123,7 @@ func MSSendTokenHandler(session *netlib.Session, packetId int, data interface{})
|
|||
if msg, ok := data.(*machine.MSSendToken); ok {
|
||||
//给客户端返回token
|
||||
token := msg.Token
|
||||
p := base.PlayerMgrSington.GetPlayer(int64(msg.Snid))
|
||||
p := base.PlayerMgrSington.GetPlayer(int64(msg.GetSid()))
|
||||
if p == nil {
|
||||
logger.Logger.Warn("MSSendTokenHandler p == nil")
|
||||
return nil
|
||||
|
|
|
@ -3,6 +3,7 @@ package clawdoll
|
|||
import (
|
||||
"mongo.games.com/game/gamesrv/action"
|
||||
"mongo.games.com/game/protocol/clawdoll"
|
||||
"mongo.games.com/game/protocol/machine"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core"
|
||||
|
@ -117,6 +118,8 @@ func (this *PolicyClawdoll) OnPlayerEnter(s *base.Scene, p *base.Player) {
|
|||
|
||||
// 玩家数据发送
|
||||
sceneEx.OnPlayerEnter(p, 0)
|
||||
|
||||
this.SendGetVideoToken(s, p, sceneEx)
|
||||
s.FirePlayerEvent(p, base.PlayerEventEnter, nil)
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +176,8 @@ func (this *PolicyClawdoll) OnPlayerRehold(s *base.Scene, p *base.Player) {
|
|||
this.SendRoomInfo(s, p, sceneEx)
|
||||
ClawdollBroadcastRoomWaitPlayers(s)
|
||||
ClawdollBroadcastPlayingInfo(s)
|
||||
|
||||
this.SendGetVideoToken(s, p, sceneEx)
|
||||
s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
|
||||
}
|
||||
}
|
||||
|
@ -193,6 +198,7 @@ func (this *PolicyClawdoll) OnPlayerReturn(s *base.Scene, p *base.Player) {
|
|||
ClawdollBroadcastRoomWaitPlayers(s)
|
||||
ClawdollBroadcastPlayingInfo(s)
|
||||
|
||||
this.SendGetVideoToken(s, p, sceneEx)
|
||||
s.FirePlayerEvent(p, base.PlayerEventReturn, nil)
|
||||
}
|
||||
}
|
||||
|
@ -256,11 +262,41 @@ func (this *PolicyClawdoll) CanChangeCoinScene(s *base.Scene, p *base.Player) bo
|
|||
}
|
||||
|
||||
func (this *PolicyClawdoll) SendRoomInfo(s *base.Scene, p *base.Player, sceneEx *SceneEx) {
|
||||
if s == nil || p == nil || sceneEx == nil {
|
||||
return
|
||||
}
|
||||
|
||||
pack := sceneEx.ClawdollCreateRoomInfoPacket(s, p)
|
||||
|
||||
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_ROOMINFO), pack)
|
||||
}
|
||||
|
||||
func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sceneEx *SceneEx) {
|
||||
//转发到娃娃机主机
|
||||
if s == nil || p == nil || sceneEx == nil {
|
||||
return
|
||||
}
|
||||
logger.Logger.Tracef("ClawdollGetVideoToken")
|
||||
if p == nil {
|
||||
logger.Logger.Warn("ClawdollGetVideoToken p == nil")
|
||||
return
|
||||
}
|
||||
pack := &machine.SMGetToken{}
|
||||
pack.Snid = p.SnId
|
||||
pack.Sid = p.GetSid()
|
||||
|
||||
machineId := s.DbGameFree.GetId() % 6080000
|
||||
appId, serverSecret := sceneEx.GetMachineServerSecret(machineId, p.Platform)
|
||||
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v", appId, serverSecret)
|
||||
if serverSecret == "" || appId == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
pack.ServerSecret = serverSecret
|
||||
pack.AppId = appId
|
||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack)
|
||||
}
|
||||
|
||||
// 广播房间状态
|
||||
func ClawdollBroadcastRoomState(s *base.Scene, params ...float32) {
|
||||
pack := &clawdoll.SCCLAWDOLLRoomState{
|
||||
|
|
|
@ -300,6 +300,9 @@ func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{})
|
|||
info := &machine.MSSendToken{}
|
||||
info.Snid = msg.Snid
|
||||
info.Token = token
|
||||
info.Sid = msg.GetSid()
|
||||
info.Appid = msg.AppId
|
||||
|
||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info)
|
||||
logger.Logger.Tracef("向游戏服务器发送娃娃机token:%v", info)
|
||||
return nil
|
||||
|
|
|
@ -505,6 +505,7 @@ type SMGetToken struct {
|
|||
Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"`
|
||||
AppId int64 `protobuf:"varint,2,opt,name=AppId,proto3" json:"AppId,omitempty"`
|
||||
ServerSecret string `protobuf:"bytes,3,opt,name=ServerSecret,proto3" json:"ServerSecret,omitempty"`
|
||||
Sid int64 `protobuf:"varint,4,opt,name=Sid,proto3" json:"Sid,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SMGetToken) Reset() {
|
||||
|
@ -560,6 +561,13 @@ func (x *SMGetToken) GetServerSecret() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *SMGetToken) GetSid() int64 {
|
||||
if x != nil {
|
||||
return x.Sid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//返回token
|
||||
type MSSendToken struct {
|
||||
state protoimpl.MessageState
|
||||
|
@ -569,6 +577,7 @@ type MSSendToken struct {
|
|||
Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"`
|
||||
Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
|
||||
Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"`
|
||||
Sid int64 `protobuf:"varint,4,opt,name=Sid,proto3" json:"Sid,omitempty"`
|
||||
}
|
||||
|
||||
func (x *MSSendToken) Reset() {
|
||||
|
@ -624,6 +633,13 @@ func (x *MSSendToken) GetToken() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *MSSendToken) GetSid() int64 {
|
||||
if x != nil {
|
||||
return x.Sid
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_machine_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_machine_proto_rawDesc = []byte{
|
||||
|
@ -661,40 +677,42 @@ var file_machine_proto_rawDesc = []byte{
|
|||
0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41, 0x64,
|
||||
0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x41,
|
||||
0x64, 0x64, 0x72, 0x22, 0x5a, 0x0a, 0x0a, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65,
|
||||
0x64, 0x64, 0x72, 0x22, 0x6c, 0x0a, 0x0a, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65,
|
||||
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22,
|
||||
0x4d, 0x0a, 0x0b, 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e,
|
||||
0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65,
|
||||
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x2a, 0xb9,
|
||||
0x02, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x61,
|
||||
0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5a, 0x65,
|
||||
0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||
0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64,
|
||||
0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||
0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x50, 0x65, 0x72, 0x61,
|
||||
0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x47, 0x72,
|
||||
0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x4c, 0x69,
|
||||
0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x26, 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
||||
0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63,
|
||||
0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0xa4, 0x9c, 0x01, 0x12, 0x27,
|
||||
0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d,
|
||||
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73,
|
||||
0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45,
|
||||
0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa6, 0x9c, 0x01,
|
||||
0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x53, 0x65, 0x6e,
|
||||
0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa7, 0x9c, 0x01, 0x42, 0x27, 0x5a, 0x25, 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, 0x6d, 0x61, 0x63, 0x68,
|
||||
0x69, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x09, 0x52, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x53, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x53, 0x69,
|
||||
0x64, 0x22, 0x5f, 0x0a, 0x0b, 0x4d, 0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
|
||||
0x53, 0x6e, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f,
|
||||
0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x53, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x53,
|
||||
0x69, 0x64, 0x2a, 0xb9, 0x02, 0x0a, 0x13, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69,
|
||||
0x6e, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41,
|
||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69,
|
||||
0x6e, 0x65, 0x5a, 0x65, 0x72, 0x6f, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x53, 0x75, 0x63,
|
||||
0x63, 0x65, 0x65, 0x64, 0x10, 0xa0, 0x9c, 0x01, 0x12, 0x20, 0x0a, 0x1a, 0x50, 0x41, 0x43, 0x4b,
|
||||
0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
|
||||
0x50, 0x65, 0x72, 0x61, 0x74, 0x65, 0x10, 0xa1, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41,
|
||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69,
|
||||
0x6e, 0x65, 0x47, 0x72, 0x61, 0x62, 0x10, 0xa2, 0x9c, 0x01, 0x12, 0x1e, 0x0a, 0x18, 0x50, 0x41,
|
||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69,
|
||||
0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xa3, 0x9c, 0x01, 0x12, 0x26, 0x0a, 0x20, 0x50, 0x41,
|
||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x6c,
|
||||
0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x10, 0xa4,
|
||||
0x9c, 0x01, 0x12, 0x27, 0x0a, 0x21, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d, 0x53, 0x44,
|
||||
0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x6f, 0x50, 0x65, 0x72, 0x61, 0x74,
|
||||
0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x10, 0xa5, 0x9c, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x50,
|
||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x4d, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x10, 0xa6, 0x9c, 0x01, 0x12, 0x18, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x4d,
|
||||
0x53, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x10, 0xa7, 0x9c, 0x01, 0x42, 0x27,
|
||||
0x5a, 0x25, 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,
|
||||
0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -64,10 +64,12 @@ message SMGetToken{
|
|||
int32 Snid = 1;
|
||||
int64 AppId = 2;
|
||||
string ServerSecret = 3;
|
||||
int64 Sid = 4;
|
||||
}
|
||||
//返回token
|
||||
message MSSendToken{
|
||||
int32 Snid = 1;
|
||||
int64 Appid = 2;
|
||||
string Token = 3;
|
||||
int64 Sid = 4;
|
||||
}
|
Loading…
Reference in New Issue