本文整理汇总了C#中PacketIn.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.ReadString方法的具体用法?C# PacketIn.ReadString怎么用?C# PacketIn.ReadString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketIn
的用法示例。
在下文中一共展示了PacketIn.ReadString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Login
public static void Login(Client client, PacketIn packet)
{
string user = packet.ReadString();
string pass = packet.ReadString();
ServerConsole.WriteLine("Login request from {0} on ip {1}.", MessageLevel.Message, user, client.IP.ToString());
client.UserLogin(user, pass);
}
示例2: CreatePlayer
public static void CreatePlayer(Client client, PacketIn packet)
{
string name = packet.ReadString();
byte type = packet.ReadByte();
byte strength = packet.ReadByte();
byte health = packet.ReadByte();
byte intelligence = packet.ReadByte();
byte wisdom = packet.ReadByte();
byte agility = packet.ReadByte();
byte face = packet.ReadByte();
byte hair = packet.ReadByte();
if((strength + health + intelligence + wisdom + agility) != 5)
{
client.Send(new Packets.CharacterCreationError(Packets.CHARACTER_CREATION_ERROR.SHARING_POINTS_ERROR));
Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
return;
}
//check if name is valid
if (!Utilities.IsAlnum(name))
{
client.Send(new Packets.CharacterError(Packets.CHARACTER_ERROR.INVALID_CHARS));
return;
}
//check if player name is taken
if (Player.GetPlayer(name) != null)
{
client.Send(new Packets.CharacterCreationError(Packets.CHARACTER_CREATION_ERROR.NAME_TAKEN));
return;
}
int playerId = client.CreatePlayer(name, type, strength, health, intelligence, wisdom, agility, face, hair);
client.SendPlayerList();
}
示例3: PlayerChat
public static void PlayerChat(Client client, PacketIn packet)
{
string message = packet.ReadString();
client.Send(new Packets.Chat(client.Character.Player.Name,message));
}
示例4: PlayerChat
public static void PlayerChat(Client Client, PacketIn packet)
{
string message = packet.ReadString();
ChatManager.Chat(Client.Character, message);
}