You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
1.9 KiB
80 lines
1.9 KiB
/*
|
|
Sog 游戏基础库
|
|
2016 by zouwei
|
|
*/
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
|
|
namespace Game
|
|
{
|
|
// 动态消息
|
|
public class DynamicMsgHandler : BasePacketHandler
|
|
{
|
|
public override int GetServiceType()
|
|
{
|
|
return GameServiceType.DynamicMsgHandler;
|
|
}
|
|
|
|
//销毁的时候置空
|
|
public override void Dispose()
|
|
{
|
|
}
|
|
|
|
public DynamicMsgHandler()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public override void HandlerClientPacket(PlayerSession playerSession, StructPacket packet)
|
|
{
|
|
if (playerSession.Player == null)
|
|
{
|
|
TraceLog.Debug("DynamicMsgHandler HandlerClientPacket drop message id {0} because session {1} no player object"
|
|
, packet.MsgID, playerSession.SessionID);
|
|
return;
|
|
}
|
|
|
|
switch (packet.MsgID)
|
|
{
|
|
case (int)CSGameMsgID.CommonDynamicReq:
|
|
ProcessDynamicMsgReq(playerSession, packet);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
public override void HandlerServerPacket(uint serverID, StructPacket packet)
|
|
{
|
|
switch (packet.MsgID)
|
|
{
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
private int ProcessDynamicMsgReq(PlayerSession playerSession, StructPacket packet)
|
|
{
|
|
ref CSCommonDynamicReq dynamicReq = ref packet.GetMessage<CSCommonDynamicReq>();
|
|
|
|
PlayerOnGame player = playerSession.Player;
|
|
if (player == null)
|
|
{
|
|
player.Debug("DynamicMsgHandler.ProcessDynamicMsgReq no player object, session {0}", playerSession.SessionID);
|
|
return -2;
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
|