Przeglądaj źródła

通过NetInner纤程实现进程间消息通信

tanghai 2 lat temu
rodzic
commit
8ca4004d8a
68 zmienionych plików z 348 dodań i 343 usunięć
  1. 4 2
      DotNet/App/Program.cs
  2. 2 1
      Unity/Assets/Scripts/Core/Entity/SceneType.cs
  3. 1 0
      Unity/Assets/Scripts/Core/Fiber/Fiber.cs
  4. 1 1
      Unity/Assets/Scripts/Core/Object/MessageObject.cs
  5. 6 0
      Unity/Assets/Scripts/Core/World/ActorId.cs
  6. 3 3
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs
  7. 2 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_XunLuo.cs
  8. 6 6
      Unity/Assets/Scripts/Hotfix/Client/Demo/Login/EnterMapHelper.cs
  9. 10 10
      Unity/Assets/Scripts/Hotfix/Client/Demo/Login/LoginHelper.cs
  10. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_PathfindingResultHandler.cs
  11. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_StopHandler.cs
  12. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/MoveHelper.cs
  13. 4 4
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs
  14. 11 11
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs
  15. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/M2C_StartSceneChangeHandler.cs
  16. 8 8
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneChangeHelper.cs
  17. 7 7
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneFactory.cs
  18. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_CreateUnitsHandler.cs
  19. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_RemoveUnitsHandler.cs
  20. 4 4
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitHelper.cs
  21. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs
  22. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs
  23. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs
  24. 3 3
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs
  25. 17 17
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs
  26. 3 3
      Unity/Assets/Scripts/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs
  27. 5 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs
  28. 26 18
      Unity/Assets/Scripts/Hotfix/Server/Demo/EntryEvent2_InitServer.cs
  29. 3 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_FirstCase.cs
  30. 4 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_SecondCase.cs
  31. 1 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs
  32. 6 12
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotCaseSystem.cs
  33. 3 3
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotManagerComponentSystem.cs
  34. 4 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs
  35. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/SceneFactory.cs
  36. 16 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs
  37. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs.meta
  38. 1 3
      Unity/Assets/Scripts/Hotfix/Share/Demo/EntryEvent1_InitShare.cs
  39. 20 0
      Unity/Assets/Scripts/Hotfix/Share/FiberInit_Main.cs
  40. 1 1
      Unity/Assets/Scripts/Hotfix/Share/FiberInit_Main.cs.meta
  41. 16 8
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorSenderComponentSystem.cs
  42. 0 22
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ClientSceneManagerComponentSystem.cs
  43. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs
  44. 0 17
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ServerSceneManagerComponentSystem.cs
  45. 0 11
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ServerSceneManagerComponentSystem.cs.meta
  46. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/EntryEvent3_InitClient.cs
  47. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs
  48. 4 4
      Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/SceneChangeStart_AddComponent.cs
  49. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelper.cs
  50. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs
  51. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs
  52. 2 2
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs
  53. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs
  54. 1 1
      Unity/Assets/Scripts/Model/Client/Demo/Router/RouterAddressComponent.cs
  55. 1 1
      Unity/Assets/Scripts/Model/Client/Demo/Session/SessionComponent.cs
  56. 1 1
      Unity/Assets/Scripts/Model/Client/Demo/Unit/PlayerComponent.cs
  57. 1 1
      Unity/Assets/Scripts/Model/Client/Module/Message/NetClientComponent.cs
  58. 24 24
      Unity/Assets/Scripts/Model/Generate/Client/Message/LockStepOuter_C_11001.cs
  59. 72 72
      Unity/Assets/Scripts/Model/Generate/Client/Message/OuterMessage_C_10001.cs
  60. 1 1
      Unity/Assets/Scripts/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs
  61. 1 1
      Unity/Assets/Scripts/Model/Server/Demo/Robot/RobotManagerComponent.cs
  62. 9 0
      Unity/Assets/Scripts/Model/Share/ConstFiberId.cs
  63. 1 1
      Unity/Assets/Scripts/Model/Share/ConstFiberId.cs.meta
  64. 1 13
      Unity/Assets/Scripts/Model/Share/Entry.cs
  65. 8 0
      Unity/Assets/Scripts/Model/Share/Module/Actor/ActorSenderComponent.cs
  66. 0 9
      Unity/Assets/Scripts/Model/Share/Module/Scene/ClientSceneManagerComponent.cs
  67. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Scene/CurrentScenesComponent.cs
  68. 0 9
      Unity/Assets/Scripts/Model/Share/Module/Scene/ServerSceneManagerComponent.cs

+ 4 - 2
DotNet/App/Program.cs

@@ -17,13 +17,15 @@ namespace ET
             Entry.Init();
             Init.Start();
             
