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


C# ServerMessage.AppendByte方法代码示例

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


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

示例1: OnHeightMapUpdate

 /// <summary>
 ///     Called when [height map update].
 /// </summary>
 /// <param name="affectedTiles">The affected tiles.</param>
 internal void OnHeightMapUpdate(ICollection affectedTiles)
 {
     var message = new ServerMessage(LibraryParser.OutgoingRequest("UpdateFurniStackMapMessageComposer"));
     message.AppendByte((byte) affectedTiles.Count);
     foreach (Point coord in affectedTiles)
     {
         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:kessiler,项目名称:azureEmulator,代码行数:16,代码来源:RoomItemHandler.cs

示例2: OnTrigger


//.........这里部分代码省略.........
                        serverMessage15.AppendBool(false);
                        serverMessage15.AppendInteger(0);
                        serverMessage15.AppendInteger(list.Count);
                        foreach (var 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:
                    {
                        var serverMessage16 = new ServerMessage(LibraryParser.OutgoingRequest("WiredEffectMessageComposer"));
                        serverMessage16.AppendBool(false);
                        serverMessage16.AppendInteger(5);

                        serverMessage16.AppendInteger(list.Count);
                        foreach (var 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:
                    {
                        var serverMessage17 = new ServerMessage(LibraryParser.OutgoingRequest("WiredEffectMessageComposer"));
                        serverMessage17.AppendBool(false);
                        serverMessage17.AppendInteger(5);
                        serverMessage17.AppendInteger(list.Count);
                        foreach (var 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;
                        var 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:BjkGkh,项目名称:Azure2,代码行数:67,代码来源:InteractorWired.cs

示例3: 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 queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.SetQuery(string.Format("SELECT DISTINCT room_id FROM users_chatlogs WHERE user_id = {0} ORDER BY timestamp DESC LIMIT 4", userId));
                DataTable table = queryReactor.GetTable();
                var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolUserChatlogMessageComposer"));
                serverMessage.AppendInteger(userId);
                serverMessage.AppendString(AzureEmulator.GetGame().GetClientManager().GetNameById(userId));
                if (table != null)
                {
                    serverMessage.AppendInteger(table.Rows.Count);
                    IEnumerator enumerator = table.Rows.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            var dataRow = (DataRow)enumerator.Current;
                            queryReactor.SetQuery(string.Concat("SELECT user_id,timestamp,message FROM users_chatlogs WHERE room_id = ", (uint)dataRow["room_id"], " AND user_id = ", userId, " ORDER BY timestamp DESC LIMIT 30"));
                            DataTable table2 = queryReactor.GetTable();
                            RoomData roomData = AzureEmulator.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())
                                    {
                                        var dataRow2 = (DataRow)enumerator2.Current;
                                        Habbo habboForId = AzureEmulator.GetHabboById((uint)dataRow2["user_id"]);
                                        AzureEmulator.UnixToDateTime((double)dataRow2["timestamp"]);
                                        if (habboForId == null)
                                        {
                                            return null;
                                        }
                                        serverMessage.AppendInteger(((int)(AzureEmulator.GetUnixTimeStamp() - (double)dataRow2["timestamp"])));

                                        serverMessage.AppendInteger(habboForId.Id);
                                        serverMessage.AppendString(habboForId.UserName);
                                        serverMessage.AppendString(dataRow2["message"].ToString());
                                        serverMessage.AppendBool(false);
                                    }
                                    continue;
                                }
                                finally
                                {
                                    var disposable = enumerator2 as IDisposable;
                                    if (disposable != null)
                                    {
                                        disposable.Dispose();
                                    }
                                }
                            }
                            serverMessage.AppendByte(1);
                            serverMessage.AppendShort(0);
                            serverMessage.AppendShort(0);
                        }
                        goto IL_29B;
                    }
                    finally
                    {
                        var disposable2 = enumerator as IDisposable;
                        if (disposable2 != null)
                        {
                            disposable2.Dispose();
                        }
                    }
                }
                serverMessage.AppendInteger(0);
                IL_29B:
                result = serverMessage;
            }
            return result;
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:89,代码来源:ModerationTool.cs

示例4: 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)
        {
            var message = new ServerMessage();
            RoomData room = AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);
            //if (room == null)
            //{
            //    throw new NullReferenceException("No room found.");
            //}

            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);

            var tempChatlogs = room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();

            message.AppendShort(tempChatlogs.Count());
            foreach (var chatLog in tempChatlogs)
            {
                chatLog.Serialize(ref message);
            }
            tempChatlogs = null;

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

示例5: 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)
        {
            var message = new ServerMessage();
            Room room = AzureEmulator.GetGame().GetRoomManager().LoadRoom(roomId);

             message.Init(LibraryParser.OutgoingRequest("ModerationToolRoomChatlogMessageComposer"));
            message.AppendByte(1); //type
            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);

            if (room != null)
            {
                var tempChatlogs = room.RoomData.RoomChat.Reverse().Skip(Math.Max(0, room.RoomData.RoomChat.Count() - 150)).Take(150).ToList();
                message.AppendShort(tempChatlogs.Count());
                foreach (var chatLog in tempChatlogs)
                {
                    chatLog.Serialize(ref message);
                }
                tempChatlogs = null;
            }
            else
            {
                DateTime Date = AzureEmulator.UnixToDateTime(1413672144);
                message.AppendInteger((DateTime.Now - Date).Seconds); // niet goed denk ik
                message.AppendInteger(1);
                message.AppendString("*Kamer is niet geladen!*");
                message.AppendString("");
                message.AppendBool(false);

            }
            return message;
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:43,代码来源:ModerationTool.cs

示例6: 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)
        {
            var message = new ServerMessage();

            var room = Azure.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);

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

                message.AppendShort(tempChatlogs.Count);

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

                return message;
            }

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


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