Beispiel #1
0
 public bool AddConnection(InsightNetworkConnection conn)
 {
     if (!connections.ContainsKey(conn.connectionId))
     {
         // connection cannot be null here or conn.connectionId
         // would throw NRE
         connections[conn.connectionId] = conn;
         conn.SetHandlers(messageHandlers);
         return(true);
     }
     // already a connection with this id
     return(false);
 }
Beispiel #2
0
        public virtual void Start()
        {
            Application.runInBackground = true;

            clientID = 0;
            insightNetworkConnection = new InsightNetworkConnection();
            insightNetworkConnection.Initialize(this, networkAddress, clientID, connectionID);
            insightNetworkConnection.SetHandlers(messageHandlers);

            transport.OnClientConnected    = OnConnected;
            transport.OnClientDataReceived = HandleBytes;
            transport.OnClientDisconnected = OnDisconnected;
            transport.OnClientError        = OnError;

            if (AutoStart)
            {
                StartInsight();
            }
        }
Beispiel #3
0
        public virtual void Start()
        {
            if (DontDestroy)
            {
                DontDestroyOnLoad(this);
            }

            Application.runInBackground = true;

            if (AutoStart)
            {
                StartInsight();
            }

            clientID = 0;
            insightNetworkConnection = new InsightNetworkConnection();
            insightNetworkConnection.Initialize(this, networkAddress, clientID, connectionID);
            insightNetworkConnection.SetHandlers(messageHandlers);

            transport.OnClientConnected.AddListener(OnConnected);
            transport.OnClientDataReceived.AddListener(HandleBytes);
            transport.OnClientDisconnected.AddListener(OnDisconnected);
            transport.OnClientError.AddListener(OnError);
        }