Kaynağa Gözat

1.客户端增加CurrentScene用来管理客户端当前的场景数据
2.玩家登陆从gate上创建一个map,然后从gate map传送到需要进入的map中去,这样登录跟传送逻辑完全一致
3.实现完整的传送逻辑
4.整个客户端切场景就是一个协程方法完成,极其优美

tanghai 4 yıl önce
ebeveyn
işleme
d9c6469633
68 değiştirilmiş dosya ile 632 ekleme ve 421 silme
  1. 5 24
      Proto/InnerMessage.proto
  2. 6 7
      Proto/MongoMessage.proto
  3. 17 7
      Proto/OuterMessage.proto
  4. 2 2
      Robot/Hotfix/Module/RobotCase/RobotCaseSystem.cs
  5. 4 0
      Robot/Hotfix/Robot.Hotfix.csproj
  6. 1 1
      Robot/Hotfix/Robot/RobotManagerComponentSystem.cs
  7. 19 7
      Server/Hotfix/Demo/C2G_EnterMapHandler.cs
  8. 1 1
      Server/Hotfix/Demo/C2G_LoginGateHandler.cs
  9. 1 1
      Server/Hotfix/Demo/C2R_LoginHandler.cs
  10. 0 37
      Server/Hotfix/Demo/G2M_CreateUnitHandler.cs
  11. 0 22
      Server/Hotfix/Demo/M2M_TrasferUnitRequestHandler.cs
  12. 42 0
      Server/Hotfix/Demo/M2M_UnitTransferRequestHandler.cs
  13. 22 0
      Server/Hotfix/Demo/PlayerComponentSystem.cs
  14. 2 2
      Server/Hotfix/Demo/Session/SessionStreamDispatcherServerOuter.cs
  15. 13 5
      Server/Hotfix/Demo/SessionPlayerComponentSystem.cs
  16. 30 0
      Server/Hotfix/Demo/Transfer/TransferHelper.cs
  17. 2 18
      Server/Hotfix/Demo/Unit/UnitComponentSystem.cs
  18. 34 0
      Server/Hotfix/Demo/Unit/UnitFactory.cs
  19. 0 34
      Server/Model/Demo/PlayerComponent.cs
  20. 7 0
      Server/Model/Demo/Scene/GateMapComponent.cs
  21. 1 1
      Server/Model/Demo/SessionPlayerComponent.cs
  22. 1 17
      Server/Model/Demo/Unit/UnitComponent.cs
  23. 1 1
      Server/Model/Demo/Unit/UnitGateComponent.cs
  24. 6 41
      Server/Model/Generate/Message/InnerMessage.cs
  25. 20 22
      Server/Model/Generate/Message/InnerOpcode.cs
  26. 8 8
      Server/Model/Generate/Message/MongoMessage.cs
  27. 1 1
      Server/Model/Generate/Message/MongoOpcode.cs
  28. 32 8
      Server/Model/Generate/Message/OuterMessage.cs
  29. 19 17
      Server/Model/Generate/Message/OuterOpcode.cs
  30. 12 3
      Unity/Assets/Mono/Module/Mongo/BsonDictionaryOptionsAttribute.cs
  31. 11 0
      Unity/Assets/Mono/Module/NetworkTCP/WChannel.cs.meta
  32. 11 0
      Unity/Assets/Mono/Module/NetworkTCP/WService.cs.meta
  33. 1 1
      Unity/Assets/Scenes/Init.unity
  34. 1 1
      Unity/Codes/Hotfix/Demo/AI/AI_Attack.cs
  35. 1 1
      Unity/Codes/Hotfix/Demo/AI/AI_XunLuo.cs
  36. 1 4
      Unity/Codes/Hotfix/Demo/Login/EnterMapHelper.cs
  37. 1 1
      Unity/Codes/Hotfix/Demo/Move/M2C_PathfindingResultHandler.cs
  38. 1 2
      Unity/Codes/Hotfix/Demo/Move/M2C_StopHandler.cs
  39. 1 1
      Unity/Codes/Hotfix/Demo/Move/MoveHelper.cs
  40. 20 0
      Unity/Codes/Hotfix/Demo/Scene/CurrentScenesComponentSystem.cs
  41. 11 0
      Unity/Codes/Hotfix/Demo/Scene/M2C_StartSceneChangeHandler.cs
  42. 30 0
      Unity/Codes/Hotfix/Demo/Scene/SceneChangeHelper.cs
  43. 16 6
      Unity/Codes/Hotfix/Demo/Scene/SceneFactory.cs
  44. 13 0
      Unity/Codes/Hotfix/Demo/Unit/M2C_CreateMyUnitHandler.cs
  45. 4 4
      Unity/Codes/Hotfix/Demo/Unit/M2C_CreateUnitsHandler.cs
  46. 3 26
      Unity/Codes/Hotfix/Demo/Unit/UnitComponent.cs
  47. 2 2
      Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs
  48. 10 3
      Unity/Codes/Hotfix/Demo/Unit/UnitHelper.cs
  49. 3 1
      Unity/Codes/HotfixView/AppStart_Init.cs
  50. 13 0
      Unity/Codes/HotfixView/Demo/Scene/AfterCreateCurrentScene_AddComponent.cs
  51. 1 0
      Unity/Codes/HotfixView/Demo/Scene/AfterCreateZoneScene_AddComponent.cs
  52. 32 0
      Unity/Codes/HotfixView/Demo/Scene/SceneChangeStart_AddComponent.cs
  53. 0 29
      Unity/Codes/HotfixView/Demo/UI/UILobby/EnterMapFinish_RemoveLobbyUI.cs
  54. 4 3
      Unity/Codes/HotfixView/Demo/UI/UILobby/UILobbyComponentSystem.cs
  55. 1 1
      Unity/Codes/HotfixView/Demo/UI/UILobby/UILobbyEvent.cs
  56. 1 1
      Unity/Codes/HotfixView/Demo/UI/UILogin/UILoginEvent.cs
  57. 1 0
      Unity/Codes/Model/Core/Entity/SceneType.cs
  58. 8 0
      Unity/Codes/Model/Core/Object/ITransfer.cs
  59. 16 0
      Unity/Codes/Model/Demo/EventType.cs
  60. 8 0
      Unity/Codes/Model/Demo/Scene/CurrentScenesComponent.cs
  61. 7 0
      Unity/Codes/Model/Demo/Unit/PlayerComponent.cs
  62. 1 6
      Unity/Codes/Model/Demo/Unit/UnitComponent.cs
  63. 11 0
      Unity/Codes/Model/Demo/WaitType.cs
  64. 32 8
      Unity/Codes/Model/Generate/Message/OuterMessage.cs
  65. 19 17
      Unity/Codes/Model/Generate/Message/OuterOpcode.cs
  66. 21 13
      Unity/Codes/Model/Module/Message/MessageSerializeHelper.cs
  67. 4 1
      Unity/Codes/Model/Module/Numeric/NumericComponent.cs
  68. 2 2
      Unity/Unity.Mono.csproj

+ 5 - 24
Proto/InnerMessage.proto

@@ -9,15 +9,6 @@ message ObjectQueryRequest // IActorRequest
 	int64 InstanceId = 2;
 }
 
-message M2M_TrasferUnitResponse // IActorResponse
-{
-	int32 RpcId = 90;
-	int32 Error = 91;
-	string Message = 92;
-
-	int64 InstanceId = 1;
-}
-
 //ResponseType A2M_Reload
 message M2A_Reload // IActorRequest
 {
@@ -151,22 +142,12 @@ message G2R_GetLoginKey // IActorResponse
 	int64 GateId = 2;
 }
 
-//ResponseType M2G_CreateUnit
-message G2M_CreateUnit // IActorRequest
+message M2M_UnitTransferResponse // IActorResponse
 {
-	int32 RpcId = 90;
-	int64 PlayerId = 1;
-	int64 GateSessionId = 2;
-}
-
-message M2G_CreateUnit // IActorResponse
-{
-	int32 RpcId = 90;
-	int32 Error = 91;
-	string Message = 92;
-
-	// 所有的unit
-	int64 MyId = 1;
+	int32 RpcId = 1;
+	int32 Error = 2;
+	string Message = 3;
+	int64 NewInstanceId = 4;
 }
 
 message G2M_SessionDisconnect // IActorLocationMessage

+ 6 - 7
Proto/MongoMessage.proto

@@ -11,12 +11,11 @@ message ObjectQueryResponse // IActorResponse
 	Entity entity = 1;
 }
 
-/// <summary>
-/// 传送unit
-/// </summary>
-//ResponseType M2M_TrasferUnitResponse
-message M2M_TrasferUnitRequest // IActorRequest
+
+//ResponseType M2M_UnitTransferResponse
+message M2M_UnitTransferRequest // IActorRequest
 {
-	int32 RpcId = 90;
-	Unit Unit = 1;
+	int32 RpcId = 1;
+	Unit Unit = 2;
+	repeated Entity Entitys = 3;
 }

+ 17 - 7
Proto/OuterMessage.proto

