本文整理汇总了C#中ClientPackets类的典型用法代码示例。如果您正苦于以下问题:C# ClientPackets类的具体用法?C# ClientPackets怎么用?C# ClientPackets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientPackets类属于命名空间,在下文中一共展示了ClientPackets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
}
示例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();
}
}
示例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});
}
示例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});
}
}
示例6: 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;
}
示例7: MergeItem
private void MergeItem(C.MergeItem p)
{
if (Stage != GameStage.Game) return;
Player.MergeItem(p.GridFrom, p.GridTo, p.IDFrom, p.IDTo);
}
示例8: GuildInvite
private void GuildInvite(C.GuildInvite p)
{
if (Stage != GameStage.Game) return;
Player.GuildInvite(p.AcceptInvite);
}
示例9: MarketSearch
private void MarketSearch(C.MarketSearch p)
{
if (Stage != GameStage.Game) return;
Player.MarketSearch(p.Match);
}
示例10: NewCharacter
private void NewCharacter(C.NewCharacter p)
{
if (Stage != GameStage.Select) return;
SMain.Envir.NewCharacter(p, this);
}
示例11: DeleteMail
public void DeleteMail(C.DeleteMail p)
{
if (Stage != GameStage.Game) return;
Player.DeleteMail(p.MailID);
}
示例12: IntelligentCreaturePickup
//IntelligentCreature
private void IntelligentCreaturePickup(C.IntelligentCreaturePickup p)
{
if (Stage != GameStage.Game) return;
Player.IntelligentCreaturePickup(p.MouseMode, p.Location);
}
示例13: Login
private void Login(C.Login p)
{
if (Stage != GameStage.Login) return;
SMain.Envir.Login(p, this);
}
示例14: 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);
}
示例15: Inspect
private void Inspect(C.Inspect p)
{
if (Stage != GameStage.Game) return;
Player.Inspect(p.ObjectID);
}