Quellcode durchsuchen

NoAwait改名成Coroutine,更加好懂一些,意思就是这里创建了一个新协程

tanghai vor 7 Jahren
Ursprung
Commit
9879ea6c84
34 geänderte Dateien mit 45 neuen und 37 gelöschten Zeilen
  1. 1 1
      Server/Hotfix/Handler/C2M_ReloadHandler.cs
  2. 1 1
      Server/Hotfix/Module/Actor/MailBoxComponentSystem.cs
  3. 1 1
      Server/Hotfix/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  4. 2 2
      Server/Hotfix/Module/ActorLocation/ActorLocationSenderSystem.cs
  5. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectGetRequestHandler.cs
  6. 1 1
      Server/Hotfix/Module/ActorLocation/ObjectLockRequestHandler.cs
  7. 1 1
      Server/Hotfix/Module/Benchmark/BenchmarkComponentSystem.cs
  8. 1 1
      Server/Hotfix/Module/Benchmark/WebSocketBenchmarkComponentSystem.cs
  9. 1 1
      Server/Hotfix/Module/DB/DBQueryBatchRequestHandler.cs
  10. 1 1
      Server/Hotfix/Module/DB/DBQueryJsonRequestHandler.cs
  11. 1 1
      Server/Hotfix/Module/DB/DBQueryRequestHandler.cs
  12. 1 1
      Server/Hotfix/Module/DB/DBSaveBatchRequestHandler.cs
  13. 1 1
      Server/Hotfix/Module/DB/DBSaveRequestHandler.cs
  14. 1 1
      Server/Hotfix/Module/Demo/C2G_EnterMapHandler.cs
  15. 1 1
      Server/Hotfix/Module/Demo/C2R_LoginHandler.cs
  16. 1 1
      Server/Hotfix/Module/Demo/Frame_ClickMapHandler.cs
  17. 1 1
      Server/Hotfix/Module/Demo/G2M_CreateUnitHandler.cs
  18. 1 1
      Server/Hotfix/Module/Message/OuterMessageDispatcher.cs
  19. 1 1
      Server/Model/Component/AppManagerComponent.cs
  20. 1 1
      Server/Model/Component/ConsoleComponent.cs
  21. 1 1
      Server/Model/Module/DB/DBTaskQueue.cs
  22. 1 1
      Server/Model/Module/Demo/GateSessionKeyComponent.cs
  23. 1 1
      Server/Model/Module/Http/HttpComponent.cs
  24. 1 1
      Unity/Assets/Editor/ServerManagerEditor/ServerManagerEditor.cs
  25. 1 1
      Unity/Assets/Hotfix/Module/Demo/M2C_PathfindingResultHandler.cs
  26. 1 1
      Unity/Assets/Hotfix/Module/Demo/OperaComponent.cs
  27. 1 1
      Unity/Assets/Hotfix/UI/UILobby/Component/UILobbyComponent.cs
  28. 1 1
      Unity/Assets/Hotfix/UI/UILogin/Component/UILoginComponent.cs
  29. 8 0
      Unity/Assets/Model/Base/Async/ETTask.cs
  30. 1 1
      Unity/Assets/Model/Base/Async/ETVoid.cs
  31. 1 1
      Unity/Assets/Model/Init.cs
  32. 3 3
      Unity/Assets/Model/Module/Message/Network/WebSocket/WChannel.cs
  33. 2 2
      Unity/Assets/Model/Module/Message/Network/WebSocket/WService.cs
  34. 1 1
      Unity/Assets/Model/UI/UILoading/Component/UILoadingComponent.cs

+ 1 - 1
Server/Hotfix/Handler/C2M_ReloadHandler.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, C2M_Reload message, Action<M2C_Reload> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		private async ETVoid RunAsync(Session session, C2M_Reload message, Action<M2C_Reload> reply)

+ 1 - 1
Server/Hotfix/Module/Actor/MailBoxComponentSystem.cs

