本文整理汇总了C#中Yupi.Messages.ServerMessage.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.Clear方法的具体用法?C# ServerMessage.Clear怎么用?C# ServerMessage.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yupi.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeNewStaffPicks
internal ServerMessage SerializeNewStaffPicks()
{
ServerMessage message = new ServerMessage();
message.StartArray();
foreach (PublicItem item in _publicItems.Values.Where(t => t.ParentId == -2))
{
message.Clear();
if (item.RoomData == null)
continue;
item.RoomData.Serialize(message);
message.SaveArray();
}
message.EndArray();
return message;
}
示例2: SerializeFlatCategories
/// <summary>
/// Serializes the flat categories.
/// </summary>
/// <param name="session">The session.</param>
/// <returns>ServerMessage.</returns>
internal ServerMessage SerializeFlatCategories(GameClient session)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("FlatCategoriesMessageComposer"));
serverMessage.StartArray();
foreach (PublicCategory flatCat in PrivateCategories.Values)
{
serverMessage.Clear();
if (flatCat == null)
continue;
serverMessage.AppendInteger(flatCat.Id);
serverMessage.AppendString(flatCat.Caption);
serverMessage.AppendBool(flatCat.MinRank <= session.GetHabbo().Rank);
serverMessage.AppendBool(false);
serverMessage.AppendString("NONE");
serverMessage.AppendString(string.Empty);
serverMessage.AppendBool(false);
serverMessage.SaveArray();
}
serverMessage.EndArray();
return serverMessage;
}
示例3: SerializeSongInventory
/// <summary>
/// Serializes the song inventory.
/// </summary>
/// <param name="songs">The songs.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage SerializeSongInventory(HybridDictionary songs)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SongsLibraryMessageComposer"));
if (songs == null)
{
serverMessage.AppendInteger(0);
return serverMessage;
}
serverMessage.StartArray();
foreach (UserItem userItem in songs.Values)
{
if (userItem == null)
{
serverMessage.Clear();
continue;
}
serverMessage.AppendInteger(userItem.Id);
SongData song = SoundMachineSongManager.GetSong(userItem.SongCode);
serverMessage.AppendInteger(song?.Id ?? 0);
serverMessage.SaveArray();
}
serverMessage.EndArray();
return serverMessage;
}