本文整理匯總了C#中PRoCon.Core.Remote.Packet類的典型用法代碼示例。如果您正苦於以下問題:C# Packet類的具體用法?C# Packet怎麽用?C# Packet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Packet類屬於PRoCon.Core.Remote命名空間,在下文中一共展示了Packet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DispatchPlayerOnSpawnRequest
protected override void DispatchPlayerOnSpawnRequest(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 9) {
if (this.PlayerSpawned != null) {
FrostbiteConnection.RaiseEvent(this.PlayerSpawned.GetInvocationList(), this, cpRequestPacket.Words[1], cpRequestPacket.Words[2], cpRequestPacket.Words.GetRange(3, 3), cpRequestPacket.Words.GetRange(6, 3)); // new Inventory(cpRequestPacket.Words[3], cpRequestPacket.Words[4], cpRequestPacket.Words[5], cpRequestPacket.Words[6], cpRequestPacket.Words[7], cpRequestPacket.Words[8]));
}
}
}
示例2: DispatchVarsRoundStartReadyPlayersNeeded
protected virtual void DispatchVarsRoundStartReadyPlayersNeeded(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 1) {
var handler = this.RoundStartReadyPlayersNeeded;
if (handler != null) {
if (cpRecievedPacket.Words.Count == 2) {
handler(this, Convert.ToInt32(cpRecievedPacket.Words[1]));
}
else if (cpRequestPacket.Words.Count >= 2) {
handler(this, Convert.ToInt32(cpRequestPacket.Words[1]));
}
}
}
}
示例3: SendAsync
public void SendAsync(Packet cpPacket) {
try {
byte[] a_bBytePacket = cpPacket.EncodePacket();
this.m_tcpStream.BeginWrite(a_bBytePacket, 0, a_bBytePacket.Length, this.SendAsyncCallback, cpPacket);
}
catch (SocketException) {
// TO DO: Error reporting, possibly in a log file.
this.Shutdown();
}
catch (Exception) {
this.Shutdown();
}
}
示例4: DispatchRequestPacket
// Events
public virtual void DispatchRequestPacket(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 1) {
if (RequestDelegates.ContainsKey(cpRequestPacket.Words[0]) == true) {
RequestDelegates[cpRequestPacket.Words[0]](sender, cpRequestPacket);
}
}
}
示例5: DispatchServerOnRoundOverTeamScoresRequest
protected virtual void DispatchServerOnRoundOverTeamScoresRequest(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 2) {
cpRequestPacket.Words.RemoveAt(0);
if (RoundOverTeamScores != null) {
this.RoundOverTeamScores(this, TeamScore.GetTeamScores(cpRequestPacket.Words));
}
}
}
示例6: DispatchServerOnRoundOverRequest
protected virtual void DispatchServerOnRoundOverRequest(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 2) {
int iTeamID = 0;
if (int.TryParse(cpRequestPacket.Words[1], out iTeamID) == true) {
if (RoundOver != null) {
this.RoundOver(this, iTeamID);
}
}
}
}
示例7: DispatchServerOnLevelLoadedRequest
protected virtual void DispatchServerOnLevelLoadedRequest(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 5) {
if (LevelLoaded != null) {
int iRoundsPlayed = 0, iRoundsTotal = 0;
if (int.TryParse(cpRequestPacket.Words[3], out iRoundsPlayed) == true && int.TryParse(cpRequestPacket.Words[4], out iRoundsTotal) == true) {
this.LevelLoaded(this, cpRequestPacket.Words[1], cpRequestPacket.Words[2], iRoundsPlayed, iRoundsTotal);
}
}
}
}
示例8: DispatchPlayerOnSquadChangeRequest
protected virtual void DispatchPlayerOnSquadChangeRequest(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 4) {
int iTeamID = 0, iSquadID = 0;
if (int.TryParse(cpRequestPacket.Words[2], out iTeamID) == true && int.TryParse(cpRequestPacket.Words[3], out iSquadID) == true) {
if (PlayerChangedSquad != null) {
this.PlayerChangedSquad(this, cpRequestPacket.Words[1], iTeamID, iSquadID);
}
}
}
}
示例9: DispatchPlayerOnKickedRequest
protected virtual void DispatchPlayerOnKickedRequest(FrostbiteConnection sender, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 3) {
if (PlayerKicked != null) {
this.PlayerKicked(this, cpRequestPacket.Words[1], cpRequestPacket.Words[2]);
}
}
}
示例10: DispatchLevelVarsEvaluateResponse
protected virtual void DispatchLevelVarsEvaluateResponse(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRecievedPacket.Words.Count >= 2 && cpRequestPacket.Words.Count >= 2) {
var request = new LevelVariable(new LevelVariableContext(String.Empty, String.Empty), cpRequestPacket.Words[1], cpRecievedPacket.Words[1]);
if (LevelVariablesEvaluate != null) {
this.LevelVariablesEvaluate(this, request, null);
}
}
}
示例11: DispatchLevelVarsGetResponse
protected virtual void DispatchLevelVarsGetResponse(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRecievedPacket.Words.Count >= 2 && cpRequestPacket.Words.Count >= 2) {
LevelVariable request = LevelVariable.ExtractContextVariable(false, cpRequestPacket.Words.GetRange(1, cpRequestPacket.Words.Count - 1));
request.RawValue = cpRecievedPacket.Words[1];
if (LevelVariablesGet != null) {
this.LevelVariablesGet(this, request, null);
}
}
}
示例12: DispatchVarsTextChatModerationModeResponse
protected virtual void DispatchVarsTextChatModerationModeResponse(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 1) {
if (TextChatModerationMode != null) {
if (cpRecievedPacket.Words.Count == 2) {
this.TextChatModerationMode(this, TextChatModerationEntry.GetServerModerationLevelType(cpRecievedPacket.Words[1]));
}
else if (cpRequestPacket.Words.Count >= 2) {
this.TextChatModerationMode(this, TextChatModerationEntry.GetServerModerationLevelType(cpRequestPacket.Words[1]));
}
}
}
}
示例13: DispatchVarsTextChatSpamCoolDownTimeResponse
protected virtual void DispatchVarsTextChatSpamCoolDownTimeResponse(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 1) {
if (TextChatSpamCoolDownTime != null) {
if (cpRecievedPacket.Words.Count == 2) {
this.TextChatSpamCoolDownTime(this, Convert.ToInt32(cpRecievedPacket.Words[1]));
}
else if (cpRequestPacket.Words.Count >= 2) {
this.TextChatSpamCoolDownTime(this, Convert.ToInt32(cpRequestPacket.Words[1]));
}
}
}
}
示例14: DispatchVarsServerNameResponse
protected virtual void DispatchVarsServerNameResponse(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 1) {
if (ServerName != null) {
if (cpRecievedPacket.Words.Count == 2) {
this.ServerName(this, cpRecievedPacket.Words[1]);
}
else if (cpRequestPacket.Words.Count >= 2) {
this.ServerName(this, cpRequestPacket.Words[1]);
}
}
}
}
示例15: DispatchVarsProfanityFilterResponse
protected virtual void DispatchVarsProfanityFilterResponse(FrostbiteConnection sender, Packet cpRecievedPacket, Packet cpRequestPacket) {
if (cpRequestPacket.Words.Count >= 1) {
if (ProfanityFilter != null) {
if (cpRecievedPacket.Words.Count == 2) {
this.ProfanityFilter(this, Convert.ToBoolean(cpRecievedPacket.Words[1]));
}
else if (cpRequestPacket.Words.Count >= 2) {
this.ProfanityFilter(this, Convert.ToBoolean(cpRequestPacket.Words[1]));
}
}
}
}