Beispiel #1
0
 public static void Log(string msg)
 {
     if (KIX.Debugging)
     {
         UnityEngine.Debug.Log(KIX.CreateKIXMSG(msg));
     }
 }
Beispiel #2
0
    /// <summary>
    /// Load URL ASYNC
    /// Loads url data async.
    /// </summary>
    /// <typeparam name="TResult">output type</typeparam>
    /// <param name="url">string</param>
    /// <returns></returns>
    public async Task <string> LoadURLAsync <TResult>(string url)
    {
        Uri uri = new Uri(url);

        using (var client = new HttpClient())
        {
            var msg = await client.GetAsync(uri);

            if (!msg.IsSuccessStatusCode)
            {
                throw new Exception(KIX.CreateKIXMSG(msg.ReasonPhrase));
            }
            string t = await msg.Content.ReadAsStringAsync();

            return(t);
        }
    }