using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Sog; using Sog.Service; using ProtoCSStruct; namespace Game { public class MoveHandler : BasePacketHandler { public override int GetServiceType() { return GameServiceType.MoveHandler; } //销毁的时候置空 public override void Dispose() { } public MoveHandler() { } public override void HandlerClientPacket(PlayerSession playerSession, StructPacket packet) { PlayerOnGame player = playerSession.Player; if (player == null) { TraceLog.Error("MoveHandler.HandlerClientPacket can not find PlayerOnGame sessionid {0}", playerSession.SessionID); return; } switch (packet.MsgID) { case (int)CSGameMsgID.MoveWalk: OnCliMoveWalkReq(player, packet); break; case (int)CSGameMsgID.MoveTurn: OnCliMoveTurnReq(player, packet); break; case (int)CSGameMsgID.MoveStop: OnCliMoveStopReq(player, packet); break; case (int)CSGameMsgID.MoveCameraChange: OnCliMoveCameraChange(player, packet); break; default: TraceLog.Error("MoveHandler.HandlerClientPacket msgId {0} not handle", packet.MsgID); break; } } public override void HandlerServerPacket(uint serverID, StructPacket packet) { switch (packet.MsgID) { default: TraceLog.Error("MoveHandler.HandlerServerPacket msgId {0} not handle", packet.MsgID); break; } } private void OnCliMoveWalkReq(PlayerOnGame player, StructPacket packet) { player.Trace("MoveHandler.OnCliMoveWalkReq uid {0}", player.UserID); ref CSMoveWalk req = ref packet.GetMessage(); MoveSvc.OnMoveWalk(player, ref req); } private void OnCliMoveTurnReq(PlayerOnGame player, StructPacket packet) { player.Trace("MoveHandler.OnCliMoveTurnReq uid {0}", player.UserID); ref CSMoveTurn req = ref packet.GetMessage(); MoveSvc.OnMoveTurn(player, ref req); } private void OnCliMoveStopReq(PlayerOnGame player, StructPacket packet) { player.Trace("MoveHandler.OnCliMoveStopReq uid {0}", player.UserID); ref CSMoveStop req = ref packet.GetMessage(); MoveSvc.OnMoveStop(player, ref req); } private void OnCliMoveCameraChange(PlayerOnGame player, StructPacket packet) { player.Trace("MoveHandler.OnCliMoveCameraChange uid {0}", player.UserID); ref CSMoveCameraChange req = ref packet.GetMessage(); MoveSvc.OnMoveCameraChange(player, ref req); } } }