Răsfoiți Sursa

集成新版的ETTask,代码更简洁,性能更高

tanghai 5 ani în urmă
părinte
comite
cdacc1b0a8
33 a modificat fișierele cu 775 adăugiri și 955 ștergeri
  1. 4 5
      Server/Hotfix/Demo/UnitPathComponentSystem.cs
  2. 1 1
      Server/Model/Demo/UnitPathComponent.cs
  3. 11 8
      Server/Model/Server.Model.csproj
  4. 0 8
      Unity/Assets/Editor/ILRuntimeEditor.meta
  5. 0 54
      Unity/Assets/Editor/ILRuntimeEditor/ILRuntimeCLRBinding.cs
  6. 1 1
      Unity/Assets/HotfixView/Helper/ResourcesHelper.cs.meta
  7. 0 8
      Unity/Assets/HotfixView/Module.meta
  8. 63 0
      Unity/Assets/Model/Base/Async/AsyncETTaskCompletedMethodBuilder.cs
  9. 1 1
      Unity/Assets/Model/Base/Async/AsyncETTaskCompletedMethodBuilder.cs.meta
  10. 20 160
      Unity/Assets/Model/Base/Async/AsyncETTaskMethodBuilder.cs
  11. 5 24
      Unity/Assets/Model/Base/Async/AsyncETVoidMethodBuilder.cs
  12. 6 1
      Unity/Assets/Model/Base/Async/AsyncMethodBuilderAttribute.cs
  13. 4 16
      Unity/Assets/Model/Base/Async/ETCancellationToken.cs
  14. 0 70
      Unity/Assets/Model/Base/Async/ETCancellationTokenSource.cs
  15. 23 241
      Unity/Assets/Model/Base/Async/ETTask.cs
  16. 34 0
      Unity/Assets/Model/Base/Async/ETTaskCompleted.cs
  17. 1 1
      Unity/Assets/Model/Base/Async/ETTaskCompleted.cs.meta
  18. 83 145
      Unity/Assets/Model/Base/Async/ETTaskCompletionSource.cs
  19. 0 86
      Unity/Assets/Model/Base/Async/ETTaskFactory.cs
  20. 112 0
      Unity/Assets/Model/Base/Async/ETTaskHelper.cs
  21. 2 3
      Unity/Assets/Model/Base/Async/ETTaskHelper.cs.meta
  22. 9 23
      Unity/Assets/Model/Base/Async/ETVoid.cs
  23. 1 49
      Unity/Assets/Model/Base/Async/IAwaiter.cs
  24. 0 15
      Unity/Assets/Model/Base/Async/MoveNextRunner.cs
  25. 4 4
      Unity/Assets/Model/Demo/MoveComponent.cs
  26. 0 3
      Unity/Assets/Model/Helper/ResourcesHelper.cs.meta
  27. 3 3
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockComponent.cs
  28. 0 8
      Unity/Assets/ModelView/Demo/UI/UILoading/System.meta
  29. 0 8
      Unity/Assets/ModelView/Helper.meta
  30. 5 5
      Unity/Packages/manifest.json
  31. 378 0
      Unity/Packages/packages-lock.json
  32. 2 2
      Unity/ProjectSettings/ProjectVersion.txt
  33. 2 2
      Unity/Unity.ThirdParty.csproj

+ 4 - 5
Server/Hotfix/Demo/UnitPathComponentSystem.cs

@@ -23,7 +23,7 @@ namespace ET
                     self.BroadcastPath(path, i, 3);
                     self.BroadcastPath(path, i, 3);
                 }
                 }
                 Vector3 v3 = path[i];
                 Vector3 v3 = path[i];
-                await self.Parent.GetComponent<MoveComponent>().MoveToAsync(v3, self.CancellationTokenSource.Token);
+                await self.Parent.GetComponent<MoveComponent>().MoveToAsync(v3, self.CancellationToken);
             }
             }
         }
         }
         
         
@@ -44,11 +44,10 @@ namespace ET
             pathfindingComponent.Search(self.ABPath);
             pathfindingComponent.Search(self.ABPath);
             Log.Debug($"find result: {self.ABPath.Result.ListToString()}");
             Log.Debug($"find result: {self.ABPath.Result.ListToString()}");
             
             
-            self.CancellationTokenSource?.Cancel();
-            self.CancellationTokenSource = EntityFactory.Create<ETCancellationTokenSource>(self.Domain);
+            self.CancellationToken?.Cancel();
+            self.CancellationToken = new ETCancellationToken();
             await self.MoveAsync(self.ABPath.Result);
             await self.MoveAsync(self.ABPath.Result);
-            self.CancellationTokenSource.Dispose();
-            self.CancellationTokenSource = null;
+            self.CancellationToken = null;
         }
         }
 
 
         // 从index找接下来3个点,广播
         // 从index找接下来3个点,广播

+ 1 - 1
Server/Model/Demo/UnitPathComponent.cs

@@ -13,7 +13,7 @@ namespace ET
         
         
         public List<Vector3> Path;
         public List<Vector3> Path;
 
 
