Exemplo n.º 1
0
        public void SendChatToPlayer(OutboundChatMessage chat)
        {
            if (!EnsurePlayerIsOnline(chat.DestinationPlayer))
            {
                // We should log here that the message failed.
                return;
            }

            SendChatToPlayer(chat.DestinationPlayer, chat.ChatMessage.ToClientJson(), SerializeChatMetadata(chat.Metadata));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends playerID
        /// Sends info for all players in system at time of login
        ///
        /// </summary>
        /// <param name="?"></param>
        private void SendLoginList(IArea area, HumanPlayer player, ChatManager chatManager)
        {
            IShip ship = player.GetActiveShip();
            MessageClientLogin data = new MessageClientLogin();

            data.Ship         = ship.GetNetworkData(true, true, true, true);
            data.CurrentCash  = player.CashOnHand;
            data.LoginMessage = GetGalacticNews(player);
            data.AreaName     = area.AreaName;
            data.PlayerInfo   = new PlayerInfo(player.Id, player.ActiveShipId);


            player.SendMessage(new NetworkMessageContainer(data, MessageTypes.ClientLoginSuccess));

            var outboundChat = new OutboundChatMessage(
                player,
                new ChatlineObject("Welcome to Freecon Galactic, " + player.Username + ".", ChatlineColor.White)
                );

            chatManager.SendChatToPlayer(outboundChat);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Builds a simple chat text with the specified colors
        /// </summary>
        /// <param name="p"></param>
        /// <param name="perfix"></param>
        /// <param name="text"></param>
        /// <param name="chatlineColor"></param>
        public void SendSimpleChat(Player p, string prefix, string text, ChatlineColor prefixColor, ChatlineColor textColor = ChatlineColor.White)
        {
            var chat = new OutboundChatMessage(p, BuildChatLine(prefix, text, prefixColor, textColor));

            SendChatToPlayer(chat);
        }