Пример #1
0
        public void Disconnect()
        {
            try
            {
                foreach (var pair in ClientList)
                {
                    TcpClient client = pair.Key as TcpClient;
                    client.Close();
                }
                ClientList.Clear();

                if (TcpClient != null)
                {
                    TcpClient.Close();
                }
                if (TcpListner != null)
                {
                    TcpListner.Stop();
                }
            }
            catch (Exception ex)
            {
                ServerEvent.ErrorLog("Disconnect", ex.Message);
            }
        }
Пример #2
0
        public void Disconnect()
        {
            try
            {
                foreach (var pair in ClientList)
                {
                    TcpClient client = pair.Key as TcpClient;
                    IpPoint  = (IPEndPoint)client.Client.RemoteEndPoint;
                    ClientIP = IpPoint.Address + ":" + IpPoint.Port;
                    DisplayText(ClientIP + " 님의 연결을 해제합니다.");
                    client.Close();
                }
                ClientList.Clear();

                if (TcpClient != null)
                {
                    TcpClient.Close();
                }
                if (TcpListner != null)
                {
                    TcpListner.Stop();
                }
            }
            catch (Exception ex)
            {
                ServerEvent.ErrorLog("Disconnect", ex.Message);
            }
        }
Пример #3
0
 private void OnEnable()
 {
     Debug.Log("Start!");
     _time          = _timeHit = _attempts = _count = _cTime = _cTimeHit = 0;
     FocusedObject  = null;
     centerHUD.text = "Catch and chase the ball!";
     TcpListner.ResetListner();
     //AnimationDone(); // Remove this line
 }
 public void Disconnect()
 {
     if (TcpClient != null)
     {
         TcpClient.Close();
     }
     if (TcpListner != null)
     {
         TcpListner.Stop();
     }
 }
Пример #5
0
    public void AnimationDone()
    {
        Debug.Log("AnimationDone!");
        TcpListner.Results.ScanningPatternIndividualResult += string.Format("{0:0.0000}\t", (float)_cTimeHit / (float)_cTime);
        _cTime = _cTimeHit = 0;

        float hits = (float)_timeHit / (float)_time;

        if (_firstTime)
        {
            points.text = string.Format("{0:0}%", hits * 100);
        }
        else
        {
            points.text = string.Format("{0:0}% (Last attempt {1:0}%)", hits * 100, _hitsLastAttempt * 100);
        }
        _hitsLastAttempt = hits;

        if (++_attempts < MAX_ATTEMPT)
        {
            if (_firstTime)
            {
                if (++_count < MIN_ATTEMPT_FIRST)
                {
                    return;
                }
            }
            else
            {
                if (++_count < MIN_ATTEMPT)
                {
                    return;
                }
            }
            if (hits < MIN_SUCCESS)
            {
                return;
            }
        }
        _firstTime = false;

        TcpListner.Results.NumberOfAttempts      = _attempts;
        TcpListner.Results.ScanningPatternResult = hits;
#if WINDOWS_UWP
        TcpListner.SendReadyForTraffic();
#endif
        this.gameObject.SetActive(false);
        nextDialog.SetActive(true);
    }
Пример #6
0
 public void Disconnect()
 {
     try
     {
         if (TcpClient != null)
         {
             TcpClient.Close();
         }
         if (TcpListner != null)
         {
             TcpListner.Stop();
         }
     }
     catch (Exception ex) { }
 }
Пример #7
0
 public void Disconnect()
 {
     try
     {
         if (TcpClient != null)
         {
             TcpClient.Close();
         }
         if (TcpListner != null)
         {
             TcpListner.Stop();
         }
     }
     catch (Exception ex)
     {
         ServerEvent.ErrorLog("Disconnect", ex.Message);
     }
 }
Пример #8
0
 public void Disconnect()
 {
     try
     {
         if (TcpClient != null)
         {
             TcpClient.Close();
         }
         if (TcpListner != null)
         {
             TcpListner.Stop();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Disconnect : \r\n" + ex.ToString());
     }
 }
Пример #9
0
    public void SpeechCommands(string command)
    {
        string answer = string.Empty;

        switch (command)
        {
        case "turn left":
        {
            answer        = "L";
            _activeButton = button1;
        }
        break;

        case "turn right":
        {
            answer        = "R";
            _activeButton = button2;
        }
        break;

        default:
            return;
        }

        // Check Answer
        if (!TcpListner.IsScenarioDataValid)
        {
            return;
        }
        try
        {
            Image image    = _activeButton.GetComponent <Image>();
            var   oldColor = image.color;
            image.color = Color.yellow;

            string result = TcpListner.ScenarioData.CompassTurn;

            Debug.Log("Answer: " + answer + " - " + result);
            Answer.text  = (answer == result) ? "Correct" : "Wrong";
            Answer.color = (answer == result) ? Color.green : Color.red;
            TcpListner.Results.CompassTurn = answer;

            // We are done, lets send the results.
            if (!_isSend)
            {
                _isSend = true;
#if WINDOWS_UWP
                TcpListner.SendResults();
#endif
            }
            Wait(3, () =>
            {
                gameObject.SetActive(false);
                image.color = oldColor;
                Answer.text = string.Empty;

                nextDialog.SetActive(true);
            });
        }
        catch (Exception ex)
        {
            Debug.LogError(ex.Message);
        }
    }