发布00
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
/// <summary>
|
||||
/// 热更基类,应该继承的基类
|
||||
/// </summary>
|
||||
public class DomainBase : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
/// 触发Domain时,调用该方法
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
public virtual void OnEnter(string param)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Domain被关闭时,会调该方法
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
public virtual void OnExit()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 如果Domain主动退出,请触发此Action
|
||||
/// </summary>
|
||||
public UnityAction RequestExit;
|
||||
|
||||
public virtual async Task OnEnterAsync(string param)
|
||||
{
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
public virtual async Task OnExitAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8923efe3eb184e7f9283f71e2dc4ea10
|
||||
timeCreated: 1742540500
|
||||
@@ -1,67 +0,0 @@
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
#if ENABLE_UNITYWEBREQUEST && (!UNITY_2019_1_OR_NEWER || UNITASK_WEBREQUEST_SUPPORT)
|
||||
using UnityEngine.Networking;
|
||||
#endif
|
||||
|
||||
namespace Stary.Evo
|
||||
{
|
||||
public static partial class UnityAsyncExtensions
|
||||
{
|
||||
|
||||
|
||||
#if !UNITY_2023_1_OR_NEWER
|
||||
// from Unity2023.1.0a15, AsyncOperationAwaitableExtensions.GetAwaiter is defined in UnityEngine.
|
||||
public static AsyncOperationAwaiter GetAwaiter(this AsyncOperation asyncOperation)
|
||||
{
|
||||
return new AsyncOperationAwaiter(asyncOperation);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public struct AsyncOperationAwaiter : ICriticalNotifyCompletion
|
||||
{
|
||||
AsyncOperation asyncOperation;
|
||||
Action<AsyncOperation> continuationAction;
|
||||
|
||||
public AsyncOperationAwaiter(AsyncOperation asyncOperation)
|
||||
{
|
||||
this.asyncOperation = asyncOperation;
|
||||
this.continuationAction = null;
|
||||
}
|
||||
|
||||
public bool IsCompleted => asyncOperation.isDone;
|
||||
|
||||
public void GetResult()
|
||||
{
|
||||
if (continuationAction != null)
|
||||
{
|
||||
asyncOperation.completed -= continuationAction;
|
||||
continuationAction = null;
|
||||
asyncOperation = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
asyncOperation = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnCompleted(Action continuation)
|
||||
{
|
||||
UnsafeOnCompleted(continuation);
|
||||
}
|
||||
|
||||
public void UnsafeOnCompleted(Action continuation)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a42a4edb452e470b87e698b7d7b7db4a
|
||||
timeCreated: 1743403227
|
||||
Reference in New Issue
Block a user