@@ -28,7 +28,7 @@ namespace ETHotfix
 	{
 		public override void Start(MailBoxComponent self)
 		{
-			self.HandleAsync().NoAwait();
+			self.HandleAsync().Coroutine();
 		}
 	}
 

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
     {
         public override void Start(ActorLocationSenderComponent self)
         {
-            StartAsync(self).NoAwait();
+            StartAsync(self).Coroutine();
         }
         
         // 每10s扫描一次过期的actorproxy进行回收,过期时间是1分钟

+ 2 - 2
Server/Hotfix/Module/ActorLocation/ActorLocationSenderSystem.cs

@@ -21,7 +21,7 @@ namespace ETHotfix
     {
 	    public override void Start(ActorLocationSender self)
 	    {
-		    StartAsync(self).NoAwait();
+		    StartAsync(self).Coroutine();
 	    }
 	    
         public async ETVoid StartAsync(ActorLocationSender self)
@@ -32,7 +32,7 @@ namespace ETHotfix
                     .Get(IdGenerater.GetAppIdFromId(self.ActorId))
                     .GetComponent<InnerConfig>().IPEndPoint;
 
-            self.UpdateAsync().NoAwait();
+            self.UpdateAsync().Coroutine();
         }
     }
 	

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectGetRequestHandler.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, ObjectGetRequest message, Action<ObjectGetResponse> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		private async ETVoid RunAsync(Session session, ObjectGetRequest message, Action<ObjectGetResponse> reply)

+ 1 - 1
Server/Hotfix/Module/ActorLocation/ObjectLockRequestHandler.cs

@@ -11,7 +11,7 @@ namespace ETHotfix
 			ObjectLockResponse response = new ObjectLockResponse();
 			try
 			{
-				Game.Scene.GetComponent<LocationComponent>().Lock(message.Key, message.InstanceId, message.Time).NoAwait();
+				Game.Scene.GetComponent<LocationComponent>().Lock(message.Key, message.InstanceId, message.Time).Coroutine();
 				reply(response);
 			}
 			catch (Exception e)

+ 1 - 1
Server/Hotfix/Module/Benchmark/BenchmarkComponentSystem.cs

@@ -23,7 +23,7 @@ namespace ETHotfix
 				NetOuterComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>();
 				for (int i = 0; i < 1000; i++)
 				{
-					self.TestAsync(networkComponent, ipEndPoint, i).NoAwait();
+					self.TestAsync(networkComponent, ipEndPoint, i).Coroutine();
 				}
 			}
 			catch (Exception e)

+ 1 - 1
Server/Hotfix/Module/Benchmark/WebSocketBenchmarkComponentSystem.cs

@@ -21,7 +21,7 @@ namespace ETHotfix
 				NetOuterComponent networkComponent = Game.Scene.GetComponent<NetOuterComponent>();
 				for (int i = 0; i < 1000; i++)
 				{
-					self.TestAsync(networkComponent, i, address).NoAwait();
+					self.TestAsync(networkComponent, i, address).Coroutine();
 				}
 			}
 			catch (Exception e)

+ 1 - 1
Server/Hotfix/Module/DB/DBQueryBatchRequestHandler.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, DBQueryBatchRequest message, Action<DBQueryBatchResponse> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, DBQueryBatchRequest message, Action<DBQueryBatchResponse> reply)

+ 1 - 1
Server/Hotfix/Module/DB/DBQueryJsonRequestHandler.cs

@@ -9,7 +9,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, DBQueryJsonRequest message, Action<DBQueryJsonResponse> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, DBQueryJsonRequest message, Action<DBQueryJsonResponse> reply)

+ 1 - 1
Server/Hotfix/Module/DB/DBQueryRequestHandler.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, DBQueryRequest message, Action<DBQueryResponse> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, DBQueryRequest message, Action<DBQueryResponse> reply)

+ 1 - 1
Server/Hotfix/Module/DB/DBSaveBatchRequestHandler.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, DBSaveBatchRequest message, Action<DBSaveBatchResponse> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, DBSaveBatchRequest message, Action<DBSaveBatchResponse> reply)

+ 1 - 1
Server/Hotfix/Module/DB/DBSaveRequestHandler.cs

@@ -8,7 +8,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, DBSaveRequest message, Action<DBSaveResponse> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, DBSaveRequest message, Action<DBSaveResponse> reply)

+ 1 - 1
Server/Hotfix/Module/Demo/C2G_EnterMapHandler.cs

@@ -9,7 +9,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, C2G_EnterMap message, Action<G2C_EnterMap> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, C2G_EnterMap message, Action<G2C_EnterMap> reply)

+ 1 - 1
Server/Hotfix/Module/Demo/C2R_LoginHandler.cs

@@ -9,7 +9,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, C2R_Login message, Action<R2C_Login> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 
 		private async ETVoid RunAsync(Session session, C2R_Login message, Action<R2C_Login> reply)

+ 1 - 1
Server/Hotfix/Module/Demo/Frame_ClickMapHandler.cs

@@ -9,7 +9,7 @@ namespace ETHotfix
 		protected override void Run(Unit unit, Frame_ClickMap message)
 		{
 			Vector3 target = new Vector3(message.X, message.Y, message.Z);
-			unit.GetComponent<UnitPathComponent>().MoveTo(target).NoAwait();
+			unit.GetComponent<UnitPathComponent>().MoveTo(target).Coroutine();
 			
 		}
 	}

+ 1 - 1
Server/Hotfix/Module/Demo/G2M_CreateUnitHandler.cs

@@ -9,7 +9,7 @@ namespace ETHotfix
 	{
 		protected override void Run(Session session, G2M_CreateUnit message, Action<M2G_CreateUnit> reply)
 		{
-			RunAsync(session, message, reply).NoAwait();
+			RunAsync(session, message, reply).Coroutine();
 		}
 		
 		protected async ETVoid RunAsync(Session session, G2M_CreateUnit message, Action<M2G_CreateUnit> reply)

+ 1 - 1
Server/Hotfix/Module/Message/OuterMessageDispatcher.cs

@@ -7,7 +7,7 @@ namespace ETHotfix
 	{
 		public void Dispatch(Session session, ushort opcode, object message)
 		{
-			DispatchAsync(session, opcode, message).NoAwait();
+			DispatchAsync(session, opcode, message).Coroutine();
 		}
 		
 		public async ETVoid DispatchAsync(Session session, ushort opcode, object message)

+ 1 - 1
Server/Model/Component/AppManagerComponent.cs

@@ -41,7 +41,7 @@ namespace ETModel
 				StartProcess(startConfig.AppId);
 			}
 
-			this.WatchProcessAsync().NoAwait();
+			this.WatchProcessAsync().Coroutine();
 		}
 
 		private void StartProcess(int appId)

+ 1 - 1
Server/Model/Component/ConsoleComponent.cs

@@ -9,7 +9,7 @@ namespace ETModel
     {
         public override void Start(ConsoleComponent self)
         {
-            self.Start().NoAwait();
+            self.Start().Coroutine();
         }
     }
 

+ 1 - 1
Server/Model/Module/DB/DBTaskQueue.cs

@@ -17,7 +17,7 @@ namespace ETModel
 	{
 		public override void Start(DBTaskQueue self)
 		{
-			StartAsync(self).NoAwait();
+			StartAsync(self).Coroutine();
 		}
 		
 		public async ETVoid StartAsync(DBTaskQueue self)

+ 1 - 1
Server/Model/Module/Demo/GateSessionKeyComponent.cs

@@ -9,7 +9,7 @@ namespace ETModel
 		public void Add(long key, string account)
 		{
 			this.sessionKey.Add(key, account);
-			this.TimeoutRemoveKey(key).NoAwait();
+			this.TimeoutRemoveKey(key).Coroutine();
 		}
 
 		public string Get(long key)

+ 1 - 1
Server/Model/Module/Http/HttpComponent.cs

@@ -119,7 +119,7 @@ namespace ETModel
 
 				this.listener.Start();
 
-				this.Accept().NoAwait();
+				this.Accept().Coroutine();
 			}
 			catch (HttpListenerException e)
 			{

+ 1 - 1
Unity/Assets/Editor/ServerManagerEditor/ServerManagerEditor.cs

@@ -43,7 +43,7 @@ namespace ETEditor
 					return;
 				}
 
-				ReloadAsync(this.managerAddress, this.account, this.password).NoAwait();
+				ReloadAsync(this.managerAddress, this.account, this.password).Coroutine();
 			}
 			
 			GUILayout.EndHorizontal();

+ 1 - 1
Unity/Assets/Hotfix/Module/Demo/M2C_PathfindingResultHandler.cs

@@ -14,7 +14,7 @@ namespace ETHotfix
 			unit.GetComponent<AnimatorComponent>().SetFloatValue("Speed", 5f);
 			UnitPathComponent unitPathComponent = unit.GetComponent<UnitPathComponent>();
 