@@ -33,16 +33,16 @@ message Actor_TransferResponse // IActorLocationResponse
 //ResponseType G2C_EnterMap
 message C2G_EnterMap // IRequest
 {
-	int32 RpcId = 90;
+	int32 RpcId = 1;
 }
 
 message G2C_EnterMap // IResponse
 {
-	int32 RpcId = 90;
-	int32 Error = 91;
-	string Message = 92;
-	// 自己unit
-	int64 MyId = 1;
+	int32 RpcId = 1;
+	int32 Error = 2;
+	string Message = 3;
+	// 自己unitId
+	int64 MyId = 4;
 }
 
 message MoveInfo
@@ -76,10 +76,20 @@ message UnitInfo
 
 message M2C_CreateUnits // IActorMessage
 {
-	int32 RpcId = 90;
 	repeated UnitInfo Units = 2;
 }
 
+message M2C_CreateMyUnit // IActorMessage
+{
+	UnitInfo Unit = 1;
+}
+
+message M2C_StartSceneChange // IActorMessage
+{
+	int64 SceneInstanceId = 1;
+	string SceneName = 2;	
+}
+
 message M2C_RemoveUnits // IActorMessage
 {
 	repeated int64 Units = 2;

+ 2 - 2
Robot/Hotfix/Module/RobotCase/RobotCaseSystem.cs

@@ -64,7 +64,7 @@ namespace ET
             Scene zoneScene = null;
             try
             {
-                zoneScene = await SceneFactory.CreateZoneScene(zone, name, self);
+                zoneScene = SceneFactory.CreateZoneScene(zone, name, self);
                 await LoginHelper.Login(zoneScene, ConstValue.LoginAddress, zone.ToString(), zone.ToString());
                 await EnterMapHelper.EnterMapAsync(zoneScene);
                 Log.Debug($"create robot ok: {zone}");
@@ -84,7 +84,7 @@ namespace ET
 
             try
             {
-                zoneScene = await SceneFactory.CreateZoneScene(zone, $"Robot_{zone}", self);
+                zoneScene = SceneFactory.CreateZoneScene(zone, $"Robot_{zone}", self);
                 await LoginHelper.Login(zoneScene, ConstValue.LoginAddress, zone.ToString(), zone.ToString());
                 await EnterMapHelper.EnterMapAsync(zoneScene);
                 Log.Debug($"create robot ok: {zone}");

+ 4 - 0
Robot/Hotfix/Robot.Hotfix.csproj

@@ -67,6 +67,10 @@
             <Link>Demo\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
+        <Compile Include="..\..\Unity\Codes\Hotfix\Core\**\*.cs">
+            <Link>Core\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
         <Compile Include="..\..\Unity\Codes\Hotfix\Module\Config\**\*.cs">
             <Link>Module\Config\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>

+ 1 - 1
Robot/Hotfix/Robot/RobotManagerComponentSystem.cs

@@ -10,7 +10,7 @@ namespace ET
             Scene zoneScene = null;
             try
             {
-                zoneScene = await SceneFactory.CreateZoneScene(zone, "Robot", self);
+                zoneScene = SceneFactory.CreateZoneScene(zone, "Robot", self);
                 await LoginHelper.Login(zoneScene, ConstValue.LoginAddress, zone.ToString(), zone.ToString());
                 await EnterMapHelper.EnterMapAsync(zoneScene);
                 Log.Debug($"create robot ok: {zone}");

+ 19 - 7
Server/Hotfix/Demo/C2G_EnterMapHandler.cs

@@ -8,14 +8,26 @@ namespace ET
 	{
 		protected override async ETTask Run(Session session, C2G_EnterMap request, G2C_EnterMap response, Action reply)
 		{
-			Player player = session.GetComponent<SessionPlayerComponent>().Player;
-			// 在map服务器上创建战斗Unit
-			long mapInstanceId = StartSceneConfigCategory.Instance.GetBySceneName(session.DomainZone(), "Map").InstanceId;
-			M2G_CreateUnit createUnit = (M2G_CreateUnit)await ActorMessageSenderComponent.Instance.Call(
-				mapInstanceId, new G2M_CreateUnit() { PlayerId = player.Id, GateSessionId = session.InstanceId });
-			player.UnitId = createUnit.MyId;
-			response.MyId = createUnit.MyId;
+			Player player = session.GetComponent<SessionPlayerComponent>().GetMyPlayer();
+
+			// 在Gate上动态创建一个Map Scene,把Unit从DB中加载放进来,然后传送到真正的Map中,这样登陆跟传送的逻辑就完全一样了
+			GateMapComponent gateMapComponent = player.AddComponent<GateMapComponent>();
+			gateMapComponent.Scene = await SceneFactory.Create(gateMapComponent, "GateMap", SceneType.Map);
+
+			Scene scene = gateMapComponent.Scene;
+			
+			// 这里可以从DB中加载Unit
+			Unit unit = UnitFactory.Create(scene, player.Id, UnitType.Player);
+			unit.AddComponent<UnitGateComponent, long>(session.InstanceId);
+			
+			StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetBySceneName(session.DomainZone(), "Map");
+			response.MyId = player.Id;
+			response.MapName = startSceneConfig.Name;
+			response.SceneInstanceId = startSceneConfig.InstanceId;
 			reply();
+			
+			// 开始传送
+			await TransferHelper.Transfer(unit, startSceneConfig.InstanceId, startSceneConfig.Name);
 		}
 	}
 }

+ 1 - 1
Server/Hotfix/Demo/C2G_LoginGateHandler.cs

@@ -23,7 +23,7 @@ namespace ET
 			PlayerComponent playerComponent = scene.GetComponent<PlayerComponent>();
 			Player player = playerComponent.AddChild<Player, string>(account);
 			playerComponent.Add(player);
-			session.AddComponent<SessionPlayerComponent>().Player = player;
+			session.AddComponent<SessionPlayerComponent>().PlayerId = player.Id;
 			session.AddComponent<MailBoxComponent, MailboxType>(MailboxType.GateSession);
 
 			response.PlayerId = player.Id;

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

@@ -11,7 +11,7 @@ namespace ET
 		{
 			// 随机分配一个Gate
 			StartSceneConfig config = RealmGateAddressHelper.GetGate(session.DomainZone());
-			//Log.Debug($"gate address: {MongoHelper.ToJson(config)}");
+			Log.Debug($"gate address: {MongoHelper.ToJson(config)}");
 			
 			// 向gate请求一个key,客户端可以拿着这个key连接gate
 			G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await ActorMessageSenderComponent.Instance.Call(

+ 0 - 37
Server/Hotfix/Demo/G2M_CreateUnitHandler.cs

@@ -1,37 +0,0 @@
-using System;
-using UnityEngine;
-
-namespace ET
-{
-	[ActorMessageHandler]
-	public class G2M_CreateUnitHandler : AMActorRpcHandler<Scene, G2M_CreateUnit, M2G_CreateUnit>
-	{
-		protected override async ETTask Run(Scene scene, G2M_CreateUnit request, M2G_CreateUnit response, Action reply)
-		{
-			UnitComponent unitComponent = scene.GetComponent<UnitComponent>();
-			Unit unit = unitComponent.AddChildWithId<Unit, int>(IdGenerater.Instance.GenerateId(), 1001);
-			unit.AddComponent<MoveComponent>();
-			unit.AddComponent<PathfindingComponent, string>("solo");
-			unit.Position = new Vector3(-10, 0, -10);
-			
-			NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
-			numericComponent.Set(NumericType.Speed, 6f); // 速度是6米每秒
-			numericComponent.Set(NumericType.AOI, 15000); // 视野15米
-			
-			unit.AddComponent<MailBoxComponent>();
-			await unit.AddLocation();
-			unit.AddComponent<UnitGateComponent, long>(request.GateSessionId);
-			unitComponent.Add(unit);
-			// 加入aoi
-			unit.AddComponent<AOIEntity, int, Vector3>(9 * 1000, unit.Position);
-
-			M2C_CreateUnits m2CCreateUnits = new M2C_CreateUnits();
-			m2CCreateUnits.Units.Add(UnitHelper.CreateUnitInfo(unit));
-			MessageHelper.SendToClient(unit, m2CCreateUnits);
-			
-			response.MyId = unit.Id;
-			
-			reply();
-		}
-	}
-}

+ 0 - 22
Server/Hotfix/Demo/M2M_TrasferUnitRequestHandler.cs

@@ -1,22 +0,0 @@
-using System;
-
-
-namespace ET
-{
-	[ActorMessageHandler]
-	public class M2M_TrasferUnitRequestHandler : AMActorRpcHandler<Scene, M2M_TrasferUnitRequest, M2M_TrasferUnitResponse>
-	{
-		protected override async ETTask Run(Scene scene, M2M_TrasferUnitRequest request, M2M_TrasferUnitResponse response, Action reply)
-		{
-			Unit unit = request.Unit;
-			// 将unit加入事件系统
-			Log.Debug(MongoHelper.ToJson(request.Unit));
-			// 这里不需要注册location,因为unlock会更新位置
-			unit.AddComponent<MailBoxComponent>();
-			scene.GetComponent<UnitComponent>().Add(unit);
-			response.InstanceId = unit.InstanceId;
-			reply();
-			await ETTask.CompletedTask;
-		}
-	}
-}

+ 42 - 0
Server/Hotfix/Demo/M2M_UnitTransferRequestHandler.cs

@@ -0,0 +1,42 @@
+using System;
+using UnityEngine;
+
+namespace ET
+{
+	[ActorMessageHandler]
+	public class M2M_UnitTransferRequestHandler : AMActorRpcHandler<Scene, M2M_UnitTransferRequest, M2M_UnitTransferResponse>
+	{
+		protected override async ETTask Run(Scene scene, M2M_UnitTransferRequest request, M2M_UnitTransferResponse response, Action reply)
+		{
+			await ETTask.CompletedTask;
+			UnitComponent unitComponent = scene.GetComponent<UnitComponent>();
+			Unit unit = request.Unit;
+			
+			unitComponent.AddChild(unit);
+			unitComponent.Add(unit);
+
+			foreach (Entity entity in request.Entitys)
+			{
+				unit.AddComponent(entity);
+			}
+			
+			unit.AddComponent<MoveComponent>();
+			unit.AddComponent<PathfindingComponent, string>("solo");
+			unit.Position = new Vector3(-10, 0, -10);
+			
+			unit.AddComponent<MailBoxComponent>();
+			
+			// 通知客户端创建My Unit
+			M2C_CreateMyUnit m2CCreateUnits = new M2C_CreateMyUnit();
+			m2CCreateUnits.Unit = UnitHelper.CreateUnitInfo(unit);
+			MessageHelper.SendToClient(unit, m2CCreateUnits);
+			
+			// 加入aoi
+			unit.AddComponent<AOIEntity, int, Vector3>(9 * 1000, unit.Position);
+
+			response.NewInstanceId = unit.InstanceId;
+			
+			reply();
+		}
+	}
+}

+ 22 - 0
Server/Hotfix/Demo/PlayerComponentSystem.cs

@@ -0,0 +1,22 @@
+using System;
+
+namespace ET
+{
+    public static class PlayerComponentSystem
+    {
+        public class AwakeSystem : AwakeSystem<PlayerComponent>
+        {
+            public override void Awake(PlayerComponent self)
+            {
+            }
+        }
+
+        [ObjectSystem]
+        public class PlayerComponentDestroySystem: DestroySystem<PlayerComponent>
+        {
+            public override void Destroy(PlayerComponent self)
+            {
+            }
+        }
+    }
+}

+ 2 - 2
Server/Hotfix/Demo/Session/SessionStreamDispatcherServerOuter.cs

@@ -30,7 +30,7 @@ namespace ET
             {
                 case IActorLocationRequest actorLocationRequest: // gate session收到actor rpc消息,先向actor 发送rpc请求,再将请求结果返回客户端
                 {
-                    long unitId = session.GetComponent<SessionPlayerComponent>().Player.UnitId;
+                    long unitId = session.GetComponent<SessionPlayerComponent>().PlayerId;
                     int rpcId = actorLocationRequest.RpcId; // 这里要保存客户端的rpcId
                     long instanceId = session.InstanceId;
                     IResponse response = await ActorLocationSenderComponent.Instance.Call(unitId, actorLocationRequest);
@@ -44,7 +44,7 @@ namespace ET
                 }
                 case IActorLocationMessage actorLocationMessage:
                 {
-                    long unitId = session.GetComponent<SessionPlayerComponent>().Player.UnitId;
+                    long unitId = session.GetComponent<SessionPlayerComponent>().PlayerId;
                     ActorLocationSenderComponent.Instance.Send(unitId, actorLocationMessage);
                     break;
                 }

+ 13 - 5
Server/Hotfix/Demo/SessionPlayerComponentSystem.cs

@@ -2,13 +2,21 @@
 
 namespace ET
 {
-	public class SessionPlayerComponentDestroySystem : DestroySystem<SessionPlayerComponent>
+	public static class SessionPlayerComponentSystem
 	{
-		public override void Destroy(SessionPlayerComponent self)
+		public class SessionPlayerComponentDestroySystem: DestroySystem<SessionPlayerComponent>
 		{
-			// 发送断线消息
-			ActorLocationSenderComponent.Instance.Send(self.Player.UnitId, new G2M_SessionDisconnect());
-			self.Domain.GetComponent<PlayerComponent>()?.Remove(self.Player.Id);
+			public override void Destroy(SessionPlayerComponent self)
+			{
+				// 发送断线消息
+				ActorLocationSenderComponent.Instance.Send(self.PlayerId, new G2M_SessionDisconnect());
+				self.Domain.GetComponent<PlayerComponent>()?.Remove(self.PlayerId);
+			}
+		}
+
+		public static Player GetMyPlayer(this SessionPlayerComponent self)
+		{
+			return self.Domain.GetComponent<PlayerComponent>().Get(self.PlayerId);
 		}
 	}
 }

+ 30 - 0
Server/Hotfix/Demo/Transfer/TransferHelper.cs

@@ -0,0 +1,30 @@
+namespace ET
+{
+    public static class TransferHelper
+    {
+        public static async ETTask Transfer(Unit unit, long sceneInstanceId, string sceneName)
+        {
+            // 通知客户端开始切场景
+            M2C_StartSceneChange m2CStartSceneChange = new M2C_StartSceneChange() {SceneInstanceId = sceneInstanceId, SceneName = sceneName};
+            MessageHelper.SendToClient(unit, m2CStartSceneChange);
+            
+            M2M_UnitTransferRequest request = new M2M_UnitTransferRequest();
+            request.Unit = unit;
+            foreach (Entity entity in unit.Components.Values)
+            {
+                if (entity is ITransfer)
+                {
+                    request.Entitys.Add(entity);
+                }
+            }
+            // 删除Mailbox,让发给Unit的ActorLocation消息重发
+            unit.RemoveComponent<MailBoxComponent>();
+            
+            // location加锁
+            long oldInstanceId = unit.InstanceId;
+            await LocationProxyComponent.Instance.Lock(unit.Id, unit.InstanceId);
+            M2M_UnitTransferResponse response = await ActorMessageSenderComponent.Instance.Call(sceneInstanceId, request) as M2M_UnitTransferResponse;
+            await LocationProxyComponent.Instance.UnLock(unit.Id, oldInstanceId, response.NewInstanceId);
+        }
+    }
+}

+ 2 - 18
Server/Hotfix/Demo/Unit/UnitComponentSystem.cs

@@ -1,5 +1,3 @@
-using System.Linq;
-
 namespace ET
 {
     public class UnitComponentAwakeSystem: AwakeSystem<UnitComponent>
@@ -13,7 +11,6 @@ namespace ET
     {
         public override void Destroy(UnitComponent self)
         {
-            self.idUnits.Clear();
         }
     }
     
@@ -21,31 +18,18 @@ namespace ET
     {
         public static void Add(this UnitComponent self, Unit unit)
         {
-            self.idUnits.Add(unit.Id, unit);
         }
 
         public static Unit Get(this UnitComponent self, long id)
         {
-            self.idUnits.TryGetValue(id, out Unit unit);
+            Unit unit = self.GetChild<Unit>(id);
             return unit;
         }
 
         public static void Remove(this UnitComponent self, long id)
         {
-            Unit unit;
-            self.idUnits.TryGetValue(id, out unit);
-            self.idUnits.Remove(id);
+            Unit unit = self.GetChild<Unit>(id);
             unit?.Dispose();
         }
-
-        public static void RemoveNoDispose(this UnitComponent self, long id)
-        {
-            self.idUnits.Remove(id);
-        }
-
-        public static Unit[] GetAll(this UnitComponent self)
-        {
-            return self.idUnits.Values.ToArray();
-        }
     }
 }

+ 34 - 0
Server/Hotfix/Demo/Unit/UnitFactory.cs

@@ -0,0 +1,34 @@
+using System;
+using UnityEngine;
+
+namespace ET
+{
+    public static class UnitFactory
+    {
+        public static Unit Create(Scene scene, long id, UnitType unitType)
+        {
+            UnitComponent unitComponent = scene.GetComponent<UnitComponent>();
+            switch (unitType)
+            {
+                case UnitType.Player:
+                {
+                    Unit unit = unitComponent.AddChildWithId<Unit, int>(id, 1001);
+                    unit.AddComponent<MoveComponent>();
+                    unit.AddComponent<PathfindingComponent, string>("solo");
+                    unit.Position = new Vector3(-10, 0, -10);
+			
+                    NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
+                    numericComponent.Set(NumericType.Speed, 6f); // 速度是6米每秒
+                    numericComponent.Set(NumericType.AOI, 15000); // 视野15米
+                    
+                    unitComponent.Add(unit);
+                    // 加入aoi
+                    unit.AddComponent<AOIEntity, int, Vector3>(9 * 1000, unit.Position);
+                    return unit;
+                }
+                default:
+                    throw new Exception($"not such unit type: {unitType}");
+            }
+        }
+    }
+}

+ 0 - 34
Server/Model/Demo/PlayerComponent.cs

@@ -3,26 +3,9 @@ using System.Linq;
 
 namespace ET
 {
-	public class PlayerComponentSystem : AwakeSystem<PlayerComponent>
-	{
-		public override void Awake(PlayerComponent self)
-		{
-			self.Awake();
-		}
-	}
-	
 	public class PlayerComponent : Entity
 	{
-		public static PlayerComponent Instance { get; private set; }
-
-		public Player MyPlayer;
-		
 		private readonly Dictionary<long, Player> idPlayers = new Dictionary<long, Player>();
-
-		public void Awake()
-		{
-			Instance = this;
-		}
 		
 		public void Add(Player player)
 		{
@@ -52,22 +35,5 @@ namespace ET
 		{
 			return this.idPlayers.Values.ToArray();
 		}
-
-		public override void Dispose()
-		{
-			if (this.IsDisposed)
-			{
-				return;
-			}
-			
-			base.Dispose();
-
-			foreach (Player player in this.idPlayers.Values)
-			{
-				player.Dispose();
-			}
-
-			Instance = null;
-		}
 	}
 }

+ 7 - 0
Server/Model/Demo/Scene/GateMapComponent.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public class GateMapComponent: Entity
+    {
+        public Scene Scene;
+    }
+}

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

@@ -2,6 +2,6 @@
 {
 	public class SessionPlayerComponent : Entity
 	{
-		public Player Player;
+		public long PlayerId;
 	}
 }

+ 1 - 17
Server/Model/Demo/Unit/UnitComponent.cs

@@ -1,22 +1,6 @@
-using System.Collections.Generic;
-using System.Linq;
-using MongoDB.Bson.Serialization.Attributes;
-using MongoDB.Bson.Serialization.Options;
-
-namespace ET
+namespace ET
 {
 	public class UnitComponent: Entity
 	{
-		[BsonElement]
-		[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
-		public readonly Dictionary<long, Unit> idUnits = new Dictionary<long, Unit>();
-		
-		public int Count
-		{
-			get
-			{
-				return this.idUnits.Count;
-			}
-		}
 	}
 }

+ 1 - 1
Server/Model/Demo/Unit/UnitGateComponent.cs

@@ -8,7 +8,7 @@
 		}
 	}
 
-	public class UnitGateComponent : Entity, ISerializeToEntity
+	public class UnitGateComponent : Entity, ITransfer
 	{
 		public long GateSessionActorId;
 

+ 6 - 41
Server/Model/Generate/Message/InnerMessage.cs

@@ -19,24 +19,6 @@ namespace ET
 
 	}
 
-	[Message(InnerOpcode.M2M_TrasferUnitResponse)]
-	[ProtoContract]
-	public partial class M2M_TrasferUnitResponse: Object, IActorResponse
-	{
-		[ProtoMember(90)]
-		public int RpcId { get; set; }
-
-		[ProtoMember(91)]
-		public int Error { get; set; }
-
-		[ProtoMember(92)]
-		public string Message { get; set; }
-
-		[ProtoMember(1)]
-		public long InstanceId { get; set; }
-
-	}
-
 	[ResponseType(nameof(A2M_Reload))]
 	[Message(InnerOpcode.M2A_Reload)]
 	[ProtoContract]
@@ -316,38 +298,21 @@ namespace ET
 
 	}
 
-	[ResponseType(nameof(M2G_CreateUnit))]
-	[Message(InnerOpcode.G2M_CreateUnit)]
+	[Message(InnerOpcode.M2M_UnitTransferResponse)]
 	[ProtoContract]
-	public partial class G2M_CreateUnit: Object, IActorRequest
+	public partial class M2M_UnitTransferResponse: Object, IActorResponse
 	{
-		[ProtoMember(90)]
-		public int RpcId { get; set; }
-
 		[ProtoMember(1)]
-		public long PlayerId { get; set; }
-
-		[ProtoMember(2)]
-		public long GateSessionId { get; set; }
-
-	}
-
-	[Message(InnerOpcode.M2G_CreateUnit)]
-	[ProtoContract]
-	public partial class M2G_CreateUnit: Object, IActorResponse
-	{
-		[ProtoMember(90)]
 		public int RpcId { get; set; }
 
-		[ProtoMember(91)]
+		[ProtoMember(2)]
 		public int Error { get; set; }
 
-		[ProtoMember(92)]
+		[ProtoMember(3)]
 		public string Message { get; set; }
 
-// 所有的unit
-		[ProtoMember(1)]
-		public long MyId { get; set; }
+		[ProtoMember(4)]
+		public long NewInstanceId { get; set; }
 
 	}
 

+ 20 - 22
Server/Model/Generate/Message/InnerOpcode.cs

@@ -3,27 +3,25 @@ namespace ET
 	public static partial class InnerOpcode
 	{
 		 public const ushort ObjectQueryRequest = 20002;
-		 public const ushort M2M_TrasferUnitResponse = 20003;
-		 public const ushort M2A_Reload = 20004;
-		 public const ushort A2M_Reload = 20005;
-		 public const ushort G2G_LockRequest = 20006;
-		 public const ushort G2G_LockResponse = 20007;
-		 public const ushort G2G_LockReleaseRequest = 20008;
-		 public const ushort G2G_LockReleaseResponse = 20009;
-		 public const ushort ObjectAddRequest = 20010;
-		 public const ushort ObjectAddResponse = 20011;
-		 public const ushort ObjectLockRequest = 20012;
-		 public const ushort ObjectLockResponse = 20013;
-		 public const ushort ObjectUnLockRequest = 20014;
-		 public const ushort ObjectUnLockResponse = 20015;
-		 public const ushort ObjectRemoveRequest = 20016;
-		 public const ushort ObjectRemoveResponse = 20017;
-		 public const ushort ObjectGetRequest = 20018;
-		 public const ushort ObjectGetResponse = 20019;
-		 public const ushort R2G_GetLoginKey = 20020;
-		 public const ushort G2R_GetLoginKey = 20021;
-		 public const ushort G2M_CreateUnit = 20022;
-		 public const ushort M2G_CreateUnit = 20023;
-		 public const ushort G2M_SessionDisconnect = 20024;
+		 public const ushort M2A_Reload = 20003;
+		 public const ushort A2M_Reload = 20004;
+		 public const ushort G2G_LockRequest = 20005;
+		 public const ushort G2G_LockResponse = 20006;
+		 public const ushort G2G_LockReleaseRequest = 20007;
+		 public const ushort G2G_LockReleaseResponse = 20008;
+		 public const ushort ObjectAddRequest = 20009;
+		 public const ushort ObjectAddResponse = 20010;
+		 public const ushort ObjectLockRequest = 20011;
+		 public const ushort ObjectLockResponse = 20012;
+		 public const ushort ObjectUnLockRequest = 20013;
+		 public const ushort ObjectUnLockResponse = 20014;
+		 public const ushort ObjectRemoveRequest = 20015;
+		 public const ushort ObjectRemoveResponse = 20016;
+		 public const ushort ObjectGetRequest = 20017;
+		 public const ushort ObjectGetResponse = 20018;
+		 public const ushort R2G_GetLoginKey = 20019;
+		 public const ushort G2R_GetLoginKey = 20020;
+		 public const ushort M2M_UnitTransferResponse = 20021;
+		 public const ushort G2M_SessionDisconnect = 20022;
 	}
 }

+ 8 - 8
Server/Model/Generate/Message/MongoMessage.cs

@@ -21,20 +21,20 @@ namespace ET
 
 	}
 
-/// <summary>
-/// 传送unit
-/// </summary>
-	[ResponseType(nameof(M2M_TrasferUnitResponse))]
-	[Message(MongoOpcode.M2M_TrasferUnitRequest)]
+	[ResponseType(nameof(M2M_UnitTransferResponse))]
+	[Message(MongoOpcode.M2M_UnitTransferRequest)]
 	[ProtoContract]
-	public partial class M2M_TrasferUnitRequest: Object, IActorRequest
+	public partial class M2M_UnitTransferRequest: Object, IActorRequest
 	{
-		[ProtoMember(90)]
+		[ProtoMember(1)]
 		public int RpcId { get; set; }
 
-		[ProtoMember(1)]
+		[ProtoMember(2)]
 		public Unit Unit { get; set; }
 
+		[ProtoMember(3)]
+		public List<Entity> Entitys = new List<Entity>();
+
 	}
 
 }

+ 1 - 1
Server/Model/Generate/Message/MongoOpcode.cs

@@ -3,6 +3,6 @@ namespace ET
 	public static partial class MongoOpcode
 	{
 		 public const ushort ObjectQueryResponse = 30002;
-		 public const ushort M2M_TrasferUnitRequest = 30003;
+		 public const ushort M2M_UnitTransferRequest = 30003;
 	}
 }

