Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="message"></param>
        /// <param name="isError"></param>
        /// <param name="sender"></param>
        public void BroadcastChatMessage(string message, bool isError = false, string sender = "System")
        {
            var msg = new LobbyChatPacket()
            {
                Message = message,
                Sender  = sender,
                IsError = isError
            };

            Broadcast(MessageHelper.Create((short)MstMessageCodes.LobbyChatMessage, msg.ToBytes()));
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="member"></param>
        /// <param name="message"></param>
        /// <param name="isError"></param>
        /// <param name="sender"></param>
        public void SendChatMessage(LobbyMember member, string message, bool isError = false, string sender = "System")
        {
            var packet = new LobbyChatPacket()
            {
                Message = message,
                Sender  = sender,
                IsError = isError
            };

            var msg = MessageHelper.Create((short)MstMessageCodes.LobbyChatMessage, packet.ToBytes());

            member.Extension.Peer.SendMessage(msg, DeliveryMethod.Reliable);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="member"></param>
        /// <param name="message"></param>
        public void ChatMessageHandler(LobbyMember member, IIncomingMessage message)
        {
            var text = message.AsString();

            var messagePacket = new LobbyChatPacket()
            {
                Message = text,
                Sender  = member.Username
            };

            var msg = MessageHelper.Create((short)MstMessageCodes.LobbyChatMessage, messagePacket.ToBytes());

            Broadcast(msg);
        }