本文整理汇总了C#中IProtocol.GetSubProtocol方法的典型用法代码示例。如果您正苦于以下问题:C# IProtocol.GetSubProtocol方法的具体用法?C# IProtocol.GetSubProtocol怎么用?C# IProtocol.GetSubProtocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProtocol
的用法示例。
在下文中一共展示了IProtocol.GetSubProtocol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageReceived
private void MessageReceived(GameServer server, IProtocol message)
{
ISubProtocol pSubProtocol = message.GetSubProtocol();
if (pSubProtocol == null ||
(ProtocolDef)message.ProtocolId != ProtocolDef.l2e_header_def)
{
return;
}
byte[] data = message.ToBytes();
switch ((ProtocolDef)pSubProtocol.SubProtocolID)
{
// ahpho
case ProtocolDef.l2e_update_custom_info_def:
{
l2e_update_custom_info protocal = new l2e_update_custom_info();
protocal.FromBytes(data);
_customInfoStrs = protocal.GetInfoStrs();
}
break;
case ProtocolDef.l2e_PlayerCount_def:
{
l2e_PlayerCount protocol = new l2e_PlayerCount();
protocol.FromBytes(data);
if (protocol.GetTotalCount() >= 0)
{
UpdatePlayerCount(protocol.GetTotalCount(),server.Group);
}
if (protocol.GetOffliveCount() >= 0)
UpdateOfflineCount(protocol.GetOffliveCount());
}
break;
//GM指令接收的消息
case ProtocolDef.l2e_ExeGMCmd_def:
{
l2e_ExeGMCmd protocol = new l2e_ExeGMCmd();
protocol.FromBytes(data);
//l2e_ExeGMCmd protocol = (l2e_ExeGMCmd)message;
if (protocol.ReturnCode == 1)
{
UpdateGMResultCache(protocol.nSessionID, protocol.szResult);
}
else
{
UpdateGMResultCache(protocol.nSessionID, "GM指令操作失败");
}
}
break;
case ProtocolDef.l2e_GetBasicInfo_def:
{
l2e_GetBasicInfo protocol = new l2e_GetBasicInfo();
protocol.FromBytes(data);
}
break;
case ProtocolDef.l2e_Who_def:
{
l2e_Who protocol = new l2e_Who();
protocol.FromBytes(data);
UpdatePlayerWho(protocol.PlayerList);
}
break;
case ProtocolDef.l2e_GetGlobalVariable_def:
{
l2e_GetGlobalVariable protocol = new l2e_GetGlobalVariable();
protocol.FromBytes(data);
server.GameSetting.UpdateGlobalVariable(protocol.VariableIndex, protocol.VariableValue);
}
break;
case ProtocolDef.l2e_GetGameStartTime_def:
{
l2e_GetGameStartTime protocol = new l2e_GetGameStartTime();
protocol.FromBytes(data);
int seconds = int.Parse(protocol.GameStartTime);
_gameRunningRefreshTime = DateTime.Now;
_gameRunningTime = new TimeSpan(0, 0, seconds);
}
break;
case ProtocolDef.l2e_ReportError_def:
{
l2e_ReportError protocol = new l2e_ReportError();
protocol.FromBytes(data);
SetModuleStateCode(protocol.Module, protocol.ErrorCode);
}
break;
case ProtocolDef.l2e_info_def:
{
l2e_info protocol = new l2e_info();
protocol.FromBytes(data);
Hashtable infoPackage = Util.ConvertKeyValuePairToHashtable(protocol.Info);
if (infoPackage != null)
GameInfoReceived(infoPackage);
}
break;
case ProtocolDef.l2e_info_large_def:
{
l2e_info_large protocol = new l2e_info_large();
protocol.FromBytes(data);
Hashtable infoPackage = Util.ConvertKeyValuePairToHashtable(protocol.InfoLarge);
if (infoPackage != null)
//.........这里部分代码省略.........