+ 32 - 8
Server/Model/Generate/Message/OuterMessage.cs

@@ -67,7 +67,7 @@ namespace ET
 	[ProtoContract]
 	public partial class C2G_EnterMap: Object, IRequest
 	{
-		[ProtoMember(90)]
+		[ProtoMember(1)]
 		public int RpcId { get; set; }
 
 	}
@@ -76,19 +76,25 @@ namespace ET
 	[ProtoContract]
 	public partial class G2C_EnterMap: Object, IResponse
 	{
-		[ProtoMember(90)]
+		[ProtoMember(1)]
 		public int RpcId { get; set; }
 
-		[ProtoMember(91)]
+		[ProtoMember(2)]
 		public int Error { get; set; }
 
-		[ProtoMember(92)]
+		[ProtoMember(3)]
 		public string Message { get; set; }
 
 // 自己unit
-		[ProtoMember(1)]
+		[ProtoMember(4)]
 		public long MyId { get; set; }
 
+		[ProtoMember(5)]
+		public string MapName { get; set; }
+
+		[ProtoMember(6)]
+		public long SceneInstanceId { get; set; }
+
 	}
 
 	[Message(OuterOpcode.MoveInfo)]
@@ -167,14 +173,32 @@ namespace ET
 	[ProtoContract]
 	public partial class M2C_CreateUnits: Object, IActorMessage
 	{
-		[ProtoMember(90)]
-		public int RpcId { get; set; }
-
 		[ProtoMember(2)]
 		public List<UnitInfo> Units = new List<UnitInfo>();
 
 	}
 
