示例#1
0
        /// <summary>
        /// Sends a chat message.
        /// </summary>
        /// <param name="message">Message.</param>
        public static void sendChatMessage(string message)
        {
            FlatBufferBuilder fbb = new FlatBufferBuilder(1);

            var mon = NetMessage.CreateNetMessage(fbb,
                                                  NetID.Chat,
                                                  Chat.CreateChat(fbb,
                                                                  fbb.CreateString(userName),
                                                                  fbb.CreateString(message)).Value);

            NetMessage.FinishNetMessageBuffer(fbb, mon);

            peer.Send(0, fbb.SizedByteArray(), PacketFlags.Reliable);
        }