Просмотр исходного кода

简化了ETTask,现在变成了完全单线程的协程

tanghai 7 лет назад
Родитель
Сommit
88642480cb

+ 1 - 1
Unity/Assets/Model/Base/Async/CancellationTokenExtensions.cs

@@ -7,7 +7,7 @@ namespace ETModel
     {
         private static readonly Action<object> cancellationTokenCallback = Callback;
 
-        public static (ETTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cts)
+        public static (ETTask, CancellationTokenRegistration) ToETTask(this CancellationToken cts)
         {
             if (cts.IsCancellationRequested)
             {

+ 19 - 19
Unity/Assets/Model/Base/Async/ETAsyncTaskMethodBuilder.cs

@@ -11,7 +11,7 @@ namespace ETModel
         private Action moveNext;
 
         // 1. Static Create method.
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public static ETAsyncTaskMethodBuilder Create()
         {
             ETAsyncTaskMethodBuilder builder = new ETAsyncTaskMethodBuilder();
@@ -19,7 +19,7 @@ namespace ETModel
         }
 
         // 2. TaskLike Task property.
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask Task
         {
             get
@@ -40,7 +40,7 @@ namespace ETModel
         }
 
         // 3. SetException
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetException(Exception exception)
         {
             if (promise == null)
@@ -59,7 +59,7 @@ namespace ETModel
         }
 
         // 4. SetResult
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetResult()
         {
             if (moveNext == null)
@@ -77,7 +77,7 @@ namespace ETModel
         }
 
         // 5. AwaitOnCompleted
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
                 where TAwaiter : INotifyCompletion
                 where TStateMachine : IAsyncStateMachine
@@ -98,7 +98,7 @@ namespace ETModel
         }
 
         // 6. AwaitUnsafeOnCompleted
-        [DebuggerHidden]
+        //[DebuggerHidden]
         [SecuritySafeCritical]
         public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
                 where TAwaiter : ICriticalNotifyCompletion
@@ -120,7 +120,7 @@ namespace ETModel
         }
 
         // 7. Start
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void Start<TStateMachine>(ref TStateMachine stateMachine)
                 where TStateMachine : IAsyncStateMachine
         {
@@ -128,28 +128,28 @@ namespace ETModel
         }
 
         // 8. SetStateMachine
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetStateMachine(IAsyncStateMachine stateMachine)
         {
         }
     }
 
-    public struct AsyncUniTaskMethodBuilder<T>
+    public struct ETAsyncTaskMethodBuilder<T>
     {
         private T result;
         private ETTaskCompletionSource<T> promise;
         private Action moveNext;
 
         // 1. Static Create method.
-        [DebuggerHidden]
-        public static AsyncUniTaskMethodBuilder<T> Create()
+        //[DebuggerHidden]
+        public static ETAsyncTaskMethodBuilder<T> Create()
         {
-            var builder = new AsyncUniTaskMethodBuilder<T>();
+            var builder = new ETAsyncTaskMethodBuilder<T>();
             return builder;
         }
 
         // 2. TaskLike Task property.
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask<T> Task
         {
             get
@@ -170,7 +170,7 @@ namespace ETModel
         }
 
         // 3. SetException
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetException(Exception exception)
         {
             if (promise == null)
@@ -189,7 +189,7 @@ namespace ETModel
         }
 
         // 4. SetResult
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetResult(T result)
         {
             if (moveNext == null)
@@ -208,7 +208,7 @@ namespace ETModel
         }
 
         // 5. AwaitOnCompleted
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
                 where TAwaiter : INotifyCompletion
                 where TStateMachine : IAsyncStateMachine
@@ -229,7 +229,7 @@ namespace ETModel
         }
 
         // 6. AwaitUnsafeOnCompleted
-        [DebuggerHidden]
+        //[DebuggerHidden]
         [SecuritySafeCritical]
         public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
                 where TAwaiter : ICriticalNotifyCompletion
@@ -251,7 +251,7 @@ namespace ETModel
         }
 
         // 7. Start
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void Start<TStateMachine>(ref TStateMachine stateMachine)
                 where TStateMachine : IAsyncStateMachine
         {
@@ -259,7 +259,7 @@ namespace ETModel
         }
 
         // 8. SetStateMachine
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetStateMachine(IAsyncStateMachine stateMachine)
         {
         }