+	[Message(OuterOpcode.M2C_CreateMyUnit)]
+	[ProtoContract]
+	public partial class M2C_CreateMyUnit: Object, IActorMessage
+	{
+		[ProtoMember(1)]
+		public UnitInfo Unit { get; set; }
+
+	}
+
+	[Message(OuterOpcode.M2C_StartSceneChange)]
+	[ProtoContract]
+	public partial class M2C_StartSceneChange: Object, IActorMessage
+	{
+		[ProtoMember(1)]
+		public long SceneInstanceId { get; set; }
+
+		[ProtoMember(2)]
+		public string SceneName { get; set; }
+
+	}
+
 	[Message(OuterOpcode.M2C_RemoveUnits)]
 	[ProtoContract]
 	public partial class M2C_RemoveUnits: Object, IActorMessage

+ 19 - 17
Server/Model/Generate/Message/OuterOpcode.cs

@@ -11,22 +11,24 @@ namespace ET
 		 public const ushort MoveInfo = 10008;
 		 public const ushort UnitInfo = 10009;
 		 public const ushort M2C_CreateUnits = 10010;
-		 public const ushort M2C_RemoveUnits = 10011;
-		 public const ushort C2M_PathfindingResult = 10012;
-		 public const ushort C2M_Stop = 10013;
-		 public const ushort M2C_PathfindingResult = 10014;
-		 public const ushort M2C_Stop = 10015;
-		 public const ushort C2G_Ping = 10016;
-		 public const ushort G2C_Ping = 10017;
-		 public const ushort G2C_Test = 10018;
-		 public const ushort C2M_Reload = 10019;
-		 public const ushort M2C_Reload = 10020;
-		 public const ushort C2R_Login = 10021;
-		 public const ushort R2C_Login = 10022;
-		 public const ushort C2G_LoginGate = 10023;
-		 public const ushort G2C_LoginGate = 10024;
-		 public const ushort G2C_TestHotfixMessage = 10025;
-		 public const ushort C2M_TestRobotCase = 10026;
-		 public const ushort M2C_TestRobotCase = 10027;
+		 public const ushort M2C_CreateMyUnit = 10011;
+		 public const ushort M2C_StartSceneChange = 10012;
+		 public const ushort M2C_RemoveUnits = 10013;
+		 public const ushort C2M_PathfindingResult = 10014;
+		 public const ushort C2M_Stop = 10015;
+		 public const ushort M2C_PathfindingResult = 10016;
+		 public const ushort M2C_Stop = 10017;
+		 public const ushort C2G_Ping = 10018;
+		 public const ushort G2C_Ping = 10019;
+		 public const ushort G2C_Test = 10020;
+		 public const ushort C2M_Reload = 10021;
+		 public const ushort M2C_Reload = 10022;
+		 public const ushort C2R_Login = 10023;
+		 public const ushort R2C_Login = 10024;
+		 public const ushort C2G_LoginGate = 10025;
+		 public const ushort G2C_LoginGate = 10026;
+		 public const ushort G2C_TestHotfixMessage = 10027;
+		 public const ushort C2M_TestRobotCase = 10028;
+		 public const ushort M2C_TestRobotCase = 10029;
 	}
 }

