public struct AckMsg<T>
{
public bool cancel;
public T msg;
public AckMsg(T msg, bool cancel)
{
this.msg = msg;
this.cancel = cancel;
}
}
public interface IMessageTest
{
int CalculateSize();
}
public interface IMessageTest<T> : IMessageTest where T : IMessageTest<T>
{
void MergeFrom(T message);
}
TaskAwaiter aw = default;
var c11 = new AsyncTaskMethodBuilder<AckMsg<IMessageTest>>();
c11.Start(ref stateMachine);
c11.AwaitUnsafeOnCompleted(ref aw, ref stateMachine);
c11.AwaitOnCompleted(ref aw, ref stateMachine);
c11.SetException(null);
c11.SetResult(default);
bl = aw.IsCompleted;
TaskAwaiter<AckMsg<IMessageTest>> awAckMsg = default;
var c12 = new AsyncVoidMethodBuilder();
var c12B = AsyncVoidMethodBuilder.Create();
c12.Start(ref stateMachine);
c12.AwaitUnsafeOnCompleted(ref awAckMsg, ref stateMachine);
c12.SetException(null);
c12.SetResult();
然后在热更层定义类VerifyACKTest继承IMessageTest
public class VerifyACKTest: IMessageTest<VerifyACKTest>
{
public void MergeFrom(VerifyACKTest message)
{
}
public int CalculateSize()
{
//throw new System.NotImplementedException();
return 0;
}
}
最后热更层调用Enter()方法就会崩溃
public static async void Enter()
{
await Send<VerifyACKTest>();
}
public static async Task<AckMsg<T>> Send<T>()
{
var tcs = new TaskCompletionSource<T>();
Debug.Log("Send---b");
return new AckMsg<T>(default, true);
}
首先在AOT定义AckMsg和IMessageTest接口,并添加泛型接口的引用
然后在热更层定义类VerifyACKTest继承IMessageTest
最后热更层调用Enter()方法就会崩溃