本文整理汇总了C#中Azure.Messages.ServerMessage.SaveArray方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.SaveArray方法的具体用法?C# ServerMessage.SaveArray怎么用?C# ServerMessage.SaveArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Azure.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.SaveArray方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
/// <summary>
/// Serializes the specified message.
/// </summary>
/// <param name="message">The message.</param>
internal void Serialize(ServerMessage message)
{
message.StartArray();
foreach (
var item1 in
Clothing.Select(clothing1 => Azure.GetGame().GetClothingManager().GetClothesInFurni(clothing1)))
{
foreach (var clothe in item1.Clothes)
message.AppendInteger(clothe);
message.SaveArray();
}
message.EndArray();
message.StartArray();
foreach (
var item2 in
Clothing.Select(clothing2 => Azure.GetGame().GetClothingManager().GetClothesInFurni(clothing2)))
{
foreach (var clothe in item2.Clothes)
message.AppendString(item2.ItemName);
message.SaveArray();
}
message.EndArray();
}
示例2: GenerateMessage
internal void GenerateMessage(ServerMessage message)
{
message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
message.AppendInteger(1);//show
message.AppendInteger(Id);
message.AppendString(Identifier);
message.AppendString(Identifier);
message.AppendInteger(CostCredits);
if (CostDiamonds > 0)
{
message.AppendInteger(CostDiamonds);
message.AppendInteger(105);
}
else
{
message.AppendInteger(CostDuckets);
message.AppendInteger(0);
}
message.AppendInteger(PurchaseLimit);
var TimeLeft = ExpirationTime - AzureEmulator.GetUnixTimeStamp();
message.AppendInteger(TimeLeft);
message.AppendString(Title);
message.AppendString(Description);
message.AppendString(Image);
message.AppendString("");
message.StartArray();
foreach (string Product in Products)
{
message.AppendString(Product);
message.SaveArray();
}
message.EndArray();
}
示例3: Serialize
/// <summary>
/// Serializes the specified message.
/// </summary>
/// <param name="message">The message.</param>
internal void Serialize(ServerMessage message)
{
message.StartArray();
foreach (var clothing1 in Clothing)
{
var item1 = AzureEmulator.GetGame().GetClothingManager().GetClothesInFurni(clothing1);
foreach (var clothe in item1.Clothes)
{
message.AppendInteger(clothe);
}
message.SaveArray();
}
message.EndArray();
message.StartArray();
foreach (var clothing2 in Clothing)
{
var item2 = AzureEmulator.GetGame().GetClothingManager().GetClothesInFurni(clothing2);
foreach (var clothe in item2.Clothes)
{
message.AppendString(item2.ItemName);
}
message.SaveArray();
}
message.EndArray();
}
示例4: AppendEntrySubmitMessage
internal ServerMessage AppendEntrySubmitMessage(ServerMessage message, int status, Room room = null)
{
message.Init(LibraryParser.OutgoingRequest("CompetitionEntrySubmitResultMessageComposer"));
message.AppendInteger(Id);
message.AppendString(Name);
message.AppendInteger(status);
// 0 : roomSent - 1 : send room - 2 : confirm register - 3 : neededFurnis - 4 : doorClosed - 6 : acceptRules
if (status != 3)
{
message.AppendInteger(0);
message.AppendInteger(0);
}
else
{
message.StartArray();
foreach (var furni in RequiredFurnis)
{
message.AppendString(furni);
message.SaveArray();
}
message.EndArray();
if (room == null)
message.AppendInteger(0);
else
{
message.StartArray();
foreach (var furni in RequiredFurnis)
{
if (!room.GetRoomItemHandler().HasFurniByItemName(furni))
{
message.AppendString(furni);
message.SaveArray();
}
}
message.EndArray();
}
}
return message;
}
示例5: GenerateMessage
internal static void GenerateMessage(ServerMessage message, TargetedOffer offer)
{
message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
message.AppendInteger(1);
message.AppendInteger(offer.Id);
message.AppendString(offer.Identifier);
message.AppendString(offer.Identifier);
message.AppendInteger(offer.CostCredits);
if (offer.CostDiamonds > 0)
{
message.AppendInteger(offer.CostDiamonds);
message.AppendInteger(105);
}
else
{
message.AppendInteger(offer.CostDuckets);
message.AppendInteger(0);
}
message.AppendInteger(offer.PurchaseLimit);
var timeLeft = offer.ExpirationTime - Azure.GetUnixTimeStamp();
message.AppendInteger(timeLeft);
message.AppendString(offer.Title);
message.AppendString(offer.Description);
message.AppendString(offer.Image);
message.AppendString(string.Empty);
message.StartArray();
foreach (var product in offer.Products)
{
message.AppendString(product);
message.SaveArray();
}
message.EndArray();
}
示例6: SerializeSongInventory
/// <summary>
/// Serializes the song inventory.
/// </summary>
/// <param name="songs">The songs.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage SerializeSongInventory(HybridDictionary songs)
{
var 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);
var song = SoundMachineSongManager.GetSong(userItem.SongCode);
serverMessage.AppendInteger(song?.Id ?? 0);
serverMessage.SaveArray();
}
serverMessage.EndArray();
return serverMessage;
}
示例7: SerializeRecentRooms
/// <summary>
/// Serializes the recent rooms.
/// </summary>
/// <param name="session">The session.</param>
/// <returns>ServerMessage.</returns>
internal ServerMessage SerializeRecentRooms(GameClient session)
{
ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("NavigatorListingsMessageComposer"));
serverMessage.AppendInteger(7);
serverMessage.AppendString(string.Empty);
serverMessage.StartArray();
foreach (
RoomData roomData in
session.GetHabbo()
.RecentlyVisitedRooms.Select(
current => AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(current)))
{
roomData.Serialize(serverMessage, false);
serverMessage.SaveArray();
}
serverMessage.EndArray();
serverMessage.AppendBool(false);
return serverMessage;
}
示例8: 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, false);
message.SaveArray();
}
message.EndArray();
return message;
}
示例9: 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 (FlatCat 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;
}
示例10: SerializeRoomVisits
/// <summary>
/// Serializes the room visits.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage SerializeRoomVisits(uint userId)
{
var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolRoomVisitsMessageComposer"));
serverMessage.AppendInteger(userId);
var user = AzureEmulator.GetGame().GetClientManager().GetClientByUserId(userId);
if (user == null || user.GetHabbo() == null)
{
serverMessage.AppendString("Not online");
serverMessage.AppendInteger(0);
return serverMessage;
}
serverMessage.AppendString(user.GetHabbo().UserName);
serverMessage.StartArray();
foreach (var roomData in user.GetHabbo()
.RecentlyVisitedRooms.Select(
roomId => AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(roomId))
.Where(roomData => roomData != null))
{
serverMessage.AppendInteger(roomData.Id);
serverMessage.AppendString(roomData.Name);
serverMessage.AppendInteger(0); //hour
serverMessage.AppendInteger(0); //min
serverMessage.SaveArray();
}
serverMessage.EndArray();
return serverMessage;
}
示例11: 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":
{
//.........这里部分代码省略.........