本文整理汇总了C#中Azure.Messages.ServerMessage.AppendServerMessage方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendServerMessage方法的具体用法?C# ServerMessage.AppendServerMessage怎么用?C# ServerMessage.AppendServerMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Azure.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.AppendServerMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeSearchResultListStatics
/// <summary>
/// Serializes the search result list statics.
/// </summary>
/// <param name="staticId">The static identifier.</param>
/// <param name="direct">if set to <c>true</c> [direct].</param>
/// <param name="message">The message.</param>
/// <param name="session">The session.</param>
internal static void SerializeSearchResultListStatics(string staticId, bool direct, ServerMessage message,
GameClient session)
{
if (string.IsNullOrEmpty(staticId) || staticId == "official") staticId = "official_view";
if (staticId != "hotel_view" && staticId != "roomads_view" && staticId != "myworld_view" &&
!staticId.StartsWith("category__") && staticId != "official_view")
{
message.AppendString(staticId); // code
message.AppendString(""); // title
message.AppendInteger(1); // 0 : no button - 1 : Show More - 2 : Show Back button
message.AppendBool(staticId != "my" && staticId != "popular" && staticId != "official-root"); // collapsed
message.AppendInteger(staticId == "official-root" ? 1 : 0); // 0 : list - 1 : thumbnail
}
KeyValuePair<RoomData, uint>[] rooms;
switch (staticId)
{
case "hotel_view":
{
SerializeSearchResultListStatics("popular", false, message, session);
foreach (FlatCat flat in AzureEmulator.GetGame().GetNavigator().PrivateCategories.Values) SerializeSearchResultListFlatcats(flat.Id, false, message);
break;
}
case "myworld_view":
{
SerializeSearchResultListStatics("my", false, message, session);
SerializeSearchResultListStatics("favorites", false, message, session);
SerializeSearchResultListStatics("my_groups", false, message, session);
SerializeSearchResultListStatics("history", false, message, session);
SerializeSearchResultListStatics("friends_rooms", false, message, session);
break;
}
case "roomads_view":
{
foreach (FlatCat flat in AzureEmulator.GetGame().GetNavigator().PrivateCategories.Values) SerializePromotionsResultListFlatcats(flat.Id, false, message);
SerializeSearchResultListStatics("top_promotions", false, message, session);
break;
}
case "official_view":
{
SerializeSearchResultListStatics("official-root", false, message, session);
SerializeSearchResultListStatics("staffpicks", false, message, session);
break;
}
case "official-root":
{
message.AppendServerMessage(AzureEmulator.GetGame().GetNavigator().NewPublicRooms);
break;
}
case "staffpicks":
{
message.AppendServerMessage(AzureEmulator.GetGame().GetNavigator().NewStaffPicks);
break;
}
case "my":
{
var i = 0;
message.StartArray();
foreach (var data in session.GetHabbo().UsersRooms.Where(data => data != null))
{
data.Serialize(message, false);
message.SaveArray();
if (i++ == (direct ? 100 : 8)) break;
}
message.EndArray();
break;
}
case "favorites":
{
if (session.GetHabbo().FavoriteRooms == null)
{
message.AppendInteger(0);
return;
}
var i = 0;
message.AppendInteger(session.GetHabbo().FavoriteRooms.Count > (direct ? 40 : 8)
? (direct ? 40 : 8)
: session.GetHabbo().FavoriteRooms.Count);
foreach (
var data in
session.GetHabbo()
.FavoriteRooms.Select(
dataId => AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(dataId))
.Where(data => data != null))
{
data.Serialize(message, false);
i++;
if (i == (direct ? 40 : 8)) break;
}
break;
}
case "friends_rooms":
{
//.........这里部分代码省略.........