Created
          April 1, 2019 18:05 
        
      - 
      
- 
        Save rdeioris/558daac7cfea8bf256ba188018a4b4a5 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| using UnityEngine.Networking; | |
| public class TalkWithFlask : MonoBehaviour | |
| { | |
| [System.Serializable] | |
| class Dumb | |
| { | |
| public float boh; | |
| public string hello; | |
| public int number; | |
| } | |
| UnityWebRequestAsyncOperation asyncOp; | |
| delegate void State(); | |
| State currentState; | |
| void MakeMatchmaking() | |
| { | |
| UnityWebRequest request = new UnityWebRequest("http://robertoaiv.pythonanywhere.com/hello"); | |
| request.downloadHandler = new DownloadHandlerBuffer(); | |
| asyncOp = request.SendWebRequest(); | |
| currentState = CheckMatchmaking; | |
| } | |
| void CheckMatchmaking() | |
| { | |
| if (asyncOp.isDone) | |
| { | |
| Debug.Log(asyncOp.webRequest.responseCode); | |
| Debug.Log(asyncOp.webRequest.downloadHandler.text); | |
| Dumb dumb = JsonUtility.FromJson<Dumb>(asyncOp.webRequest.downloadHandler.text); | |
| Debug.Log(dumb.boh); | |
| currentState = MakePoll; | |
| } | |
| } | |
| void MakePoll() | |
| { | |
| } | |
| void Start() | |
| { | |
| currentState = MakeMatchmaking; | |
| } | |
| void Update() | |
| { | |
| currentState(); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment