当前位置: 首页>>代码示例>>C#>>正文


C# ServerMessage.EndArray方法代码示例

本文整理汇总了C#中Yupi.Messages.ServerMessage.EndArray方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.EndArray方法的具体用法?C# ServerMessage.EndArray怎么用?C# ServerMessage.EndArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Yupi.Messages.ServerMessage的用法示例。


在下文中一共展示了ServerMessage.EndArray方法的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();
        }
开发者ID:sgf,项目名称:Yupi,代码行数:29,代码来源:UserClothesManager.cs

示例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;
        }
开发者ID:ImNotSatan,项目名称:Yupi,代码行数:47,代码来源:RoomCompetitionManager.cs

示例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();
        }
开发者ID:sgf,项目名称:Yupi,代码行数:39,代码来源:TargetedOfferComposer.cs

示例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;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:41,代码来源:ModerationTool.cs

示例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;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:24,代码来源:HotelBrowserManager.cs

示例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;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:32,代码来源:HotelBrowserManager.cs

示例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;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:21,代码来源:HotelBrowserManager.cs

示例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;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:37,代码来源:SoundMachineComposer.cs

示例9: SerializeSearchResultListStatics


//.........这里部分代码省略.........
                        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;
                            }
                        }

                        message.EndArray();

                        break;
                    }
                case "favorites":
                    {
                        if (session.GetHabbo().FavoriteRooms == null)
                        {
                            message.AppendInteger(0);

                            return;
                        }

                        int i = 0;

                        message.AppendInteger(session.GetHabbo().FavoriteRooms.Count > (direct ? 40 : 8)
                            ? (direct ? 40 : 8)
                            : session.GetHabbo().FavoriteRooms.Count);

                        foreach (
                            RoomData data in
                                session.GetHabbo()
                                    .FavoriteRooms.Select(dataId => Yupi.GetGame().GetRoomManager().GenerateRoomData(dataId))
                                    .Where(data => data != null))
                        {
                            data.Serialize(message);

                            i++;

                            if (i == (direct ? 40 : 8))
                                break;
                        }
开发者ID:AngelRmz,项目名称:Yupi,代码行数:66,代码来源:SearchResultList.cs


注:本文中的Yupi.Messages.ServerMessage.EndArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。