- Added support for downloading assets (including auto-update) - By default, auto-update is turned off. Enable it in settings. - Default repository for app icons and names is [https://github.com/tverona1/QuestAppLauncher_assets]. This can be configured in config.json.
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
|
|
namespace QuestAppLauncher
|
|
{
|
|
/// <summary>
|
|
/// Awaiter implementation for UnityWebRequest - allows us to use async / await pattern on UnityWebRequest.
|
|
/// </summary>
|
|
public class UnityWebRequestAwaiter : INotifyCompletion
|
|
{
|
|
private UnityWebRequestAsyncOperation asyncOp;
|
|
private Action continuation;
|
|
|
|
public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp)
|
|
{
|
|
this.asyncOp = asyncOp;
|
|
asyncOp.completed += OnRequestCompleted;
|
|
}
|
|
|
|
public bool IsCompleted { get { return asyncOp.isDone; } }
|
|
|
|
public void GetResult() { }
|
|
|
|
public void OnCompleted(Action continuation)
|
|
{
|
|
this.continuation = continuation;
|
|
}
|
|
|
|
private void OnRequestCompleted(AsyncOperation obj)
|
|
{
|
|
continuation();
|
|
}
|
|
}
|
|
|
|
public static class ExtensionMethods
|
|
{
|
|
public static UnityWebRequestAwaiter GetAwaiter(this UnityWebRequestAsyncOperation asyncOp)
|
|
{
|
|
return new UnityWebRequestAwaiter(asyncOp);
|
|
}
|
|
}
|
|
}
|