+            FiberManager.MainThreadScheduler mainThreadScheduler = FiberManager.MainThreadScheduler.Instance;
+            
             while (true)
             {
                 Thread.Sleep(1);
                 try
                 {
-                    FiberManager.MainThreadScheduler.Instance.Update();
-                    FiberManager.MainThreadScheduler.Instance.LateUpdate();
+                    mainThreadScheduler.Update();
+                    mainThreadScheduler.LateUpdate();
                 }
                 catch (Exception e)
                 {

+ 2 - 1
Unity/Assets/Scripts/Core/Entity/SceneType.cs

@@ -23,7 +23,8 @@ namespace ET
 		Room = 1 << 15,
 		LockStepClient = 1 << 16,
 		LockStepServer = 1 << 17,
-		Main = 1 << 18,
+		Main = 1 << 18, // 主纤程,一个进程一个, 初始化从这里开始
+		NetInner = 1 << 19,  // 负责进程间消息通信
 
 		// 客户端
 		Demo = 1 << 30,

+ 1 - 0
Unity/Assets/Scripts/Core/Fiber/Fiber.cs

@@ -36,6 +36,7 @@ namespace ET
         
         public IScene Root { get; set; }
         public SceneType SceneType { get; set; }
+        public int Zone { get; set; }
         
         public int Process { get; private set; }
         

+ 1 - 1
Unity/Assets/Scripts/Core/Object/MessageObject.cs

@@ -4,7 +4,7 @@ using MongoDB.Bson.Serialization.Attributes;
 
 namespace ET
 {
-    public abstract class MessageObject: ProtoObject, IDisposable
+    public abstract class MessageObject: ProtoObject, IMessage, IDisposable
     {
         public virtual void Dispose()
         {

+ 6 - 0
Unity/Assets/Scripts/Core/World/ActorId.cs

@@ -101,6 +101,12 @@ namespace ET
             }
         }
         
+        public ActorId(int process, int fiber)
+        {
+            this.Address = new Address(process, fiber);
+            this.InstanceId = 1;
+        }
+        
         public ActorId(int process, int fiber, long instanceId)
         {
             this.Address = new Address(process, fiber);

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs

@@ -14,16 +14,16 @@ namespace ET.Client
 
         public override async ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken)
         {
-            Scene clientScene = aiComponent.Scene();
+            Fiber fiber = aiComponent.Fiber();
 
-            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(clientScene);
+            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(fiber);
             if (myUnit == null)
             {
                 return;
             }
 
             // 停在当前位置
-            clientScene.GetComponent<SessionComponent>().Session.Send(new C2M_Stop());
+            fiber.GetComponent<SessionComponent>().Session.Send(new C2M_Stop());
             
             Log.Debug("开始攻击");
 

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_XunLuo.cs

@@ -16,9 +16,9 @@ namespace ET.Client
 
         public override async ETTask Execute(AIComponent aiComponent, AIConfig aiConfig, ETCancellationToken cancellationToken)
         {
-            Scene clientScene = aiComponent.Scene();
+            Fiber fiber = aiComponent.Fiber();
 
-            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(clientScene);
+            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(fiber);
             if (myUnit == null)
             {
                 return;

+ 6 - 6
Unity/Assets/Scripts/Hotfix/Client/Demo/Login/EnterMapHelper.cs

@@ -5,16 +5,16 @@ namespace ET.Client
 {
     public static partial class EnterMapHelper
     {
-        public static async ETTask EnterMapAsync(Scene clientScene)
+        public static async ETTask EnterMapAsync(Fiber fiber)
         {
             try
             {
-                G2C_EnterMap g2CEnterMap = await clientScene.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
+                G2C_EnterMap g2CEnterMap = await fiber.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
                 
                 // 等待场景切换完成
-                await clientScene.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
+                await fiber.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
                 
-                EventSystem.Instance.Publish(clientScene, new EventType.EnterMapFinish());
+                EventSystem.Instance.Publish(fiber, new EventType.EnterMapFinish());
             }
             catch (Exception e)
             {
@@ -22,11 +22,11 @@ namespace ET.Client
             }	
         }
         
-        public static async ETTask Match(Scene clientScene)
+        public static async ETTask Match(Fiber fiber)
         {
             try
             {
-                G2C_Match g2CEnterMap = await clientScene.GetComponent<SessionComponent>().Session.Call(new C2G_Match()) as G2C_Match;
+                G2C_Match g2CEnterMap = await fiber.GetComponent<SessionComponent>().Session.Call(new C2G_Match()) as G2C_Match;
             }
             catch (Exception e)
             {

+ 10 - 10
Unity/Assets/Scripts/Hotfix/Client/Demo/Login/LoginHelper.cs

@@ -6,41 +6,41 @@ namespace ET.Client
 {
     public static partial class LoginHelper
     {
-        public static async ETTask Login(Scene clientScene, string account, string password)
+        public static async ETTask Login(Fiber fiber, string account, string password)
         {
             try
             {
                 // 创建一个ETModel层的Session
-                clientScene.RemoveComponent<RouterAddressComponent>();
+                fiber.RemoveComponent<RouterAddressComponent>();
                 // 获取路由跟realmDispatcher地址
-                RouterAddressComponent routerAddressComponent = clientScene.GetComponent<RouterAddressComponent>();
+                RouterAddressComponent routerAddressComponent = fiber.GetComponent<RouterAddressComponent>();
                 if (routerAddressComponent == null)
                 {
-                    routerAddressComponent = clientScene.AddComponent<RouterAddressComponent, string, int>(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort);
+                    routerAddressComponent = fiber.AddComponent<RouterAddressComponent, string, int>(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort);
                     await routerAddressComponent.Init();
                     
-                    clientScene.AddComponent<NetClientComponent, AddressFamily>(routerAddressComponent.RouterManagerIPAddress.AddressFamily);
+                    fiber.AddComponent<NetClientComponent, AddressFamily>(routerAddressComponent.RouterManagerIPAddress.AddressFamily);
                 }
                 IPEndPoint realmAddress = routerAddressComponent.GetRealmAddress(account);
                 
                 R2C_Login r2CLogin;
-                using (Session session = await RouterHelper.CreateRouterSession(clientScene, realmAddress))
+                using (Session session = await RouterHelper.CreateRouterSession(fiber, realmAddress))
                 {
                     r2CLogin = (R2C_Login) await session.Call(new C2R_Login() { Account = account, Password = password });
                 }
 
                 // 创建一个gate Session,并且保存到SessionComponent中
-                Session gateSession = await RouterHelper.CreateRouterSession(clientScene, NetworkHelper.ToIPEndPoint(r2CLogin.Address));
-                clientScene.AddComponent<SessionComponent>().Session = gateSession;
+                Session gateSession = await RouterHelper.CreateRouterSession(fiber, NetworkHelper.ToIPEndPoint(r2CLogin.Address));
+                fiber.AddComponent<SessionComponent>().Session = gateSession;
 				
                 G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(
                     new C2G_LoginGate() { Key = r2CLogin.Key, GateId = r2CLogin.GateId});
                 
-                clientScene.GetComponent<PlayerComponent>().MyId = g2CLoginGate.PlayerId;
+                fiber.GetComponent<PlayerComponent>().MyId = g2CLoginGate.PlayerId;
 
                 Log.Debug("登陆gate成功!");
 
-                await EventSystem.Instance.PublishAsync(clientScene, new EventType.LoginFinish());
+                await EventSystem.Instance.PublishAsync(fiber, new EventType.LoginFinish());
             }
             catch (Exception e)
             {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_PathfindingResultHandler.cs

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

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_StopHandler.cs

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

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Move/MoveHelper.cs

@@ -10,7 +10,7 @@ namespace ET.Client
         public static async ETTask<int> MoveToAsync(this Unit unit, float3 targetPos, ETCancellationToken cancellationToken = null)
         {
             C2M_PathfindingResult msg = new C2M_PathfindingResult() { Position = targetPos };
-            unit.ClientScene().GetComponent<SessionComponent>().Session.Send(msg);
+            unit.Fiber().GetComponent<SessionComponent>().Session.Send(msg);
 
             ObjectWait objectWait = unit.GetComponent<ObjectWait>();
             

+ 4 - 4
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs

@@ -44,16 +44,16 @@ namespace ET.Client
                     (uint localConn, uint remoteConn) = session.AService.GetChannelConn(sessionId);
                     
                     IPEndPoint realAddress = self.GetParent<Session>().RemoteAddress;
-                    Log.Info($"get recvLocalConn start: {self.ClientScene().Id} {realAddress} {localConn} {remoteConn}");
+                    Log.Info($"get recvLocalConn start: {fiber.Id} {realAddress} {localConn} {remoteConn}");
 
-                    (uint recvLocalConn, IPEndPoint routerAddress) = await RouterHelper.GetRouterAddress(self.ClientScene(), realAddress, localConn, remoteConn);
+                    (uint recvLocalConn, IPEndPoint routerAddress) = await RouterHelper.GetRouterAddress(self.Fiber(), realAddress, localConn, remoteConn);
                     if (recvLocalConn == 0)
                     {
-                        Log.Error($"get recvLocalConn fail: {self.ClientScene().Id} {routerAddress} {realAddress} {localConn} {remoteConn}");
+                        Log.Error($"get recvLocalConn fail: {fiber.Id} {routerAddress} {realAddress} {localConn} {remoteConn}");
                         continue;
                     }
                     
-                    Log.Info($"get recvLocalConn ok: {self.ClientScene().Id} {routerAddress} {realAddress} {recvLocalConn} {localConn} {remoteConn}");
+                    Log.Info($"get recvLocalConn ok: {fiber.Id} {routerAddress} {realAddress} {recvLocalConn} {localConn} {remoteConn}");
                     
                     session.LastRecvTime = TimeHelper.ClientNow();
                     

+ 11 - 11
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs

@@ -7,39 +7,39 @@ namespace ET.Client
     public static partial class RouterHelper
     {
         // 注册router
-        public static async ETTask<Session> CreateRouterSession(Scene clientScene, IPEndPoint address)
+        public static async ETTask<Session> CreateRouterSession(Fiber fiber, IPEndPoint address)
         {
-            (uint recvLocalConn, IPEndPoint routerAddress) = await GetRouterAddress(clientScene, address, 0, 0);
+            (uint recvLocalConn, IPEndPoint routerAddress) = await GetRouterAddress(fiber, address, 0, 0);
 
             if (recvLocalConn == 0)
             {
-                throw new Exception($"get router fail: {clientScene.Id} {address}");
+                throw new Exception($"get router fail: {fiber.Id} {address}");
             }
             
             Log.Info($"get router: {recvLocalConn} {routerAddress}");
 
-            Session routerSession = clientScene.GetComponent<NetClientComponent>().Create(routerAddress, address, recvLocalConn);
+            Session routerSession = fiber.GetComponent<NetClientComponent>().Create(routerAddress, address, recvLocalConn);
             routerSession.AddComponent<PingComponent>();
             routerSession.AddComponent<RouterCheckComponent>();
             
             return routerSession;
         }
         
-        public static async ETTask<(uint, IPEndPoint)> GetRouterAddress(Scene clientScene, IPEndPoint address, uint localConn, uint remoteConn)
+        public static async ETTask<(uint, IPEndPoint)> GetRouterAddress(Fiber fiber, IPEndPoint address, uint localConn, uint remoteConn)
         {
-            Log.Info($"start get router address: {clientScene.Id} {address} {localConn} {remoteConn}");
+            Log.Info($"start get router address: {fiber.Id} {address} {localConn} {remoteConn}");
             //return (RandomHelper.RandUInt32(), address);
-            RouterAddressComponent routerAddressComponent = clientScene.GetComponent<RouterAddressComponent>();
+            RouterAddressComponent routerAddressComponent = fiber.GetComponent<RouterAddressComponent>();
             IPEndPoint routerInfo = routerAddressComponent.GetAddress();
             
-            uint recvLocalConn = await Connect(clientScene, routerInfo, address, localConn, remoteConn);
+            uint recvLocalConn = await Connect(fiber, routerInfo, address, localConn, remoteConn);
             
-            Log.Info($"finish get router address: {clientScene.Id} {address} {localConn} {remoteConn} {recvLocalConn} {routerInfo}");
+            Log.Info($"finish get router address: {fiber.Id} {address} {localConn} {remoteConn} {recvLocalConn} {routerInfo}");
             return (recvLocalConn, routerInfo);
         }
 
         // 向router申请
-        private static async ETTask<uint> Connect(Scene clientScene, IPEndPoint routerAddress, IPEndPoint realAddress, uint localConn, uint remoteConn)
+        private static async ETTask<uint> Connect(Fiber fiber, IPEndPoint routerAddress, IPEndPoint realAddress, uint localConn, uint remoteConn)
         {
             uint connectId = RandomGenerator.RandUInt32();
             
@@ -78,7 +78,7 @@ namespace ET.Client
                     socket.SendTo(sendCache, 0, addressBytes.Length + 13, SocketFlags.None, routerAddress);
                 }
                     
-                await clientScene.Fiber().GetComponent<TimerComponent>().WaitFrameAsync();
+                await fiber.GetComponent<TimerComponent>().WaitFrameAsync();
                     
                 // 接收
                 if (socket.Available > 0)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/M2C_StartSceneChangeHandler.cs

@@ -5,7 +5,7 @@
 	{
 		protected override async ETTask Run(Session session, M2C_StartSceneChange message)
 		{
-			await SceneChangeHelper.SceneChangeTo(session.ClientScene(), message.SceneName, message.SceneInstanceId);
+			await SceneChangeHelper.SceneChangeTo(session.Fiber(), message.SceneName, message.SceneInstanceId);
 		}
 	}
 }

+ 8 - 8
Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneChangeHelper.cs

@@ -3,27 +3,27 @@
     public static partial class SceneChangeHelper
     {
         // 场景切换协程
-        public static async ETTask SceneChangeTo(Scene clientScene, string sceneName, long sceneInstanceId)
+        public static async ETTask SceneChangeTo(Fiber fiber, string sceneName, long sceneInstanceId)
         {
-            clientScene.RemoveComponent<AIComponent>();
+            fiber.RemoveComponent<AIComponent>();
             
-            CurrentScenesComponent currentScenesComponent = clientScene.GetComponent<CurrentScenesComponent>();
+            CurrentScenesComponent currentScenesComponent = fiber.GetComponent<CurrentScenesComponent>();
             currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
-            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, clientScene.Zone, sceneName, currentScenesComponent);
+            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, fiber.Zone, sceneName, currentScenesComponent);
             UnitComponent unitComponent = currentScene.AddComponent<UnitComponent>();
          
             // 可以订阅这个事件中创建Loading界面
-            EventSystem.Instance.Publish(clientScene, new EventType.SceneChangeStart());
+            EventSystem.Instance.Publish(fiber, new EventType.SceneChangeStart());
             // 等待CreateMyUnit的消息
-            Wait_CreateMyUnit waitCreateMyUnit = await clientScene.GetComponent<ObjectWait>().Wait<Wait_CreateMyUnit>();
+            Wait_CreateMyUnit waitCreateMyUnit = await fiber.GetComponent<ObjectWait>().Wait<Wait_CreateMyUnit>();
             M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;
             Unit unit = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);
             unitComponent.Add(unit);
-            clientScene.RemoveComponent<AIComponent>();
+            fiber.RemoveComponent<AIComponent>();
             
             EventSystem.Instance.Publish(currentScene, new EventType.SceneChangeFinish());
             // 通知等待场景切换的协程
-            clientScene.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
+            fiber.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
         }
     }
 }

+ 7 - 7
Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneFactory.cs

@@ -2,17 +2,17 @@ namespace ET.Client
 {
     public static partial class SceneFactory
     {
-        public static async ETTask<Scene> CreateClientScene(Fiber fiber, int zone, SceneType sceneType, string name)
+        public static async ETTask<Scene> CreateClientFiber(Fiber fiber, int zone, SceneType sceneType, string name)
         {
             await ETTask.CompletedTask;
             
-            Scene clientScene = EntitySceneFactory.CreateScene(zone, sceneType, name, fiber.GetComponent<ClientSceneManagerComponent>());
-            clientScene.AddComponent<ObjectWait>();
-            clientScene.AddComponent<PlayerComponent>();
-            clientScene.AddComponent<CurrentScenesComponent>();
+            //Scene clientScene = EntitySceneFactory.CreateScene(zone, sceneType, name, );
+            //clientScene.AddComponent<ObjectWait>();
+            //clientScene.AddComponent<PlayerComponent>();
+            //clientScene.AddComponent<CurrentScenesComponent>();
             
-            EventSystem.Instance.Publish(clientScene, new EventType.AfterCreateClientScene());
-            return clientScene;
+            //EventSystem.Instance.Publish(clientScene, new EventType.AfterCreateClientScene());
+            return null;
         }
         
         public static Scene CreateCurrentScene(long id, int zone, string name, CurrentScenesComponent currentScenesComponent)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_CreateUnitsHandler.cs

@@ -5,7 +5,7 @@
 	{
 		protected override async ETTask Run(Session session, M2C_CreateUnits message)
 		{
-			Scene currentScene = session.Scene().CurrentScene();
+			Scene currentScene = session.Fiber().CurrentScene();
 			UnitComponent unitComponent = currentScene.GetComponent<UnitComponent>();
 			
 			foreach (UnitInfo unitInfo in message.Units)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_RemoveUnitsHandler.cs

@@ -5,7 +5,7 @@
 	{
 		protected override async ETTask Run(Session session, M2C_RemoveUnits message)
 		{	
-			UnitComponent unitComponent = session.Scene().CurrentScene()?.GetComponent<UnitComponent>();
+			UnitComponent unitComponent = session.Fiber().CurrentScene()?.GetComponent<UnitComponent>();
 			if (unitComponent == null)
 			{
 				return;

+ 4 - 4
Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitHelper.cs

@@ -2,16 +2,16 @@
 {
     public static partial class UnitHelper
     {
-        public static Unit GetMyUnitFromClientScene(Scene clientScene)
+        public static Unit GetMyUnitFromClientScene(Fiber fiber)
         {
-            PlayerComponent playerComponent = clientScene.GetComponent<PlayerComponent>();
-            Scene currentScene = clientScene.GetComponent<CurrentScenesComponent>().Scene;
+            PlayerComponent playerComponent = fiber.GetComponent<PlayerComponent>();
+            Scene currentScene = fiber.GetComponent<CurrentScenesComponent>().Scene;
             return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
         }
         
         public static Unit GetMyUnitFromCurrentScene(Scene currentScene)
         {
-            PlayerComponent playerComponent = currentScene.Parent.GetParent<Scene>().GetComponent<PlayerComponent>();
+            PlayerComponent playerComponent = currentScene.Parent.GetParent<Fiber>().GetComponent<PlayerComponent>();
             return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs

@@ -5,7 +5,7 @@ namespace ET.Client
     {
         protected override async ETTask Run(Session session, Match2G_NotifyMatchSuccess message)
         {
-            await LSSceneChangeHelper.SceneChangeTo(session.Scene(), "Map1", message.ActorId.InstanceId);
+            await LSSceneChangeHelper.SceneChangeTo(session.Fiber(), "Map1", message.ActorId.InstanceId);
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs

@@ -5,7 +5,7 @@
     {
         protected override async ETTask Run(Session session, G2C_Reconnect message)
         {
-            await LSSceneChangeHelper.SceneChangeToReconnect(session.ClientScene(), message);
+            await LSSceneChangeHelper.SceneChangeToReconnect(session.Fiber(), message);
             await ETTask.CompletedTask;
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs

@@ -66,7 +66,7 @@ namespace ET
             C2Room_CheckHash c2RoomCheckHash = C2Room_CheckHash.Create(true);
             c2RoomCheckHash.Frame = frame;
             c2RoomCheckHash.Hash = hash;
-            self.GetParent<Scene>().GetComponent<SessionComponent>().Session.Send(c2RoomCheckHash);
+            self.GetParent<Fiber>().GetComponent<SessionComponent>().Session.Send(c2RoomCheckHash);
         }
         
         // 重新调整预测消息,只需要调整其他玩家的输入

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs

@@ -10,7 +10,7 @@ namespace ET.Client
         private static void Awake(this LSClientUpdater self)
         {
             Room room = self.GetParent<Room>();
-            self.MyId = room.GetParent<Scene>().GetComponent<PlayerComponent>().MyId;
+            self.MyId = room.GetParent<Fiber>().GetComponent<PlayerComponent>().MyId;
         }
         
         [EntitySystem]
@@ -18,7 +18,7 @@ namespace ET.Client
         {
             Room room = self.GetParent<Room>();
             long timeNow = TimeHelper.ServerNow();
-            Scene clientScene = room.GetParent<Scene>();
+            Fiber fiber = room.GetParent<Fiber>();
 
             int i = 0;
             while (true)
@@ -45,7 +45,7 @@ namespace ET.Client
                 FrameMessage frameMessage = FrameMessage.Create(true);
                 frameMessage.Frame = room.PredictionFrame;
                 frameMessage.Input = self.Input;
-                clientScene.GetComponent<SessionComponent>().Session.Send(frameMessage);
+                fiber.GetComponent<SessionComponent>().Session.Send(frameMessage);
                 
                 long timeNow2 = TimeHelper.ServerNow();
                 if (timeNow2 - timeNow > 5)

+ 17 - 17
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs

@@ -4,20 +4,20 @@ namespace ET.Client
     public static partial class LSSceneChangeHelper
     {
         // 场景切换协程
-        public static async ETTask SceneChangeTo(Scene clientScene, string sceneName, long sceneInstanceId)
+        public static async ETTask SceneChangeTo(Fiber fiber, string sceneName, long sceneInstanceId)
         {
-            clientScene.RemoveComponent<Room>();
+            fiber.RemoveComponent<Room>();
 
-            Room room = clientScene.AddComponentWithId<Room>(sceneInstanceId);
+            Room room = fiber.AddComponentWithId<Room>(sceneInstanceId);
             room.Name = sceneName;
 
             // 等待表现层订阅的事件完成
-            await EventSystem.Instance.PublishAsync(clientScene, new EventType.LSSceneChangeStart() {Room = room});
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.LSSceneChangeStart() {Room = room});
 
-            clientScene.GetComponent<SessionComponent>().Session.Send(new C2Room_ChangeSceneFinish());
+            fiber.GetComponent<SessionComponent>().Session.Send(new C2Room_ChangeSceneFinish());
             
             // 等待Room2C_EnterMap消息
-            WaitType.Wait_Room2C_Start waitRoom2CStart = await clientScene.GetComponent<ObjectWait>().Wait<WaitType.Wait_Room2C_Start>();
+            WaitType.Wait_Room2C_Start waitRoom2CStart = await fiber.GetComponent<ObjectWait>().Wait<WaitType.Wait_Room2C_Start>();
 
             room.LSWorld = new LSWorld(SceneType.LockStepClient);
             room.Init(waitRoom2CStart.Message.UnitInfo, waitRoom2CStart.Message.StartTime);
@@ -25,15 +25,15 @@ namespace ET.Client
             room.AddComponent<LSClientUpdater>();
 
             // 这个事件中可以订阅取消loading
-            EventSystem.Instance.Publish(clientScene, new EventType.LSSceneInitFinish());
+            EventSystem.Instance.Publish(fiber, new EventType.LSSceneInitFinish());
         }
         
         // 场景切换协程
-        public static async ETTask SceneChangeToReplay(Scene clientScene, Replay replay)
+        public static async ETTask SceneChangeToReplay(Fiber fiber, Replay replay)
         {
-            clientScene.RemoveComponent<Room>();
+            fiber.RemoveComponent<Room>();
 
-            Room room = clientScene.AddComponent<Room>();
+            Room room = fiber.AddComponent<Room>();
             room.Name = "Map1";
             room.IsReplay = true;
             room.Replay = replay;
@@ -41,32 +41,32 @@ namespace ET.Client
             room.Init(replay.UnitInfos, TimeHelper.ServerFrameTime());
             
             // 等待表现层订阅的事件完成
-            await EventSystem.Instance.PublishAsync(clientScene, new EventType.LSSceneChangeStart() {Room = room});
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.LSSceneChangeStart() {Room = room});
             
 
             room.AddComponent<LSReplayUpdater>();
             // 这个事件中可以订阅取消loading
-            EventSystem.Instance.Publish(clientScene, new EventType.LSSceneInitFinish());
+            EventSystem.Instance.Publish(fiber, new EventType.LSSceneInitFinish());
         }
         
         // 场景切换协程
-        public static async ETTask SceneChangeToReconnect(Scene clientScene, G2C_Reconnect message)
+        public static async ETTask SceneChangeToReconnect(Fiber fiber, G2C_Reconnect message)
         {
-            clientScene.RemoveComponent<Room>();
+            fiber.RemoveComponent<Room>();
 
-            Room room = clientScene.AddComponent<Room>();
+            Room room = fiber.AddComponent<Room>();
             room.Name = "Map1";
             
             room.LSWorld = new LSWorld(SceneType.LockStepClient);
             room.Init(message.UnitInfos, message.StartTime, message.Frame);
             
             // 等待表现层订阅的事件完成
-            await EventSystem.Instance.PublishAsync(clientScene, new EventType.LSSceneChangeStart() {Room = room});
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.LSSceneChangeStart() {Room = room});
 
 
             room.AddComponent<LSClientUpdater>();
             // 这个事件中可以订阅取消loading
-            EventSystem.Instance.Publish(clientScene, new EventType.LSSceneInitFinish());
+            EventSystem.Instance.Publish(fiber, new EventType.LSSceneInitFinish());
         }
     }
 }

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs

@@ -6,14 +6,14 @@ namespace ET.Client
         protected override async ETTask Run(Session session, Room2C_CheckHashFail message)
         {
             LSWorld serverWorld = MongoHelper.Deserialize(typeof(LSWorld), message.LSWorldBytes, 0, message.LSWorldBytes.Length) as LSWorld;
-            using (session.ClientScene().AddChild(serverWorld))
+            using (session.Fiber().AddChild(serverWorld))
             {
                 Log.Debug($"check hash fail, server: {message.Frame} {serverWorld.ToJson()}");
             }
 
-            Room room = session.ClientScene().GetComponent<Room>();
+            Room room = session.Fiber().GetComponent<Room>();
             LSWorld clientWorld = room.GetLSWorld(SceneType.LockStepClient, message.Frame);
-            using (session.ClientScene().AddChild(clientWorld))
+            using (session.Fiber().AddChild(clientWorld))
             {
                 Log.Debug($"check hash fail, client: {message.Frame} {clientWorld.ToJson()}");
             }

+ 5 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Benchmark/BenchmarkClientComponentSystem.cs

@@ -17,8 +17,12 @@ namespace ET.Server
 
         private static async ETTask Start(this BenchmarkClientComponent self)
         {
+            await ETTask.CompletedTask;
+            /*
             await self.Fiber().GetComponent<TimerComponent>().WaitAsync(1000);
 
+            
+            
             Scene scene = await SceneFactory.CreateServerScene(self, self.Fiber().IdGenerater.GenerateId(), self.Fiber().IdGenerater.GenerateInstanceId(),
                 self.DomainZone(), "bechmark", SceneType.Benchmark);
             
@@ -41,6 +45,7 @@ namespace ET.Server
                 }
                 await ETTaskHelper.WaitAll(list);
             }
+            */
         }
     }
 }

+ 26 - 18
Unity/Assets/Scripts/Hotfix/Server/Demo/EntryEvent2_InitServer.cs

@@ -2,43 +2,51 @@ using System.Net;
 
 namespace ET.Server
 {
-    [Event(SceneType.Process)]
+    [Event(SceneType.Main)]
     public class EntryEvent2_InitServer: AEvent<Fiber, ET.EventType.EntryEvent2>
     {
         protected override async ETTask Run(Fiber fiber, ET.EventType.EntryEvent2 args)
         {
+            await ETTask.CompletedTask;
+            
             // 发送普通actor消息
-            fiber.AddComponent<ActorSenderComponent>();
-            // 发送location actor消息
-            fiber.AddComponent<ActorLocationSenderComponent>();
-            // 访问location server的组件
-            fiber.AddComponent<LocationProxyComponent>();
-            ServerSceneManagerComponent serverSceneManagerComponent = fiber.AddComponent<ServerSceneManagerComponent>();
-            fiber.AddComponent<RobotCaseComponent>();
-            fiber.AddComponent<NavmeshComponent>();
+            //fiber.AddComponent<ActorSenderComponent>();
+            //// 发送location actor消息
+            //fiber.AddComponent<ActorLocationSenderComponent>();
+            //// 访问location server的组件
+            //fiber.AddComponent<LocationProxyComponent>();
+            //fiber.AddComponent<RobotCaseComponent>();
+            //fiber.AddComponent<NavmeshComponent>();
 
-            StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(fiber.Process);
             switch (Options.Instance.AppType)
             {
                 case AppType.Server:
                 {
-                    fiber.AddComponent<NetInnerComponent, IPEndPoint>(processConfig.InnerIPPort);
-
+                    FiberManager.ThreadPoolScheduler threadPoolScheduler = World.Instance.AddSingleton<FiberManager.ThreadPoolScheduler, int>(10);
+                    
+                    // 创建进程通信纤程
+                    int fiberId = FiberManager.Instance.Create(ConstFiberId.NetInner, SceneType.NetInner);
+                    threadPoolScheduler.Add(fiberId);
+                    
+                    // 根据配置创建纤程
                     var processScenes = StartSceneConfigCategory.Instance.GetByProcess(fiber.Process);
                     foreach (StartSceneConfig startConfig in processScenes)
                     {
-                        await SceneFactory.CreateServerScene(serverSceneManagerComponent, startConfig.Id, startConfig.ActorId.InstanceId, startConfig.Zone, startConfig.Name,
-                            startConfig.Type, startConfig);
+                        fiberId = FiberManager.Instance.Create(startConfig.Id, startConfig.Type);
+                        threadPoolScheduler.Add(fiberId);
+                        
+                        //await SceneFactory.CreateServerScene(serverSceneManagerComponent, startConfig.Id, startConfig.ActorId.InstanceId, startConfig.Zone, startConfig.Name,
+                        //    startConfig.Type, startConfig);
                     }
 
                     break;
                 }
                 case AppType.Watcher:
                 {
-                    StartMachineConfig startMachineConfig = WatcherHelper.GetThisMachineConfig();
-                    WatcherComponent watcherComponent = fiber.AddComponent<WatcherComponent>();
-                    watcherComponent.Start(Options.Instance.CreateScenes);
-                    fiber.AddComponent<NetInnerComponent, IPEndPoint>(NetworkHelper.ToIPEndPoint($"{startMachineConfig.InnerIP}:{startMachineConfig.WatcherPort}"));
+                    //StartMachineConfig startMachineConfig = WatcherHelper.GetThisMachineConfig();
+                    //WatcherComponent watcherComponent = fiber.AddComponent<WatcherComponent>();
+                    //watcherComponent.Start(Options.Instance.CreateScenes);
+                    //fiber.AddComponent<NetInnerComponent, IPEndPoint>(NetworkHelper.ToIPEndPoint($"{startMachineConfig.InnerIP}:{startMachineConfig.WatcherPort}"));
                     break;
                 }
                 case AppType.GameTool:

+ 3 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_FirstCase.cs

@@ -7,6 +7,8 @@ namespace ET.Server
     {
         protected override async ETTask Run(RobotCase robotCase)
         {
+            await ETTask.CompletedTask;
+            /*
             using ListComponent<Scene> robots = ListComponent<Scene>.Create();
             
             // 创建了两个机器人,生命周期是RobotCase,RobotCase_FirstCase.Run执行结束,机器人就会删除
@@ -21,6 +23,7 @@ namespace ET.Server
                     throw new Exception($"robot case: {RobotCaseType.FirstCase} run fail!");
                 }
             }
+            */
         }
     }
 }

+ 4 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_SecondCase.cs

@@ -7,7 +7,7 @@ namespace ET.Server
     {
         protected override async ETTask Run(Session session, M2C_TestRobotCase2 message)
         {
-            ObjectWait objectWait = session.ClientScene().GetComponent<ObjectWait>();
+            ObjectWait objectWait = session.Fiber().GetComponent<ObjectWait>();
             if (objectWait == null)
             {
                 return;
@@ -22,6 +22,8 @@ namespace ET.Server
     {
         protected override async ETTask Run(RobotCase robotCase)
         {
+            await ETTask.CompletedTask;
+            /*
             // 创建了1个机器人,生命周期是RobotCase
             Scene robotScene = await robotCase.NewRobot(1);
 
@@ -32,6 +34,7 @@ namespace ET.Server
             {
                 throw new Exception($"robot case: {RobotCaseType.SecondCase} run fail!");
             }
+            */
         }
     }
 }

+ 1 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs

@@ -39,8 +39,7 @@ namespace ET.Server
                         {
                             int index = i % thisProcessRobotScenes.Count;
                             StartSceneConfig robotSceneConfig = thisProcessRobotScenes[index];
-                            Scene robotScene = fiber.GetComponent<ServerSceneManagerComponent>().Get(robotSceneConfig.Id);
-                            RobotManagerComponent robotManagerComponent = robotScene.GetComponent<RobotManagerComponent>();
+                            RobotManagerComponent robotManagerComponent = fiber.GetComponent<RobotManagerComponent>();
                             Scene robot = await robotManagerComponent.NewRobot(Options.Instance.Process * 10000 + i);
                             robot.AddComponent<AIComponent, int>(1);
                             Log.Console($"create robot {robot.Zone}");

+ 6 - 12
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotCaseSystem.cs

@@ -13,12 +13,6 @@ namespace ET.Server
             {
                 return;
             }
-
-            ClientSceneManagerComponent clientSceneManagerComponent = root.GetComponent<ClientSceneManagerComponent>();
-            foreach (long id in self.Scenes)
-            {
-                clientSceneManagerComponent.Remove(id);
-            }
         }
 
         // 创建机器人,生命周期是RobotCase
@@ -80,9 +74,9 @@ namespace ET.Server
             Scene clientScene = null;
             try
             {
-                clientScene = await Client.SceneFactory.CreateClientScene(self.Fiber(), zone, SceneType.Robot, name);
-                await Client.LoginHelper.Login(clientScene, zone.ToString(), zone.ToString());
-                await Client.EnterMapHelper.EnterMapAsync(clientScene);
+                clientScene = await Client.SceneFactory.CreateClientFiber(self.Fiber(), zone, SceneType.Robot, name);
+                await Client.LoginHelper.Login(self.Fiber(), zone.ToString(), zone.ToString());
+                await Client.EnterMapHelper.EnterMapAsync(self.Fiber());
                 Log.Debug($"create robot ok: {zone}");
                 self.Scenes.Add(clientScene.Id);
                 return clientScene;
@@ -101,9 +95,9 @@ namespace ET.Server
 
             try
             {
-                clientScene = await Client.SceneFactory.CreateClientScene(self.Fiber(), zone, SceneType.Robot, $"Robot_{zone}");
-                await Client.LoginHelper.Login(clientScene, zone.ToString(), zone.ToString());
-                await Client.EnterMapHelper.EnterMapAsync(clientScene);
+                clientScene = await Client.SceneFactory.CreateClientFiber(self.Fiber(), zone, SceneType.Robot, $"Robot_{zone}");
+                await Client.LoginHelper.Login(self.Fiber(), zone.ToString(), zone.ToString());
+                await Client.EnterMapHelper.EnterMapAsync(self.Fiber());
                 Log.Debug($"create robot ok: {zone}");
                 self.Scenes.Add(clientScene.Id);
                 return clientScene;

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotManagerComponentSystem.cs

@@ -10,9 +10,9 @@ namespace ET.Server
             Scene clientScene = null;
             try
             {
-                clientScene = await Client.SceneFactory.CreateClientScene(self.Fiber(), zone, SceneType.Robot, "Robot");
-                await Client.LoginHelper.Login(clientScene, zone.ToString(), zone.ToString());
-                await Client.EnterMapHelper.EnterMapAsync(clientScene);
+                clientScene = await Client.SceneFactory.CreateClientFiber(self.Fiber(), zone, SceneType.Robot, "Robot");
+                await Client.LoginHelper.Login(self.Fiber(), zone.ToString(), zone.ToString());
+                await Client.EnterMapHelper.EnterMapAsync(self.Fiber());
                 Log.Debug($"create robot ok: {zone}");
                 return clientScene;
             }

+ 4 - 0
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Scene/RobotSceneFactory.cs

@@ -12,6 +12,7 @@ namespace ET.Server
             StartSceneConfig startSceneConfig = null
         )
         {
+            /*
             await ETTask.CompletedTask;
             Log.Info($"create scene: {sceneType} {name} {zone}");
             Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent);
@@ -26,6 +27,9 @@ namespace ET.Server
             }
 
             return scene;
+            */
+            await ETTask.CompletedTask;
+            return null;
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/SceneFactory.cs

@@ -40,7 +40,7 @@ namespace ET.Server
                     scene.AddComponent<LocationManagerComoponent>();
                     break;
                 case SceneType.Robot:
-                    scene.AddComponent<RobotManagerComponent>();
+                    //scene.AddComponent<RobotManagerComponent>();
                     break;
                 case SceneType.BenchmarkServer:
                     scene.AddComponent<BenchmarkServerComponent>();

+ 16 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs

@@ -0,0 +1,16 @@
+namespace ET.Server
+{
+    [ActorMessageHandler(SceneType.NetInner)]
+    public class A2NetInner_MessageHandler: ActorMessageHandler<Fiber, A2NetInner_Message>
+    {
+        protected override async ETTask Run(Fiber fiber, A2NetInner_Message message)
+        {
+            int process = message.ActorId.Process;
+            Session session = fiber.GetComponent<NetInnerComponent>().Get(process);
+            ActorId actorId = message.ActorId;
+            actorId.Address = message.FromAddress;
+            session.Send(actorId, message.MessageObject);
+            await ETTask.CompletedTask;
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Scene/ClientSceneManagerComponent.cs.meta → Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 0a009f7eebcd16e4d9694f47e79d7280
+guid: 4359315e8c3f08048a63d07d17a65fae
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 3
Unity/Assets/Scripts/Hotfix/Share/Demo/EntryEvent1_InitShare.cs

@@ -1,12 +1,10 @@
 namespace ET
 {
-    [Event(SceneType.Process)]
+    [Event(SceneType.Main)]
     public class EntryEvent1_InitShare: AEvent<Fiber, EventType.EntryEvent1>
     {
         protected override async ETTask Run(Fiber scene, EventType.EntryEvent1 args)
         {
-            scene.AddComponent<ClientSceneManagerComponent>();
-
             await ETTask.CompletedTask;
         }
     }

+ 20 - 0
Unity/Assets/Scripts/Hotfix/Share/FiberInit_Main.cs

@@ -0,0 +1,20 @@
+namespace ET
+{
+    [Invoke((long)SceneType.Main)]
+    public class FiberInit_Main: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            HandleAsync(fiberInit).Coroutine();
+        }
+
+        private async ETTask HandleAsync(FiberInit fiberInit)
+        {
+            Fiber fiber = fiberInit.Fiber;
+
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.EntryEvent1());
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.EntryEvent2());
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.EntryEvent3());
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ClientSceneManagerComponentSystem.cs.meta → Unity/Assets/Scripts/Hotfix/Share/FiberInit_Main.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 798a03fd68bac0b449ce48e4cdf231bf
+guid: 62d95081b9d849642bd346348b28c3ee
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 16 - 8
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorSenderComponentSystem.cs

@@ -89,26 +89,34 @@ namespace ET
             self.TimeoutActorMessageSenders.Clear();
         }
         
-        public static void Reply(this ActorSenderComponent self, Address fromAddress, IMessage message)
+        public static void Reply(this ActorSenderComponent self, Address fromAddress, IActorResponse message)
         {
-            self.Send(new ActorId(fromAddress, 0), message);
+            self.SendInner(new ActorId(fromAddress, 0), message as MessageObject);
         }
 
-        public static void Send(this ActorSenderComponent self, ActorId actorId, IMessage message)
+        public static void Send(this ActorSenderComponent self, ActorId actorId, IActorMessage message)
+        {
+            self.SendInner(actorId, message as MessageObject);
+        }
+
+        private static void SendInner(this ActorSenderComponent self, ActorId actorId, MessageObject message)
         {
             if (actorId == default)
             {
                 throw new Exception($"actor id is 0: {message}");
             }
-            
+
+            Fiber fiber = self.Fiber();
             // 如果发向同一个进程,则扔到消息队列中
-            if (actorId.Process == self.Fiber().Process)
+            if (actorId.Process == fiber.Process)
             {
-                ActorMessageQueue.Instance.Send(self.Fiber().Address, actorId, message as MessageObject);
+                ActorMessageQueue.Instance.Send(self.Fiber().Address, actorId, message);
                 return;
             }
-            
+
+            A2NetInner_Message netInnerMessage = new() { FromAddress = fiber.Address, ActorId = actorId, MessageObject = message };
             // 扔到NetInner纤程
+            ActorMessageQueue.Instance.Send(new ActorId(actorId.Process, ConstFiberId.NetInner), netInnerMessage);
         }
 
 
@@ -152,7 +160,7 @@ namespace ET
             
             self.requestCallback.Add(rpcId, new ActorMessageSender(actorId, iActorRequest, tcs, needException));
             
-            self.Send(actorId, iActorRequest);
+            self.SendInner(actorId, iActorRequest as MessageObject);
 
             long beginTime = TimeHelper.ServerFrameTime();
             IActorResponse response = await tcs;

+ 0 - 22
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ClientSceneManagerComponentSystem.cs

@@ -1,22 +0,0 @@
-namespace ET
-{
-    [FriendOf(typeof(ClientSceneManagerComponent))]
-    public static partial class ClientSceneManagerComponentSystem
-    {
-        public static Scene ClientScene(this Entity entity)
-        {
-            return entity.Fiber().GetComponent<ClientSceneManagerComponent>().Get(entity.DomainZone());
-        }
-        
-        public static Scene Get(this ClientSceneManagerComponent self, long id)
-        {
-            Scene scene = self.GetChild<Scene>(id);
-            return scene;
-        }
-        
-        public static void Remove(this ClientSceneManagerComponent self, long id)
-        {
-            self.RemoveChild(id);
-        }
-    }
-}

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs

@@ -4,9 +4,9 @@ namespace ET
 {
     public static partial class CurrentScenesComponentSystem
     {
-        public static Scene  CurrentScene(this Scene clientScene)
+        public static Scene CurrentScene(this Fiber fiber)
         {
-            return clientScene.GetComponent<CurrentScenesComponent>()?.Scene;
+            return fiber.GetComponent<CurrentScenesComponent>()?.Scene;
         }
     }
 }

+ 0 - 17
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ServerSceneManagerComponentSystem.cs

@@ -1,17 +0,0 @@
-namespace ET
-{
-    [FriendOf(typeof(ServerSceneManagerComponent))]
-    public static partial class ServerSceneManagerComponentSystem
-    {
-        public static Scene Get(this ServerSceneManagerComponent self, int id)
-        {
-            Scene scene = self.GetChild<Scene>(id);
-            return scene;
-        }
-        
-        public static void Remove(this ServerSceneManagerComponent self, int id)
-        {
-            self.RemoveChild(id);
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Hotfix/Share/Module/Scene/ServerSceneManagerComponentSystem.cs.meta

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

+ 2 - 2
Unity/Assets/Scripts/HotfixView/Client/Demo/EntryEvent3_InitClient.cs

@@ -3,7 +3,7 @@ using System.IO;
 
 namespace ET.Client
 {
-    [Event(SceneType.Process)]
+    [Event(SceneType.Main)]
     public class EntryEvent3_InitClient: AEvent<Fiber, ET.EventType.EntryEvent3>
     {
         protected override async ETTask Run(Fiber fiber, ET.EventType.EntryEvent3 args)
@@ -19,7 +19,7 @@ namespace ET.Client
 
             SceneType sceneType = EnumHelper.FromString<SceneType>(globalComponent.GlobalConfig.AppType.ToString());
             
-            Scene clientScene = await SceneFactory.CreateClientScene(fiber, 1, sceneType, sceneType.ToString());
+            Scene clientScene = await SceneFactory.CreateClientFiber(fiber, 1, sceneType, sceneType.ToString());
             
             await EventSystem.Instance.PublishAsync(clientScene, new EventType.AppStartInitFinish());
         }

+ 2 - 2
Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs

@@ -23,7 +23,7 @@ namespace ET.Client
                 {
                     C2M_PathfindingResult c2MPathfindingResult = new C2M_PathfindingResult();
                     c2MPathfindingResult.Position = hit.point;
-                    self.ClientScene().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
+                    self.Fiber().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
                 }
             }
 
@@ -36,7 +36,7 @@ namespace ET.Client
             if (Input.GetKeyDown(KeyCode.T))
             {
                 C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
-                self.ClientScene().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
+                self.Fiber().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
             }
         }
     }

+ 4 - 4
Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/SceneChangeStart_AddComponent.cs

@@ -3,13 +3,13 @@ using UnityEngine.SceneManagement;
 namespace ET.Client
 {
     [Event(SceneType.Demo)]
-    public class SceneChangeStart_AddComponent: AEvent<Scene, EventType.SceneChangeStart>
+    public class SceneChangeStart_AddComponent: AEvent<Fiber, EventType.SceneChangeStart>
     {
-        protected override async ETTask Run(Scene scene, EventType.SceneChangeStart args)
+        protected override async ETTask Run(Fiber fiber, EventType.SceneChangeStart args)
         {
-            Scene currentScene = scene.CurrentScene();
+            Scene currentScene = fiber.CurrentScene();
 
-            ResourcesComponent resourcesComponent = scene.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = fiber.GetComponent<ResourcesComponent>();
             
             // 加载场景资源
             await resourcesComponent.LoadBundleAsync($"{currentScene.Name}.unity3d");

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelper.cs

@@ -8,7 +8,7 @@
             return await scene.GetComponent<UIComponent>().Create(uiType, uiLayer);
         }
         
-        public static async ETTask Remove(Scene scene, string uiType)
+        public static async ETTask Remove(Entity scene, string uiType)
         {
             scene.GetComponent<UIComponent>().Remove(uiType);
             await ETTask.CompletedTask;

+ 2 - 2
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs

@@ -17,8 +17,8 @@ namespace ET.Client
         
         public static async ETTask EnterMap(this UILobbyComponent self)
         {
-            await EnterMapHelper.EnterMapAsync(self.ClientScene());
-            await UIHelper.Remove(self.ClientScene(), UIType.UILobby);
+            await EnterMapHelper.EnterMapAsync(self.Fiber());
+            await UIHelper.Remove(self.Fiber(), UIType.UILobby);
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs

@@ -21,7 +21,7 @@ namespace ET.Client
 		public static void OnLogin(this UILoginComponent self)
 		{
 			LoginHelper.Login(
-				self.Scene(), 
+				self.Fiber(), 
 				self.account.GetComponent<InputField>().text, 
 				self.password.GetComponent<InputField>().text).Coroutine();
 		}

+ 2 - 2
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs

@@ -25,7 +25,7 @@ namespace ET.Client
 
         private static async ETTask EnterMap(this UILSLobbyComponent self)
         {
-            await EnterMapHelper.Match(self.ClientScene());
+            await EnterMapHelper.Match(self.Fiber());
         }
         
         private static void Replay(this UILSLobbyComponent self)
@@ -34,7 +34,7 @@ namespace ET.Client
             
             Replay replay = MemoryPackHelper.Deserialize(typeof (Replay), bytes, 0, bytes.Length) as Replay;
             Log.Debug($"start replay: {replay.Snapshots.Count} {replay.FrameInputs.Count} {replay.UnitInfos.Count}");
-            LSSceneChangeHelper.SceneChangeToReplay(self.ClientScene(), replay).Coroutine();
+            LSSceneChangeHelper.SceneChangeToReplay(self.Fiber(), replay).Coroutine();
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs

@@ -22,7 +22,7 @@ namespace ET.Client
         public static void OnLogin(this UILSLoginComponent self)
         {
             LoginHelper.Login(
-                self.Scene(),
+                self.Fiber(),
                 self.account.GetComponent<InputField>().text,
                 self.password.GetComponent<InputField>().text).Coroutine();
         }

+ 1 - 1
Unity/Assets/Scripts/Model/Client/Demo/Router/RouterAddressComponent.cs

@@ -4,7 +4,7 @@ using System.Net.Sockets;
 
 namespace ET.Client
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(Fiber))]
     public class RouterAddressComponent: Entity, IAwake<string, int>
     {
         public IPAddress RouterManagerIPAddress { get; set; }

+ 1 - 1
Unity/Assets/Scripts/Model/Client/Demo/Session/SessionComponent.cs

@@ -1,6 +1,6 @@
 namespace ET.Client
 {
-	[ComponentOf(typeof(Scene))]
+	[ComponentOf(typeof(Fiber))]
 	public class SessionComponent: Entity, IAwake, IDestroy
 	{
 		private EntityRef<Session> session;

+ 1 - 1
Unity/Assets/Scripts/Model/Client/Demo/Unit/PlayerComponent.cs

@@ -1,6 +1,6 @@
 namespace ET.Client
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(Fiber))]
     public class PlayerComponent: Entity, IAwake
     {
         public long MyId { get; set; }

+ 1 - 1
Unity/Assets/Scripts/Model/Client/Module/Message/NetClientComponent.cs

@@ -8,7 +8,7 @@ namespace ET.Client
         public object Message;
     }
     
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(Fiber))]
     public class NetClientComponent: Entity, IAwake<AddressFamily>, IDestroy
     {
         public AService AService;

+ 24 - 24
Unity/Assets/Scripts/Model/Generate/Client/Message/LockStepOuter_C_11001.cs

@@ -8,9 +8,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2G_Match: MessageObject, IRequest
 	{
-		public static C2G_Match Create(bool isFromPool = false) { return !isFromPool? new C2G_Match() : NetServices.Instance.FetchMessage(typeof(C2G_Match)) as C2G_Match; }
+		public static C2G_Match Create(bool isFromPool = false) { return !isFromPool? new C2G_Match() : ObjectPool.Instance.Fetch(typeof(C2G_Match)) as C2G_Match; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -21,9 +21,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_Match: MessageObject, IResponse
 	{
-		public static G2C_Match Create(bool isFromPool = false) { return !isFromPool? new G2C_Match() : NetServices.Instance.FetchMessage(typeof(G2C_Match)) as G2C_Match; }
+		public static G2C_Match Create(bool isFromPool = false) { return !isFromPool? new G2C_Match() : ObjectPool.Instance.Fetch(typeof(G2C_Match)) as G2C_Match; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -41,9 +41,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class Match2G_NotifyMatchSuccess: MessageObject, IActorMessage
 	{
-		public static Match2G_NotifyMatchSuccess Create(bool isFromPool = false) { return !isFromPool? new Match2G_NotifyMatchSuccess() : NetServices.Instance.FetchMessage(typeof(Match2G_NotifyMatchSuccess)) as Match2G_NotifyMatchSuccess; }
+		public static Match2G_NotifyMatchSuccess Create(bool isFromPool = false) { return !isFromPool? new Match2G_NotifyMatchSuccess() : ObjectPool.Instance.Fetch(typeof(Match2G_NotifyMatchSuccess)) as Match2G_NotifyMatchSuccess; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -59,9 +59,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2Room_ChangeSceneFinish: MessageObject, IActorRoom
 	{
-		public static C2Room_ChangeSceneFinish Create(bool isFromPool = false) { return !isFromPool? new C2Room_ChangeSceneFinish() : NetServices.Instance.FetchMessage(typeof(C2Room_ChangeSceneFinish)) as C2Room_ChangeSceneFinish; }
+		public static C2Room_ChangeSceneFinish Create(bool isFromPool = false) { return !isFromPool? new C2Room_ChangeSceneFinish() : ObjectPool.Instance.Fetch(typeof(C2Room_ChangeSceneFinish)) as C2Room_ChangeSceneFinish; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long PlayerId { get; set; }
@@ -72,9 +72,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class LockStepUnitInfo: MessageObject
 	{
-		public static LockStepUnitInfo Create(bool isFromPool = false) { return !isFromPool? new LockStepUnitInfo() : NetServices.Instance.FetchMessage(typeof(LockStepUnitInfo)) as LockStepUnitInfo; }
+		public static LockStepUnitInfo Create(bool isFromPool = false) { return !isFromPool? new LockStepUnitInfo() : ObjectPool.Instance.Fetch(typeof(LockStepUnitInfo)) as LockStepUnitInfo; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long PlayerId { get; set; }
@@ -92,9 +92,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class Room2C_Start: MessageObject, IActorMessage
 	{
-		public static Room2C_Start Create(bool isFromPool = false) { return !isFromPool? new Room2C_Start() : NetServices.Instance.FetchMessage(typeof(Room2C_Start)) as Room2C_Start; }
+		public static Room2C_Start Create(bool isFromPool = false) { return !isFromPool? new Room2C_Start() : ObjectPool.Instance.Fetch(typeof(Room2C_Start)) as Room2C_Start; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long StartTime { get; set; }
@@ -108,9 +108,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class FrameMessage: MessageObject, IActorMessage
 	{
-		public static FrameMessage Create(bool isFromPool = false) { return !isFromPool? new FrameMessage() : NetServices.Instance.FetchMessage(typeof(FrameMessage)) as FrameMessage; }
+		public static FrameMessage Create(bool isFromPool = false) { return !isFromPool? new FrameMessage() : ObjectPool.Instance.Fetch(typeof(FrameMessage)) as FrameMessage; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int Frame { get; set; }
@@ -127,9 +127,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class OneFrameInputs: MessageObject, IActorMessage
 	{
-		public static OneFrameInputs Create(bool isFromPool = false) { return !isFromPool? new OneFrameInputs() : NetServices.Instance.FetchMessage(typeof(OneFrameInputs)) as OneFrameInputs; }
+		public static OneFrameInputs Create(bool isFromPool = false) { return !isFromPool? new OneFrameInputs() : ObjectPool.Instance.Fetch(typeof(OneFrameInputs)) as OneFrameInputs; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MongoDB.Bson.Serialization.Attributes.BsonDictionaryOptions(MongoDB.Bson.Serialization.Options.DictionaryRepresentation.ArrayOfArrays)]
 		[MemoryPackOrder(1)]
@@ -140,9 +140,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class Room2C_AdjustUpdateTime: MessageObject, IActorMessage
 	{
-		public static Room2C_AdjustUpdateTime Create(bool isFromPool = false) { return !isFromPool? new Room2C_AdjustUpdateTime() : NetServices.Instance.FetchMessage(typeof(Room2C_AdjustUpdateTime)) as Room2C_AdjustUpdateTime; }
+		public static Room2C_AdjustUpdateTime Create(bool isFromPool = false) { return !isFromPool? new Room2C_AdjustUpdateTime() : ObjectPool.Instance.Fetch(typeof(Room2C_AdjustUpdateTime)) as Room2C_AdjustUpdateTime; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int DiffTime { get; set; }
@@ -153,9 +153,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2Room_CheckHash: MessageObject, IActorRoom
 	{
-		public static C2Room_CheckHash Create(bool isFromPool = false) { return !isFromPool? new C2Room_CheckHash() : NetServices.Instance.FetchMessage(typeof(C2Room_CheckHash)) as C2Room_CheckHash; }
+		public static C2Room_CheckHash Create(bool isFromPool = false) { return !isFromPool? new C2Room_CheckHash() : ObjectPool.Instance.Fetch(typeof(C2Room_CheckHash)) as C2Room_CheckHash; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long PlayerId { get; set; }
@@ -172,9 +172,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class Room2C_CheckHashFail: MessageObject, IActorMessage
 	{
-		public static Room2C_CheckHashFail Create(bool isFromPool = false) { return !isFromPool? new Room2C_CheckHashFail() : NetServices.Instance.FetchMessage(typeof(Room2C_CheckHashFail)) as Room2C_CheckHashFail; }
+		public static Room2C_CheckHashFail Create(bool isFromPool = false) { return !isFromPool? new Room2C_CheckHashFail() : ObjectPool.Instance.Fetch(typeof(Room2C_CheckHashFail)) as Room2C_CheckHashFail; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int Frame { get; set; }
@@ -188,9 +188,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_Reconnect: MessageObject, IActorMessage
 	{
-		public static G2C_Reconnect Create(bool isFromPool = false) { return !isFromPool? new G2C_Reconnect() : NetServices.Instance.FetchMessage(typeof(G2C_Reconnect)) as G2C_Reconnect; }
+		public static G2C_Reconnect Create(bool isFromPool = false) { return !isFromPool? new G2C_Reconnect() : ObjectPool.Instance.Fetch(typeof(G2C_Reconnect)) as G2C_Reconnect; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long StartTime { get; set; }

+ 72 - 72
Unity/Assets/Scripts/Model/Generate/Client/Message/OuterMessage_C_10001.cs

@@ -7,9 +7,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class HttpGetRouterResponse: MessageObject
 	{
-		public static HttpGetRouterResponse Create(bool isFromPool = false) { return !isFromPool? new HttpGetRouterResponse() : NetServices.Instance.FetchMessage(typeof(HttpGetRouterResponse)) as HttpGetRouterResponse; }
+		public static HttpGetRouterResponse Create(bool isFromPool = false) { return !isFromPool? new HttpGetRouterResponse() : ObjectPool.Instance.Fetch(typeof(HttpGetRouterResponse)) as HttpGetRouterResponse; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public List<string> Realms { get; set; }
@@ -23,9 +23,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class RouterSync: MessageObject
 	{
-		public static RouterSync Create(bool isFromPool = false) { return !isFromPool? new RouterSync() : NetServices.Instance.FetchMessage(typeof(RouterSync)) as RouterSync; }
+		public static RouterSync Create(bool isFromPool = false) { return !isFromPool? new RouterSync() : ObjectPool.Instance.Fetch(typeof(RouterSync)) as RouterSync; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public uint ConnectId { get; set; }
@@ -40,9 +40,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_TestRequest: MessageObject, IActorLocationRequest
 	{
-		public static C2M_TestRequest Create(bool isFromPool = false) { return !isFromPool? new C2M_TestRequest() : NetServices.Instance.FetchMessage(typeof(C2M_TestRequest)) as C2M_TestRequest; }
+		public static C2M_TestRequest Create(bool isFromPool = false) { return !isFromPool? new C2M_TestRequest() : ObjectPool.Instance.Fetch(typeof(C2M_TestRequest)) as C2M_TestRequest; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -56,9 +56,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_TestResponse: MessageObject, IActorResponse
 	{
-		public static M2C_TestResponse Create(bool isFromPool = false) { return !isFromPool? new M2C_TestResponse() : NetServices.Instance.FetchMessage(typeof(M2C_TestResponse)) as M2C_TestResponse; }
+		public static M2C_TestResponse Create(bool isFromPool = false) { return !isFromPool? new M2C_TestResponse() : ObjectPool.Instance.Fetch(typeof(M2C_TestResponse)) as M2C_TestResponse; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -79,9 +79,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class Actor_TransferRequest: MessageObject, IActorLocationRequest
 	{
-		public static Actor_TransferRequest Create(bool isFromPool = false) { return !isFromPool? new Actor_TransferRequest() : NetServices.Instance.FetchMessage(typeof(Actor_TransferRequest)) as Actor_TransferRequest; }
+		public static Actor_TransferRequest Create(bool isFromPool = false) { return !isFromPool? new Actor_TransferRequest() : ObjectPool.Instance.Fetch(typeof(Actor_TransferRequest)) as Actor_TransferRequest; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -95,9 +95,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class Actor_TransferResponse: MessageObject, IActorLocationResponse
 	{
-		public static Actor_TransferResponse Create(bool isFromPool = false) { return !isFromPool? new Actor_TransferResponse() : NetServices.Instance.FetchMessage(typeof(Actor_TransferResponse)) as Actor_TransferResponse; }
+		public static Actor_TransferResponse Create(bool isFromPool = false) { return !isFromPool? new Actor_TransferResponse() : ObjectPool.Instance.Fetch(typeof(Actor_TransferResponse)) as Actor_TransferResponse; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -115,9 +115,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2G_EnterMap: MessageObject, IRequest
 	{
-		public static C2G_EnterMap Create(bool isFromPool = false) { return !isFromPool? new C2G_EnterMap() : NetServices.Instance.FetchMessage(typeof(C2G_EnterMap)) as C2G_EnterMap; }
+		public static C2G_EnterMap Create(bool isFromPool = false) { return !isFromPool? new C2G_EnterMap() : ObjectPool.Instance.Fetch(typeof(C2G_EnterMap)) as C2G_EnterMap; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -128,9 +128,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_EnterMap: MessageObject, IResponse
 	{
-		public static G2C_EnterMap Create(bool isFromPool = false) { return !isFromPool? new G2C_EnterMap() : NetServices.Instance.FetchMessage(typeof(G2C_EnterMap)) as G2C_EnterMap; }
+		public static G2C_EnterMap Create(bool isFromPool = false) { return !isFromPool? new G2C_EnterMap() : ObjectPool.Instance.Fetch(typeof(G2C_EnterMap)) as G2C_EnterMap; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -151,9 +151,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class MoveInfo: MessageObject
 	{
-		public static MoveInfo Create(bool isFromPool = false) { return !isFromPool? new MoveInfo() : NetServices.Instance.FetchMessage(typeof(MoveInfo)) as MoveInfo; }
+		public static MoveInfo Create(bool isFromPool = false) { return !isFromPool? new MoveInfo() : ObjectPool.Instance.Fetch(typeof(MoveInfo)) as MoveInfo; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public List<Unity.Mathematics.float3> Points { get; set; }
@@ -170,9 +170,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class UnitInfo: MessageObject
 	{
-		public static UnitInfo Create(bool isFromPool = false) { return !isFromPool? new UnitInfo() : NetServices.Instance.FetchMessage(typeof(UnitInfo)) as UnitInfo; }
+		public static UnitInfo Create(bool isFromPool = false) { return !isFromPool? new UnitInfo() : ObjectPool.Instance.Fetch(typeof(UnitInfo)) as UnitInfo; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long UnitId { get; set; }
@@ -201,9 +201,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_CreateUnits: MessageObject, IActorMessage
 	{
-		public static M2C_CreateUnits Create(bool isFromPool = false) { return !isFromPool? new M2C_CreateUnits() : NetServices.Instance.FetchMessage(typeof(M2C_CreateUnits)) as M2C_CreateUnits; }
+		public static M2C_CreateUnits Create(bool isFromPool = false) { return !isFromPool? new M2C_CreateUnits() : ObjectPool.Instance.Fetch(typeof(M2C_CreateUnits)) as M2C_CreateUnits; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public List<UnitInfo> Units { get; set; }
@@ -214,9 +214,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_CreateMyUnit: MessageObject, IActorMessage
 	{
-		public static M2C_CreateMyUnit Create(bool isFromPool = false) { return !isFromPool? new M2C_CreateMyUnit() : NetServices.Instance.FetchMessage(typeof(M2C_CreateMyUnit)) as M2C_CreateMyUnit; }
+		public static M2C_CreateMyUnit Create(bool isFromPool = false) { return !isFromPool? new M2C_CreateMyUnit() : ObjectPool.Instance.Fetch(typeof(M2C_CreateMyUnit)) as M2C_CreateMyUnit; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public UnitInfo Unit { get; set; }
@@ -227,9 +227,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_StartSceneChange: MessageObject, IActorMessage
 	{
-		public static M2C_StartSceneChange Create(bool isFromPool = false) { return !isFromPool? new M2C_StartSceneChange() : NetServices.Instance.FetchMessage(typeof(M2C_StartSceneChange)) as M2C_StartSceneChange; }
+		public static M2C_StartSceneChange Create(bool isFromPool = false) { return !isFromPool? new M2C_StartSceneChange() : ObjectPool.Instance.Fetch(typeof(M2C_StartSceneChange)) as M2C_StartSceneChange; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long SceneInstanceId { get; set; }
@@ -243,9 +243,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_RemoveUnits: MessageObject, IActorMessage
 	{
-		public static M2C_RemoveUnits Create(bool isFromPool = false) { return !isFromPool? new M2C_RemoveUnits() : NetServices.Instance.FetchMessage(typeof(M2C_RemoveUnits)) as M2C_RemoveUnits; }
+		public static M2C_RemoveUnits Create(bool isFromPool = false) { return !isFromPool? new M2C_RemoveUnits() : ObjectPool.Instance.Fetch(typeof(M2C_RemoveUnits)) as M2C_RemoveUnits; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public List<long> Units { get; set; }
@@ -256,9 +256,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_PathfindingResult: MessageObject, IActorLocationMessage
 	{
-		public static C2M_PathfindingResult Create(bool isFromPool = false) { return !isFromPool? new C2M_PathfindingResult() : NetServices.Instance.FetchMessage(typeof(C2M_PathfindingResult)) as C2M_PathfindingResult; }
+		public static C2M_PathfindingResult Create(bool isFromPool = false) { return !isFromPool? new C2M_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(C2M_PathfindingResult)) as C2M_PathfindingResult; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -272,9 +272,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_Stop: MessageObject, IActorLocationMessage
 	{
-		public static C2M_Stop Create(bool isFromPool = false) { return !isFromPool? new C2M_Stop() : NetServices.Instance.FetchMessage(typeof(C2M_Stop)) as C2M_Stop; }
+		public static C2M_Stop Create(bool isFromPool = false) { return !isFromPool? new C2M_Stop() : ObjectPool.Instance.Fetch(typeof(C2M_Stop)) as C2M_Stop; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -285,9 +285,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_PathfindingResult: MessageObject, IActorMessage
 	{
-		public static M2C_PathfindingResult Create(bool isFromPool = false) { return !isFromPool? new M2C_PathfindingResult() : NetServices.Instance.FetchMessage(typeof(M2C_PathfindingResult)) as M2C_PathfindingResult; }
+		public static M2C_PathfindingResult Create(bool isFromPool = false) { return !isFromPool? new M2C_PathfindingResult() : ObjectPool.Instance.Fetch(typeof(M2C_PathfindingResult)) as M2C_PathfindingResult; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public long Id { get; set; }
@@ -304,9 +304,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_Stop: MessageObject, IActorMessage
 	{
-		public static M2C_Stop Create(bool isFromPool = false) { return !isFromPool? new M2C_Stop() : NetServices.Instance.FetchMessage(typeof(M2C_Stop)) as M2C_Stop; }
+		public static M2C_Stop Create(bool isFromPool = false) { return !isFromPool? new M2C_Stop() : ObjectPool.Instance.Fetch(typeof(M2C_Stop)) as M2C_Stop; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int Error { get; set; }
@@ -327,9 +327,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2G_Ping: MessageObject, IRequest
 	{
-		public static C2G_Ping Create(bool isFromPool = false) { return !isFromPool? new C2G_Ping() : NetServices.Instance.FetchMessage(typeof(C2G_Ping)) as C2G_Ping; }
+		public static C2G_Ping Create(bool isFromPool = false) { return !isFromPool? new C2G_Ping() : ObjectPool.Instance.Fetch(typeof(C2G_Ping)) as C2G_Ping; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -340,9 +340,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_Ping: MessageObject, IResponse
 	{
-		public static G2C_Ping Create(bool isFromPool = false) { return !isFromPool? new G2C_Ping() : NetServices.Instance.FetchMessage(typeof(G2C_Ping)) as G2C_Ping; }
+		public static G2C_Ping Create(bool isFromPool = false) { return !isFromPool? new G2C_Ping() : ObjectPool.Instance.Fetch(typeof(G2C_Ping)) as G2C_Ping; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -362,9 +362,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_Test: MessageObject, IMessage
 	{
-		public static G2C_Test Create(bool isFromPool = false) { return !isFromPool? new G2C_Test() : NetServices.Instance.FetchMessage(typeof(G2C_Test)) as G2C_Test; }
+		public static G2C_Test Create(bool isFromPool = false) { return !isFromPool? new G2C_Test() : ObjectPool.Instance.Fetch(typeof(G2C_Test)) as G2C_Test; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 	}
 
@@ -373,9 +373,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_Reload: MessageObject, IRequest
 	{
-		public static C2M_Reload Create(bool isFromPool = false) { return !isFromPool? new C2M_Reload() : NetServices.Instance.FetchMessage(typeof(C2M_Reload)) as C2M_Reload; }
+		public static C2M_Reload Create(bool isFromPool = false) { return !isFromPool? new C2M_Reload() : ObjectPool.Instance.Fetch(typeof(C2M_Reload)) as C2M_Reload; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -392,9 +392,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_Reload: MessageObject, IResponse
 	{
-		public static M2C_Reload Create(bool isFromPool = false) { return !isFromPool? new M2C_Reload() : NetServices.Instance.FetchMessage(typeof(M2C_Reload)) as M2C_Reload; }
+		public static M2C_Reload Create(bool isFromPool = false) { return !isFromPool? new M2C_Reload() : ObjectPool.Instance.Fetch(typeof(M2C_Reload)) as M2C_Reload; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -412,9 +412,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2R_Login: MessageObject, IRequest
 	{
-		public static C2R_Login Create(bool isFromPool = false) { return !isFromPool? new C2R_Login() : NetServices.Instance.FetchMessage(typeof(C2R_Login)) as C2R_Login; }
+		public static C2R_Login Create(bool isFromPool = false) { return !isFromPool? new C2R_Login() : ObjectPool.Instance.Fetch(typeof(C2R_Login)) as C2R_Login; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -431,9 +431,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class R2C_Login: MessageObject, IResponse
 	{
-		public static R2C_Login Create(bool isFromPool = false) { return !isFromPool? new R2C_Login() : NetServices.Instance.FetchMessage(typeof(R2C_Login)) as R2C_Login; }
+		public static R2C_Login Create(bool isFromPool = false) { return !isFromPool? new R2C_Login() : ObjectPool.Instance.Fetch(typeof(R2C_Login)) as R2C_Login; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -460,9 +460,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2G_LoginGate: MessageObject, IRequest
 	{
-		public static C2G_LoginGate Create(bool isFromPool = false) { return !isFromPool? new C2G_LoginGate() : NetServices.Instance.FetchMessage(typeof(C2G_LoginGate)) as C2G_LoginGate; }
+		public static C2G_LoginGate Create(bool isFromPool = false) { return !isFromPool? new C2G_LoginGate() : ObjectPool.Instance.Fetch(typeof(C2G_LoginGate)) as C2G_LoginGate; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -479,9 +479,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_LoginGate: MessageObject, IResponse
 	{
-		public static G2C_LoginGate Create(bool isFromPool = false) { return !isFromPool? new G2C_LoginGate() : NetServices.Instance.FetchMessage(typeof(G2C_LoginGate)) as G2C_LoginGate; }
+		public static G2C_LoginGate Create(bool isFromPool = false) { return !isFromPool? new G2C_LoginGate() : ObjectPool.Instance.Fetch(typeof(G2C_LoginGate)) as G2C_LoginGate; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -501,9 +501,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_TestHotfixMessage: MessageObject, IMessage
 	{
-		public static G2C_TestHotfixMessage Create(bool isFromPool = false) { return !isFromPool? new G2C_TestHotfixMessage() : NetServices.Instance.FetchMessage(typeof(G2C_TestHotfixMessage)) as G2C_TestHotfixMessage; }
+		public static G2C_TestHotfixMessage Create(bool isFromPool = false) { return !isFromPool? new G2C_TestHotfixMessage() : ObjectPool.Instance.Fetch(typeof(G2C_TestHotfixMessage)) as G2C_TestHotfixMessage; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public string Info { get; set; }
@@ -515,9 +515,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_TestRobotCase: MessageObject, IActorLocationRequest
 	{
-		public static C2M_TestRobotCase Create(bool isFromPool = false) { return !isFromPool? new C2M_TestRobotCase() : NetServices.Instance.FetchMessage(typeof(C2M_TestRobotCase)) as C2M_TestRobotCase; }
+		public static C2M_TestRobotCase Create(bool isFromPool = false) { return !isFromPool? new C2M_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase)) as C2M_TestRobotCase; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -531,9 +531,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_TestRobotCase: MessageObject, IActorLocationResponse
 	{
-		public static M2C_TestRobotCase Create(bool isFromPool = false) { return !isFromPool? new M2C_TestRobotCase() : NetServices.Instance.FetchMessage(typeof(M2C_TestRobotCase)) as M2C_TestRobotCase; }
+		public static M2C_TestRobotCase Create(bool isFromPool = false) { return !isFromPool? new M2C_TestRobotCase() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase)) as M2C_TestRobotCase; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -553,9 +553,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_TestRobotCase2: MessageObject, IActorLocationMessage
 	{
-		public static C2M_TestRobotCase2 Create(bool isFromPool = false) { return !isFromPool? new C2M_TestRobotCase2() : NetServices.Instance.FetchMessage(typeof(C2M_TestRobotCase2)) as C2M_TestRobotCase2; }
+		public static C2M_TestRobotCase2 Create(bool isFromPool = false) { return !isFromPool? new C2M_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(C2M_TestRobotCase2)) as C2M_TestRobotCase2; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -569,9 +569,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_TestRobotCase2: MessageObject, IActorLocationMessage
 	{
-		public static M2C_TestRobotCase2 Create(bool isFromPool = false) { return !isFromPool? new M2C_TestRobotCase2() : NetServices.Instance.FetchMessage(typeof(M2C_TestRobotCase2)) as M2C_TestRobotCase2; }
+		public static M2C_TestRobotCase2 Create(bool isFromPool = false) { return !isFromPool? new M2C_TestRobotCase2() : ObjectPool.Instance.Fetch(typeof(M2C_TestRobotCase2)) as M2C_TestRobotCase2; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -586,9 +586,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2M_TransferMap: MessageObject, IActorLocationRequest
 	{
-		public static C2M_TransferMap Create(bool isFromPool = false) { return !isFromPool? new C2M_TransferMap() : NetServices.Instance.FetchMessage(typeof(C2M_TransferMap)) as C2M_TransferMap; }
+		public static C2M_TransferMap Create(bool isFromPool = false) { return !isFromPool? new C2M_TransferMap() : ObjectPool.Instance.Fetch(typeof(C2M_TransferMap)) as C2M_TransferMap; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -599,9 +599,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class M2C_TransferMap: MessageObject, IActorLocationResponse
 	{
-		public static M2C_TransferMap Create(bool isFromPool = false) { return !isFromPool? new M2C_TransferMap() : NetServices.Instance.FetchMessage(typeof(M2C_TransferMap)) as M2C_TransferMap; }
+		public static M2C_TransferMap Create(bool isFromPool = false) { return !isFromPool? new M2C_TransferMap() : ObjectPool.Instance.Fetch(typeof(M2C_TransferMap)) as M2C_TransferMap; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -619,9 +619,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class C2G_Benchmark: MessageObject, IRequest
 	{
-		public static C2G_Benchmark Create(bool isFromPool = false) { return !isFromPool? new C2G_Benchmark() : NetServices.Instance.FetchMessage(typeof(C2G_Benchmark)) as C2G_Benchmark; }
+		public static C2G_Benchmark Create(bool isFromPool = false) { return !isFromPool? new C2G_Benchmark() : ObjectPool.Instance.Fetch(typeof(C2G_Benchmark)) as C2G_Benchmark; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }
@@ -632,9 +632,9 @@ namespace ET
 	[MemoryPackable]
 	public partial class G2C_Benchmark: MessageObject, IResponse
 	{
-		public static G2C_Benchmark Create(bool isFromPool = false) { return !isFromPool? new G2C_Benchmark() : NetServices.Instance.FetchMessage(typeof(G2C_Benchmark)) as G2C_Benchmark; }
+		public static G2C_Benchmark Create(bool isFromPool = false) { return !isFromPool? new G2C_Benchmark() : ObjectPool.Instance.Fetch(typeof(G2C_Benchmark)) as G2C_Benchmark; }
 
-		public override void Dispose() { NetServices.Instance.RecycleMessage(this); }
+		public override void Dispose() { ObjectPool.Instance.Recycle(this); }
 
 		[MemoryPackOrder(0)]
 		public int RpcId { get; set; }

+ 1 - 1
Unity/Assets/Scripts/Model/Generate/ClientServer/ConfigPartial/StartSceneConfig.cs

@@ -135,7 +135,7 @@ namespace ET
 
         public override void EndInit()
         {
-            this.ActorId = new ActorId(this.Process, 0, 0);
+            this.ActorId = new ActorId(this.Process, this.Id, 1);
             this.Type = EnumHelper.FromString<SceneType>(this.SceneType);
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Demo/Robot/RobotManagerComponent.cs

@@ -1,6 +1,6 @@
 namespace ET.Server
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(Fiber))]
     public class RobotManagerComponent: Entity, IAwake
     {
         

+ 9 - 0
Unity/Assets/Scripts/Model/Share/ConstFiberId.cs

@@ -0,0 +1,9 @@
+namespace ET
+{
+    public static class ConstFiberId
+    {
+        public const int Main = -1;
+        public const int NetInner = -2;
+        public const int DB = -3;
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Scene/ServerSceneManagerComponent.cs.meta → Unity/Assets/Scripts/Model/Share/ConstFiberId.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: d94c3adfee4afb64aa098dd6ddb890cc
+guid: a5e2228e988db544687281f0ff80f009
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 13
Unity/Assets/Scripts/Model/Share/Entry.cs

@@ -50,22 +50,10 @@ namespace ET
             World.Instance.AddSingleton<FiberManager>();
             FiberManager.MainThreadScheduler mainThreadScheduler = World.Instance.AddSingleton<FiberManager.MainThreadScheduler>();
 
-            int fiberId = FiberManager.Instance.Create(0, SceneType.Main);
+            int fiberId = FiberManager.Instance.Create(ConstFiberId.Main, SceneType.Main);
             mainThreadScheduler.Add(fiberId);
-			
-            // 发送消息
-            ActorMessageQueue.Instance.Send(new ActorId(Options.Instance.Process, fiberId, 1), null);
-
-
-            Fiber fiber = Fiber.Instance;
-            
-
 
             await World.Instance.AddSingleton<ConfigComponent>().LoadAsync();
-
-            await EventSystem.Instance.PublishAsync(fiber, new EventType.EntryEvent1());
-            await EventSystem.Instance.PublishAsync(fiber, new EventType.EntryEvent2());
-            await EventSystem.Instance.PublishAsync(fiber, new EventType.EntryEvent3());
         }
     }
 }

+ 8 - 0
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorSenderComponent.cs

@@ -2,6 +2,14 @@
 
 namespace ET
 {
+    public class A2NetInner_Message: MessageObject, IActorMessage
+    {
+        public Address FromAddress;
+        public ActorId ActorId;
+        public MessageObject MessageObject;
+    }
+
+    
     [ComponentOf(typeof(Fiber))]
     public class ActorSenderComponent: Entity, IAwake, IDestroy
     {

+ 0 - 9
Unity/Assets/Scripts/Model/Share/Module/Scene/ClientSceneManagerComponent.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace ET
-{
-    [ComponentOf(typeof(Fiber))]
-    public class ClientSceneManagerComponent: Entity, IAwake
-    {
-    }
-}

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Scene/CurrentScenesComponent.cs

@@ -1,7 +1,7 @@
 namespace ET
 {
     // 可以用来管理多个客户端场景,比如大世界会加载多块场景
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(Fiber))]
     public class CurrentScenesComponent: Entity, IAwake
     {
         private EntityRef<Scene> scene;

+ 0 - 9
Unity/Assets/Scripts/Model/Share/Module/Scene/ServerSceneManagerComponent.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace ET
-{
-    [ComponentOf(typeof(Fiber))]
-    public class ServerSceneManagerComponent: Entity, IAwake, IDestroy
-    {
-    }
-}