public bool TrySend(IPlayer player, string text, out MessageOut messageOut) { messageOut = default; if (!Participants.TryGetValue(player, out var participant)) { return(false); } var messageIn = new MessageIn(participant, text); return(TrySend(messageIn, out messageOut)); }
public bool TrySend(MessageIn messageIn, out MessageOut messageOut) { messageOut = default; if (!CanSend(messageIn)) { return(false); } var listeners = new HashSet <IPlayer>(); foreach (var participant in Participants.Values) { if (participant.CanReceive()) { listeners.Add(participant.Owner); } } messageOut = new MessageOut(messageIn, listeners); return(messageOut != default); }