+ 7 - 8
Unity/Assets/Model/Base/Async/ETAsyncTaskVoidMethodBuilder.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Diagnostics;
 using System.Runtime.CompilerServices;
 using System.Security;
 
@@ -10,7 +9,7 @@ namespace ETModel
         private Action moveNext;
 
         // 1. Static Create method.
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public static ETAsyncTaskVoidMethodBuilder Create()
         {
             ETAsyncTaskVoidMethodBuilder builder = new ETAsyncTaskVoidMethodBuilder();
@@ -21,20 +20,20 @@ namespace ETModel
         public ETTaskVoid Task => default;
 
         // 3. SetException
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetException(Exception exception)
         {
         }
 
         // 4. SetResult
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetResult()
         {
             // do nothing
         }
 
         // 5. AwaitOnCompleted
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
                 where TAwaiter : INotifyCompletion
                 where TStateMachine : IAsyncStateMachine
@@ -50,7 +49,7 @@ namespace ETModel
         }
 
         // 6. AwaitUnsafeOnCompleted
-        [DebuggerHidden]
+        //[DebuggerHidden]
         [SecuritySafeCritical]
         public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
                 where TAwaiter : ICriticalNotifyCompletion
@@ -67,7 +66,7 @@ namespace ETModel
         }
 
         // 7. Start
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void Start<TStateMachine>(ref TStateMachine stateMachine)
                 where TStateMachine : IAsyncStateMachine
         {
@@ -75,7 +74,7 @@ namespace ETModel
         }
 
         // 8. SetStateMachine
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void SetStateMachine(IAsyncStateMachine stateMachine)
         {
         }

+ 27 - 28
Unity/Assets/Model/Base/Async/ETTask.cs

@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.Runtime.CompilerServices;
 
 namespace ETModel