+ 12 - 3
Unity/Assets/Mono/Module/Mongo/BsonDictionaryOptionsAttribute.cs

@@ -1,17 +1,26 @@
 using System;
 
-namespace MongoDB.Bson.Serialization.Attributes
+namespace MongoDB.Bson.Serialization.Options
 {
+    /// <summary>
+    /// Represents the representation to use for dictionaries.
+    /// </summary>
     public enum DictionaryRepresentation
     {
+        /// <summary>Represent the dictionary as a Document.</summary>
         Document,
+        /// <summary>Represent the dictionary as an array of arrays.</summary>
         ArrayOfArrays,
+        /// <summary>Represent the dictionary as an array of documents.</summary>
         ArrayOfDocuments,
     }
-    
+}
+
+namespace MongoDB.Bson.Serialization.Attributes
+{
     public class BsonDictionaryOptionsAttribute: Attribute
     {
-        public BsonDictionaryOptionsAttribute(DictionaryRepresentation dictionaryRepresentation)
+        public BsonDictionaryOptionsAttribute(MongoDB.Bson.Serialization.Options.DictionaryRepresentation dictionaryRepresentation)
         {
             
         }

+ 11 - 0
Unity/Assets/Mono/Module/NetworkTCP/WChannel.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b1521b5d15359624296c9e2f801bee89
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 11 - 0
Unity/Assets/Mono/Module/NetworkTCP/WService.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: edded4e0a631e0347bb019ee35ad5975
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Unity/Assets/Scenes/Init.unity

@@ -417,7 +417,7 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: ff906ecbbd0163f4094f8fa4e305d39f, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  CodeMode: 2
+  CodeMode: 1
 --- !u!4 &575235020
 Transform:
   m_ObjectHideFlags: 0

+ 1 - 1
Unity/Codes/Hotfix/Demo/AI/AI_Attack.cs

@@ -18,7 +18,7 @@ namespace ET
         {
             Scene zoneScene = aiComponent.DomainScene();
 
-            Unit myUnit = UnitHelper.GetMyUnit(zoneScene);
+            Unit myUnit = UnitHelper.GetMyUnitFromZoneScene(zoneScene);
             if (myUnit == null)
             {
                 return;

+ 1 - 1
Unity/Codes/Hotfix/Demo/AI/AI_XunLuo.cs

@@ -18,7 +18,7 @@ namespace ET
         {
             Scene zoneScene = aiComponent.DomainScene();
 
-            Unit myUnit = UnitHelper.GetMyUnit(zoneScene);
+            Unit myUnit = UnitHelper.GetMyUnitFromZoneScene(zoneScene);
             if (myUnit == null)
             {
                 return;

+ 1 - 4
Unity/Codes/Hotfix/Demo/Login/EnterMapHelper.cs

@@ -10,10 +10,7 @@ namespace ET
             try
             {
                 G2C_EnterMap g2CEnterMap = await zoneScene.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
-
-                UnitComponent unitComponent = zoneScene.GetComponent<UnitComponent>();
-                unitComponent.MyId = g2CEnterMap.MyId;
-                
+                zoneScene.GetComponent<PlayerComponent>().MyId = g2CEnterMap.MyId;
                 Game.EventSystem.Publish(new EventType.EnterMapFinish() {ZoneScene = zoneScene});
             }
             catch (Exception e)

+ 1 - 1
Unity/Codes/Hotfix/Demo/Move/M2C_PathfindingResultHandler.cs

@@ -8,7 +8,7 @@ namespace ET
 	{
 		protected override async ETTask Run(Session session, M2C_PathfindingResult message)
 		{
-			Unit unit = session.Domain.GetComponent<UnitComponent>().Get(message.Id);
+			Unit unit = session.DomainScene().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
 
 			float speed = unit.GetComponent<NumericComponent>().GetAsFloat(NumericType.Speed);
 

+ 1 - 2
Unity/Codes/Hotfix/Demo/Move/M2C_StopHandler.cs

@@ -7,8 +7,7 @@ namespace ET
 	{
 		protected override async ETTask Run(Session session, M2C_Stop message)
 		{
-			Unit unit = session.Domain.GetComponent<UnitComponent>().Get(message.Id);
-			
+			Unit unit = session.DomainScene().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
 			if (unit == null)
 			{
 				return;

+ 1 - 1
Unity/Codes/Hotfix/Demo/Move/MoveHelper.cs

@@ -9,7 +9,7 @@ namespace ET
         public static async ETTask<int> MoveToAsync(this Unit unit, Vector3 targetPos, ETCancellationToken cancellationToken = null)
         {
             C2M_PathfindingResult msg = new C2M_PathfindingResult() {X = targetPos.x, Y = targetPos.y, Z = targetPos.z};
-            unit.Domain.GetComponent<SessionComponent>().Session.Send(msg);
+            unit.ZoneScene().GetComponent<SessionComponent>().Session.Send(msg);
 
             ObjectWait objectWait = unit.GetComponent<ObjectWait>();
             

+ 20 - 0
Unity/Codes/Hotfix/Demo/Scene/CurrentScenesComponentSystem.cs

@@ -0,0 +1,20 @@
+using System;
+
+namespace ET
+{
+    public static class CurrentScenesComponentSystem
+    {
+        [ObjectSystem]
+        public class CurrentScenesComponentAwakeSystem: AwakeSystem<CurrentScenesComponent>
+        {
+            public override void Awake(CurrentScenesComponent self)
+            {
+            }
+        }
+
+        public static Scene CurrentScene(this Scene zoneScene)
+        {
+            return zoneScene.GetComponent<CurrentScenesComponent>()?.Scene;
+        }
+    }
+}

+ 11 - 0
Unity/Codes/Hotfix/Demo/Scene/M2C_StartSceneChangeHandler.cs

@@ -0,0 +1,11 @@
+namespace ET
+{
+	[MessageHandler]
+	public class M2C_StartSceneChangeHandler : AMHandler<M2C_StartSceneChange>
+	{
+		protected override async ETTask Run(Session session, M2C_StartSceneChange message)
+		{
+			await SceneChangeHelper.SceneChangeTo(session.ZoneScene(), message.SceneName, message.SceneInstanceId);
+		}
+	}
+}

+ 30 - 0
Unity/Codes/Hotfix/Demo/Scene/SceneChangeHelper.cs

@@ -0,0 +1,30 @@
+namespace ET
+{
+    public static class SceneChangeHelper
+    {
+        // 场景切换协程
+        public static async ETTask SceneChangeTo(Scene zoneScene, string sceneName, long sceneInstanceId)
+        {
+            // 可以订阅这个事件中创建Loading界面
+            Game.EventSystem.Publish(new EventType.SceneChangeStart() {ZoneScene = zoneScene});
+            
+            Log.Debug($"11111111111111111111111111111111111111111111111111a1");
+            CurrentScenesComponent currentScenesComponent = zoneScene.GetComponent<CurrentScenesComponent>();
+            Log.Debug($"11111111111111111111111111111111111111111111111111a2");
+            currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
+            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, zoneScene.Zone, sceneName, currentScenesComponent);
+            Log.Debug($"11111111111111111111111111111111111111111111111111a3");
+            UnitComponent unitComponent = currentScene.AddComponent<UnitComponent>();
+
+            // 等待CreateMyUnit的消息
+            WaitType.Wait_CreateMyUnit waitCreateMyUnit = await zoneScene.GetComponent<ObjectWait>().Wait<WaitType.Wait_CreateMyUnit>();
+            M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;
+            Unit unit = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);
+            unitComponent.Add(unit);
+            
+            zoneScene.AddComponent<AIComponent, int>(1);
+
+            Game.EventSystem.Publish(new EventType.SceneChangeFinish() {ZoneScene = zoneScene});
+        }
+    }
+}

+ 16 - 6
Unity/Codes/Hotfix/Demo/Scene/SceneFactory.cs

@@ -2,18 +2,28 @@ namespace ET
 {
     public static class SceneFactory
     {
-        public static async ETTask<Scene> CreateZoneScene(int zone, string name, Entity parent)
+        public static Scene CreateZoneScene(int zone, string name, Entity parent)
         {
             Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateInstanceId(), zone, SceneType.Zone, name, parent);
             zoneScene.AddComponent<ZoneSceneFlagComponent>();
             zoneScene.AddComponent<NetKcpComponent, int>(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter);
-            zoneScene.AddComponent<UnitComponent>();
-            zoneScene.AddComponent<AIComponent, int>(1);
-            
-            // UI层的初始化
-            await Game.EventSystem.PublishAsync(new EventType.AfterCreateZoneScene() {ZoneScene = zoneScene});
+			zoneScene.AddComponent<CurrentScenesComponent>();
+            zoneScene.AddComponent<ObjectWait>();
+            zoneScene.AddComponent<PlayerComponent>();
             
+            Game.EventSystem.Publish(new EventType.AfterCreateZoneScene() {ZoneScene = zoneScene});
             return zoneScene;
         }
+        
+        public static Scene CreateCurrentScene(long id, int zone, string name, CurrentScenesComponent currentScenesComponent)
+        {
+            Scene currentScene = EntitySceneFactory.CreateScene(id, zone, SceneType.Current, name, currentScenesComponent);
+            currentScenesComponent.Scene = currentScene;
+            
+            Game.EventSystem.Publish(new EventType.AfterCreateCurrentScene() {CurrentScene = currentScene});
+            return currentScene;
+        }
+        
+        
     }
 }

+ 13 - 0
Unity/Codes/Hotfix/Demo/Unit/M2C_CreateMyUnitHandler.cs

@@ -0,0 +1,13 @@
+namespace ET
+{
+	[MessageHandler]
+	public class M2C_CreateMyUnitHandler : AMHandler<M2C_CreateMyUnit>
+	{
+		protected override async ETTask Run(Session session, M2C_CreateMyUnit message)
+		{
+			// 通知场景切换协程继续往下走
+			session.DomainScene().GetComponent<ObjectWait>().Notify(new WaitType.Wait_CreateMyUnit() {Message = message});
+			await ETTask.CompletedTask;
+		}
+	}
+}

+ 4 - 4
Unity/Codes/Hotfix/Demo/Unit/M2C_CreateUnitsHandler.cs

@@ -4,8 +4,9 @@
 	public class M2C_CreateUnitsHandler : AMHandler<M2C_CreateUnits>
 	{
 		protected override async ETTask Run(Session session, M2C_CreateUnits message)
-		{	
-			UnitComponent unitComponent = session.Domain.GetComponent<UnitComponent>();
+		{
+			Scene currentScene = session.DomainScene().CurrentScene();
+			UnitComponent unitComponent = currentScene.GetComponent<UnitComponent>();
 			
 			foreach (UnitInfo unitInfo in message.Units)
 			{
@@ -13,9 +14,8 @@
 				{
 					continue;
 				}
-				Unit unit = UnitFactory.Create(session.Domain, unitInfo);
+				Unit unit = UnitFactory.Create(currentScene, unitInfo);
 			}
-
 			await ETTask.CompletedTask;
 		}
 	}

+ 3 - 26
Unity/Codes/Hotfix/Demo/Unit/UnitComponent.cs

@@ -1,7 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace ET
+namespace ET
 {
 	[ObjectSystem]
 	public class UnitComponentAwakeSystem : AwakeSystem<UnitComponent>
@@ -16,12 +13,6 @@ namespace ET
 	{
 		public override void Destroy(UnitComponent self)
 		{
-			foreach (Unit unit in self.idUnits.Values)
-			{
-				unit.Dispose();
-			}
-
-			self.idUnits.Clear();
 		}
 	}
 	
@@ -29,32 +20,18 @@ namespace ET
 	{
 		public static void Add(this UnitComponent self, Unit unit)
 		{
-			self.idUnits.Add(unit.Id, unit);
 		}
 
 		public static Unit Get(this UnitComponent self, long id)
 		{
-			Unit unit;
-			self.idUnits.TryGetValue(id, out unit);
+			Unit unit = self.GetChild<Unit>(id);
 			return unit;
 		}
 
 		public static void Remove(this UnitComponent self, long id)
 		{
-			Unit unit;
-			self.idUnits.TryGetValue(id, out unit);
-			self.idUnits.Remove(id);
+			Unit unit = self.GetChild<Unit>(id);
 			unit?.Dispose();
 		}
-
-		public static void RemoveNoDispose(this UnitComponent self, long id)
-		{
-			self.idUnits.Remove(id);
-		}
-
-		public static Unit[] GetAll(this UnitComponent self)
-		{
-			return self.idUnits.Values.ToArray();
-		}
 	}
 }

+ 2 - 2
Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs

@@ -4,9 +4,9 @@ namespace ET
 {
     public static class UnitFactory
     {
-        public static Unit Create(Entity domain, UnitInfo unitInfo)
+        public static Unit Create(Scene currentScene, UnitInfo unitInfo)
         {
-	        UnitComponent unitComponent = domain.GetComponent<UnitComponent>();
+	        UnitComponent unitComponent = currentScene.GetComponent<UnitComponent>();
 	        Unit unit = unitComponent.AddChildWithId<Unit, int>(unitInfo.UnitId, unitInfo.ConfigId);
 	        unitComponent.Add(unit);
 	        

+ 10 - 3
Unity/Codes/Hotfix/Demo/Unit/UnitHelper.cs

@@ -2,10 +2,17 @@
 {
     public static class UnitHelper
     {
-        public static Unit GetMyUnit(Scene zoneScene)
+        public static Unit GetMyUnitFromZoneScene(Scene zoneScene)
         {
-            UnitComponent unitComponent = zoneScene.GetComponent<UnitComponent>();
-            return unitComponent.Get(unitComponent.MyId);
+            PlayerComponent playerComponent = zoneScene.GetComponent<PlayerComponent>();
+            Scene currentScene = zoneScene.GetComponent<CurrentScenesComponent>().Scene;
+            return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
+        }
+        
+        public static Unit GetMyUnitFromCurrentScene(Scene currentScene)
+        {
+            PlayerComponent playerComponent = currentScene.Parent.Parent.GetComponent<PlayerComponent>();
+            return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
         }
     }
 }

+ 3 - 1
Unity/Codes/HotfixView/AppStart_Init.cs

@@ -25,7 +25,9 @@ namespace ET
 
             Game.Scene.AddComponent<AIDispatcherComponent>();
             await ResourcesComponent.Instance.LoadBundleAsync("unit.unity3d");
-            Scene zoneScene = await SceneFactory.CreateZoneScene(1, "Game", Game.Scene);
+            
+            Scene zoneScene = SceneFactory.CreateZoneScene(1, "Game", Game.Scene);
+            
             await Game.EventSystem.PublishAsync(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
         }
     }

+ 13 - 0
Unity/Codes/HotfixView/Demo/Scene/AfterCreateCurrentScene_AddComponent.cs

@@ -0,0 +1,13 @@
+namespace ET
+{
+    public class AfterCreateCurrentScene_AddComponent: AEvent<EventType.AfterCreateCurrentScene>
+    {
+        protected override async ETTask Run(EventType.AfterCreateCurrentScene args)
+        {
+            Scene zoneScene = args.CurrentScene;
+            zoneScene.AddComponent<UIComponent>();
+            zoneScene.AddComponent<ResourcesLoaderComponent>();
+            await ETTask.CompletedTask;
+        }
+    }
+}

+ 1 - 0
Unity/Codes/HotfixView/Demo/Scene/AfterCreateZoneScene_AddComponent.cs

@@ -7,6 +7,7 @@ namespace ET
             Scene zoneScene = args.ZoneScene;
             zoneScene.AddComponent<UIEventComponent>();
             zoneScene.AddComponent<UIComponent>();
+            zoneScene.AddComponent<ResourcesLoaderComponent>();
             await ETTask.CompletedTask;
         }
     }

+ 32 - 0
Unity/Codes/HotfixView/Demo/Scene/SceneChangeStart_AddComponent.cs

@@ -0,0 +1,32 @@
+namespace ET
+{
+    public class SceneChangeStart_AddComponent: AEvent<EventType.SceneChangeStart>
+    {
+        protected override async ETTask Run(EventType.SceneChangeStart args)
+        {
+            await ETTask.CompletedTask;
+
+            Scene zoneScene = args.ZoneScene;
+            
+            // 加载场景资源
+            await ResourcesComponent.Instance.LoadBundleAsync("map.unity3d");
+            // 切换到map场景
+
+            SceneChangeComponent sceneChangeComponent = null;
+            try
+            {
+                sceneChangeComponent = Game.Scene.AddComponent<SceneChangeComponent>();
+                {
+                    await sceneChangeComponent.ChangeSceneAsync("Map");
+                }
+            }
+            finally
+            {
+                sceneChangeComponent?.Dispose();
+            }
+			
+
+            args.ZoneScene.AddComponent<OperaComponent>();
+        }
+    }
+}

+ 0 - 29
Unity/Codes/HotfixView/Demo/UI/UILobby/EnterMapFinish_RemoveLobbyUI.cs

@@ -1,29 +0,0 @@
-namespace ET
-{
-	public class EnterMapFinish_RemoveLobbyUI: AEvent<EventType.EnterMapFinish>
-	{
-		protected override async ETTask Run(EventType.EnterMapFinish args)
-		{
-			// 加载场景资源
-			await ResourcesComponent.Instance.LoadBundleAsync("map.unity3d");
-			// 切换到map场景
-
-			SceneChangeComponent sceneChangeComponent = null;
-			try
-			{
-				sceneChangeComponent = Game.Scene.AddComponent<SceneChangeComponent>();
-				{
-					await sceneChangeComponent.ChangeSceneAsync("Map");
-				}
-			}
-			finally
-			{
-				sceneChangeComponent?.Dispose();
-			}
-			
-
-            args.ZoneScene.AddComponent<OperaComponent>();
-            await UIHelper.Remove(args.ZoneScene, UIType.UILobby);
-		}
-	}
-}

+ 4 - 3
Unity/Codes/HotfixView/Demo/UI/UILobby/UILobbyComponentSystem.cs

@@ -11,16 +11,17 @@ namespace ET
             ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
 
             self.enterMap = rc.Get<GameObject>("EnterMap");
-            self.enterMap.GetComponent<Button>().onClick.AddListener(() => { self.EnterMap(); });
+            self.enterMap.GetComponent<Button>().onClick.AddListener(() => { self.EnterMap().Coroutine(); });
             self.text = rc.Get<GameObject>("Text").GetComponent<Text>();
         }
     }
 
     public static class UILobbyComponentSystem
     {
-        public static void EnterMap(this UILobbyComponent self)
+        public static async ETTask EnterMap(this UILobbyComponent self)
         {
-            EnterMapHelper.EnterMapAsync(self.ZoneScene()).Coroutine();
+            await EnterMapHelper.EnterMapAsync(self.ZoneScene());
+            await UIHelper.Remove(self.ZoneScene(), UIType.UILobby);
         }
     }
 }

+ 1 - 1
Unity/Codes/HotfixView/Demo/UI/UILobby/UILobbyEvent.cs

@@ -9,7 +9,7 @@ namespace ET
         public override async ETTask<UI> OnCreate(UIComponent uiComponent)
         {
             await ETTask.CompletedTask;
-            ResourcesComponent.Instance.LoadBundle(UIType.UILobby.StringToAB());
+            await uiComponent.Parent.GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILobby.StringToAB());
             GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILobby, gameObject);

+ 1 - 1
Unity/Codes/HotfixView/Demo/UI/UILogin/UILoginEvent.cs

@@ -8,7 +8,7 @@ namespace ET
     {
         public override async ETTask<UI> OnCreate(UIComponent uiComponent)
         {
-            await ResourcesComponent.Instance.LoadBundleAsync(UIType.UILogin.StringToAB());
+            await uiComponent.Parent.GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILogin.StringToAB());
             GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILogin, gameObject);

+ 1 - 0
Unity/Codes/Model/Core/Entity/SceneType.cs

@@ -15,5 +15,6 @@
 		Zone = 31,
 		Login = 32,
 		Robot = 33,
+		Current = 34,
 	}
 }

+ 8 - 0
Unity/Codes/Model/Core/Object/ITransfer.cs

@@ -0,0 +1,8 @@
+namespace ET
+{
+    // Unit的组件有这个接口说明需要传送
+    public interface ITransfer
+    {
+        
+    }
+}

+ 16 - 0
Unity/Codes/Model/Demo/EventType.cs

@@ -8,6 +8,17 @@ namespace ET
         {
         }
 
+        public struct SceneChangeStart
+        {
+            public Scene ZoneScene;
+        }
+        
+        
+        public struct SceneChangeFinish
+        {
+            public Scene ZoneScene;
+        }
+
         public struct ChangePosition
         {
             public Unit Unit;
@@ -30,6 +41,11 @@ namespace ET
             public Scene ZoneScene;
         }
         
+        public struct AfterCreateCurrentScene
+        {
+            public Scene CurrentScene;
+        }
+        
         public struct AfterCreateLoginScene
         {
             public Scene LoginScene;

+ 8 - 0
Unity/Codes/Model/Demo/Scene/CurrentScenesComponent.cs

@@ -0,0 +1,8 @@
+namespace ET
+{
+    // 可以用来管理多个客户端场景,比如大世界会加载多块场景
+    public class CurrentScenesComponent: Entity
+    {
+        public Scene Scene;
+    }
+}

+ 7 - 0
Unity/Codes/Model/Demo/Unit/PlayerComponent.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public class PlayerComponent: Entity
+    {
+        public long MyId;
+    }
+}

+ 1 - 6
Unity/Codes/Model/Demo/Unit/UnitComponent.cs

@@ -1,11 +1,6 @@
-using System.Collections.Generic;
-
-namespace ET
+namespace ET
 {
-	
 	public class UnitComponent: Entity
 	{
-		public Dictionary<long, Unit> idUnits = new Dictionary<long, Unit>();
-		public long MyId;
 	}
 }

+ 11 - 0
Unity/Codes/Model/Demo/WaitType.cs

@@ -10,5 +10,16 @@
                 set;
             }
         }
+        
+        public struct Wait_CreateMyUnit: IWaitType
+        {
+            public int Error
+            {
+                get;
+                set;
+            }
+
+            public M2C_CreateMyUnit Message;
+        }
     }
 }

