本文整理汇总了C#中PRoCon.Core.Remote.FrostbiteConnection.GetRequestPacket方法的典型用法代码示例。如果您正苦于以下问题:C# FrostbiteConnection.GetRequestPacket方法的具体用法?C# FrostbiteConnection.GetRequestPacket怎么用?C# FrostbiteConnection.GetRequestPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PRoCon.Core.Remote.FrostbiteConnection
的用法示例。
在下文中一共展示了FrostbiteConnection.GetRequestPacket方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connection_PacketRecieved
private void Connection_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) {
if (packetBeforeDispatch.OriginatedFromServer == false) {
Packet request = sender.GetRequestPacket(packetBeforeDispatch);
if (request != null && String.Compare(request.Words[0], "version", StringComparison.OrdinalIgnoreCase) == 0) {
if (Game == null) {
if (String.Compare(packetBeforeDispatch.Words[1], "BFBC2", StringComparison.OrdinalIgnoreCase) == 0) {
Game = new BFBC2Client(sender);
_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "MOH", StringComparison.OrdinalIgnoreCase) == 0) {
Game = new MoHClient(sender);
_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "BF3", StringComparison.OrdinalIgnoreCase) == 0) {
Game = new BF3Client(sender);
_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "BF4", StringComparison.OrdinalIgnoreCase) == 0) {
Game = new BF4Client(sender);
_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "MOHW", StringComparison.OrdinalIgnoreCase) == 0) {
Game = new MOHWClient(sender);
_connection = null;
}
if (Game != null) {
VersionNumber = packetBeforeDispatch.Words[2];
Game.ServerInfo += new FrostbiteClient.ServerInfoHandler(OnServerInfo);
Game.SendServerinfoPacket();
//sender.SendQueued(new Packet(false, false, sender.AcquireSequenceNumber, "serverInfo"));
}
}
else if (Game.Connection != null) {
BeginLoginSequence();
}
sender.PacketReceived -= new FrostbiteConnection.PacketDispatchHandler(Connection_PacketRecieved);
}
}
}
示例2: Connection_PacketRecieved
private void Connection_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch) {
if (packetBeforeDispatch.OriginatedFromServer == false) {
Packet request = sender.GetRequestPacket(packetBeforeDispatch);
/*
if (request != null && String.Compare(request.Words[0], "serverInfo", true) == 0) {
this.CurrentServerInfo = new CServerInfo(
new List<string>() {
"ServerName",
"PlayerCount",
"MaxPlayerCount",
"GameMode",
"Map",
"CurrentRound",
"TotalRounds",
"TeamScores",
"ConnectionState",
"Ranked",
"PunkBuster",
"Passworded",
"ServerUptime",
"RoundTime",
"GameMod", // Note: if another variable is affixed to both games this method
"Mappack", // will need to be split into MoHClient and BFBC2Client.
"ExternalGameIpandPort",
"PunkBusterVersion",
"JoinQueueEnabled",
"ServerRegion"
}, packetBeforeDispatch.Words.GetRange(1, packetBeforeDispatch.Words.Count - 1)
);
}
*/
if (request != null && String.Compare(request.Words[0], "version", true) == 0) {
if (this.Game == null) {
if (String.Compare(packetBeforeDispatch.Words[1], "BFBC2", true) == 0) {
this.Game = new BFBC2Client((FrostbiteConnection)sender);
this.m_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "MOH", true) == 0) {
this.Game = new MoHClient((FrostbiteConnection)sender);
this.m_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "BF3", true) == 0) {
this.Game = new BF3Client((FrostbiteConnection)sender);
this.m_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "MOHW", true) == 0)
{
this.Game = new MOHWClient((FrostbiteConnection)sender);
this.m_connection = null;
}
if (this.Game != null) {
this.VersionNumber = packetBeforeDispatch.Words[2];
this.Game.ServerInfo += new FrostbiteClient.ServerInfoHandler(this.OnServerInfo);
this.Game.SendServerinfoPacket();
//sender.SendQueued(new Packet(false, false, sender.AcquireSequenceNumber, "serverInfo"));
}
}
else if (this.Game.Connection != null) {
this.BeginLoginSequence();
}
sender.PacketReceived -= new FrostbiteConnection.PacketDispatchHandler(Connection_PacketRecieved);
}
}
}
示例3: Connection_PacketRecieved
private void Connection_PacketRecieved(FrostbiteConnection sender, bool isHandled, Packet packetBeforeDispatch)
{
if (packetBeforeDispatch.OriginatedFromServer == false) {
Packet request = sender.GetRequestPacket(packetBeforeDispatch);
if (request != null && String.Compare(request.Words[0], "serverInfo", true) == 0) {
this.CurrentServerInfo = new CServerInfo(
new List<string>() {
"ServerName",
"PlayerCount",
"MaxPlayerCount",
"GameMode",
"Map",
"CurrentRound",
"TotalRounds",
"TeamScores",
"ConnectionState",
"Ranked",
"PunkBuster",
"Passworded",
"ServerUptime",
"RoundTime",
"GameMod", // Note: if another variable is affixed to both games this method
"Mappack", // will need to be split into MoHClient and BFBC2Client.
"ExternalGameIpandPort",
"PunkBusterVersion",
"JoinQueueEnabled",
"ServerRegion"
}, packetBeforeDispatch.Words.GetRange(1, packetBeforeDispatch.Words.Count - 1)
);
}
else if (request != null && String.Compare(request.Words[0], "version", true) == 0) {
if (packetBeforeDispatch.Words.Count >= 1 && String.Compare(packetBeforeDispatch.Words[0], "LogInRequired", true) == 0) {
// 0.6.0.0 -> 0.5.4.9 connections. A login would have been required in previous
// version for a "version" packet to be sent.
this.Game = new BFBC2Client((FrostbiteConnection)sender);
this.m_connection = null;
if (this.Game != null) {
this.InitialSetup();
if (this.GameTypeDiscovered != null) {
FrostbiteConnection.RaiseEvent(this.GameTypeDiscovered.GetInvocationList(), this);
}
}
}
else if (packetBeforeDispatch.Words.Count >= 3) {
if (this.Game == null) {
if (String.Compare(packetBeforeDispatch.Words[1], "BFBC2", true) == 0) {
this.Game = new BFBC2Client((FrostbiteConnection)sender);
this.m_connection = null;
}
else if (String.Compare(packetBeforeDispatch.Words[1], "MOH", true) == 0) {
this.Game = new MoHClient((FrostbiteConnection)sender);
this.m_connection = null;
}
if (this.Game != null) {
this.VersionNumber = packetBeforeDispatch.Words[2];
this.InitialSetup();
if (this.GameTypeDiscovered != null) {
FrostbiteConnection.RaiseEvent(this.GameTypeDiscovered.GetInvocationList(), this);
}
}
}
else if (this.Game.Connection != null) {
this.BeginLoginSequence();
}
}
sender.PacketReceived -= new FrostbiteConnection.PacketDispatchHandler(Connection_PacketRecieved);
}
}
}