示例#1
0
        /// <inheritdoc/>
        public void ShowMessage(string message, OpenMU.Interfaces.MessageType messageType)
        {
            const string messagePrefix = "000000000";
            string       content       = messagePrefix + message;

            byte[] packet = new byte[content.Length + 5];
            packet[0] = 0xc1;
            packet[1] = (byte)(content.Length + 5);
            packet[2] = 13;
            packet[3] = (byte)messageType;
            Encoding.UTF8.GetBytes(content, 0, content.Length, packet, 4);
            this.connection.Send(packet);
        }
示例#2
0
        /// <inheritdoc/>
        public void ShowMessage(string message, OpenMU.Interfaces.MessageType messageType)
        {
            const string messagePrefix = "000000000";
            string       content       = messagePrefix + message;

            using (var writer = this.connection.StartSafeWrite(0xC1, 5 + content.Length))
            {
                var packet = writer.Span;
                packet[2] = 13;
                packet[3] = (byte)messageType;
                packet.Slice(4).WriteString(content, Encoding.UTF8);
                writer.Commit();
            }
        }