+ 32 - 8
Unity/Codes/Model/Generate/Message/OuterMessage.cs

@@ -67,7 +67,7 @@ namespace ET
 	[ProtoContract]
 	public partial class C2G_EnterMap: Object, IRequest
 	{
-		[ProtoMember(90)]
+		[ProtoMember(1)]
 		public int RpcId { get; set; }
 
 	}
@@ -76,19 +76,25 @@ namespace ET
 	[ProtoContract]
 	public partial class G2C_EnterMap: Object, IResponse
 	{
-		[ProtoMember(90)]
+		[ProtoMember(1)]
 		public int RpcId { get; set; }
 
-		[ProtoMember(91)]
+		[ProtoMember(2)]
 		public int Error { get; set; }
 
-		[ProtoMember(92)]
+		[ProtoMember(3)]
 		public string Message { get; set; }
 
 // 自己unit
-		[ProtoMember(1)]
+		[ProtoMember(4)]
 		public long MyId { get; set; }
 
+		[ProtoMember(5)]
+		public string MapName { get; set; }
+
+		[ProtoMember(6)]
+		public long SceneInstanceId { get; set; }
+
 	}
 
 	[Message(OuterOpcode.MoveInfo)]
@@ -167,14 +173,32 @@ namespace ET
 	[ProtoContract]
 	public partial class M2C_CreateUnits: Object, IActorMessage
 	{
-		[ProtoMember(90)]
-		public int RpcId { get; set; }
-
 		[ProtoMember(2)]
 		public List<UnitInfo> Units = new List<UnitInfo>();
 
 	}
 
