Пример #1
0
        internal void AddObserver(NetworkConnection conn)
        {
            if (m_Observers == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("AddObserver for " + gameObject + " observer list is null");
                }
                return;
            }

            // uses hashset for better-than-list-iteration lookup performance.
            if (m_ObserverConnections.Contains(conn.connectionId))
            {
                // if we try to add a connectionId that was already added, then
                // we may have generated one that was already in use. this is
                // not good and there should be a notification.
                if (LogFilter.logWarn)
                {
                    Debug.Log("AddObserver: connectionId=" + conn.connectionId + " already added for " + name + ". Maybe this function was called twice. Or maybe the transport layer generated the same connectionId twice, which would be a huge problem.");
                }
                return;
            }

            if (LogFilter.logDev)
            {
                Debug.Log("Added observer " + conn.address + " added for " + gameObject);
            }

            m_Observers.Add(conn);
            m_ObserverConnections.Add(conn.connectionId);
            conn.AddToVisList(this);
        }
Пример #2
0
        internal void AddObserver(NetworkConnection conn)
        {
            if (m_Observers == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("AddObserver for " + gameObject + " observer list is null");
                }
                return;
            }

            if (m_Observers.ContainsKey(conn.connectionId))
            {
                // if we try to add a connectionId that was already added, then
                // we may have generated one that was already in use.
                return;
            }

            if (LogFilter.logDev)
            {
                Debug.Log("Added observer " + conn.address + " added for " + gameObject);
            }

            m_Observers[conn.connectionId] = conn;
            conn.AddToVisList(this);
        }
Пример #3
0
        internal void AddObserver(NetworkConnection conn)
        {
            if (m_Observers == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("AddObserver for " + gameObject + " observer list is null");
                }
                return;
            }

            // uses hashset for better-than-list-iteration lookup performance.
            if (m_ObserverConnections.Contains(conn.connectionId))
            {
                // if we try to add a connectionId that was already added, then
                // we may have generated one that was already in use.
                return;
            }

            if (LogFilter.logDev)
            {
                Debug.Log("Added observer " + conn.address + " added for " + gameObject);
            }

            m_Observers.Add(conn);
            m_ObserverConnections.Add(conn.connectionId);
            conn.AddToVisList(this);
        }