本文整理汇总了C#中Yupi.Messages.ServerMessage.SaveArray方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.SaveArray方法的具体用法?C# ServerMessage.SaveArray怎么用?C# ServerMessage.SaveArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yupi.Messages.ServerMessage
的用法示例。
在下文中一共展示了ServerMessage.SaveArray方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
/// <summary>
/// Serializes the specified message.
/// </summary>
/// <param name="message">The message.</param>
internal void Serialize(ServerMessage message)
{
message.StartArray();
foreach (ClothingItem item1 in Clothing.Select(clothing1 => Yupi.GetGame().GetClothingManager().GetClothesInFurni(clothing1)))
{
foreach (int clothe in item1.Clothes)
message.AppendInteger(clothe);
message.SaveArray();
}
message.EndArray();
message.StartArray();
foreach (ClothingItem item2 in Clothing.Select(clothing2 => Yupi.GetGame().GetClothingManager().GetClothesInFurni(clothing2)))
{
foreach (int clothe in item2.Clothes)
message.AppendString(item2.ItemName);
message.SaveArray();
}
message.EndArray();
}
示例2: 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 (string furni in RequiredFurnis)
{
message.AppendString(furni);
message.SaveArray();
}
message.EndArray();
if (room == null)
message.AppendInteger(0);
else
{
message.StartArray();
foreach (string furni in RequiredFurnis)
{
if (!room.GetRoomItemHandler().HasFurniByItemName(furni))
{
message.AppendString(furni);
message.SaveArray();
}
}
message.EndArray();
}
}
return message;
}
示例3: 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);
int timeLeft = offer.ExpirationTime - Yupi.GetUnixTimeStamp();
message.AppendInteger(timeLeft);
message.AppendString(offer.Title);
message.AppendString(offer.Description);
message.AppendString(offer.Image);
message.AppendString(string.Empty);
message.StartArray();
foreach (string product in offer.Products)
{
message.AppendString(product);
message.SaveArray();
}
message.EndArray();
}
示例4: SerializeRoomVisits
/// <summary>
/// Serializes the room visits.
/// </summary>
/// <param name="userId">The user identifier.</param>
/// <returns>ServerMessage.</returns>
internal static ServerMessage SerializeRoomVisits(uint userId)
{
ServerMessage serverMessage =
new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolRoomVisitsMessageComposer"));
serverMessage.AppendInteger(userId);
GameClient user = Yupi.GetGame().GetClientManager().GetClientByUserId(userId);
if (user?.GetHabbo() == null)
{
serverMessage.AppendString("Not online");
serverMessage.AppendInteger(0);
return serverMessage;
}
serverMessage.AppendString(user.GetHabbo().UserName);
serverMessage.StartArray();
foreach (
RoomData roomData in
user.GetHabbo()
.RecentlyVisitedRooms.Select(roomId => Yupi.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;
}
示例5: 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 => Yupi.GetGame().GetRoomManager().GenerateRoomData(current)))
{
roomData.Serialize(serverMessage);
serverMessage.SaveArray();
}
serverMessage.EndArray();
serverMessage.AppendBool(false);
return serverMessage;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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>
/// <param name="opened"></param>
/// <param name="showImage"></param>
internal static void SerializeSearchResultListStatics(string staticId, bool direct, ServerMessage message, GameClient session, bool opened = false, bool showImage = false)
{
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);
message.AppendString(string.Empty);
message.AppendInteger(1);
message.AppendBool(!opened); // staticId != "my" && staticId != "popular" && staticId != "official-root"
message.AppendInteger(showImage ? 1 : 0);
}
KeyValuePair<RoomData, uint>[] rooms;
switch (staticId)
{
case "hotel_view":
{
NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);
foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
foreach (PublicCategory flat in Yupi.GetGame().GetNavigator().PrivateCategories.Values)
SerializeSearchResultListFlatcats(flat.Id, false, message);
break;
}
case "official_view":
{
NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);
foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
}
break;
case "myworld_view":
{
NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);
foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
}
break;
case "roomads_view":
{
foreach (PublicCategory flat in Yupi.GetGame().GetNavigator().PrivateCategories.Values)
SerializePromotionsResultListFlatcats(flat.Id, false, message);
NavigatorCategory navCategory = Yupi.GetGame().GetNavigator().GetNavigatorCategory(staticId);
foreach (NavigatorSubCategory subCategory in navCategory.SubCategories)
SerializeSearchResultListStatics(subCategory.Caption, false, message, session, subCategory.IsOpened, subCategory.IsImage);
break;
}
case "official-root":
{
message.AppendServerMessage(Yupi.GetGame().GetNavigator().NewPublicRooms);
break;
}
case "staffpicks":
{
message.AppendServerMessage(Yupi.GetGame().GetNavigator().NewStaffPicks);
break;
}
case "my":
{
int i = 0;
message.StartArray();
foreach (RoomData data in session.GetHabbo().UsersRooms)
{
if (data != null)
{
data.Serialize(message);
message.SaveArray();
if (i++ == (direct ? 100 : 8))
break;
}
}
//.........这里部分代码省略.........