Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (_ksimSocket != null)
     {
         string ksimUrl = string.Format("{0}:{1}", _ksimSocket.Address, _ksimSocket.Port);
         if (_ksimSocket.IsConnected())
         {
             if (commBridge.tryAgainSockets.ContainsKey(ksimUrl))
             {
                 if (commBridge.tryAgainSockets[ksimUrl] == typeof(FusionSocket))
                 {
                     _ksimSocket = (KSIMSocket)commBridge.FindSocketConnectionByLabel("KSIM");
                     //Debug.Log(_fusionSocket.IsConnected());
                 }
             }
         }
         else
         {
             //SocketConnection _retry = socketConnections.FirstOrDefault(s => s.GetType() == typeof(FusionSocket));
             //TryReconnectSocket(_fusionSocket.Address, _fusionSocket.Port, typeof(FusionSocket), ref _retry);
             //_fusionSocket.OnConnectionLost(this, null);
             if (!commBridge.tryAgainSockets.ContainsKey(ksimUrl))
             {
                 commBridge.tryAgainSockets.Add(ksimUrl, _ksimSocket.GetType());
             }
         }
     }
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (_fusionSocket != null)
        {
            string fusionUrl = string.Format("{0}:{1}", _fusionSocket.Address, _fusionSocket.Port);
            if (_fusionSocket.IsConnected())
            {
                if (commBridge.tryAgainSockets.ContainsKey(fusionUrl))
                {
                    if (commBridge.tryAgainSockets[fusionUrl] == typeof(FusionSocket))
                    {
                        _fusionSocket = (FusionSocket)commBridge.FindSocketConnectionByLabel("Fusion");
                        //Debug.Log(_fusionSocket.IsConnected());
                    }
                }

                string inputFromFusion = _fusionSocket.GetMessage();
                if (inputFromFusion != "")
                {
                    Debug.Log(inputFromFusion);
                    Debug.Log(_fusionSocket.HowManyLeft() + " messages left.");
                    _fusionSocket.OnFusionReceived(this, new FusionEventArgs(inputFromFusion));
                }
            }
            else
            {
                //SocketConnection _retry = socketConnections.FirstOrDefault(s => s.GetType() == typeof(FusionSocket));
                //TryReconnectSocket(_fusionSocket.Address, _fusionSocket.Port, typeof(FusionSocket), ref _retry);
                //_fusionSocket.OnConnectionLost(this, null);
                if (!commBridge.tryAgainSockets.ContainsKey(fusionUrl))
                {
                    commBridge.tryAgainSockets.Add(fusionUrl, _fusionSocket.GetType());
                }
            }
        }
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     commBridge  = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     _ksimSocket = (KSIMSocket)commBridge.FindSocketConnectionByLabel("KSIM");
 }
Example #4
0
 // Use this for initialization
 void Start()
 {
     commBridge    = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     _fusionSocket = (FusionSocket)commBridge.FindSocketConnectionByLabel("Fusion");
 }