feat 协议移动到Public
This commit is contained in:
@@ -2,8 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"common/log"
|
||||
"common/proto/gen/common"
|
||||
"common/proto/gen/grpc_pb"
|
||||
"common/proto/ss/grpc_pb"
|
||||
"context"
|
||||
"scene/instance"
|
||||
"sync"
|
||||
@@ -52,5 +51,5 @@ func (s *Server) Action(server grpc_pb.Scene_ActionServer) error {
|
||||
}
|
||||
}()
|
||||
wg.Wait()
|
||||
return server.SendAndClose(&common.Empty{})
|
||||
return server.SendAndClose(&grpc_pb.ActionResp{})
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package server
|
||||
import (
|
||||
"common/discover/common"
|
||||
"common/net/grpc/service"
|
||||
"common/proto/gen/grpc_pb"
|
||||
"common/proto/ss/grpc_pb"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package instance
|
||||
import (
|
||||
"common/discover"
|
||||
"common/log"
|
||||
"common/proto/gen/cs"
|
||||
"common/proto/gen/grpc_pb"
|
||||
"common/proto/sc/sc_pb"
|
||||
"common/proto/ss/grpc_pb"
|
||||
"common/utils"
|
||||
"context"
|
||||
"fmt"
|
||||
@@ -97,12 +97,12 @@ func (i *Instance) onEvent(e proto.Message) {
|
||||
|
||||
// 逻辑帧
|
||||
func (i *Instance) onLogic() {
|
||||
positionUpdate := make([]*cs.PositionInfo, 0)
|
||||
positionUpdate := make([]*sc_pb.PositionInfo, 0)
|
||||
sid := int64(0)
|
||||
// 优先处理移动指令
|
||||
for _, node := range i.players {
|
||||
if node.LogicMove() {
|
||||
positionUpdate = append(positionUpdate, &cs.PositionInfo{
|
||||
positionUpdate = append(positionUpdate, &sc_pb.PositionInfo{
|
||||
UID: int32(node.UID),
|
||||
X: node.Position[0],
|
||||
Y: node.Position[1],
|
||||
@@ -111,12 +111,12 @@ func (i *Instance) onLogic() {
|
||||
}
|
||||
}
|
||||
if len(positionUpdate) > 0 {
|
||||
payload, _ := proto.Marshal(&cs.S2C_Position{
|
||||
payload, _ := proto.Marshal(&sc_pb.S2C_Position{
|
||||
Info: positionUpdate,
|
||||
})
|
||||
if err := stream_client.SendMessageToGateway(sid, stream_client.FunToClient, &grpc_pb.ToClientReq{
|
||||
UID: -1,
|
||||
MessageID: int32(cs.MessageID_MESSAGE_ID_POSITION),
|
||||
MessageID: int32(sc_pb.MessageID_MESSAGE_ID_POSITION),
|
||||
Payload: payload,
|
||||
}); err != nil {
|
||||
i.logger.Errorf("send action err: %v", err)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package npc
|
||||
|
||||
import (
|
||||
"common/proto/gen/grpc_pb"
|
||||
"common/proto/ss/grpc_pb"
|
||||
)
|
||||
|
||||
// NPCNode 定义NPC节点
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package npc
|
||||
|
||||
import (
|
||||
"common/proto/gen/grpc_pb"
|
||||
"common/proto/ss/grpc_pb"
|
||||
)
|
||||
|
||||
// PlayerNode 定义玩家节点结构体
|
||||
|
||||
Reference in New Issue
Block a user