-        public ETCancellationTokenSource CancellationTokenSource;
+        public ETCancellationToken CancellationToken;
 
 
         public ABPathWrap ABPath
         public ABPathWrap ABPath
         {
         {

+ 11 - 8
Server/Model/Server.Model.csproj

@@ -20,26 +20,32 @@
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Remove="Libs\**" />
     <Compile Remove="Libs\**" />
+    <Compile Include="..\..\Unity\Assets\Model\Base\Async\AsyncETTaskCompletedMethodBuilder.cs">
+      <Link>Base\Async\AsyncETTaskCompletedMethodBuilder.cs</Link>
+    </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\AsyncETTaskMethodBuilder.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\AsyncETTaskMethodBuilder.cs">
       <Link>Base\Async\AsyncETTaskMethodBuilder.cs</Link>
       <Link>Base\Async\AsyncETTaskMethodBuilder.cs</Link>
     </Compile>
     </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\AsyncETVoidMethodBuilder.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\AsyncETVoidMethodBuilder.cs">
       <Link>Base\Async\AsyncETVoidMethodBuilder.cs</Link>
       <Link>Base\Async\AsyncETVoidMethodBuilder.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\..\Unity\Assets\Model\Base\Async\AsyncMethodBuilderAttribute.cs">
+      <Link>Base\Async\AsyncMethodBuilderAttribute.cs</Link>
+    </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETCancellationToken.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETCancellationToken.cs">
       <Link>Base\Async\ETCancellationToken.cs</Link>
       <Link>Base\Async\ETCancellationToken.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETCancellationTokenSource.cs">
-      <Link>Base\Async\ETCancellationTokenSource.cs</Link>
-    </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTask.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTask.cs">
       <Link>Base\Async\ETTask.cs</Link>
       <Link>Base\Async\ETTask.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTaskCompleted.cs">
+      <Link>Base\Async\ETTaskCompleted.cs</Link>
+    </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTaskCompletionSource.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTaskCompletionSource.cs">
       <Link>Base\Async\ETTaskCompletionSource.cs</Link>
       <Link>Base\Async\ETTaskCompletionSource.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTaskFactory.cs">
-      <Link>Base\Async\ETTaskFactory.cs</Link>
+    <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETTaskHelper.cs">
+      <Link>Base\Async\ETTaskHelper.cs</Link>
     </Compile>
     </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETVoid.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\ETVoid.cs">
       <Link>Base\Async\ETVoid.cs</Link>
       <Link>Base\Async\ETVoid.cs</Link>
@@ -47,9 +53,6 @@
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\IAwaiter.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Async\IAwaiter.cs">
       <Link>Base\Async\IAwaiter.cs</Link>
       <Link>Base\Async\IAwaiter.cs</Link>
     </Compile>
     </Compile>
-    <Compile Include="..\..\Unity\Assets\Model\Base\Async\MoveNextRunner.cs">
-      <Link>Base\Async\MoveNextRunner.cs</Link>
-    </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Base\Helper\MongoHelper.cs">
     <Compile Include="..\..\Unity\Assets\Model\Base\Helper\MongoHelper.cs">
       <Link>Base\Helper\MongoHelper.cs</Link>
       <Link>Base\Helper\MongoHelper.cs</Link>
     </Compile>
     </Compile>

+ 0 - 8
Unity/Assets/Editor/ILRuntimeEditor.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 9d559c42e1a79bd45bd6968ec42899d2
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 54
Unity/Assets/Editor/ILRuntimeEditor/ILRuntimeCLRBinding.cs

@@ -1,54 +0,0 @@
-#if ILRuntime
-using UnityEditor;
-using UnityEngine;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-
-public static class ILRuntimeCLRBinding
-{
-    //[MenuItem("Tools/ILRuntime/Generate CLR Binding Code")]
-    static void GenerateCLRBinding()
-    {
-        List<Type> types = new List<Type>();
-        types.Add(typeof(int));
-        types.Add(typeof(float));
-        types.Add(typeof(long));
-        types.Add(typeof(object));
-        types.Add(typeof(string));
-        types.Add(typeof(Array));
-        types.Add(typeof(Vector2));
-        types.Add(typeof(Vector3));
-        types.Add(typeof(Quaternion));
-        types.Add(typeof(GameObject));
-        types.Add(typeof(UnityEngine.Object));
-        types.Add(typeof(Transform));
-        types.Add(typeof(RectTransform));
-        types.Add(typeof(Time));
-        types.Add(typeof(Debug));
-        //所有DLL内的类型的真实C#类型都是ILTypeInstance
-        types.Add(typeof(List<ILRuntime.Runtime.Intepreter.ILTypeInstance>));
-
-        ILRuntime.Runtime.CLRBinding.BindingCodeGenerator.GenerateBindingCode(types, "Assets/Model/ILBinding");
-		AssetDatabase.Refresh();
-    }
-
-    [MenuItem("Tools/ILRuntime/Generate CLR Binding Code by Analysis")]
-    static void GenerateCLRBindingByAnalysis()
-    {
-	    GenerateCLRBinding();
-	    
-        //用新的分析热更dll调用引用来生成绑定代码
-        ILRuntime.Runtime.Enviorment.AppDomain domain = new ILRuntime.Runtime.Enviorment.AppDomain();
-        using (FileStream fs = new FileStream("Assets/Res/Code/Hotfix.dll.bytes", FileMode.Open, FileAccess.Read))
-        {
-	        domain.LoadAssembly(fs);
-	        //Crossbind Adapter is needed to generate the correct binding code
-	        ILHelper.InitILRuntime(domain);
-	        ILRuntime.Runtime.CLRBinding.BindingCodeGenerator.GenerateBindingCode(domain, "Assets/Model/ILBinding");
-	        AssetDatabase.Refresh();
-        }
-    }
-}
-#endif

+ 1 - 1
Unity/Assets/Model/Base/Async/ETTaskFactory.cs.meta → Unity/Assets/HotfixView/Helper/ResourcesHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: 5799679ead03f044a8db11144a25e609
+guid: 0fd42cba47a6e4c859b25674bfa831d5
 MonoImporter:
 MonoImporter:
   externalObjects: {}
   externalObjects: {}
   serializedVersion: 2
   serializedVersion: 2

+ 0 - 8
Unity/Assets/HotfixView/Module.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 0850edb2f02b2d34091700c557b963ac
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 63 - 0
Unity/Assets/Model/Base/Async/AsyncETTaskCompletedMethodBuilder.cs

@@ -0,0 +1,63 @@
+using System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Security;
+
+namespace ET
+{
+    public struct AsyncETTaskCompletedMethodBuilder
+    {
+        // 1. Static Create method.
+        [DebuggerHidden]
+        public static AsyncETTaskCompletedMethodBuilder Create()
+        {
+            AsyncETTaskCompletedMethodBuilder builder = new AsyncETTaskCompletedMethodBuilder();
+            return builder;
+        }
+
+        // 2. TaskLike Task property(void)
+        public ETTaskCompleted Task => default;
+
+        // 3. SetException
+        [DebuggerHidden]
+        public void SetException(Exception exception)
+        {
+            Log.Error(exception);
+        }
+
+        // 4. SetResult
+        [DebuggerHidden]
+        public void SetResult()
+        {
+            // do nothing
+        }
+
+        // 5. AwaitOnCompleted
+        [DebuggerHidden]
+        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
+        {
+            awaiter.OnCompleted(stateMachine.MoveNext);
+        }
+
+        // 6. AwaitUnsafeOnCompleted
+        [DebuggerHidden]
+        [SecuritySafeCritical]
+        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
+        {
+            awaiter.UnsafeOnCompleted(stateMachine.MoveNext);
+        }
+
+        // 7. Start
+        [DebuggerHidden]
+        public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine
+        {
+            stateMachine.MoveNext();
+        }
+
+        // 8. SetStateMachine
+        [DebuggerHidden]
+        public void SetStateMachine(IAsyncStateMachine stateMachine)
+        {
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Model/Base/Async/ETCancellationTokenSource.cs.meta → Unity/Assets/Model/Base/Async/AsyncETTaskCompletedMethodBuilder.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: d84361f4f81274c3d807bb783cc8a864
+guid: bf2682587b9394aa89238524a4ef1ef9
 MonoImporter:
 MonoImporter:
   externalObjects: {}
   externalObjects: {}
   serializedVersion: 2
   serializedVersion: 2

+ 20 - 160
Unity/Assets/Model/Base/Async/AsyncETTaskMethodBuilder.cs

@@ -5,118 +5,49 @@ using System.Security;
 
 
 namespace ET
 namespace ET
 {
 {
-    public struct AsyncETTaskMethodBuilder
+    public struct ETAsyncTaskMethodBuilder
     {
     {
-        private ETTaskCompletionSource tcs;
-        private Action moveNext;
+        public ETTaskCompletionSource Tcs;
 
 
         // 1. Static Create method.
         // 1. Static Create method.
         [DebuggerHidden]
         [DebuggerHidden]
-        public static AsyncETTaskMethodBuilder Create()
+        public static ETAsyncTaskMethodBuilder Create()
         {
         {
-            AsyncETTaskMethodBuilder builder = new AsyncETTaskMethodBuilder();
+            ETAsyncTaskMethodBuilder builder = new ETAsyncTaskMethodBuilder() { Tcs = new ETTaskCompletionSource() };
             return builder;
             return builder;
         }
         }
 
 
         // 2. TaskLike Task property.
         // 2. TaskLike Task property.
         [DebuggerHidden]
         [DebuggerHidden]
-        public ETTask Task
-        {
-            get
-            {
-                if (this.tcs != null)
-                {
-                    return this.tcs.Task;
-                }
-
-                if (moveNext == null)
-                {
-                    return ETTask.CompletedTask;
-                }
-
-                this.tcs = new ETTaskCompletionSource();
-                return this.tcs.Task;
-            }
-        }
+        public ETTask Task => this.Tcs.Task;
 
 
         // 3. SetException
         // 3. SetException
         [DebuggerHidden]
         [DebuggerHidden]
         public void SetException(Exception exception)
         public void SetException(Exception exception)
         {
         {
-            if (this.tcs == null)
-            {
-                this.tcs = new ETTaskCompletionSource();
-            }
-
-            if (exception is OperationCanceledException ex)
-            {
-                this.tcs.TrySetCanceled(ex);
-            }
-            else
-            {
-                this.tcs.TrySetException(exception);
-            }
+            this.Tcs.SetException(exception);
         }
         }
 
 
         // 4. SetResult
         // 4. SetResult
         [DebuggerHidden]
         [DebuggerHidden]
         public void SetResult()
         public void SetResult()
         {
         {
-            if (moveNext == null)
-            {
-            }
-            else
-            {
-                if (this.tcs == null)
-                {
-                    this.tcs = new ETTaskCompletionSource();
-                }
-
-                this.tcs.TrySetResult();
-            }
+            this.Tcs.SetResult();
         }
         }
 
 
         // 5. AwaitOnCompleted
         // 5. AwaitOnCompleted
         [DebuggerHidden]
         [DebuggerHidden]
-        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-                where TAwaiter : INotifyCompletion
-                where TStateMachine : IAsyncStateMachine
+        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
         {
         {
-            if (moveNext == null)
-            {
-                if (this.tcs == null)
-                {
-                    this.tcs = new ETTaskCompletionSource(); // built future.
-                }
-
-                var runner = new MoveNextRunner<TStateMachine>();
-                moveNext = runner.Run;
-                runner.StateMachine = stateMachine; // set after create delegate.
-            }
-
-            awaiter.OnCompleted(moveNext);
+            awaiter.OnCompleted(stateMachine.MoveNext);
         }
         }
 
 
         // 6. AwaitUnsafeOnCompleted
         // 6. AwaitUnsafeOnCompleted
         [DebuggerHidden]
         [DebuggerHidden]
         [SecuritySafeCritical]
         [SecuritySafeCritical]
-        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-                where TAwaiter : ICriticalNotifyCompletion
-                where TStateMachine : IAsyncStateMachine
+        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
         {
         {
-            if (moveNext == null)
-            {
-                if (this.tcs == null)
-                {
-                    this.tcs = new ETTaskCompletionSource(); // built future.
-                }
-
-                var runner = new MoveNextRunner<TStateMachine>();
-                moveNext = runner.Run;
-                runner.StateMachine = stateMachine; // set after create delegate.
-            }
-
-            awaiter.UnsafeOnCompleted(moveNext);
+            awaiter.OnCompleted(stateMachine.MoveNext);
         }
         }
 
 
         // 7. Start
         // 7. Start
@@ -135,118 +66,47 @@ namespace ET
 
 
     public struct ETAsyncTaskMethodBuilder<T>
     public struct ETAsyncTaskMethodBuilder<T>
     {
     {
-        private T result;
-        private ETTaskCompletionSource<T> tcs;
-        private Action moveNext;
+        public ETTaskCompletionSource<T> Tcs;
 
 
         // 1. Static Create method.
         // 1. Static Create method.
         [DebuggerHidden]
         [DebuggerHidden]
         public static ETAsyncTaskMethodBuilder<T> Create()
         public static ETAsyncTaskMethodBuilder<T> Create()
         {
         {
-            var builder = new ETAsyncTaskMethodBuilder<T>();
+            ETAsyncTaskMethodBuilder<T> builder = new ETAsyncTaskMethodBuilder<T>() { Tcs = new ETTaskCompletionSource<T>() };
             return builder;
             return builder;
         }
         }
 
 
         // 2. TaskLike Task property.
         // 2. TaskLike Task property.
         [DebuggerHidden]
         [DebuggerHidden]
-        public ETTask<T> Task
-        {
-            get
-            {
-                if (this.tcs != null)
-                {
-                    return new ETTask<T>(this.tcs);
-                }
-
-                if (moveNext == null)
-                {
-                    return new ETTask<T>(result);
-                }
-
-                this.tcs = new ETTaskCompletionSource<T>();
-                return this.tcs.Task;
-            }
-        }
+        public ETTask<T> Task => this.Tcs.Task;
 
 
         // 3. SetException
         // 3. SetException
         [DebuggerHidden]
         [DebuggerHidden]
         public void SetException(Exception exception)
         public void SetException(Exception exception)
         {
         {
-            if (this.tcs == null)
-            {
-                this.tcs = new ETTaskCompletionSource<T>();
-            }
-
-            if (exception is OperationCanceledException ex)
-            {
-                this.tcs.TrySetCanceled(ex);
-            }
-            else
-            {
-                this.tcs.TrySetException(exception);
-            }
+            this.Tcs.SetException(exception);
         }
         }
 
 
         // 4. SetResult
         // 4. SetResult
         [DebuggerHidden]
         [DebuggerHidden]
         public void SetResult(T ret)
         public void SetResult(T ret)
         {
         {
-            if (moveNext == null)
-            {
-                this.result = ret;
-            }
-            else
-            {
-                if (this.tcs == null)
-                {
-                    this.tcs = new ETTaskCompletionSource<T>();
-                }
-
-                this.tcs.TrySetResult(ret);
-            }
+            this.Tcs.SetResult(ret);
         }
         }
 
 
         // 5. AwaitOnCompleted
         // 5. AwaitOnCompleted
         [DebuggerHidden]
         [DebuggerHidden]
-        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-                where TAwaiter : INotifyCompletion
-                where TStateMachine : IAsyncStateMachine
+        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
         {
         {
-            if (moveNext == null)
-            {
-                if (this.tcs == null)
-                {
-                    this.tcs = new ETTaskCompletionSource<T>(); // built future.
-                }
-
-                var runner = new MoveNextRunner<TStateMachine>();
-                moveNext = runner.Run;
-                runner.StateMachine = stateMachine; // set after create delegate.
-            }
-
-            awaiter.OnCompleted(moveNext);
+            awaiter.OnCompleted(stateMachine.MoveNext);
         }
         }
 
 
         // 6. AwaitUnsafeOnCompleted
         // 6. AwaitUnsafeOnCompleted
         [DebuggerHidden]
         [DebuggerHidden]
         [SecuritySafeCritical]
         [SecuritySafeCritical]
-        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-                where TAwaiter : ICriticalNotifyCompletion
-                where TStateMachine : IAsyncStateMachine
+        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
         {
         {
-            if (moveNext == null)
-            {
-                if (this.tcs == null)
-                {
-                    this.tcs = new ETTaskCompletionSource<T>(); // built future.
-                }
-
-                var runner = new MoveNextRunner<TStateMachine>();
-                moveNext = runner.Run;
-                runner.StateMachine = stateMachine; // set after create delegate.
-            }
-
-            awaiter.UnsafeOnCompleted(moveNext);
+            awaiter.OnCompleted(stateMachine.MoveNext);
         }
         }
 
 
         // 7. Start
         // 7. Start

+ 5 - 24
Unity/Assets/Model/Base/Async/AsyncETVoidMethodBuilder.cs

@@ -7,8 +7,6 @@ namespace ET
 {
 {
     public struct AsyncETVoidMethodBuilder
     public struct AsyncETVoidMethodBuilder
     {
     {
-        private Action moveNext;
-
         // 1. Static Create method.
         // 1. Static Create method.
         [DebuggerHidden]
         [DebuggerHidden]
         public static AsyncETVoidMethodBuilder Create()
         public static AsyncETVoidMethodBuilder Create()
@@ -18,6 +16,7 @@ namespace ET
         }
         }
 
 
         // 2. TaskLike Task property(void)
         // 2. TaskLike Task property(void)
+        [DebuggerHidden]
         public ETVoid Task => default;
         public ETVoid Task => default;
 
 
         // 3. SetException
         // 3. SetException
@@ -36,35 +35,17 @@ namespace ET
 
 
         // 5. AwaitOnCompleted
         // 5. AwaitOnCompleted
         [DebuggerHidden]
         [DebuggerHidden]
-        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-            where TAwaiter : INotifyCompletion
-            where TStateMachine : IAsyncStateMachine
+        public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine
         {
         {
-            if (moveNext == null)
-            {
-                var runner = new MoveNextRunner<TStateMachine>();
-                moveNext = runner.Run;
-                runner.StateMachine = stateMachine; // set after create delegate.
-            }
-
-            awaiter.OnCompleted(moveNext);
+            awaiter.OnCompleted(stateMachine.MoveNext);
         }
         }
 
 
         // 6. AwaitUnsafeOnCompleted
         // 6. AwaitUnsafeOnCompleted
         [DebuggerHidden]
         [DebuggerHidden]
         [SecuritySafeCritical]
         [SecuritySafeCritical]
-        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
-            where TAwaiter : ICriticalNotifyCompletion
-            where TStateMachine : IAsyncStateMachine
+        public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine
         {
         {
-            if (moveNext == null)
-            {
-                var runner = new MoveNextRunner<TStateMachine>();
-                moveNext = runner.Run;
-                runner.StateMachine = stateMachine; // set after create delegate.
-            }
-
-            awaiter.UnsafeOnCompleted(moveNext);
+            awaiter.UnsafeOnCompleted(stateMachine.MoveNext);
         }
         }
 
 
         // 7. Start
         // 7. Start

+ 6 - 1
Unity/Assets/Model/Base/Async/AsyncMethodBuilderAttribute.cs

@@ -1,12 +1,17 @@
 namespace System.Runtime.CompilerServices
 namespace System.Runtime.CompilerServices
 {
 {
+#if !NOT_CLIENT
     public sealed class AsyncMethodBuilderAttribute: Attribute
     public sealed class AsyncMethodBuilderAttribute: Attribute
     {
     {
-        public Type BuilderType { get; }
+        public Type BuilderType
+        {
+            get;
+        }
 
 
         public AsyncMethodBuilderAttribute(Type builderType)
         public AsyncMethodBuilderAttribute(Type builderType)
         {
         {
             BuilderType = builderType;
             BuilderType = builderType;
         }
         }
     }
     }
+#endif
 }
 }

+ 4 - 16
Unity/Assets/Model/Base/Async/ETCancellationToken.cs

@@ -3,30 +3,18 @@ using System.Collections.Generic;
 
 
 namespace ET
 namespace ET
 {
 {
-    [ObjectSystem]
-    public class ETCancellationTokenDestroySystem: DestroySystem<ETCancellationToken>
+    public class ETCancellationToken
     {
     {
-        public override void Destroy(ETCancellationToken self)
-        {
-            self.actions.Clear();
-        }
-    }
-    
-    public class ETCancellationToken: Entity
-    {
-        public readonly List<Action> actions = new List<Action>();
+        private Action action;
 
 
         public void Register(Action callback)
         public void Register(Action callback)
         {
         {
-            this.actions.Add(callback);
+            this.action = callback;
         }
         }
 
 
         public void Cancel()
         public void Cancel()
         {
         {
-            foreach (Action action in this.actions)
-            {
-                action.Invoke();
-            }
+            action.Invoke();
         }
         }
     }
     }
 }
 }

+ 0 - 70
Unity/Assets/Model/Base/Async/ETCancellationTokenSource.cs

@@ -1,70 +0,0 @@
-using System.Collections.Generic;
-
-namespace ET
-{
-    [ObjectSystem]
-    public class ETCancellationTokenSourceAwakeSystem: AwakeSystem<ETCancellationTokenSource>
-    {
-        public override void Awake(ETCancellationTokenSource self)
-        {
-        }
-    }
-    
-    [ObjectSystem]
-    public class ETCancellationTokenSourceAwake2System: AwakeSystem<ETCancellationTokenSource, long>
-    {
-        public override void Awake(ETCancellationTokenSource self, long afterTimeCancel)
-        {
-            self.CancelAfter(afterTimeCancel).Coroutine();
-        }
-    }
-    
-    [ObjectSystem]
-    public class ETCancellationTokenSourceDestroySystem: DestroySystem<ETCancellationTokenSource>
-    {
-        public override void Destroy(ETCancellationTokenSource self)
-        {
-            self.cancellationTokens.Clear();
-        }
-    }
-    
-    public class ETCancellationTokenSource: Entity
-    {
-        public readonly List<ETCancellationToken> cancellationTokens = new List<ETCancellationToken>();
-
-        public void Cancel()
-        {
-            foreach (ETCancellationToken token in this.cancellationTokens)
-            {
-                token.Cancel();
-            }
-            
-            this.Dispose();
-        }
-
-        public async ETVoid CancelAfter(long afterTimeCancel)
-        {
-            long instanceId = this.InstanceId;
-            
-            await TimerComponent.Instance.WaitAsync(afterTimeCancel);
-            
-            if (this.InstanceId != instanceId)
-            {
-                return;
-            }
-            this.Dispose();
-        }
-
-        public ETCancellationToken Token
-        {
-            get
-            {
-                ETCancellationToken etCancellationToken = EntityFactory.Create<ETCancellationToken>(this.Domain);
-                this.cancellationTokens.Add(etCancellationToken);
-
-                etCancellationToken.Parent = this;
-                return etCancellationToken;
-            }
-        }
-    }
-}

+ 23 - 241
Unity/Assets/Model/Base/Async/ETTask.cs

@@ -1,284 +1,66 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics;
 using System.Runtime.CompilerServices;
 using System.Runtime.CompilerServices;
 
 
 namespace ET
 namespace ET
 {
 {
-    /// <summary>
-    /// Lightweight unity specified task-like object.
-    /// </summary>
-    [AsyncMethodBuilder(typeof (AsyncETTaskMethodBuilder))]
-    public partial struct ETTask: IEquatable<ETTask>
+    [AsyncMethodBuilder(typeof (ETAsyncTaskMethodBuilder))]
+    public struct ETTask
     {
     {
-        private readonly IAwaiter awaiter;
+        public static ETTaskCompleted CompletedTask => new ETTaskCompleted();
+
+        private readonly ETTaskCompletionSource awaiter;
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public ETTask(IAwaiter awaiter)
+        public ETTask(ETTaskCompletionSource awaiter)
         {
         {
             this.awaiter = awaiter;
             this.awaiter = awaiter;
         }
         }
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public AwaiterStatus Status => awaiter?.Status ?? AwaiterStatus.Succeeded;
-
-        [DebuggerHidden]
-        public bool IsCompleted => awaiter?.IsCompleted ?? true;
-
-        [DebuggerHidden]
-        public void GetResult()
-        {
-            if (awaiter != null)
-            {
-                awaiter.GetResult();
-            }
-        }
-        
-        public void Coroutine()
+        public ETTaskCompletionSource GetAwaiter()
         {
         {
+            return this.awaiter;
         }
         }
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public Awaiter GetAwaiter()
-        {
-            return new Awaiter(this);
-        }
-
-        public bool Equals(ETTask other)
-        {
-            if (this.awaiter == null && other.awaiter == null)
-            {
-                return true;
-            }
-
-            if (this.awaiter != null && other.awaiter != null)
-            {
-                return this.awaiter == other.awaiter;
-            }
-
-            return false;
-        }
-
-        public override int GetHashCode()
-        {
-            if (this.awaiter == null)
-            {
-                return 0;
-            }
-
-            return this.awaiter.GetHashCode();
-        }
-
-        public override string ToString()
+        public void Coroutine()
         {
         {
-            return this.awaiter == null? "()"
-                    : this.awaiter.Status == AwaiterStatus.Succeeded? "()"
-                    : "(" + this.awaiter.Status + ")";
+            InnerCoroutine().Coroutine();
         }
         }
 
 
-        public struct Awaiter: IAwaiter
+        [DebuggerHidden]
+        private async ETVoid InnerCoroutine()
         {
         {
-            private readonly ETTask task;
-
-            [DebuggerHidden]
-            public Awaiter(ETTask task)
-            {
-                this.task = task;
-            }
-
-            [DebuggerHidden]
-            public bool IsCompleted => task.IsCompleted;
-
-            [DebuggerHidden]
-            public AwaiterStatus Status => task.Status;
-
-            [DebuggerHidden]
-            public void GetResult()
-            {
-                task.GetResult();
-            }
-
-            [DebuggerHidden]
-            public void OnCompleted(Action continuation)
-            {
-                if (task.awaiter != null)
-                {
-                    task.awaiter.OnCompleted(continuation);
-                }
-                else
-                {
-                    continuation();
-                }
-            }
-
-            [DebuggerHidden]
-            public void UnsafeOnCompleted(Action continuation)
-            {
-                if (task.awaiter != null)
-                {
-                    task.awaiter.UnsafeOnCompleted(continuation);
-                }
-                else
-                {
-                    continuation();
-                }
-            }
+            await this;
         }
         }
     }
     }
 
 
-    /// <summary>
-    /// Lightweight unity specified task-like object.
-    /// </summary>
     [AsyncMethodBuilder(typeof (ETAsyncTaskMethodBuilder<>))]
     [AsyncMethodBuilder(typeof (ETAsyncTaskMethodBuilder<>))]
-    public struct ETTask<T>: IEquatable<ETTask<T>>
+    public struct ETTask<T>
     {
     {
-        private readonly T result;
-        private readonly IAwaiter<T> awaiter;
-
-        [DebuggerHidden]
-        public ETTask(T result)
-        {
-            this.result = result;
-            this.awaiter = null;
-        }
+        private readonly ETTaskCompletionSource<T> awaiter;
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public ETTask(IAwaiter<T> awaiter)
+        public ETTask(ETTaskCompletionSource<T> awaiter)
         {
         {
-            this.result = default;
             this.awaiter = awaiter;
             this.awaiter = awaiter;
         }
         }
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public AwaiterStatus Status => awaiter?.Status ?? AwaiterStatus.Succeeded;
-
-        [DebuggerHidden]
-        public bool IsCompleted => awaiter?.IsCompleted ?? true;
-
-        [DebuggerHidden]
-        public T Result
-        {
-            get
-            {
-                if (awaiter == null)
-                {
-                    return result;
-                }
-
-                return this.awaiter.GetResult();
-            }
-        }
-        
-        public void Coroutine()
+        public ETTaskCompletionSource<T> GetAwaiter()
         {
         {
+            return this.awaiter;
         }
         }
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public Awaiter GetAwaiter()
-        {
-            return new Awaiter(this);
-        }
-
-        public bool Equals(ETTask<T> other)
-        {
-            if (this.awaiter == null && other.awaiter == null)
-            {
-                return EqualityComparer<T>.Default.Equals(this.result, other.result);
-            }
-
-            if (this.awaiter != null && other.awaiter != null)
-            {
-                return this.awaiter == other.awaiter;
-            }
-
-            return false;
-        }
-
-        public override int GetHashCode()
-        {
-            if (this.awaiter == null)
-            {
-                if (result == null)
-                {
-                    return 0;
-                }
-
-                return result.GetHashCode();
-            }
-
-            return this.awaiter.GetHashCode();
-        }
-
-        public override string ToString()
-        {
-            return this.awaiter == null? result.ToString()
-                    : this.awaiter.Status == AwaiterStatus.Succeeded? this.awaiter.GetResult().ToString()
-                    : "(" + this.awaiter.Status + ")";
-        }
-
-        public static implicit operator ETTask(ETTask<T> task)
+        public void Coroutine()
         {
         {
-            if (task.awaiter != null)
-            {
-                return new ETTask(task.awaiter);
-            }
-
-            return new ETTask();
+            InnerCoroutine().Coroutine();
         }
         }
 
 
-        public struct Awaiter: IAwaiter<T>
+        private async ETVoid InnerCoroutine()
         {
         {
-            private readonly ETTask<T> task;
-
-            [DebuggerHidden]
-            public Awaiter(ETTask<T> task)
-            {
-                this.task = task;
-            }
-
-            [DebuggerHidden]
-            public bool IsCompleted => task.IsCompleted;
-
-            [DebuggerHidden]
-            public AwaiterStatus Status => task.Status;
-
-            [DebuggerHidden]
-            void IAwaiter.GetResult()
-            {
-                GetResult();
-            }
-
-            [DebuggerHidden]
-            public T GetResult()
-            {
-                return task.Result;
-            }
-
-            [DebuggerHidden]
-            public void OnCompleted(Action continuation)
-            {
-                if (task.awaiter != null)
-                {
-                    task.awaiter.OnCompleted(continuation);
-                }
-                else
-                {
-                    continuation();
-                }
-            }
-
-            [DebuggerHidden]
-            public void UnsafeOnCompleted(Action continuation)
-            {
-                if (task.awaiter != null)
-                {
-                    task.awaiter.UnsafeOnCompleted(continuation);
-                }
-                else
-                {
-                    continuation();
-                }
-            }
+            await this;
         }
         }
     }
     }
 }
 }

+ 34 - 0
Unity/Assets/Model/Base/Async/ETTaskCompleted.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+
+namespace ET
+{
+    [AsyncMethodBuilder(typeof (AsyncETTaskCompletedMethodBuilder))]
+    public struct ETTaskCompleted: ICriticalNotifyCompletion
+    {
+        [DebuggerHidden]
+        public ETTaskCompleted GetAwaiter()
+        {
+            return this;
+        }
+
+        [DebuggerHidden]
+        public bool IsCompleted => true;
+
+        [DebuggerHidden]
+        public void GetResult()
+        {
+        }
+
+        [DebuggerHidden]
+        public void OnCompleted(Action continuation)
+        {
+        }
+
+        [DebuggerHidden]
+        public void UnsafeOnCompleted(Action continuation)
+        {
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Model/Base/Async/MoveNextRunner.cs.meta → Unity/Assets/Model/Base/Async/ETTaskCompleted.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: 3832d83e9c3404c419b3760c2ebe3871
+guid: c27123994d9644acf9b27e884c5fdf1e
 MonoImporter:
 MonoImporter:
   externalObjects: {}
   externalObjects: {}
   serializedVersion: 2
   serializedVersion: 2

+ 83 - 145
Unity/Assets/Model/Base/Async/ETTaskCompletionSource.cs

@@ -1,63 +1,58 @@
 using System;
 using System;
+using System.Diagnostics;
 using System.Runtime.CompilerServices;
 using System.Runtime.CompilerServices;
 using System.Runtime.ExceptionServices;
 using System.Runtime.ExceptionServices;
 
 
 namespace ET
 namespace ET
 {
 {
-    public class ETTaskCompletionSource: IAwaiter
+    public class ETTaskCompletionSource: ICriticalNotifyCompletion
     {
     {
-        // State(= AwaiterStatus)
-        private const int Pending = 0;
-        private const int Succeeded = 1;
-        private const int Faulted = 2;
-        private const int Canceled = 3;
-
-        private int state;
+        private AwaiterStatus state;
         private ExceptionDispatchInfo exception;
         private ExceptionDispatchInfo exception;
         private Action continuation; // action or list
         private Action continuation; // action or list
 
 
-        AwaiterStatus IAwaiter.Status => (AwaiterStatus) state;
+        [DebuggerHidden]
+        public ETTask Task => new ETTask(this);
+
+        [DebuggerHidden]
+        public AwaiterStatus Status => state;
 
 
-        bool IAwaiter.IsCompleted => state != Pending;
+        [DebuggerHidden]
+        public bool IsCompleted => state != AwaiterStatus.Pending;
 
 
-        public ETTask Task => new ETTask(this);
+        [DebuggerHidden]
+        public void UnsafeOnCompleted(Action action)
+        {
+            this.continuation = action;
+            if (state != AwaiterStatus.Pending)
+            {
+                TryInvokeContinuation();
+            }
+        }
+
+        [DebuggerHidden]
+        public void OnCompleted(Action action)
+        {
+            this.UnsafeOnCompleted(action);
+        }
 
 
-        void IAwaiter.GetResult()
+        [DebuggerHidden]
+        public void GetResult()
         {
         {
             switch (this.state)
             switch (this.state)
             {
             {
-                case Succeeded:
+                case AwaiterStatus.Succeeded:
                     return;
                     return;
-                case Faulted:
+                case AwaiterStatus.Faulted:
                     this.exception?.Throw();
                     this.exception?.Throw();
                     this.exception = null;
                     this.exception = null;
                     return;
                     return;
-                case Canceled:
-                {
-                    this.exception?.Throw(); // guranteed operation canceled exception.
-                    this.exception = null;
-                    throw new OperationCanceledException();
-                }
                 default:
                 default:
                     throw new NotSupportedException("ETTask 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)
-        {
-            this.continuation = action;
-            if (state != Pending)
-            {
-                TryInvokeContinuation();
-            }
-        }
-
-        private void TryInvokeContinuation()
-        {
-            this.continuation?.Invoke();
-            this.continuation = null;
-        }
-
+        [DebuggerHidden]
         public void SetResult()
         public void SetResult()
         {
         {
             if (this.TrySetResult())
             if (this.TrySetResult())
@@ -68,6 +63,7 @@ namespace ET
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
         }
         }
 
 
+        [DebuggerHidden]
         public void SetException(Exception e)
         public void SetException(Exception e)
         {
         {
             if (this.TrySetException(e))
             if (this.TrySetException(e))
@@ -78,125 +74,98 @@ namespace ET
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
         }
         }
 
 
-        public bool TrySetResult()
+        [DebuggerHidden]
+        private void TryInvokeContinuation()
         {
         {
-            if (this.state != Pending)
-            {
-                return false;
-            }
-
-            this.state = Succeeded;
-
-            this.TryInvokeContinuation();
-            return true;
-
+            this.continuation?.Invoke();
+            this.continuation = null;
         }
         }
 
 
-        public bool TrySetException(Exception e)
+        [DebuggerHidden]
+        private bool TrySetResult()
         {
         {
-            if (this.state != Pending)
+            if (this.state != AwaiterStatus.Pending)
             {
             {
                 return false;
                 return false;
             }
             }
 
 
-            this.state = Faulted;
+            this.state = AwaiterStatus.Succeeded;
 
 
-            this.exception = ExceptionDispatchInfo.Capture(e);
             this.TryInvokeContinuation();
             this.TryInvokeContinuation();
             return true;
             return true;
-
         }
         }
 
 
-        public bool TrySetCanceled()
+        [DebuggerHidden]
+        private bool TrySetException(Exception e)
         {
         {
-            if (this.state != Pending)
+            if (this.state != AwaiterStatus.Pending)
             {
             {
                 return false;
                 return false;
             }
             }
 
 
-            this.state = Canceled;
-
-            this.TryInvokeContinuation();
-            return true;
-
-        }
-
-        public bool TrySetCanceled(OperationCanceledException e)
-        {
-            if (this.state != Pending)
-            {
-                return false;
-            }
-
-            this.state = Canceled;
+            this.state = AwaiterStatus.Faulted;
 
 
             this.exception = ExceptionDispatchInfo.Capture(e);
             this.exception = ExceptionDispatchInfo.Capture(e);
             this.TryInvokeContinuation();
             this.TryInvokeContinuation();
             return true;
             return true;
-
-        }
-
-        void INotifyCompletion.OnCompleted(Action action)
-        {
-            ((ICriticalNotifyCompletion) this).UnsafeOnCompleted(action);
         }
         }
     }
     }
 
 
-    public class ETTaskCompletionSource<T>: IAwaiter<T>
+    public class ETTaskCompletionSource<T>: ICriticalNotifyCompletion
     {
     {
-        // State(= AwaiterStatus)
-        private const int Pending = 0;
-        private const int Succeeded = 1;
-        private const int Faulted = 2;
-        private const int Canceled = 3;
-
-        private int state;
+        private AwaiterStatus state;
         private T value;
         private T value;
         private ExceptionDispatchInfo exception;
         private ExceptionDispatchInfo exception;
         private Action continuation; // action or list
         private Action continuation; // action or list
 
 
-        bool IAwaiter.IsCompleted => state != Pending;
-
+        [DebuggerHidden]
         public ETTask<T> Task => new ETTask<T>(this);
         public ETTask<T> Task => new ETTask<T>(this);
 
 
-        AwaiterStatus IAwaiter.Status => (AwaiterStatus) state;
+        [DebuggerHidden]
+        public ETTaskCompletionSource<T> GetAwaiter()
+        {
+            return this;
+        }
 
 
-        T IAwaiter<T>.GetResult()
+        [DebuggerHidden]
+        public T GetResult()
         {
         {
             switch (this.state)
             switch (this.state)
             {
             {
-                case Succeeded:
+                case AwaiterStatus.Succeeded:
                     return this.value;
                     return this.value;
-                case Faulted:
+                case AwaiterStatus.Faulted:
                     this.exception?.Throw();
                     this.exception?.Throw();
                     this.exception = null;
                     this.exception = null;
                     return default;
                     return default;
-                case Canceled:
-                {
-                    this.exception?.Throw(); // guranteed operation canceled exception.
-                    this.exception = null;
-                    throw new OperationCanceledException();
-                }
                 default:
                 default:
-                    throw new NotSupportedException("ETTask does not allow call GetResult directly when task not completed. Please use 'await'.");
+                    throw new NotSupportedException("ETask does not allow call GetResult directly when task not completed. Please use 'await'.");
             }
             }
         }
         }
 
 
-        void ICriticalNotifyCompletion.UnsafeOnCompleted(Action action)
+        [DebuggerHidden]
+        public bool IsCompleted => state != AwaiterStatus.Pending;
+
+        [DebuggerHidden]
+        public AwaiterStatus Status => state;
+
+        [DebuggerHidden]
+        public void UnsafeOnCompleted(Action action)
         {
         {
             this.continuation = action;
             this.continuation = action;
-            if (state != Pending)
+            if (state != AwaiterStatus.Pending)
             {
             {
                 TryInvokeContinuation();
                 TryInvokeContinuation();
             }
             }
         }
         }
 
 
-        private void TryInvokeContinuation()
+        [DebuggerHidden]
+        public void OnCompleted(Action action)
         {
         {
-            this.continuation?.Invoke();
-            this.continuation = null;
+            this.UnsafeOnCompleted(action);
         }
         }
 
 
+        [DebuggerHidden]
         public void SetResult(T result)
         public void SetResult(T result)
         {
         {
             if (this.TrySetResult(result))
             if (this.TrySetResult(result))
@@ -207,6 +176,7 @@ namespace ET
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
         }
         }
 
 
+        [DebuggerHidden]
         public void SetException(Exception e)
         public void SetException(Exception e)
         {
         {
             if (this.TrySetException(e))
             if (this.TrySetException(e))
@@ -217,73 +187,41 @@ namespace ET
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
             throw new InvalidOperationException("TaskT_TransitionToFinal_AlreadyCompleted");
         }
         }
 
 
-        public bool TrySetResult(T result)
-        {
-            if (this.state != Pending)
-            {
-                return false;
-            }
-
-            this.state = Succeeded;
-
-            this.value = result;
-            this.TryInvokeContinuation();
-            return true;
-
-        }
-
-        public bool TrySetException(Exception e)
+        [DebuggerHidden]
+        private void TryInvokeContinuation()
         {
         {
-            if (this.state != Pending)
-            {
-                return false;
-            }
-
-            this.state = Faulted;
-
-            this.exception = ExceptionDispatchInfo.Capture(e);
-            this.TryInvokeContinuation();
-            return true;
-
+            this.continuation?.Invoke();
+            this.continuation = null;
         }
         }
 
 
-        public bool TrySetCanceled()
+        [DebuggerHidden]
+        private bool TrySetResult(T result)
         {
         {
-            if (this.state != Pending)
+            if (this.state != AwaiterStatus.Pending)
             {
             {
                 return false;
                 return false;
             }
             }
 
 
-            this.state = Canceled;
+            this.state = AwaiterStatus.Succeeded;
 
 
+            this.value = result;
             this.TryInvokeContinuation();
             this.TryInvokeContinuation();
             return true;
             return true;
-
         }
         }
 
 
-        public bool TrySetCanceled(OperationCanceledException e)
+        [DebuggerHidden]
+        private bool TrySetException(Exception e)
         {
         {
-            if (this.state != Pending)
+            if (this.state != AwaiterStatus.Pending)
             {
             {
                 return false;
                 return false;
             }
             }
 
 
-            this.state = Canceled;
+            this.state = AwaiterStatus.Faulted;
 
 
             this.exception = ExceptionDispatchInfo.Capture(e);
             this.exception = ExceptionDispatchInfo.Capture(e);
             this.TryInvokeContinuation();
             this.TryInvokeContinuation();
             return true;
             return true;
-
-        }
-
-        void IAwaiter.GetResult()
-        {
-            ((IAwaiter<T>) this).GetResult();
-        }
-
-        void INotifyCompletion.OnCompleted(Action action)
-        {
-            ((ICriticalNotifyCompletion) this).UnsafeOnCompleted(action);
         }
         }
     }
     }
 }
 }

+ 0 - 86
Unity/Assets/Model/Base/Async/ETTaskFactory.cs

@@ -1,86 +0,0 @@
-using System;
-using System.Threading;
-
-namespace ET
-{
-    public partial struct ETTask
-    {
-        public static ETTask CompletedTask => new ETTask();
-
-        public static ETTask FromException(Exception ex)
-        {
-            ETTaskCompletionSource tcs = new ETTaskCompletionSource();
-            tcs.TrySetException(ex);
-            return tcs.Task;
-        }
-
-        public static ETTask<T> FromException<T>(Exception ex)
-        {
-            var tcs = new ETTaskCompletionSource<T>();
-            tcs.TrySetException(ex);
-            return tcs.Task;
-        }
-
-        public static ETTask<T> FromResult<T>(T value)
-        {
-            return new ETTask<T>(value);
-        }
-
-        public static ETTask FromCanceled()
-        {
-            return CanceledETTaskCache.Task;
-        }
-
-        public static ETTask<T> FromCanceled<T>()
-        {
-            return CanceledETTaskCache<T>.Task;
-        }
-
-        public static ETTask FromCanceled(CancellationToken token)
-        {
-            ETTaskCompletionSource tcs = new ETTaskCompletionSource();
-            tcs.TrySetException(new OperationCanceledException(token));
-            return tcs.Task;
-        }
-
-        public static ETTask<T> FromCanceled<T>(CancellationToken token)
-        {
-            var tcs = new ETTaskCompletionSource<T>();
-            tcs.TrySetException(new OperationCanceledException(token));
-            return tcs.Task;
-        }
-        
-        private static class CanceledETTaskCache
-        {
-            public static readonly ETTask Task;
-
-            static CanceledETTaskCache()
-            {
-                ETTaskCompletionSource tcs = new ETTaskCompletionSource();
-                tcs.TrySetCanceled();
-                Task = tcs.Task;
-            }
-        }
-
-        private static class CanceledETTaskCache<T>
-        {
-            public static readonly ETTask<T> Task;
-
-            static CanceledETTaskCache()
-            {
-                var taskCompletionSource = new ETTaskCompletionSource<T>();
-                taskCompletionSource.TrySetCanceled();
-                Task = taskCompletionSource.Task;
-            }
-        }
-    }
-
-    internal static class CompletedTasks
-    {
-        public static readonly ETTask<bool> True = ETTask.FromResult(true);
-        public static readonly ETTask<bool> False = ETTask.FromResult(false);
-        public static readonly ETTask<int> Zero = ETTask.FromResult(0);
-        public static readonly ETTask<int> MinusOne = ETTask.FromResult(-1);
-        public static readonly ETTask<int> One = ETTask.FromResult(1);
-    }
-}

+ 112 - 0
Unity/Assets/Model/Base/Async/ETTaskHelper.cs

@@ -0,0 +1,112 @@
+using System.Collections.Generic;
+
+namespace ET
+{
+    public static class ETTaskHelper
+    {
+        private class CoroutineBlocker
+        {
+            private int count;
+
+            private List<ETTaskCompletionSource> tcss = new List<ETTaskCompletionSource>();
+
+            public CoroutineBlocker(int count)
+            {
+                this.count = count;
+            }
+
+            public async ETTask WaitAsync()
+            {
+                --this.count;
+                if (this.count < 0)
+                {
+                    return;
+                }
+
+                if (this.count == 0)
+                {
+                    List<ETTaskCompletionSource> t = this.tcss;
+                    this.tcss = null;
+                    foreach (ETTaskCompletionSource ttcs in t)
+                    {
+                        ttcs.SetResult();
+                    }
+
+                    return;
+                }
+
+                ETTaskCompletionSource tcs = new ETTaskCompletionSource();
+                tcss.Add(tcs);
+                await tcs.Task;
+            }
+        }
+
+        public static async ETTask WaitAny<T>(ETTask<T>[] tasks)
+        {
+            CoroutineBlocker coroutineBlocker = new CoroutineBlocker(2);
+            foreach (ETTask<T> task in tasks)
+            {
+                RunOneTask(task).Coroutine();
+            }
+
+            await coroutineBlocker.WaitAsync();
+
+            async ETVoid RunOneTask(ETTask<T> task)
+            {
+                await task;
+                await coroutineBlocker.WaitAsync();
+            }
+        }
+
+        public static async ETTask WaitAny(ETTask[] tasks)
+        {
+            CoroutineBlocker coroutineBlocker = new CoroutineBlocker(2);
+            foreach (ETTask task in tasks)
+            {
+                RunOneTask(task).Coroutine();
+            }
+
+            await coroutineBlocker.WaitAsync();
+
+            async ETVoid RunOneTask(ETTask task)
+            {
+                await task;
+                await coroutineBlocker.WaitAsync();
+            }
+        }
+
+        public static async ETTask WaitAll<T>(ETTask<T>[] tasks)
+        {
+            CoroutineBlocker coroutineBlocker = new CoroutineBlocker(tasks.Length + 1);
+            foreach (ETTask<T> task in tasks)
+            {
+                RunOneTask(task).Coroutine();
+            }
+
+            await coroutineBlocker.WaitAsync();
+
+            async ETVoid RunOneTask(ETTask<T> task)
+            {
+                await task;
+                await coroutineBlocker.WaitAsync();
+            }
+        }
+
+        public static async ETTask WaitAll(ETTask[] tasks)
+        {
+            CoroutineBlocker coroutineBlocker = new CoroutineBlocker(tasks.Length + 1);
+            foreach (ETTask task in tasks)
+            {
+                RunOneTask(task).Coroutine();
+            }
+
+            await coroutineBlocker.WaitAsync();
+
+            async ETVoid RunOneTask(ETTask task)
+            {
+                await task;
+                await coroutineBlocker.WaitAsync();
+            }
+        }
+    }
+}

+ 2 - 3
Unity/Assets/Editor/ILRuntimeEditor/ILRuntimeCLRBinding.cs.meta → Unity/Assets/Model/Base/Async/ETTaskHelper.cs.meta

@@ -1,8 +1,7 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: 970393f1bc06b0a4a8572b5eae410a9a
-timeCreated: 1481621267
-licenseType: Free
+guid: 918113fec35224afa958d442f09ba720
 MonoImporter:
 MonoImporter:
+  externalObjects: {}
   serializedVersion: 2
   serializedVersion: 2
   defaultReferences: []
   defaultReferences: []
   executionOrder: 0
   executionOrder: 0

+ 9 - 23
Unity/Assets/Model/Base/Async/ETVoid.cs

@@ -4,39 +4,25 @@ using System.Runtime.CompilerServices;
 
 
 namespace ET
 namespace ET
 {
 {
-    [AsyncMethodBuilder(typeof(AsyncETVoidMethodBuilder))]
-    public struct ETVoid
+    [AsyncMethodBuilder(typeof (AsyncETVoidMethodBuilder))]
+    public struct ETVoid: ICriticalNotifyCompletion
     {
     {
+        [DebuggerHidden]
         public void Coroutine()
         public void Coroutine()
         {
         {
         }
         }
 
 
         [DebuggerHidden]
         [DebuggerHidden]
-        public Awaiter GetAwaiter()
+        public bool IsCompleted => true;
+
+        [DebuggerHidden]
+        public void OnCompleted(Action continuation)
         {
         {
-            return new Awaiter();
         }
         }
 
 
-        public struct Awaiter : ICriticalNotifyCompletion
+        [DebuggerHidden]
+        public void UnsafeOnCompleted(Action continuation)
         {
         {
-            [DebuggerHidden]
-            public bool IsCompleted => true;
-
-            [DebuggerHidden]
-            public void GetResult()
-            {
-                throw new InvalidOperationException("ETAvoid can not await, use Coroutine method instead!");
-            }
-
-            [DebuggerHidden]
-            public void OnCompleted(Action continuation)
-            {
-            }
-
-            [DebuggerHidden]
-            public void UnsafeOnCompleted(Action continuation)
-            {
-            }
         }
         }
     }
     }
 }
 }

+ 1 - 49
Unity/Assets/Model/Base/Async/IAwaiter.cs

@@ -1,6 +1,4 @@
-using System.Runtime.CompilerServices;
-
-namespace ET
+namespace ET
 {
 {
     public enum AwaiterStatus
     public enum AwaiterStatus
     {
     {
@@ -12,51 +10,5 @@ namespace ET
 
 
         /// <summary>The operation completed with an error.</summary>
         /// <summary>The operation completed with an error.</summary>
         Faulted = 2,
         Faulted = 2,
-
-        /// <summary>The operation completed due to cancellation.</summary>
-        Canceled = 3
-    }
-
-    public interface IAwaiter: ICriticalNotifyCompletion
-    {
-        AwaiterStatus Status { get; }
-        bool IsCompleted { get; }
-        void GetResult();
-    }
-
-    public interface IAwaiter<out T>: IAwaiter
-    {
-        new T GetResult();
-    }
-
-    public static class AwaiterStatusExtensions
-    {
-        /// <summary>!= Pending.</summary>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static bool IsCompleted(this AwaiterStatus status)
-        {
-            return status != AwaiterStatus.Pending;
-        }
-
-        /// <summary>== Succeeded.</summary>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static bool IsCompletedSuccessfully(this AwaiterStatus status)
-        {
-            return status == AwaiterStatus.Succeeded;
-        }
-
-        /// <summary>== Canceled.</summary>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static bool IsCanceled(this AwaiterStatus status)
-        {
-            return status == AwaiterStatus.Canceled;
-        }
-
-        /// <summary>== Faulted.</summary>
-        [MethodImpl(MethodImplOptions.AggressiveInlining)]
-        public static bool IsFaulted(this AwaiterStatus status)
-        {
-            return status == AwaiterStatus.Faulted;
-        }
     }
     }
 }
 }

+ 0 - 15
Unity/Assets/Model/Base/Async/MoveNextRunner.cs

@@ -1,15 +0,0 @@
-using System.Runtime.CompilerServices;
-
-namespace ET
-{
-    internal class MoveNextRunner<TStateMachine> where TStateMachine : IAsyncStateMachine
-    {
-        public TStateMachine StateMachine;
-
-        //[DebuggerHidden]
-        public void Run()
-        {
-            StateMachine.MoveNext();
-        }
-    }
-}

+ 4 - 4
Unity/Assets/Model/Demo/MoveComponent.cs

@@ -51,13 +51,13 @@ namespace ET
 			unit.Position = Vector3.Lerp(this.StartPos, this.Target, amount);
 			unit.Position = Vector3.Lerp(this.StartPos, this.Target, amount);
 		}
 		}
 
 
-		public ETTask MoveToAsync(Vector3 target, float speedValue, CancellationToken cancellationToken)
+		public async ETTask MoveToAsync(Vector3 target, float speedValue, CancellationToken cancellationToken)
 		{
 		{
 			Unit unit = this.GetParent<Unit>();
 			Unit unit = this.GetParent<Unit>();
 			
 			
 			if ((target - this.Target).magnitude < 0.1f)
 			if ((target - this.Target).magnitude < 0.1f)
 			{
 			{
-				return ETTask.CompletedTask;
+				return;
 			}
 			}
 			
 			
 			this.Target = target;
 			this.Target = target;
@@ -68,7 +68,7 @@ namespace ET
 			float distance = (this.Target - this.StartPos).magnitude;
 			float distance = (this.Target - this.StartPos).magnitude;
 			if (Math.Abs(distance) < 0.1f)
 			if (Math.Abs(distance) < 0.1f)
 			{
 			{
-				return ETTask.CompletedTask;
+				return;
 			}
 			}
             
             
 			this.needTime = (long)(distance / speedValue * 1000);
 			this.needTime = (long)(distance / speedValue * 1000);
@@ -79,7 +79,7 @@ namespace ET
 			{
 			{
 				this.moveTcs = null;
 				this.moveTcs = null;
 			});
 			});
-			return this.moveTcs.Task;
+			await this.moveTcs.Task;
 		}
 		}
 	}
 	}
 }
 }

+ 0 - 3
Unity/Assets/Model/Helper/ResourcesHelper.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 45c9a2ca2abc43bbab561109c340f827
-timeCreated: 1510746394

+ 3 - 3
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockComponent.cs

@@ -41,7 +41,7 @@ namespace ET
             this.list.Clear();
             this.list.Clear();
         }
         }
 
 
-        public ETTask<CoroutineLock> Wait(CoroutineLockType coroutineLockType, long key)
+        public async ETTask<CoroutineLock> Wait(CoroutineLockType coroutineLockType, long key)
         {
         {
             CoroutineLockQueueType coroutineLockQueueType = this.list[(int) coroutineLockType];
             CoroutineLockQueueType coroutineLockQueueType = this.list[(int) coroutineLockType];
             if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
             if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
@@ -49,12 +49,12 @@ namespace ET
                 queue = EntityFactory.Create<CoroutineLockQueue>(this.Domain);
                 queue = EntityFactory.Create<CoroutineLockQueue>(this.Domain);
                 coroutineLockQueueType.Add(key, queue);
                 coroutineLockQueueType.Add(key, queue);
                 
                 
-                return ETTask.FromResult(EntityFactory.CreateWithParent<CoroutineLock, CoroutineLockType, long>(this, coroutineLockType, key));
+                return EntityFactory.CreateWithParent<CoroutineLock, CoroutineLockType, long>(this, coroutineLockType, key);
             }
             }
             
             
             ETTaskCompletionSource<CoroutineLock> tcs = new ETTaskCompletionSource<CoroutineLock>();
             ETTaskCompletionSource<CoroutineLock> tcs = new ETTaskCompletionSource<CoroutineLock>();
             queue.Enqueue(tcs);
             queue.Enqueue(tcs);
-            return tcs.Task;
+            return await tcs.Task;
         }
         }
         
         
         public void Notify(CoroutineLockType coroutineLockType, long key)
         public void Notify(CoroutineLockType coroutineLockType, long key)

+ 0 - 8
Unity/Assets/ModelView/Demo/UI/UILoading/System.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: a9d9f57b5ebc26a46a09e6468f377b2b
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
Unity/Assets/ModelView/Helper.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 543bdb6ba0696034083ca26876560c56
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 5 - 5
Unity/Packages/manifest.json

@@ -2,19 +2,19 @@
   "dependencies": {
   "dependencies": {
     "com.unity.2d.sprite": "1.0.0",
     "com.unity.2d.sprite": "1.0.0",
     "com.unity.2d.tilemap": "1.0.0",
     "com.unity.2d.tilemap": "1.0.0",
-    "com.unity.ads": "2.0.8",
+    "com.unity.ads": "3.4.7",
     "com.unity.analytics": "3.3.5",
     "com.unity.analytics": "3.3.5",
     "com.unity.assetbundlebrowser": "1.7.0",
     "com.unity.assetbundlebrowser": "1.7.0",
     "com.unity.collab-proxy": "1.2.16",
     "com.unity.collab-proxy": "1.2.16",
     "com.unity.ide.rider": "1.1.4",
     "com.unity.ide.rider": "1.1.4",
-    "com.unity.ide.vscode": "1.1.4",
-    "com.unity.multiplayer-hlapi": "1.0.4",
+    "com.unity.ide.vscode": "1.2.1",
+    "com.unity.multiplayer-hlapi": "1.0.6",
     "com.unity.purchasing": "2.0.6",
     "com.unity.purchasing": "2.0.6",
-    "com.unity.test-framework": "1.1.9",
+    "com.unity.test-framework": "1.1.14",
     "com.unity.textmeshpro": "2.0.1",
     "com.unity.textmeshpro": "2.0.1",
     "com.unity.timeline": "1.2.10",
     "com.unity.timeline": "1.2.10",
     "com.unity.ugui": "1.0.0",
     "com.unity.ugui": "1.0.0",
-    "com.unity.xr.legacyinputhelpers": "1.3.8",
+    "com.unity.xr.legacyinputhelpers": "2.1.4",
     "com.unity.modules.ai": "1.0.0",
     "com.unity.modules.ai": "1.0.0",
     "com.unity.modules.androidjni": "1.0.0",
     "com.unity.modules.androidjni": "1.0.0",
     "com.unity.modules.animation": "1.0.0",
     "com.unity.modules.animation": "1.0.0",

+ 378 - 0
Unity/Packages/packages-lock.json

@@ -0,0 +1,378 @@
+{
+  "dependencies": {
+    "com.unity.2d.sprite": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.2d.tilemap": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.ads": {
+      "version": "3.4.7",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {
+        "com.unity.ugui": "1.0.0"
+      },
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.analytics": {
+      "version": "3.3.5",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {
+        "com.unity.ugui": "1.0.0"
+      },
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.assetbundlebrowser": {
+      "version": "1.7.0",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.collab-proxy": {
+      "version": "1.2.16",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.ext.nunit": {
+      "version": "1.0.0",
+      "depth": 1,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.ide.rider": {
+      "version": "1.1.4",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {
+        "com.unity.test-framework": "1.1.3"
+      },
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.ide.vscode": {
+      "version": "1.2.1",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.multiplayer-hlapi": {
+      "version": "1.0.6",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {
+        "nuget.mono-cecil": "0.1.6-preview"
+      },
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.purchasing": {
+      "version": "2.0.6",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.test-framework": {
+      "version": "1.1.14",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {
+        "com.unity.ext.nunit": "1.0.0",
+        "com.unity.modules.imgui": "1.0.0",
+        "com.unity.modules.jsonserialize": "1.0.0"
+      },
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.textmeshpro": {
+      "version": "2.0.1",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {
+        "com.unity.ugui": "1.0.0"
+      },
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.timeline": {
+      "version": "1.2.10",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.ugui": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.ui": "1.0.0"
+      }
+    },
+    "com.unity.xr.legacyinputhelpers": {
+      "version": "2.1.4",
+      "depth": 0,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "nuget.mono-cecil": {
+      "version": "0.1.6-preview",
+      "depth": 1,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
+    "com.unity.modules.ai": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.androidjni": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.animation": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.assetbundle": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.audio": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.cloth": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.physics": "1.0.0"
+      }
+    },
+    "com.unity.modules.director": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.audio": "1.0.0",
+        "com.unity.modules.animation": "1.0.0"
+      }
+    },
+    "com.unity.modules.imageconversion": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.imgui": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.jsonserialize": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.particlesystem": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.physics": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.physics2d": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.screencapture": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.imageconversion": "1.0.0"
+      }
+    },
+    "com.unity.modules.subsystems": {
+      "version": "1.0.0",
+      "depth": 1,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.jsonserialize": "1.0.0"
+      }
+    },
+    "com.unity.modules.terrain": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.terrainphysics": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.physics": "1.0.0",
+        "com.unity.modules.terrain": "1.0.0"
+      }
+    },
+    "com.unity.modules.tilemap": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.physics2d": "1.0.0"
+      }
+    },
+    "com.unity.modules.ui": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.uielements": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.imgui": "1.0.0",
+        "com.unity.modules.jsonserialize": "1.0.0"
+      }
+    },
+    "com.unity.modules.umbra": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.unityanalytics": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.unitywebrequest": "1.0.0",
+        "com.unity.modules.jsonserialize": "1.0.0"
+      }
+    },
+    "com.unity.modules.unitywebrequest": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.unitywebrequestassetbundle": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.assetbundle": "1.0.0",
+        "com.unity.modules.unitywebrequest": "1.0.0"
+      }
+    },
+    "com.unity.modules.unitywebrequestaudio": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.unitywebrequest": "1.0.0",
+        "com.unity.modules.audio": "1.0.0"
+      }
+    },
+    "com.unity.modules.unitywebrequesttexture": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.unitywebrequest": "1.0.0",
+        "com.unity.modules.imageconversion": "1.0.0"
+      }
+    },
+    "com.unity.modules.unitywebrequestwww": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.unitywebrequest": "1.0.0",
+        "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
+        "com.unity.modules.unitywebrequestaudio": "1.0.0",
+        "com.unity.modules.audio": "1.0.0",
+        "com.unity.modules.assetbundle": "1.0.0",
+        "com.unity.modules.imageconversion": "1.0.0"
+      }
+    },
+    "com.unity.modules.vehicles": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.physics": "1.0.0"
+      }
+    },
+    "com.unity.modules.video": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.audio": "1.0.0",
+        "com.unity.modules.ui": "1.0.0",
+        "com.unity.modules.unitywebrequest": "1.0.0"
+      }
+    },
+    "com.unity.modules.vr": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.jsonserialize": "1.0.0",
+        "com.unity.modules.physics": "1.0.0",
+        "com.unity.modules.xr": "1.0.0"
+      }
+    },
+    "com.unity.modules.wind": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {}
+    },
+    "com.unity.modules.xr": {
+      "version": "1.0.0",
+      "depth": 0,
+      "source": "builtin",
+      "dependencies": {
+        "com.unity.modules.physics": "1.0.0",
+        "com.unity.modules.jsonserialize": "1.0.0",
+        "com.unity.modules.subsystems": "1.0.0"
+      }
+    }
+  }
+}

