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


C# ServerMessage.AppendByte方法代码示例

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


在下文中一共展示了ServerMessage.AppendByte方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTrigger


//.........这里部分代码省略.........
                    serverMessage15.AppendBool(false);
                    serverMessage15.AppendInteger(0);
                    serverMessage15.AppendInteger(list.Count);
                    foreach (RoomItem current15 in list) serverMessage15.AppendInteger(current15.Id);
                    serverMessage15.AppendInteger(item.GetBaseItem().SpriteId);
                    serverMessage15.AppendInteger(item.Id);
                    serverMessage15.AppendString(extraInfo);
                    serverMessage15.AppendInteger(0);
                    serverMessage15.AppendInteger(0);
                    serverMessage15.AppendInteger(7);
                    serverMessage15.AppendInteger(0);
                    serverMessage15.AppendInteger(0);
                    serverMessage15.AppendInteger(0);
                    session.SendMessage(serverMessage15);
                    return;
                }
                case Interaction.ActionTeleportTo:
                {
                    ServerMessage serverMessage16 = new ServerMessage(LibraryParser.OutgoingRequest("WiredEffectMessageComposer"));
                    serverMessage16.AppendBool(false);
                    serverMessage16.AppendInteger(5);

                    serverMessage16.AppendInteger(list.Count);
                    foreach (RoomItem roomItem in list) serverMessage16.AppendInteger(roomItem.Id);

                    serverMessage16.AppendInteger(item.GetBaseItem().SpriteId);
                    serverMessage16.AppendInteger(item.Id);
                    serverMessage16.AppendString(extraInfo);
                    serverMessage16.AppendInteger(0);
                    serverMessage16.AppendInteger(8);
                    serverMessage16.AppendInteger(0);
                    serverMessage16.AppendInteger(delay);
                    serverMessage16.AppendInteger(0);
                    serverMessage16.AppendByte(2);
                    session.SendMessage(serverMessage16);
                    return;
                }
                case Interaction.ActionToggleState:
                {
                    ServerMessage serverMessage17 = new ServerMessage(LibraryParser.OutgoingRequest("WiredEffectMessageComposer"));
                    serverMessage17.AppendBool(false);
                    serverMessage17.AppendInteger(5);
                    serverMessage17.AppendInteger(list.Count);
                    foreach (RoomItem current17 in list) serverMessage17.AppendInteger(current17.Id);
                    serverMessage17.AppendInteger(item.GetBaseItem().SpriteId);
                    serverMessage17.AppendInteger(item.Id);
                    serverMessage17.AppendString(extraInfo);
                    serverMessage17.AppendInteger(0);
                    serverMessage17.AppendInteger(8);
                    serverMessage17.AppendInteger(0);
                    serverMessage17.AppendInteger(delay);
                    serverMessage17.AppendInteger(0);
                    serverMessage17.AppendInteger(0);
                    session.SendMessage(serverMessage17);
                    return;
                }
                case Interaction.ActionGiveReward:
                {
                    if (!session.GetHabbo().HasFuse("fuse_use_superwired")) return;
                    ServerMessage serverMessage18 = new ServerMessage(LibraryParser.OutgoingRequest("WiredEffectMessageComposer"));
                    serverMessage18.AppendBool(false);
                    serverMessage18.AppendInteger(5);
                    serverMessage18.AppendInteger(0);
                    serverMessage18.AppendInteger(item.GetBaseItem().SpriteId);
                    serverMessage18.AppendInteger(item.Id);
                    serverMessage18.AppendString(extraInfo);
开发者ID:weslley17w,项目名称:Yupi,代码行数:67,代码来源:InteractorWired.cs

示例2: SerializeRoomChatlog

        /// <summary>
        ///     Serializes the room chatlog.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <returns>ServerMessage.</returns>
        /// <exception cref="System.NullReferenceException">No room found.</exception>
        internal static ServerMessage SerializeRoomChatlog(uint roomId)
        {
            ServerMessage message = new ServerMessage();

            Room room = Yupi.GetGame().GetRoomManager().LoadRoom(roomId);

            if (room?.RoomData != null)
            {
                message.Init(LibraryParser.OutgoingRequest("ModerationToolRoomChatlogMessageComposer"));
                message.AppendByte(1);
                message.AppendShort(2);
                message.AppendString("roomName");
                message.AppendByte(2);
                message.AppendString(room.RoomData.Name);
                message.AppendString("roomId");
                message.AppendByte(1);
                message.AppendInteger(room.RoomData.Id);

                List<Chatlog> tempChatlogs =
                    room.RoomData.RoomChat.Reverse()
                        .Skip(Math.Max(0, room.RoomData.RoomChat.Count - 60))
                        .Take(60)
                        .ToList();

                message.AppendShort(tempChatlogs.Count);

                foreach (Chatlog chatLog in tempChatlogs)
                    chatLog.Serialize(ref message);

                return message;
            }

            return null;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:40,代码来源:ModerationTool.cs

示例3: SerializeTicketChatlog

        /// <summary>
        ///     Serializes the ticket chatlog.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="roomData">The room data.</param>
        /// <param name="timestamp">The timestamp.</param>
        /// <returns>ServerMessage.</returns>
        /// <exception cref="System.NullReferenceException">No room found.</exception>
        internal static ServerMessage SerializeTicketChatlog(SupportTicket ticket, RoomData roomData, double timestamp)
        {
            ServerMessage message = new ServerMessage();

            RoomData room = Yupi.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);

            if (room != null)
            {
                message.Init(LibraryParser.OutgoingRequest("ModerationToolIssueChatlogMessageComposer"));

                message.AppendInteger(ticket.TicketId);
                message.AppendInteger(ticket.SenderId);
                message.AppendInteger(ticket.ReportedId);
                message.AppendInteger(ticket.RoomId);

                message.AppendByte(1);
                message.AppendShort(2);
                message.AppendString("roomName");
                message.AppendByte(2);
                message.AppendString(ticket.RoomName);
                message.AppendString("roomId");
                message.AppendByte(1);
                message.AppendInteger(ticket.RoomId);

                List<Chatlog> tempChatlogs =
                    room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();

                message.AppendShort(tempChatlogs.Count);

                foreach (Chatlog chatLog in tempChatlogs)
                    chatLog.Serialize(ref message);

                return message;
            }
            return null;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:44,代码来源:ModerationTool.cs

示例4: SerializeUserChatlog

        /// <summary>
        ///     Serializes the user chatlog.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage SerializeUserChatlog(uint userId)
        {
            ServerMessage result;

            using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                commitableQueryReactor.SetQuery($"SELECT DISTINCT room_id FROM users_chatlogs WHERE user_id = '{userId}' ORDER BY timestamp DESC LIMIT 4");

                DataTable table = commitableQueryReactor.GetTable();

                ServerMessage serverMessage =  new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolUserChatlogMessageComposer"));
                serverMessage.AppendInteger(userId);
                serverMessage.AppendString(Yupi.GetGame().GetClientManager().GetNameById(userId));

                if (table != null)
                {
                    serverMessage.AppendInteger(table.Rows.Count);
                    IEnumerator enumerator = table.Rows.GetEnumerator();

                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow dataRow = (DataRow) enumerator.Current;

                            commitableQueryReactor.SetQuery($"SELECT user_id,timestamp,message FROM users_chatlogs WHERE room_id = {dataRow["room_id"]} AND user_id = {userId} ORDER BY timestamp DESC LIMIT 30");

                            DataTable table2 = commitableQueryReactor.GetTable();
                            RoomData roomData = Yupi.GetGame().GetRoomManager().GenerateRoomData((uint) dataRow["room_id"]);

                            if (table2 != null)
                            {
                                serverMessage.AppendByte(1);
                                serverMessage.AppendShort(2);
                                serverMessage.AppendString("roomName");
                                serverMessage.AppendByte(2);
                                serverMessage.AppendString(roomData == null ? "This room was deleted" : roomData.Name);
                                serverMessage.AppendString("roomId");
                                serverMessage.AppendByte(1);
                                serverMessage.AppendInteger((uint) dataRow["room_id"]);
                                serverMessage.AppendShort(table2.Rows.Count);
                                IEnumerator enumerator2 = table2.Rows.GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        DataRow dataRow2 = (DataRow) enumerator2.Current;

                                        Habbo habboForId = Yupi.GetHabboById((uint) dataRow2["user_id"]);
                                        Yupi.UnixToDateTime((double) dataRow2["timestamp"]);

                                        if (habboForId == null)
                                            return null;

                                        serverMessage.AppendInteger(
                                            (int) (Yupi.GetUnixTimeStamp() - (double) dataRow2["timestamp"]));

                                        serverMessage.AppendInteger(habboForId.Id);
                                        serverMessage.AppendString(habboForId.UserName);
                                        serverMessage.AppendString(dataRow2["message"].ToString());
                                        serverMessage.AppendBool(false);
                                    }
                                    continue;
                                }
                                finally
                                {
                                    IDisposable disposable = enumerator2 as IDisposable;

                                    disposable?.Dispose();
                                }
                            }

                            serverMessage.AppendByte(1);
                            serverMessage.AppendShort(0);
                            serverMessage.AppendShort(0);
                        }

                        result = serverMessage;
                        return result;
                    }
                    finally
                    {
                        IDisposable disposable2 = enumerator as IDisposable;

                        disposable2?.Dispose();
                    }
                }

                serverMessage.AppendInteger(0);
                result = serverMessage;
            }
            return result;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:98,代码来源:ModerationTool.cs

示例5: OnHeightMapUpdate

        /// <summary>
        ///     Called when [height map update].
        /// </summary>
        /// <param name="affectedTiles">The affected tiles.</param>
        internal void OnHeightMapUpdate(Dictionary<int, ThreeDCoord> affectedTiles)
        {
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("UpdateFurniStackMapMessageComposer"));
            message.AppendByte((byte) affectedTiles.Count);

            foreach (ThreeDCoord coord in affectedTiles.Values)
            {
                message.AppendByte((byte) coord.X);
                message.AppendByte((byte) coord.Y);
                message.AppendShort((short) (_room.GetGameMap().SqAbsoluteHeight(coord.X, coord.Y)*256));
            }

            _room.SendMessage(message);
        }
开发者ID:ImNotSatan,项目名称:Yupi,代码行数:18,代码来源:RoomItemHandler.cs


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