@@ -15,25 +14,25 @@ namespace ETModel
 
         private readonly IAwaiter awaiter;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask(IAwaiter awaiter)
         {
             this.awaiter = awaiter;
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask(Func<ETTask> factory)
         {
             this.awaiter = new LazyPromise(factory);
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public AwaiterStatus Status => awaiter?.Status ?? AwaiterStatus.Succeeded;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public bool IsCompleted => awaiter?.IsCompleted ?? true;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void GetResult()
         {
             if (awaiter != null)
@@ -42,7 +41,7 @@ namespace ETModel
             }
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public Awaiter GetAwaiter()
         {
             return new Awaiter(this);
@@ -193,25 +192,25 @@ namespace ETModel
         {
             private readonly ETTask task;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public Awaiter(ETTask task)
             {
                 this.task = task;
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public bool IsCompleted => task.IsCompleted;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public AwaiterStatus Status => task.Status;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void GetResult()
             {
                 task.GetResult();
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void OnCompleted(Action continuation)
             {
                 if (task.awaiter != null)
@@ -224,7 +223,7 @@ namespace ETModel
                 }
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void UnsafeOnCompleted(Action continuation)
             {
                 if (task.awaiter != null)
@@ -242,40 +241,40 @@ namespace ETModel
     /// <summary>
     /// Lightweight unity specified task-like object.
     /// </summary>
-    [AsyncMethodBuilder(typeof (AsyncUniTaskMethodBuilder<>))]
+    [AsyncMethodBuilder(typeof (ETAsyncTaskMethodBuilder<>))]
     public struct ETTask<T>: IEquatable<ETTask<T>>
     {
         private readonly T result;
         private readonly IAwaiter<T> awaiter;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask(T result)
         {
             this.result = result;
             this.awaiter = null;
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask(IAwaiter<T> awaiter)
         {
             this.result = default;
             this.awaiter = awaiter;
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public ETTask(Func<ETTask<T>> factory)
         {
             this.result = default;
             this.awaiter = new LazyPromise<T>(factory);
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public AwaiterStatus Status => awaiter?.Status ?? AwaiterStatus.Succeeded;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public bool IsCompleted => awaiter?.IsCompleted ?? true;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public T Result
         {
             get
@@ -289,7 +288,7 @@ namespace ETModel
             }
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public Awaiter GetAwaiter()
         {
             return new Awaiter(this);
@@ -404,31 +403,31 @@ namespace ETModel
         {
             private readonly ETTask<T> task;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public Awaiter(ETTask<T> task)
             {
                 this.task = task;
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public bool IsCompleted => task.IsCompleted;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public AwaiterStatus Status => task.Status;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             void IAwaiter.GetResult()
             {
                 GetResult();
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public T GetResult()
             {
                 return task.Result;
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void OnCompleted(Action continuation)
             {
                 if (task.awaiter != null)
@@ -441,7 +440,7 @@ namespace ETModel
                 }
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void UnsafeOnCompleted(Action continuation)
             {
                 if (task.awaiter != null)

+ 40 - 143
Unity/Assets/Model/Base/Async/ETTaskCompletionSource.cs

@@ -1,8 +1,6 @@
 using System;
-using System.Collections.Generic;
 using System.Runtime.CompilerServices;
 using System.Runtime.ExceptionServices;
-using System.Threading;
 
 namespace ETModel
 {
@@ -30,35 +28,7 @@ namespace ETModel
         }
     }
 
-    public interface IResolvePromise
-    {
-        bool TrySetResult();
-    }
-
-    public interface IResolvePromise<T>
-    {
-        bool TrySetResult(T value);
-    }
-
-    public interface IRejectPromise
-    {
-        bool TrySetException(Exception e);
-    }
-
-    public interface ICancelPromise
-    {
-        bool TrySetCanceled();
-    }
-
-    public interface IPromise<T>: IResolvePromise<T>, IRejectPromise, ICancelPromise
-    {
-    }
-
-    public interface IPromise: IResolvePromise, IRejectPromise, ICancelPromise
-    {
-    }
-
-    public class ETTaskCompletionSource: IAwaiter, IPromise
+    public class ETTaskCompletionSource: IAwaiter
     {
         // State(= AwaiterStatus)
         private const int Pending = 0;
@@ -68,7 +38,7 @@ namespace ETModel
 
         private int state;
         private ExceptionHolder exception;
-        private object continuation; // action or list
+        private Action continuation; // action or list
 
         AwaiterStatus IAwaiter.Status => (AwaiterStatus) state;
 
@@ -95,68 +65,23 @@ namespace ETModel
                     throw new OperationCanceledException();
                 }
                 default:
-                    throw new NotSupportedException("UniTask does not allow call GetResult directly when task not completed. Please use 'await'.");
+                    throw new NotSupportedException("ETTask does not allow call GetResult directly when task not completed. Please use 'await'.");
             }
         }
 
         void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action)
         {
-            if (Interlocked.CompareExchange(ref continuation, action, null) == null)
+            this.continuation = action;
+            if (state != Pending)
             {
-                if (state != Pending)
-                {
-                    TryInvokeContinuation();
-                }
-            }
-            else
-            {
-                object c = continuation;
-                if (c is Action action1)
-                {
-                    var list = new List<Action>();
-                    list.Add(action1);
-                    list.Add(action);
-                    if (Interlocked.CompareExchange(ref continuation, list, action1) == action1)
-                    {
-                        goto TRYINVOKE;
-                    }
-                }
-
-                var l = (List<Action>) continuation;
-                lock (l)
-                {
-                    l.Add(action);
-                }
-
-                TRYINVOKE:
-                if (state != Pending)
-                {
-                    TryInvokeContinuation();
-                }
+                TryInvokeContinuation();
             }
         }
 
         private void TryInvokeContinuation()
         {
-            object c = Interlocked.Exchange(ref continuation, null);
-            if (c == null)
-            {
-                return;
-            }
-
-            if (c is Action action)
-            {
-                action.Invoke();
-            }
-            else
-            {
-                var l = (List<Action>) c;
-                int cnt = l.Count;
-                for (int i = 0; i < cnt; i++)
-                {
-                    l[i].Invoke();
-                }
-            }
+            this.continuation?.Invoke();
+            this.continuation = null;
         }
 
         public void SetResult()
@@ -181,11 +106,13 @@ namespace ETModel
 
         public bool TrySetResult()
         {
-            if (Interlocked.CompareExchange(ref this.state, Succeeded, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Succeeded;
+
             this.TryInvokeContinuation();
             return true;
 
@@ -193,11 +120,13 @@ namespace ETModel
 
         public bool TrySetException(Exception e)
         {
-            if (Interlocked.CompareExchange(ref this.state, Faulted, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Faulted;
+
             this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(e));
             this.TryInvokeContinuation();
             return true;
@@ -206,11 +135,13 @@ namespace ETModel
 
         public bool TrySetCanceled()
         {
-            if (Interlocked.CompareExchange(ref this.state, Canceled, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Canceled;
+
             this.TryInvokeContinuation();
             return true;
 
@@ -218,11 +149,13 @@ namespace ETModel
 
         public bool TrySetCanceled(OperationCanceledException e)
         {
-            if (Interlocked.CompareExchange(ref this.state, Canceled, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Canceled;
+
             this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(e));
             this.TryInvokeContinuation();
             return true;
@@ -235,7 +168,7 @@ namespace ETModel
         }
     }
 
-    public class ETTaskCompletionSource<T>: IAwaiter<T>, IPromise<T>
+    public class ETTaskCompletionSource<T>: IAwaiter<T>
     {
         // State(= AwaiterStatus)
         private const int Pending = 0;
@@ -246,7 +179,7 @@ namespace ETModel
         private int state;
         private T value;
         private ExceptionHolder exception;
-        private object continuation; // action or list
+        private Action continuation; // action or list
 
         bool IAwaiter.IsCompleted => state != Pending;
 
@@ -274,67 +207,23 @@ namespace ETModel
                     throw new OperationCanceledException();
                 }
                 default:
-                    throw new NotSupportedException("UniTask does not allow call GetResult directly when task not completed. Please use 'await'.");
+                    throw new NotSupportedException("ETTask does not allow call GetResult directly when task not completed. Please use 'await'.");
             }
         }
 
         void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action)
         {
-            if (Interlocked.CompareExchange(ref continuation, action, null) == null)
+            this.continuation = action;
+            if (state != Pending)
             {
-                if (state != Pending)
-                {
-                    TryInvokeContinuation();
-                }
-            }
-            else
-            {
-                var c = continuation;
-                if (c is Action action1)
-                {
-                    var list = new List<Action>();
-                    list.Add(action1);
-                    list.Add(action);
-                    if (Interlocked.CompareExchange(ref continuation, list, action1) == action1)
-                    {
-                        goto TRYINVOKE;
-                    }
-                }
-
-                var l = (List<Action>) continuation;
-                lock (l)
-                {
-                    l.Add(action);
-                }
-
-                TRYINVOKE:
-                if (state != Pending)
-                {
-                    TryInvokeContinuation();
-                }
+                TryInvokeContinuation();
             }
         }
 
         private void TryInvokeContinuation()
         {
-            object c = Interlocked.Exchange(ref continuation, null);
-            if (c == null)
-            {
-                return;
-            }
-
-            if (c is Action action)
-            {
-                action.Invoke();
-                return;
-            }
-
-            var l = (List<Action>) c;
-            int cnt = l.Count;
-            for (int i = 0; i < cnt; i++)
-            {
-                l[i].Invoke();
-            }
+            this.continuation?.Invoke();
+            this.continuation = null;
         }
 
         public void SetResult(T result)
@@ -359,11 +248,13 @@ namespace ETModel
 
         public bool TrySetResult(T result)
         {
-            if (Interlocked.CompareExchange(ref this.state, Succeeded, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Succeeded;
+
             this.value = result;
             this.TryInvokeContinuation();
             return true;
@@ -372,11 +263,13 @@ namespace ETModel
 
         public bool TrySetException(Exception e)
         {
-            if (Interlocked.CompareExchange(ref this.state, Faulted, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Faulted;
+
             this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(e));
             this.TryInvokeContinuation();
             return true;
@@ -385,11 +278,13 @@ namespace ETModel
 
         public bool TrySetCanceled()
         {
-            if (Interlocked.CompareExchange(ref this.state, Canceled, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Canceled;
+
             this.TryInvokeContinuation();
             return true;
 
@@ -397,11 +292,13 @@ namespace ETModel
 
         public bool TrySetCanceled(OperationCanceledException e)
         {
-            if (Interlocked.CompareExchange(ref this.state, Canceled, Pending) != Pending)
+            if (this.state != Pending)
             {
                 return false;
             }
 
+            this.state = Canceled;
+
             this.exception = new ExceptionHolder(ExceptionDispatchInfo.Capture(e));
             this.TryInvokeContinuation();
             return true;

+ 5 - 5
Unity/Assets/Model/Base/Async/ETTaskFactory.cs

@@ -5,7 +5,7 @@ namespace ETModel
 {
     public partial struct ETTask
     {
-        private static readonly ETTask CanceledUniTask = new Func<ETTask>(() =>
+        private static readonly ETTask CanceledTask = new Func<ETTask>(() =>
         {
             var promise = new ETTaskCompletionSource<AsyncUnit>();
             promise.TrySetCanceled();
@@ -35,12 +35,12 @@ namespace ETModel
 
         public static ETTask FromCanceled()
         {
-            return CanceledUniTask;
+            return CanceledTask;
         }
 
         public static ETTask<T> FromCanceled<T>()
         {
-            return CanceledUniTaskCache<T>.Task;
+            return CanceledETTaskCache<T>.Task;
         }
 
         public static ETTask FromCanceled(CancellationToken token)
@@ -63,11 +63,11 @@ namespace ETModel
             return new ETTask<T>(factory);
         }
 
-        private static class CanceledUniTaskCache<T>
+        private static class CanceledETTaskCache<T>
         {
             public static readonly ETTask<T> Task;
 
-            static CanceledUniTaskCache()
+            static CanceledETTaskCache()
             {
                 var promise = new ETTaskCompletionSource<T>();
                 promise.TrySetCanceled();

+ 6 - 7
Unity/Assets/Model/Base/Async/ETTaskVoid.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Diagnostics;
 using System.Runtime.CompilerServices;
 
 namespace ETModel
@@ -11,7 +10,7 @@ namespace ETModel
         {
         }
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public Awaiter GetAwaiter()
         {
             return new Awaiter();
@@ -19,21 +18,21 @@ namespace ETModel
 
         public struct Awaiter: ICriticalNotifyCompletion
         {
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public bool IsCompleted => true;
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void GetResult()
             {
-                throw new Exception("UniTask can't await, always fire-and-forget. use Forget instead of await.");
+                throw new Exception("ETTask can't await, always fire-and-forget. use Forget instead of await.");
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void OnCompleted(Action continuation)
             {
             }
 
-            [DebuggerHidden]
+            //[DebuggerHidden]
             public void UnsafeOnCompleted(Action continuation)
             {
             }

+ 2 - 3
Unity/Assets/Model/Base/Async/MoveNextRunner.cs

@@ -1,5 +1,4 @@
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
 
 namespace ETModel
 {
@@ -7,7 +6,7 @@ namespace ETModel
     {
         public TStateMachine StateMachine;
 
-        [DebuggerHidden]
+        //[DebuggerHidden]
         public void Run()
         {
             StateMachine.MoveNext();

+ 0 - 4
Unity/Assets/Model/Init.cs

@@ -43,10 +43,6 @@ namespace ETModel
 
 				Game.Hotfix.GotoHotfix();
 
-				Log.Debug($"111111111111111111111111111111111111111");
-				await Game.Scene.GetComponent<TimerComponent>().WaitAsync(1000);
-				Log.Debug($"111111111111111111111111111111111111112");
-
 				Game.EventSystem.Run(EventIdType.TestHotfixSubscribMonoEvent, "TestHotfixSubscribMonoEvent");
 			}
 			catch (Exception e)

+ 3 - 4
Unity/Unity.Model.csproj

@@ -9,8 +9,7 @@
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
     <ProductVersion>10.0.20506</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
-    <RootNamespace>
-    </RootNamespace>
+    <RootNamespace></RootNamespace>
     <ProjectGuid>{B4BF9894-F5D9-41C4-13E3-3F26F7700E29}</ProjectGuid>
     <OutputType>Library</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
@@ -55,11 +54,11 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="Assets\Model\Base\Async\ETAsyncTaskMethodBuilder.cs" />
-    <Compile Include="Assets\Model\Base\Async\ETAsyncTaskVoidMethodBuilder.cs" />
     <Compile Include="Assets\Model\Base\Async\AsyncMethodBuilderAttribute.cs" />
     <Compile Include="Assets\Model\Base\Async\AsyncUnit.cs" />
     <Compile Include="Assets\Model\Base\Async\CancellationTokenExtensions.cs" />
+    <Compile Include="Assets\Model\Base\Async\ETAsyncTaskMethodBuilder.cs" />
+    <Compile Include="Assets\Model\Base\Async\ETAsyncTaskVoidMethodBuilder.cs" />
     <Compile Include="Assets\Model\Base\Async\ETTask.cs" />
     <Compile Include="Assets\Model\Base\Async\ETTaskCompletionSource.cs" />
     <Compile Include="Assets\Model\Base\Async\ETTaskFactory.cs" />