+ 2 - 2
Unity/ProjectSettings/ProjectVersion.txt

@@ -1,2 +1,2 @@
-m_EditorVersion: 2019.3.0f6
-m_EditorVersionWithRevision: 2019.3.0f6 (27ab2135bccf)
+m_EditorVersion: 2019.4.3f1
+m_EditorVersionWithRevision: 2019.4.3f1 (ac4571766456)

+ 2 - 2
Unity/Unity.ThirdParty.csproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
   <PropertyGroup>
     <LangVersion>latest</LangVersion>
     <LangVersion>latest</LangVersion>
@@ -635,7 +635,7 @@
  <HintPath>C:/Source/ET/Unity/Library/PackageCache/com.unity.analytics@3.3.5/AnalyticsStandardEvents/Unity.Analytics.StandardEvents.dll</HintPath>
  <HintPath>C:/Source/ET/Unity/Library/PackageCache/com.unity.analytics@3.3.5/AnalyticsStandardEvents/Unity.Analytics.StandardEvents.dll</HintPath>
  </Reference>
  </Reference>
  <Reference Include="UnityEditor.Purchasing">
  <Reference Include="UnityEditor.Purchasing">
- <HintPath>C:/Source/ET/Unity/Library/PackageCache/com.unity.purchasing@2.0.6/Editor/UnityEditor.Purchasing.dll</HintPath>
+ <HintPath>/Users/tanghai/Documents/ET/Unity/Library/PackageCache/com.unity.purchasing@2.0.6/Editor/UnityEditor.Purchasing.dll</HintPath>
  </Reference>
  </Reference>
  <Reference Include="mscorlib">
  <Reference Include="mscorlib">
  <HintPath>C:/Apps/Unity/2019.3.0f6/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>
  <HintPath>C:/Apps/Unity/2019.3.0f6/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll</HintPath>