本文整理汇总了C#中NetGore.IO.BitStream.Write方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.Write方法的具体用法?C# BitStream.Write怎么用?C# BitStream.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetGore.IO.BitStream
的用法示例。
在下文中一共展示了BitStream.Write方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteRemoveActiveQuest
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's quest information for when
/// a quest is removed from the active quests.
/// The message is then read and handled by the receiver using <see cref="UserQuestInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="questID">The ID of the removed active quest.</param>
public static void WriteRemoveActiveQuest(BitStream bs, QuestID questID)
{
bs.WriteEnum(QuestInfoMessages.RemoveActiveQuest);
bs.Write(questID);
}
示例2: WriteAddCompletedQuest
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's quest information for when
/// a quest is completed.
/// The message is then read and handled by the receiver using <see cref="UserQuestInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="questID">The ID of the completed quest.</param>
public static void WriteAddCompletedQuest(BitStream bs, QuestID questID)
{
bs.WriteEnum(QuestInfoMessages.AddCompletedQuest);
bs.Write(questID);
}
示例3: WriteQuestInfo
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing all of the client's quest information.
/// The message is then read and handled by the receiver using <see cref="UserQuestInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="completedQuests">All of the completed quests.</param>
/// <param name="activeQuests">All of the active quests.</param>
public static void WriteQuestInfo(BitStream bs, IEnumerable<QuestID> completedQuests, IEnumerable<QuestID> activeQuests)
{
completedQuests = completedQuests.ToImmutable();
activeQuests = activeQuests.ToImmutable();
bs.WriteEnum(QuestInfoMessages.RemoveActiveQuest);
// Write the completed quests
bs.Write((ushort)completedQuests.Count());
foreach (var q in completedQuests)
{
bs.Write(q);
}
// Write the active quests
bs.Write((byte)activeQuests.Count());
foreach (var q in activeQuests)
{
bs.Write(q);
}
}
示例4: WriteAddRepeatableQuest
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's quest information for when
/// a quest is repeatable.
/// The message is then read and handled by the receiver using <see cref="UserQuestInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="questID">The ID of the repeatable quest.</param>
public static void WriteAddRepeatableQuest(BitStream bs, QuestID questID)
{
bs.WriteEnum(QuestInfoMessages.AddRepeatableQuest);
bs.Write(questID);
}
示例5: WriteQuestInfo
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing all of the client's quest information.
/// The message is then read and handled by the receiver using <see cref="UserQuestInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="completedQuests">All of the completed quests.</param>
/// <param name="activeQuests">All of the active quests.</param>
/// <param name="repeatableQuests">All of the repeatable quests.</param>
public static void WriteQuestInfo(BitStream bs, IEnumerable<QuestID> completedQuests, IEnumerable<QuestID> activeQuests, IEnumerable<QuestID> repeatableQuests)
{
completedQuests = completedQuests.ToImmutable();
activeQuests = activeQuests.ToImmutable();
repeatableQuests = repeatableQuests.ToImmutable();
bs.WriteEnum(QuestInfoMessages.LoadInitialValues);
// Write the completed quests
bs.Write((ushort)completedQuests.Count());
foreach (var q in completedQuests)
{
bs.Write(q);
}
// Write the active quests
bs.Write((byte)activeQuests.Count());
foreach (var q in activeQuests)
{
bs.Write(q);
}
// Write the repeatable quests
bs.Write((byte)repeatableQuests.Count());
foreach (var q in repeatableQuests)
{
bs.Write(q);
}
}
示例6: WriteUpdateMemberRank
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
/// a member's rank changes.
/// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
/// </summary>
/// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="member">The guild member who's rank changed.</param>
public static void WriteUpdateMemberRank(BitStream pw, GuildMemberNameRank member)
{
pw.WriteEnum(GuildInfoMessages.UpdateRank);
pw.Write(null, member);
}
示例7: WriteUpdateNameTag
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
/// a the guild's name or tag changes and needs to be updated.
/// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
/// </summary>
/// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="name">The new guild name.</param>
/// <param name="tag">The new guild tag.</param>
public static void WriteUpdateNameTag(BitStream pw, string name, string tag)
{
pw.WriteEnum(GuildInfoMessages.UpdateNameTag);
pw.Write(name);
pw.Write(tag);
}
示例8: WriteRemoveOnlineMember
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
/// a member goes offline.
/// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
/// </summary>
/// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="memberName">The name of the guild member that went offline.</param>
public static void WriteRemoveOnlineMember(BitStream pw, string memberName)
{
pw.WriteEnum(GuildInfoMessages.RemoveOnlineMember);
pw.Write(memberName);
}
示例9: WriteGuildInfo
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
/// the guild changes or the user is receiving their first update on the guild state and all values have to be sent.
/// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
/// </summary>
/// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="guild">The guild to send the state values for.</param>
public static void WriteGuildInfo(BitStream pw, IGuild guild)
{
pw.WriteEnum(GuildInfoMessages.SetGuild);
if (guild == null)
{
pw.Write(false);
return;
}
var members = guild.GetMembers().ToArray();
var onlineMembers = guild.OnlineMembers.ToArray();
pw.Write(true);
pw.Write(guild.Name);
pw.Write(guild.Tag);
pw.Write((ushort)members.Length);
for (var i = 0; i < members.Length; i++)
{
pw.Write(null, members[i]);
}
pw.Write((ushort)onlineMembers.Length);
for (var i = 0; i < onlineMembers.Length; i++)
{
pw.Write(onlineMembers[i].Name);
}
}
示例10: WriteAddMember
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's guild information for when
/// a member is added to the guild.
/// The message is then read and handled by the receiver using <see cref="UserGuildInformation.Read"/>.
/// </summary>
/// <param name="pw">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="member">The guild member that was added.</param>
public static void WriteAddMember(BitStream pw, GuildMemberNameRank member)
{
pw.WriteEnum(GuildInfoMessages.AddMember);
pw.Write(null, member);
}
示例11: WriteRemoveMember
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing the client's group information for when
/// a member is removed from the group.
/// The message is then read and handled by the receiver using <see cref="UserGroupInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="member">The group member to remove.</param>
public static void WriteRemoveMember(BitStream bs, IGroupable member)
{
bs.WriteEnum(GroupInfoMessages.RemoveMember);
bs.Write(member.Name);
}
示例12: WriteGroupInfo
/// <summary>
/// Appends a message to a <see cref="BitStream"/> for synchronizing all of the client's group information.
/// The message is then read and handled by the receiver using <see cref="UserGroupInformation.Read"/>.
/// </summary>
/// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
/// <param name="group">The group information. Can be null for when the user is not in a group.</param>
public static void WriteGroupInfo(BitStream bs, IGroup group)
{
bs.WriteEnum(GroupInfoMessages.SetGroup);
// Check if in a group
if (group == null)
{
bs.Write(false);
return;
}
bs.Write(true);
// Write the group member names
var members = group.Members.Select(x => x.Name).ToArray();
Debug.Assert(members.Length <= byte.MaxValue);
bs.Write((byte)members.Length);
bs.Write(members, 0, members.Length);
// Write the founder's name
bs.Write(group.Founder.Name);
}