diff --git a/Assets/Scripts/GlobalBehaviour.cs b/Assets/Scripts/GlobalBehaviour.cs index 124d016520e45407bea2079ff914cbee815eeb3f..edc41510f5417a5890ca88bec93177d4bfd8f780 100644 --- a/Assets/Scripts/GlobalBehaviour.cs +++ b/Assets/Scripts/GlobalBehaviour.cs @@ -80,43 +80,40 @@ IEnumerator _GetScrollsfromServer() //UnityWebRequest request = UnityWebRequest.Get("https://019a8ea5-843a-498b-8d0c-778669aef987.mock.pstmn.io/get"); System.DateTime requestTime = System.DateTime.UtcNow; - //UnityWebRequest request = null; - //for (int i = 0; i < this.tryScrollListTimes; i++) - //{ - // request = UnityWebRequest.Get(CommunicationEvents.ServerAdress + "/scroll/list"); - // request.method = UnityWebRequest.kHttpVerbGET; - - // yield return request.SendWebRequest(); - - // if (request.result == UnityWebRequest.Result.ConnectionError - // || request.result == UnityWebRequest.Result.ProtocolError) - // { - // Debug.LogWarning(request.error); - // Debug.Log("GET Scroll/list failed. Attempt: " + (i + 1).ToString()); - // } - // else - // break; - //} - //while (request.result == UnityWebRequest.Result.InProgress) - // yield return null; + UnityWebRequest request = null; + for (int i = 0; i < this.tryScrollListTimes; i++) + { + request = UnityWebRequest.Get(CommunicationEvents.ServerAdress + "/scroll/list"); + request.method = UnityWebRequest.kHttpVerbGET; + yield return request.SendWebRequest(); + if (request.result == UnityWebRequest.Result.ConnectionError + || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogWarning(request.error); + Debug.Log("GET Scroll/list failed. Attempt: " + (i + 1).ToString()); + } + else + break; + } + while (request.result == UnityWebRequest.Result.InProgress) + yield return null; System.DateTime answerTime = System.DateTime.UtcNow; string jsonString = null; - //if (request.result == UnityWebRequest.Result.ConnectionError - // || request.result == UnityWebRequest.Result.ProtocolError) - //{ - // Debug.LogWarning(request.error); - //} - //else - //{ - // CommunicationEvents.ServerRunning = true; - - // while (!request.downloadHandler.isDone) - // yield return null; - // jsonString = request.downloadHandler.text; - //} + if (request.result == UnityWebRequest.Result.ConnectionError + || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogWarning(request.error); + } + else + { + CommunicationEvents.ServerRunning = true; + while (!request.downloadHandler.isDone) + yield return null; + jsonString = request.downloadHandler.text; + } if (string.IsNullOrEmpty(jsonString) || jsonString.Equals("[]")) diff --git a/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs b/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs index 1c21f66dfd73d6c347ef3c7c2cc1c018fee9fddf..17258675b1dbe43c078379647627276979f120bf 100644 --- a/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs +++ b/Assets/Scripts/MMTServer/CommunicationProtocoll/MMTConstants.cs @@ -122,6 +122,7 @@ public static class MMTConstants public const string ScrollCylinderVolumeScroll = "http://mathhub.info/FrameIT/frameworld?CylinderVolumeScroll"; public const string ScrollCircleLineAngleToAngleScroll = "http://mathhub.info/FrameIT/frameworld?CircleLineAngleToAngleScroll"; public const string ScrollMidpoint = "http://mathhub.info/FrameIT/frameworld?Midpoint"; + public const string ScrollTest = "http://mathhub.info/FrameIT/frameworld?Test"; public const string ScrollCircleScroll = "http://mathhub.info/FrameIT/frameworld?CircleScroll"; public const string ScrollCircleLineAngleScroll = "http://mathhub.info/FrameIT/frameworld?CircleLineAngleScroll"; public const string ScrollCircleAreaScroll = "http://mathhub.info/FrameIT/frameworld?CircleAreaScroll";