//------------------------------------------------------------------------------------------------------------- public void GetTinyURL(ShowMyAppDelegateURL sDelegate) { if (TinyURLRequest == false) { TinyURLRequest = true; StartCoroutine(GetTinyURLAsync(sDelegate)); } }
//------------------------------------------------------------------------------------------------------------- #region Get URL public void GetURL(ShowMyAppDelegateURL sDelegate) { if (Tiny == true) { GetTinyURL(sDelegate); } else { GetFullURL(sDelegate);; } }
//------------------------------------------------------------------------------------------------------------- private IEnumerator GetTinyURLAsync(ShowMyAppDelegateURL sDelegate) { string tURI = website + "url.php?t=1&" + GetParam(); Debug.Log("GetTinyURLAsync() => tURI = " + tURI); UnityWebRequest www = UnityWebRequest.Get(tURI); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { TinyURL = www.downloadHandler.text; Debug.Log("GetTinyURLAsync() => tURI result = " + TinyURL); sDelegate?.Invoke(TinyURL); } TinyURLRequest = false; }
//------------------------------------------------------------------------------------------------------------- public void GetFullURL(ShowMyAppDelegateURL sDelegate) { string rReturn = website + "r.php?" + GetParam(); sDelegate(rReturn); }