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


C# ServerMessage.AppendByte方法代碼示例

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


在下文中一共展示了ServerMessage.AppendByte方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SerializeRoomChatlog

        internal static ServerMessage SerializeRoomChatlog(uint roomID)
        {
            // NEW CHATLOGS [March 2014] Coded by Finn
            // Please don't remove credits, this took me some time to do... :(
            // Credits to Itachi for the structure's "context" enigma :D




            ServerMessage Message = new ServerMessage();
            RoomData Room = SilverwaveEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID);
            if (Room == null)
            {
                throw new NullReferenceException("No room found.");
            }




            Message.Init(Outgoing.RoomChatlog);
            Message.AppendByte(1);
            Message.AppendShort(2);
            Message.AppendString("roomName");
            Message.AppendByte(2);
            Message.AppendString(Room.Name);
            Message.AppendString("roomId");
            Message.AppendByte(1);
            Message.AppendInt32(Room.Id);




            Message.AppendShort(Room.RoomChat.Count);
            Room.RoomChat.Reverse();
            foreach (Chatlog Log in Room.RoomChat)
            {
                Habbo Habbo = SilverwaveEnvironment.getHabboForId(Log.UserId);
                DateTime Date = SilverwaveEnvironment.UnixToDateTime(Log.Timestamp);
                if (Habbo == null)
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendInt32(Log.UserId);
                    Message.AppendString("*User not found*");
                    Message.AppendString(Log.Message);
                    Message.AppendBoolean(true);
                }
                else
                {
                    Message.AppendInt32((DateTime.Now - Date).Seconds);
                    Message.AppendInt32(Habbo.Id);
                    Message.AppendString(Habbo.Username);
                    Message.AppendString(Log.Message);
                    Message.AppendBoolean(false); // Text is bold
                }
            }
            Room.RoomChat.Reverse();
            return Message;
        }
開發者ID:BjkGkh,項目名稱:07052014,代碼行數:58,代碼來源:ModerationTool.cs

示例2: OnTrigger


//.........這裏部分代碼省略.........
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendInt32(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendInt32(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(7);
                        message.AppendInt32(0);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionteleportto:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendInt32(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendInt32(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(0);
                        message.AppendInt32(8);
                        message.AppendInt32(0);
                        message.AppendInt32(Delay);
                        message.AppendInt32(0);
                        message.AppendByte(2);

                        Session.SendMessage(message);
                        break;
                    }

                case InteractionType.actionmoverotate:
                    {
                        ServerMessage message = new ServerMessage(Outgoing.WiredEffect);
                        message.AppendBoolean(false);
                        message.AppendInt32(5);
                        message.AppendInt32(items.Count);
                        foreach (RoomItem item in items)
                            message.AppendInt32(item.Id);
                        message.AppendInt32(Item.GetBaseItem().SpriteId);
                        message.AppendInt32(Item.Id);
                        message.AppendString(ExtraInfo);
                        message.AppendInt32(2);
                        message.AppendInt32(int.Parse(ExtraInfo.Split(';')[0]));
                        message.AppendInt32(int.Parse(ExtraInfo.Split(';')[1]));
                        message.AppendInt32(0);
                        message.AppendInt32(4);
                        message.AppendInt32(Delay);
                        message.AppendInt32(0);
                        message.AppendInt32(0);

                        Session.SendMessage(message);
                        break;
                    }

                #endregion

                #region Add-ons
開發者ID:BjkGkh,項目名稱:07052014,代碼行數:67,代碼來源:InteractorWired.cs


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