IEnumerator StartDownloadingImage(string URL, Action <bool> onResponse) { if (_rawImage != null) { Destroy(_rawImage.gameObject); } UnityWebRequest request = UnityWebRequestTexture.GetTexture(URL); yield return(request.SendWebRequest()); if (request.isNetworkError || request.isHttpError) { Debug.Log(request.error); } else { _rawImage = Instantiate(PrefabsController.GetInstance().GetPrefab("OptionalRawImage"), transform).GetComponent <RawImage>(); _rawImage.texture = ((DownloadHandlerTexture)request.downloadHandler).texture; } if (onResponse != null) { onResponse.Invoke(!(request.isNetworkError || request.isHttpError)); } }
private void Awake() { if (instance == null) { instance = this; } DontDestroyOnLoad(gameObject); }
public void Start() { Submit.onClick.AddListener(() => { Submit.GetComponent <ButtonLoader>().StartLoading(); RequestManager.Patient.Authorize(new Dictionary <string, string>() { { "email", Email.text }, { "password", Password.text } }, response => { TokenManager.Token = response.data.attributes.token; Debug.Log(response.rawData); RequestManager.Patient.Profile(_response => { RequestManager.User.TwoFA.Request( __response => { PrefabsController.OpenPrefabUI("2FA").GetComponent <TwoFAController>().OnComplete(() => { Submit.GetComponent <ButtonLoader>().StopLoading(); FrameSetController.GetInstance().OpenFrame(FrameSet.PROFILE); }); }, error => { Message.Debug("2FA Failed"); } ); }, error => { Message.CREDENTIALS_WRONG.Show(); Form.Clear(); Submit.GetComponent <ButtonLoader>().StopLoading(); }); }, error => { Message.CREDENTIALS_WRONG.Show(); Form.Clear(); Submit.GetComponent <ButtonLoader>().StopLoading(); }); }); RegistrationButton.onClick.AddListener(() => { FrameSetController.GetInstance().OpenFrame(FrameSet.REGISTRATION); }); }