當前位置: 首頁>>代碼示例>>C#>>正文


C# ServerMessage.Clear方法代碼示例

本文整理匯總了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;
        }
開發者ID:sgf,項目名稱:Yupi,代碼行數:21,代碼來源:HotelBrowserManager.cs

示例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;
        }
開發者ID:sgf,項目名稱:Yupi,代碼行數:32,代碼來源:HotelBrowserManager.cs

示例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;
        }
開發者ID:sgf,項目名稱:Yupi,代碼行數:37,代碼來源:SoundMachineComposer.cs


注:本文中的Yupi.Messages.ServerMessage.Clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。