/* Sog 游戏基础库 2016 by zouwei */ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Sog; using Sog.Gate; using ProtoCSStruct; namespace Account { // 实现 SendToPlayer public static class PlayerPacketSender { public static void SendToPlayer(long sessionId, int iMsgID, ref T structMessage) where T : struct, IStructMessage { PlayerSession playerSession = AccountServerUtils.GetPlayerTableOp().GetPlayerSession(sessionId); if (playerSession != null) { GateService.SendToGate(0, AccountServerUtils.GetApp().GetCluster() , playerSession.GateServerID, playerSession.SessionID, iMsgID, ref structMessage); } else { TraceLog.Debug("PlayerPacketSender.SendToPlayer sessionId {0} no PlayerSession object!", sessionId); } } public static void SendToPlayer(PlayerSession playerSession, int iMsgID, ref T structMessage) where T : struct, IStructMessage { GateService.SendToGate(0,AccountServerUtils.GetApp().GetCluster() ,playerSession.GateServerID,playerSession.SessionID, iMsgID, ref structMessage); } /// /// 直接转发 /// /// /// public static void SendToPlayer(PlayerSession playerSession, StructPacket packet) where T : struct, IStructMessage { GateService.SendToGate(0,AccountServerUtils.GetApp().GetCluster() , playerSession.GateServerID, playerSession.SessionID, packet.MsgID, ref packet.GetMessage()); } } }