Пример #1
0
        private byte[] buildMessage(string message)
        {
            FlatBufferBuilder builder       = new FlatBufferBuilder(0x400);
            StringOffset      nameOffset    = builder.CreateString("[SYSTEM]");
            StringOffset      messageOffset = builder.CreateString(message);

            ChatMessage.StartChatMessage(builder);
            ChatMessage.AddName(builder, nameOffset);
            ChatMessage.AddMessage(builder, messageOffset);
            Offset <ChatMessage> offset3 = ChatMessage.EndChatMessage(builder);

            builder.Finish(offset3.Value);
            return(builder.SizedByteArray());
        }
Пример #2
0
        private byte[] buildMove(string NewRoom)
        {
            this.RoomId = NewRoom;
            FlatBufferBuilder builder          = new FlatBufferBuilder(1024);
            StringOffset      interestIDOffset = builder.CreateString(this.RoomId);
            StringOffset      regionIDOffset   = builder.CreateString(this.RegionId);
            Offset <Header>   mHeaderOffset    = Header.CreateHeader(builder, interestIDOffset, regionIDOffset, MessageType.Move);

            ChatMessage.StartChatMessage(builder);
            ChatMessage.AddMHeader(builder, mHeaderOffset);
            Offset <ChatMessage> offset4 = ChatMessage.EndChatMessage(builder);

            builder.Finish(offset4.Value);
            return(builder.SizedByteArray());
        }
Пример #3
0
        private byte[] buildMessage(string message)
        {
            FlatBufferBuilder builder          = new FlatBufferBuilder(1024);
            StringOffset      nameOffset       = builder.CreateString($"[{this.chatName}]: ");
            StringOffset      messageOffset    = builder.CreateString(message);
            StringOffset      interestIDOffset = builder.CreateString(this.RoomId);
            StringOffset      regionIDOffset   = builder.CreateString(this.RegionId);
            Offset <Header>   mHeaderOffset    = Header.CreateHeader(builder, interestIDOffset, regionIDOffset, MessageType.Chat);

            ChatMessage.StartChatMessage(builder);
            ChatMessage.AddMHeader(builder, mHeaderOffset);
            ChatMessage.AddName(builder, nameOffset);
            ChatMessage.AddMessage(builder, messageOffset);
            var msg = ChatMessage.EndChatMessage(builder);

            builder.Finish(msg.Value);
            return(builder.SizedByteArray());
        }