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


C# ServerMessage.AppendServerMessage方法代碼示例

本文整理匯總了C#中Yupi.Messages.ServerMessage.AppendServerMessage方法的典型用法代碼示例。如果您正苦於以下問題:C# ServerMessage.AppendServerMessage方法的具體用法?C# ServerMessage.AppendServerMessage怎麽用?C# ServerMessage.AppendServerMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Yupi.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>
        /// <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;
                            }
                        }

//.........這裏部分代碼省略.........
開發者ID:AngelRmz,項目名稱:Yupi,代碼行數:101,代碼來源:SearchResultList.cs


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