本文整理汇总了C#中ClientPackets类的典型用法代码示例。如果您正苦于以下问题:C# ClientPackets类的具体用法?C# ClientPackets怎么用?C# ClientPackets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientPackets类属于命名空间,在下文中一共展示了ClientPackets类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CharacterInfo
public CharacterInfo(ClientPackets.NewCharacter p, MirConnection c)
{
Name = p.Name;
Class = p.Class;
Gender = p.Gender;
CreationIP = c.IPAddress;
CreationDate = SMain.Envir.Now;
}
开发者ID:Shamwow2,项目名称:mir2,代码行数:9,代码来源:CharacterInfo.cs
示例2: RegisterResponse
private void RegisterResponse(ClientPackets packet)
{
if (!this.IsDisposed)
{
if (packet == ClientPackets.RegisterAccept)
{
if (MessageBox.Show(Program.LanguageManager.Translation.RegistMsb4) == System.Windows.Forms.DialogResult.OK)
{
DialogResult = System.Windows.Forms.DialogResult.OK;
}
}
else if (packet == ClientPackets.RegisterFailed)
{
MessageBox.Show(Program.LanguageManager.Translation.RegistMsb5);
}
}
}
开发者ID:Belmakar,项目名称:DevProLauncher,代码行数:17,代码来源:Register_frm.cs
示例3: LoginResponse
private void LoginResponse(ClientPackets type, LoginData data)
{
if (type == ClientPackets.Banned)
{
if (ResetTimeout != null)
ResetTimeout();
MessageBox.Show("You are banned.");
}
else if (type == ClientPackets.LoginFailed)
{
if (ResetTimeout != null)
ResetTimeout();
MessageBox.Show("Incorrect Password or Username.");
}
else
{
_userInfo.Username = _username;
_userInfo.LoginKey = data.LoginKey.ToString();
_userInfo.Rank = data.UserRank;
if (NotifyLogin != null)
NotifyLogin();
}
}
开发者ID:Belmakar,项目名称:DevProLauncher,代码行数:24,代码来源:Authenticator.cs
示例4: ChangePassword
public void ChangePassword(ClientPackets.ChangePassword p, MirConnection c)
{
if (!Settings.AllowChangePassword)
{
c.Enqueue(new ServerPackets.ChangePassword {Result = 0});
return;
}
if (!AccountIDReg.IsMatch(p.AccountID))
{
c.Enqueue(new ServerPackets.ChangePassword {Result = 1});
return;
}
if (!PasswordReg.IsMatch(p.CurrentPassword))
{
c.Enqueue(new ServerPackets.ChangePassword {Result = 2});
return;
}
if (!PasswordReg.IsMatch(p.NewPassword))
{
c.Enqueue(new ServerPackets.ChangePassword {Result = 3});
return;
}
AccountInfo account = GetAccount(p.AccountID);
if (account == null)
{
c.Enqueue(new ServerPackets.ChangePassword {Result = 4});
return;
}
if (account.Banned)
{
if (account.ExpiryDate > Now)
{
c.Enqueue(new ServerPackets.ChangePasswordBanned {Reason = account.BanReason, ExpiryDate = account.ExpiryDate});
return;
}
account.Banned = false;
}
account.BanReason = string.Empty;
account.ExpiryDate = DateTime.MinValue;
if (String.CompareOrdinal(account.Password, p.CurrentPassword) != 0)
{
c.Enqueue(new ServerPackets.ChangePassword {Result = 5});
return;
}
account.Password = p.NewPassword;
c.Enqueue(new ServerPackets.ChangePassword {Result = 6});
}
开发者ID:nerestaren,项目名称:mir2,代码行数:55,代码来源:Envir.cs
示例5: NewAccount
public void NewAccount(ClientPackets.NewAccount p, MirConnection c)
{
if (!Settings.AllowNewAccount)
{
c.Enqueue(new ServerPackets.NewAccount {Result = 0});
return;
}
if (!AccountIDReg.IsMatch(p.AccountID))
{
c.Enqueue(new ServerPackets.NewAccount {Result = 1});
return;
}
if (!PasswordReg.IsMatch(p.Password))
{
c.Enqueue(new ServerPackets.NewAccount {Result = 2});
return;
}
if (!string.IsNullOrWhiteSpace(p.EMailAddress) && !EMailReg.IsMatch(p.EMailAddress) ||
p.EMailAddress.Length > 50)
{
c.Enqueue(new ServerPackets.NewAccount {Result = 3});
return;
}
if (!string.IsNullOrWhiteSpace(p.UserName) && p.UserName.Length > 20)
{
c.Enqueue(new ServerPackets.NewAccount {Result = 4});
return;
}
if (!string.IsNullOrWhiteSpace(p.SecretQuestion) && p.SecretQuestion.Length > 30)
{
c.Enqueue(new ServerPackets.NewAccount {Result = 5});
return;
}
if (!string.IsNullOrWhiteSpace(p.SecretAnswer) && p.SecretAnswer.Length > 30)
{
c.Enqueue(new ServerPackets.NewAccount {Result = 6});
return;
}
lock (AccountLock)
{
if (AccountExists(p.AccountID))
{
c.Enqueue(new ServerPackets.NewAccount {Result = 7});
return;
}
AccountList.Add(new AccountInfo(p) {Index = ++NextAccountID, CreationIP = c.IPAddress});
c.Enqueue(new ServerPackets.NewAccount {Result = 8});
}
}
开发者ID:nerestaren,项目名称:mir2,代码行数:57,代码来源:Envir.cs
示例6: NewCharacter
public void NewCharacter(ClientPackets.NewCharacter p, MirConnection c)
{
if (!Settings.AllowNewCharacter)
{
c.Enqueue(new ServerPackets.NewCharacter {Result = 0});
return;
}
if (!CharacterReg.IsMatch(p.Name))
{
c.Enqueue(new ServerPackets.NewCharacter {Result = 1});
return;
}
if (p.Gender != MirGender.Male && p.Gender != MirGender.Female)
{
c.Enqueue(new ServerPackets.NewCharacter {Result = 2});
return;
}
if (p.Class != MirClass.Warrior && p.Class != MirClass.Wizard && p.Class != MirClass.Taoist &&
p.Class != MirClass.Assassin && p.Class != MirClass.Archer)
{
c.Enqueue(new ServerPackets.NewCharacter {Result = 3});
return;
}
if((p.Class == MirClass.Assassin && !Settings.AllowCreateAssassin) ||
(p.Class == MirClass.Archer && !Settings.AllowCreateArcher))
{
c.Enqueue(new ServerPackets.NewCharacter { Result = 3 });
return;
}
int count = 0;
for (int i = 0; i < c.Account.Characters.Count; i++)
{
if (c.Account.Characters[i].Deleted) continue;
if (++count >= Globals.MaxCharacterCount)
{
c.Enqueue(new ServerPackets.NewCharacter {Result = 4});
return;
}
}
lock (AccountLock)
{
if (CharacterExists(p.Name))
{
c.Enqueue(new ServerPackets.NewCharacter {Result = 5});
return;
}
CharacterInfo info = new CharacterInfo(p, c) { Index = ++NextCharacterID, AccountInfo = c.Account };
c.Account.Characters.Add(info);
CharacterList.Add(info);
c.Enqueue(new ServerPackets.NewCharacterSuccess {CharInfo = info.ToSelectInfo()});
}
}
开发者ID:nerestaren,项目名称:mir2,代码行数:63,代码来源:Envir.cs
示例7: Login
public void Login(ClientPackets.Login p, MirConnection c)
{
if (!Settings.AllowLogin)
{
c.Enqueue(new ServerPackets.Login { Result = 0 });
return;
}
if (!AccountIDReg.IsMatch(p.AccountID))
{
c.Enqueue(new ServerPackets.Login { Result = 1 });
return;
}
if (!PasswordReg.IsMatch(p.Password))
{
c.Enqueue(new ServerPackets.Login { Result = 2 });
return;
}
AccountInfo account = GetAccount(p.AccountID);
if (account == null)
{
c.Enqueue(new ServerPackets.Login { Result = 3 });
return;
}
if (account.Banned)
{
if (account.ExpiryDate > DateTime.Now)
{
c.Enqueue(new ServerPackets.LoginBanned
{
Reason = account.BanReason,
ExpiryDate = account.ExpiryDate
});
return;
}
account.Banned = false;
}
account.BanReason = string.Empty;
account.ExpiryDate = DateTime.MinValue;
if (String.CompareOrdinal(account.Password, p.Password) != 0)
{
c.Enqueue(new ServerPackets.Login { Result = 4 });
return;
}
lock (AccountLock)
{
if (account.Connection != null)
account.Connection.SendDisconnect(1);
account.Connection = c;
}
c.Account = account;
c.Stage = GameStage.Select;
account.LastDate = Now;
account.LastIP = c.IPAddress;
c.Enqueue(new ServerPackets.LoginSuccess { Characters = account.GetSelectInfo() });
}
开发者ID:nerestaren,项目名称:mir2,代码行数:65,代码来源:Envir.cs
示例8: AccountInfo
public AccountInfo(C.NewAccount p)
{
AccountID = p.AccountID;
Password = p.Password;
UserName = p.UserName;
SecretQuestion = p.SecretQuestion;
SecretAnswer = p.SecretAnswer;
EMailAddress = p.EMailAddress;
BirthDate = p.BirthDate;
CreationDate = SMain.Envir.Now;
}
开发者ID:Ilmarinen946,项目名称:mir2,代码行数:12,代码来源:AccountInfo.cs
示例9: MergeItem
private void MergeItem(C.MergeItem p)
{
if (Stage != GameStage.Game) return;
Player.MergeItem(p.GridFrom, p.GridTo, p.IDFrom, p.IDTo);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例10: GuildInvite
private void GuildInvite(C.GuildInvite p)
{
if (Stage != GameStage.Game) return;
Player.GuildInvite(p.AcceptInvite);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例11: MarketSearch
private void MarketSearch(C.MarketSearch p)
{
if (Stage != GameStage.Game) return;
Player.MarketSearch(p.Match);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例12: NewCharacter
private void NewCharacter(C.NewCharacter p)
{
if (Stage != GameStage.Select) return;
SMain.Envir.NewCharacter(p, this);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例13: DeleteMail
public void DeleteMail(C.DeleteMail p)
{
if (Stage != GameStage.Game) return;
Player.DeleteMail(p.MailID);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例14: IntelligentCreaturePickup
//IntelligentCreature
private void IntelligentCreaturePickup(C.IntelligentCreaturePickup p)
{
if (Stage != GameStage.Game) return;
Player.IntelligentCreaturePickup(p.MouseMode, p.Location);
}
开发者ID:Roborius,项目名称:mir2,代码行数:7,代码来源:MirConnection.cs
示例15: Login
private void Login(C.Login p)
{
if (Stage != GameStage.Login) return;
SMain.Envir.Login(p, this);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例16: Harvest
private void Harvest(C.Harvest p)
{
if (Stage != GameStage.Game) return;
if (!Player.Dead && Player.ActionTime > SMain.Envir.Time)
_retryList.Enqueue(p);
else
Player.Harvest(p.Direction);
}
开发者ID:Roborius,项目名称:mir2,代码行数:9,代码来源:MirConnection.cs
示例17: Inspect
private void Inspect(C.Inspect p)
{
if (Stage != GameStage.Game) return;
Player.Inspect(p.ObjectID);
}
开发者ID:Roborius,项目名称:mir2,代码行数:6,代码来源:MirConnection.cs
示例18: GuildWarReturn
private void GuildWarReturn(C.GuildWarReturn p)
{
if (Stage != GameStage.Game) return;
Player.GuildWarReturn(p.Name);
}
开发者ID:Roborius,项目名称:mir2,代码行数:5,代码来源:MirConnection.cs
示例19: GuildStorageItemChange
private void GuildStorageItemChange(C.GuildStorageItemChange p)
{
if (Stage != GameStage.Game) return;
Player.GuildStorageItemChange(p.Type, p.From, p.To);
}
开发者ID:Roborius,项目名称:mir2,代码行数:5,代码来源:MirConnection.cs
示例20: GuildStorageGoldChange
private void GuildStorageGoldChange(C.GuildStorageGoldChange p)
{
if (Stage != GameStage.Game) return;
Player.GuildStorageGoldChange(p.Type, p.Amount);
}
开发者ID:Roborius,项目名称:mir2,代码行数:5,代码来源:MirConnection.cs
注:本文中的ClientPackets类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论