本文整理汇总了C#中Network.SendFriends方法的典型用法代码示例。如果您正苦于以下问题:C# Network.SendFriends方法的具体用法?C# Network.SendFriends怎么用?C# Network.SendFriends使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network.SendFriends方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleDeleteFriend
public static void HandleDeleteFriend(Network.Game.GameClient client, string packet)
{
if (packet.Length > 3)
{
var data = packet.Substring(2);
var type = data[0];
switch (type)
{
case '*':
var name = data.Substring(1);
var friend = client.Account.Infos.GetFriendByNickname(name);
if (friend != null)
{
client.Account.Infos.Friends.Remove(friend);
client.SendFriends();
client.Account.Infos.Save();
}
else
{
client.ErrorMessage("Vous ne posseder pas cette personne en ami !");
}
break;
}
}
}
示例2: HandleAddFriend
public static void HandleAddFriend(Network.Game.GameClient client, string packet)
{
if (packet.Length > 3)
{
var data = packet.Substring(2);
var type = data[0];
switch (type)
{
case '%'://Account
var name = data.Substring(1).ToLower();
//He have no friends :(
if (name == client.Account.Pseudo.ToLower() || name == client.Character.Nickname.ToLower())
{
client.ErrorMessage("Vous ne pouvez vous ajouter en ami, chercher plutot de <b>\"vrai\"</b> ami(s) ! :(");
return;
}
var accountFinded = World.GetClientByPseudo(name);
if (accountFinded != null)
{
Utilities.Logger.Debug("Try to add friend by account [" + name + "]");
if (!client.Account.Infos.HaveFriend(accountFinded.Account.ID))
{
client.Account.Infos.Friends.Add(new Friends.Friend(accountFinded.Account.Infos.AccountId));
client.SendFriends();
client.Account.Infos.Save();
}
else
{
//TODO: Have already friend
}
}
else//Try find by character name
{
addByCharacter(client, name);
}
break;
default://Character name
addByCharacter(client, data);
break;
}
}
}
示例3: addByCharacter
private static void addByCharacter(Network.Game.GameClient client, string name)
{
Utilities.Logger.Debug("Try to add friend by character [" + name + "]");
var player = World.GetClient(name);
if (player != null)
{
if (!client.Account.Infos.HaveFriend(player.Account.ID))
{
client.Account.Infos.Friends.Add(new Friends.Friend(player.Account.Infos.AccountId));
client.SendFriends();
client.Account.Infos.Save();
}
else
{
//TODO: Have already friend
}
}
else
{
client.Send("cMEf" + name);
}
}
示例4: HandleRequestFriends
public static void HandleRequestFriends(Network.Game.GameClient client, string packet)
{
client.SendFriends();
}