+	[Message(OuterOpcode.M2C_CreateMyUnit)]
+	[ProtoContract]
+	public partial class M2C_CreateMyUnit: Object, IActorMessage
+	{
+		[ProtoMember(1)]
+		public UnitInfo Unit { get; set; }
+
+	}
+
+	[Message(OuterOpcode.M2C_StartSceneChange)]
+	[ProtoContract]
+	public partial class M2C_StartSceneChange: Object, IActorMessage
+	{
+		[ProtoMember(1)]
+		public long SceneInstanceId { get; set; }
+
+		[ProtoMember(2)]
+		public string SceneName { get; set; }
+
+	}
+
 	[Message(OuterOpcode.M2C_RemoveUnits)]
 	[ProtoContract]
 	public partial class M2C_RemoveUnits: Object, IActorMessage

+ 19 - 17
Unity/Codes/Model/Generate/Message/OuterOpcode.cs

@@ -11,22 +11,24 @@ namespace ET
 		 public const ushort MoveInfo = 10008;
 		 public const ushort UnitInfo = 10009;
 		 public const ushort M2C_CreateUnits = 10010;
-		 public const ushort M2C_RemoveUnits = 10011;
-		 public const ushort C2M_PathfindingResult = 10012;
-		 public const ushort C2M_Stop = 10013;
-		 public const ushort M2C_PathfindingResult = 10014;
-		 public const ushort M2C_Stop = 10015;
-		 public const ushort C2G_Ping = 10016;
-		 public const ushort G2C_Ping = 10017;
-		 public const ushort G2C_Test = 10018;
-		 public const ushort C2M_Reload = 10019;
-		 public const ushort M2C_Reload = 10020;
-		 public const ushort C2R_Login = 10021;
-		 public const ushort R2C_Login = 10022;
-		 public const ushort C2G_LoginGate = 10023;
-		 public const ushort G2C_LoginGate = 10024;
-		 public const ushort G2C_TestHotfixMessage = 10025;
-		 public const ushort C2M_TestRobotCase = 10026;
-		 public const ushort M2C_TestRobotCase = 10027;
+		 public const ushort M2C_CreateMyUnit = 10011;
+		 public const ushort M2C_StartSceneChange = 10012;
+		 public const ushort M2C_RemoveUnits = 10013;
+		 public const ushort C2M_PathfindingResult = 10014;
+		 public const ushort C2M_Stop = 10015;
+		 public const ushort M2C_PathfindingResult = 10016;
+		 public const ushort M2C_Stop = 10017;
+		 public const ushort C2G_Ping = 10018;
+		 public const ushort G2C_Ping = 10019;
+		 public const ushort G2C_Test = 10020;
+		 public const ushort C2M_Reload = 10021;
+		 public const ushort M2C_Reload = 10022;
+		 public const ushort C2R_Login = 10023;
+		 public const ushort R2C_Login = 10024;
+		 public const ushort C2G_LoginGate = 10025;
+		 public const ushort G2C_LoginGate = 10026;
+		 public const ushort G2C_TestHotfixMessage = 10027;
+		 public const ushort C2M_TestRobotCase = 10028;
+		 public const ushort M2C_TestRobotCase = 10029;
 	}
 }

