本文整理汇总了C#中BitPack.WriteStringLength方法的典型用法代码示例。如果您正苦于以下问题:C# BitPack.WriteStringLength方法的具体用法?C# BitPack.WriteStringLength怎么用?C# BitPack.WriteStringLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitPack
的用法示例。
在下文中一共展示了BitPack.WriteStringLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessage
public static void SendMessage(ref WorldClass session, ChatMessageValues chatMessage, WorldClass pSession = null)
{
byte[] GuidMask = { 4, 1, 3, 6, 2, 5, 0, 7 };
byte[] GuidMask3 = { 6, 1, 3, 5, 4, 2, 7, 0 };
byte[] GuidBytes = { 7, 4, 0, 6, 3, 2, 5, 1 };
byte[] GuidBytes3 = { 7, 4, 1, 3, 0, 6, 5, 2 };
var pChar = session.Character;
var guid = pChar.Guid;
if (pSession != null)
guid = pSession.Character.Guid;
PacketWriter chat = new PacketWriter(ServerMessage.Chat);
BitPack BitPack = new BitPack(chat, guid);
BitPack.Write(!chatMessage.HasLanguage);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(0, 8);
BitPack.Write(1);
BitPack.Write(0);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(1);
BitPack.Write(0, 8);
BitPack.Write(0);
BitPack.WriteGuidMask(GuidMask3);
BitPack.Write(1);
BitPack.Write(0);
BitPack.Write(1);
BitPack.Write(!chatMessage.HasRealmId);
BitPack.Write(0);
BitPack.WriteStringLength(chatMessage.Message, 12);
BitPack.Write(0);
BitPack.WriteGuidMask(GuidMask);
BitPack.Write(0);
BitPack.Write(8, 9);
BitPack.Flush();
BitPack.WriteGuidBytes(GuidBytes3);
if (chatMessage.HasLanguage)
chat.WriteUInt8(chatMessage.Language);
BitPack.WriteGuidBytes(GuidBytes);
chat.WriteString(chatMessage.Message, false);
chat.WriteUInt8((byte)chatMessage.ChatType);
chat.WriteInt32(0);
if (chatMessage.HasRealmId)
chat.WriteInt32(chatMessage.RealmId);
switch (chatMessage.ChatType)
{
case MessageType.ChatMessageSay:
WorldMgr.SendByDist(pChar, chat, 625);
break;
case MessageType.ChatMessageYell:
WorldMgr.SendByDist(pChar, chat, 90000);
break;
default:
session.Send(ref chat);
break;
}
}