feat sc改名ss
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/ss/ss_pb"
|
||||
instance2 "git.hlsq.asia/mmorpg/service-scene/internal/instance"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"sync"
|
||||
@@ -23,8 +23,8 @@ func (s *Server) Enter(ctx context.Context, req *grpc_pb.EnterReq) (*grpc_pb.Ent
|
||||
}
|
||||
i.EventIn <- req
|
||||
|
||||
payload, _ := proto.Marshal(&sc_pb.S2C_EnterInstance{
|
||||
Info: &sc_pb.PositionInfo{
|
||||
payload, _ := proto.Marshal(&ss_pb.S2C_EnterInstance{
|
||||
Info: &ss_pb.PositionInfo{
|
||||
USN: req.USN,
|
||||
X: 1,
|
||||
Y: 1,
|
||||
@@ -33,7 +33,7 @@ func (s *Server) Enter(ctx context.Context, req *grpc_pb.EnterReq) (*grpc_pb.Ent
|
||||
return &grpc_pb.EnterResp{
|
||||
SceneSID: s.SID,
|
||||
UniqueNo: i.UniqueNo,
|
||||
MessageID: int32(sc_pb.MessageID_MESSAGE_ID_ENTER_INSTANCE),
|
||||
MessageID: int32(ss_pb.MessageID_MESSAGE_ID_ENTER_INSTANCE),
|
||||
Payload: payload,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"git.hlsq.asia/mmorpg/service-common/discover"
|
||||
"git.hlsq.asia/mmorpg/service-common/log"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/ss/ss_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"git.hlsq.asia/mmorpg/service-scene/internal/grpc_server/stream_client"
|
||||
"git.hlsq.asia/mmorpg/service-scene/internal/npc"
|
||||
@@ -103,12 +103,12 @@ func (i *Instance) onEvent(e proto.Message) {
|
||||
|
||||
// 逻辑帧
|
||||
func (i *Instance) onLogic(delta int64) {
|
||||
positionUpdate := make([]*sc_pb.PositionInfo, 0)
|
||||
positionUpdate := make([]*ss_pb.PositionInfo, 0)
|
||||
sid := ""
|
||||
// 处理玩家指令
|
||||
for _, node := range i.players {
|
||||
if node.LogicAction(delta) {
|
||||
positionUpdate = append(positionUpdate, &sc_pb.PositionInfo{
|
||||
positionUpdate = append(positionUpdate, &ss_pb.PositionInfo{
|
||||
USN: node.USN,
|
||||
X: int32(node.Position[0] * 100),
|
||||
Y: int32(node.Position[1] * 100),
|
||||
@@ -117,12 +117,12 @@ func (i *Instance) onLogic(delta int64) {
|
||||
}
|
||||
}
|
||||
if len(positionUpdate) > 0 {
|
||||
payload, _ := proto.Marshal(&sc_pb.S2C_Position{
|
||||
payload, _ := proto.Marshal(&ss_pb.S2C_Position{
|
||||
Info: positionUpdate,
|
||||
})
|
||||
if err := stream_client.SendMessageToGateway(sid, stream_client.FunToClient, &grpc_pb.ToClientReq{
|
||||
USN: "",
|
||||
MessageID: int32(sc_pb.MessageID_MESSAGE_ID_POSITION),
|
||||
MessageID: int32(ss_pb.MessageID_MESSAGE_ID_POSITION),
|
||||
Payload: payload,
|
||||
}); err != nil {
|
||||
i.logger.Errorf("send action err: %v", err)
|
||||
|
||||
@@ -2,7 +2,7 @@ package npc
|
||||
|
||||
import (
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/sc/sc_pb"
|
||||
"git.hlsq.asia/mmorpg/service-common/proto/ss/ss_pb"
|
||||
)
|
||||
|
||||
// PlayerNode 定义玩家节点结构体
|
||||
@@ -36,11 +36,11 @@ func (p *PlayerNode) AddAction(e *grpc_pb.ActionReq) {
|
||||
// return 是否更新玩家状态
|
||||
func (p *PlayerNode) LogicAction(delta int64) bool {
|
||||
for _, a := range p.Action {
|
||||
switch sc_pb.ActionID(a.Action) {
|
||||
case sc_pb.ActionID_ACTION_ID_MOVE:
|
||||
switch ss_pb.ActionID(a.Action) {
|
||||
case ss_pb.ActionID_ACTION_ID_MOVE:
|
||||
p.MoveDirection = [2]int8{int8(a.DirX), int8(a.DirY)}
|
||||
p.MoveCount = 0
|
||||
case sc_pb.ActionID_ACTION_ID_ATTACK:
|
||||
case ss_pb.ActionID_ACTION_ID_ATTACK:
|
||||
}
|
||||
}
|
||||
p.Action = make([]*grpc_pb.ActionReq, 0)
|
||||
|
||||
Reference in New Issue
Block a user