Beispiel #1
0
 internal void DisableListen()
 {
     if (m_ChatListener != null)
     {
         m_ChatListener.Remove();
         m_ChatListener = null;
     }
 }
Beispiel #2
0
 internal void EnableListen()
 {
     if (m_ChatListener == null)
     {
         try
         {
             m_ChatService  = CurrentScene.GetService <ChatServiceInterface>();
             m_ChatListener = m_ChatService.AddAgentListen(0, string.Empty, UUID.Zero, string.Empty, GetMyUUID, GetMyPosition, OnChatReceive);
         }
         catch
         {
             /* intentionally ignored */
         }
     }
 }
Beispiel #3
0
        private void SendToListener(ChatServiceInterface.Listener listener, ListenEvent ev, double maxDistanceSquared)
        {
            Func <UUID> getowner = listener.GetOwner;
            Func <UGI>  getGroup = listener.GetGroup;

            if ((ev.GlobalPosition - listener.GetPosition()).LengthSquared > maxDistanceSquared &&
                !listener.IsIgnorePosition)
            {
                /* too far so no listening */
            }
            else if (listener.LimitToSameGroup && getGroup != null && ev.Group != null && ev.Group.Equals(getGroup()))
            {
                /* ignore group mismatch */
            }
            else if (listener.LimitToSameOwner && getowner != null && getowner() != ev.OwnerID)
            {
                /* ignore owner mismatch */
            }
            else if (ev.TargetID == UUID.Zero ||
                     ev.TargetID == listener.GetUUID())
            {
                listener.Send(ev);
            }
        }