-			unitPathComponent.StartMove(message).NoAwait();
+			unitPathComponent.StartMove(message).Coroutine();
 
 			GizmosDebug.Instance.Path.Clear();
 			GizmosDebug.Instance.Path.Add(new Vector3(message.X, message.Y, message.Z));

+ 1 - 1
Unity/Assets/Hotfix/Module/Demo/OperaComponent.cs

@@ -50,7 +50,7 @@ namespace ETHotfix
 		            ETModel.SessionComponent.Instance.Session.Send(frameClickMap);
 
 					// 测试actor rpc消息
-					this.TestActor().NoAwait();
+					this.TestActor().Coroutine();
 				}
             }
         }

+ 1 - 1
Unity/Assets/Hotfix/UI/UILobby/Component/UILobbyComponent.cs

@@ -31,7 +31,7 @@ namespace ETHotfix
 
 		private void EnterMap()
 		{
-			EnterMapAsync().NoAwait();
+			EnterMapAsync().Coroutine();
 		}
 		
 		private async ETVoid EnterMapAsync()

+ 1 - 1
Unity/Assets/Hotfix/UI/UILogin/Component/UILoginComponent.cs

@@ -30,7 +30,7 @@ namespace ETHotfix
 
 		public void OnLogin()
 		{
-			OnLoginAsync().NoAwait();
+			OnLoginAsync().Coroutine();
 		}
 
 		public async ETVoid OnLoginAsync()

+ 8 - 0
Unity/Assets/Model/Base/Async/ETTask.cs

@@ -33,6 +33,10 @@ namespace ETModel
                 awaiter.GetResult();
             }
         }
+        
+        public void Coroutine()
+        {
+        }
 
         [DebuggerHidden]
         public Awaiter GetAwaiter()
@@ -164,6 +168,10 @@ namespace ETModel
                 return this.awaiter.GetResult();
             }
         }
+        
+        public void Coroutine()
+        {
+        }
 
         [DebuggerHidden]
         public Awaiter GetAwaiter()

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

@@ -7,7 +7,7 @@ namespace ETModel
     [AsyncMethodBuilder(typeof(AsyncETVoidMethodBuilder))]
     public struct ETVoid
     {
-        public void NoAwait()
+        public void Coroutine()
         {
         }
 

+ 1 - 1
Unity/Assets/Model/Init.cs

@@ -10,7 +10,7 @@ namespace ETModel
 	{
 		private void Start()
 		{
-			this.StartAsync().NoAwait();
+			this.StartAsync().Coroutine();
 		}
 		
 		private async ETVoid StartAsync()

+ 3 - 3
Unity/Assets/Model/Module/Message/Network/WebSocket/WChannel.cs

@@ -78,8 +78,8 @@ namespace ETModel
             {
                 return;
             }
-            this.StartRecv().NoAwait();
-            this.StartSend().NoAwait();
+            this.StartRecv().Coroutine();
+            this.StartSend().Coroutine();
         }
         
         private WService GetService()
@@ -110,7 +110,7 @@ namespace ETModel
 
             if (this.isConnected)
             {
-                this.StartSend().NoAwait();
+                this.StartSend().Coroutine();
             }
         }
 

+ 2 - 2
Unity/Assets/Model/Module/Message/Network/WebSocket/WService.cs

@@ -20,7 +20,7 @@ namespace ETModel
             
             this.httpListener = new HttpListener();
 
-            StartAccept(prefixs).NoAwait();
+            StartAccept(prefixs).Coroutine();
         }
         
         public WService()
@@ -44,7 +44,7 @@ namespace ETModel
 			ClientWebSocket webSocket = new ClientWebSocket();
             WChannel channel = new WChannel(webSocket, this);
             this.channels[channel.Id] = channel;
-            channel.ConnectAsync(address).NoAwait();
+            channel.ConnectAsync(address).Coroutine();
             return channel;
         }
 

+ 1 - 1
Unity/Assets/Model/UI/UILoading/Component/UILoadingComponent.cs

@@ -17,7 +17,7 @@ namespace ETModel
 	{
 		public override void Start(UILoadingComponent self)
 		{
-			StartAsync(self).NoAwait();
+			StartAsync(self).Coroutine();
 		}
 		
 		public async ETVoid StartAsync(UILoadingComponent self)