+ 21 - 13
Unity/Codes/Model/Module/Message/MessageSerializeHelper.cs

@@ -25,24 +25,32 @@ namespace ET
 
         public static void SerializeTo(ushort opcode, object obj, MemoryStream memoryStream)
         {
-            if (opcode < OpcodeRangeDefine.PbMaxOpcode)
+            try
             {
-                ProtobufHelper.ToStream(obj, memoryStream);
-                return;
-            }
+                if (opcode < OpcodeRangeDefine.PbMaxOpcode)
+                {
+                    ProtobufHelper.ToStream(obj, memoryStream);
+                    return;
+                }
 
-            if (opcode >= OpcodeRangeDefine.JsonMinOpcode)
-            {
-                string s = JsonHelper.ToJson(obj);
-                byte[] bytes = s.ToUtf8();
-                memoryStream.Write(bytes, 0, bytes.Length);
-                return;
-            }
+                if (opcode >= OpcodeRangeDefine.JsonMinOpcode)
+                {
+                    string s = JsonHelper.ToJson(obj);
+                    byte[] bytes = s.ToUtf8();
+                    memoryStream.Write(bytes, 0, bytes.Length);
+                    return;
+                }
 #if NOT_UNITY
-            MongoHelper.ToStream(obj, memoryStream);
+                MongoHelper.ToStream(obj, memoryStream);
 #else
-            throw new Exception($"client no message: {opcode}");
+                throw new Exception($"client no message: {opcode}");
 #endif
+            }
+            catch (Exception e)
+            {
+                throw new Exception($"SerializeTo error: {opcode}", e);
+            }
+
         }
 
         public static MemoryStream GetStream(int count = 0)

+ 4 - 1
Unity/Codes/Model/Module/Numeric/NumericComponent.cs

@@ -1,4 +1,6 @@
 using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+using MongoDB.Bson.Serialization.Options;
 
 namespace ET
 {
@@ -22,8 +24,9 @@ namespace ET
 		}
 	}
 
-	public class NumericComponent: Entity
+	public class NumericComponent: Entity, ITransfer
 	{
+		[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
 		public Dictionary<int, long> NumericDic = new Dictionary<int, long>();
 
 		public void Awake()

+ 2 - 2
Unity/Unity.Mono.csproj

@@ -72,8 +72,6 @@
      <Compile Include="Assets\Mono\ILRuntime\Generate\System_BitConverter_Binding.cs" />
      <Compile Include="Assets\Mono\Core\Helper\NetworkHelper.cs" />
      <Compile Include="Assets\Mono\Core\DoubleMap.cs" />
-     <Compile Include="Assets\Mono\Module\NetworkTCP\WChannel.cs" />
-     <Compile Include="Assets\Mono\Module\NetworkTCP\WService.cs" />
      <Compile Include="Assets\Mono\MonoBehaviour\Init.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding_t3.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\System_Collections_Generic_Dictionary_2_Type_ILTypeInstance_Binding_V.cs" />
@@ -152,6 +150,7 @@
      <Compile Include="Assets\Mono\ILRuntime\Generate\ET_ComponentView_Binding.cs" />
      <Compile Include="Assets\Mono\ILRuntime\IDisposableAdapter.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\ET_NetworkHelper_Binding.cs" />
+     <Compile Include="Assets\Mono\Module\NetworkTCP\WChannel.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\ET_ErrorCore_Binding.cs" />
      <Compile Include="Assets\Mono\MonoBehaviour\UILayerScript.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\System_Collections_Generic_Dictionary_2_Int32_ILTypeInstance_Binding__t2.cs" />
@@ -276,6 +275,7 @@
      <Compile Include="Assets\Mono\MonoBehaviour\ComponentView.cs" />
      <Compile Include="Assets\Mono\Core\Options.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\ET_ETTask_1_AssetBundle_Binding.cs" />
+     <Compile Include="Assets\Mono\Module\NetworkTCP\WService.cs" />
      <Compile Include="Assets\Mono\MonoBehaviour\CanvasConfig.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\UnityEngine_Resources_Binding.cs" />
      <Compile Include="Assets\Mono\ILRuntime\Generate\System_Collections_Generic_SortedDictionary_2_Int64_List_1_ILTypeInst.cs" />