Exemplo n.º 1
0
        /// <summary>
        /// Sends a message to the location that is visible to all characters in the location
        /// </summary>
        /// <param name="text">The text to send</param>
        /// <param name="fromCharacter">
        /// If the message is being sent from a character then specify that here.
        /// Otherwise use Guid.Empty
        /// This will assure that the sender does not also get the message
        /// </param>
        public void SendDtoMessage(FiniteDto dto, Character fromCharacter)
        {
            var charactersInLocation = GrainClusterClient.Universe.GetCharactersInLocation(this.TrackingId).Result
                                       .Where(c => fromCharacter == null || c.TrackingId != fromCharacter.TrackingId);

            foreach (var charInLoc in charactersInLocation)
            {
                charInLoc.SendDtoMessage(dto);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends a message to the character that only the receiving character can see
        /// </summary>
        /// <param name="text">The text to send</param>
        public void SendDtoMessage(FiniteDto dto)
        {
            // Is any client focusing on this character? If not then no message is sent.
            var focusedClient = AttachedClients.GetCharacterFocusedClient(this.TrackingId);

            if (focusedClient == null)
            {
                return;
            }

            focusedClient.SendDtoMessage(dto);
        }
Exemplo n.º 3
0
        public void SendDtoMessage(FiniteDto dto)
        {
            var serialized = JsonDtoSerializer.SerializeDto(dto);

            if (ServerToClientEndpoint != null)
            {
                ServerToClientEndpoint.SendMessage(serialized);
            }
            else
            {
                System.Console.WriteLine(serialized);
            }
        }
Exemplo n.º 4
0
        public static void SendDtoMessage(FiniteDto messageDto)
        {
            var serialized = JsonDtoSerializer.SerializeDto(messageDto);
            var message    = new Message(serialized);

            try
            {
                sender.SendAsync(message);
            }
            catch (Exception ex)
            {
                Windows.WriteMainWindowDescriptiveText(ex.ToString());
            }
        }