Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (_cloudSocket != null)
        {
            string epiSimUrl = string.Format("{0}:{1}", _cloudSocket.address, _cloudSocket.port);
            if (_cloudSocket.isConnected)
            {
                if (commBridge.tryAgainSockets.ContainsKey(epiSimUrl))
                {
                    if (commBridge.tryAgainSockets[epiSimUrl] == typeof(FusionSocket))
                    {
                        _cloudSocket = (WordCloudRestClient)commBridge.FindRestClientByLabel("Parser URL"); // Maybe wrong
                        //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.tryAgainRest.ContainsKey(epiSimUrl))
                {
                    commBridge.tryAgainRest.Add(epiSimUrl, _cloudSocket.GetType());
                }
            }
        }
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     commBridge = GameObject.Find("CommunicationsBridge").GetComponent <CommunicationsBridge>();
     //_wordcloudrestclient = (EpistemicState)commBridge.FindRestClientByLabel("EpiSim");
     _cloudSocket = (WordCloudRestClient)commBridge.FindRestClientByLabel("EpiSim");
 }