Răsfoiți Sursa

Fiber不设计成Entity,Fiber有个字段Root作为Entity根

tanghai 2 ani în urmă
părinte
comite
ae195382ca
100 a modificat fișierele cu 351 adăugiri și 283 ștergeri
  1. 4 4
      Unity/Assets/Scripts/Core/Entity/Entity.cs
  2. 6 1
      Unity/Assets/Scripts/Core/Entity/EntityHelper.cs
  3. 1 1
      Unity/Assets/Scripts/Core/Entity/IScene.cs
  4. 0 3
      Unity/Assets/Scripts/Core/Entity/Scene.cs
  5. 10 18
      Unity/Assets/Scripts/Core/Fiber/Fiber.cs
  6. 1 1
      Unity/Assets/Scripts/Core/Fiber/MailBoxComponent.cs
  7. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorRecverComponent.cs
  8. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorSenderComponent.cs
  9. 2 2
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs
  10. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs
  11. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Synchronization/MainThreadSynchronizationContext.cs
  12. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Timer/TimerComponent.cs
  13. 1 1
      Unity/Assets/Scripts/Core/Helper/ETCancelationTokenHelper.cs
  14. 11 0
      Unity/Assets/Scripts/Core/World/Module/Config/ConfigAttribute.cs.meta
  15. 11 0
      Unity/Assets/Scripts/Core/World/Module/Config/ConfigComponent.cs.meta
  16. 11 0
      Unity/Assets/Scripts/Core/World/Module/Config/ConfigSingleton.cs.meta
  17. 11 0
      Unity/Assets/Scripts/Core/World/Module/Config/IConfig.cs.meta
  18. 11 0
      Unity/Assets/Scripts/Core/World/Module/Config/IMerge.cs.meta
  19. 5 5
      Unity/Assets/Scripts/Core/World/Module/Fiber/FiberManager.cs
  20. 4 4
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs
  21. 2 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_XunLuo.cs
  22. 5 5
      Unity/Assets/Scripts/Hotfix/Client/Demo/Login/EnterMapHelper.cs
  23. 10 10
      Unity/Assets/Scripts/Hotfix/Client/Demo/Login/LoginHelper.cs
  24. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_PathfindingResultHandler.cs
  25. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_StopHandler.cs
  26. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/MoveHelper.cs
  27. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Ping/PingComponentSystem.cs
  28. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterAddressComponentSystem.cs
  29. 6 6
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs
  30. 11 11
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs
  31. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/M2C_StartSceneChangeHandler.cs
  32. 8 8
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneChangeHelper.cs
  33. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_CreateUnitsHandler.cs
  34. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_RemoveUnitsHandler.cs
  35. 4 4
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitHelper.cs
  36. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs
  37. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ReconnectHandler.cs
  38. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs
  39. 3 3
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs
  40. 17 17
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs
  41. 4 3
      Unity/Assets/Scripts/Hotfix/Client/LockStep/Room2C_CheckHashFailHandler.cs
  42. 4 4
      Unity/Assets/Scripts/Hotfix/Server/Demo/EntryEvent2_InitServer.cs
  43. 6 5
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs
  44. 5 5
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs
  45. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/GateSessionKeyComponentSystem.cs
  46. 5 5
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs
  47. 4 4
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs
  48. 3 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs
  49. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs
  50. 3 3
      Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs
  51. 4 4
      Unity/Assets/Scripts/Hotfix/Server/Demo/MessageHelper.cs
  52. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs
  53. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs
  54. 1 0
      Unity/Assets/Scripts/Hotfix/Server/Demo/SceneFactory.cs
  55. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs
  56. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs
  57. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs
  58. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs
  59. 4 3
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs
  60. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs
  61. 25 16
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  62. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs
  63. 5 5
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs
  64. 7 7
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs
  65. 14 14
      Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs
  66. 3 3
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/A2NetInner_MessageHandler.cs
  67. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/RobotCase/ARobotCase.cs
  68. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Demo/EntryEvent1_InitShare.cs
  69. 3 3
      Unity/Assets/Scripts/Hotfix/Share/FiberInit_Main.cs
  70. 5 4
      Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIComponentSystem.cs
  71. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorMessageHandler.cs
  72. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorRecverComponentSystem.cs
  73. 4 3
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorSenderComponentSystem.cs
  74. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs
  75. 4 3
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs
  76. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs
  77. 4 3
      Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs
  78. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs
  79. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs
  80. 6 6
      Unity/Assets/Scripts/HotfixView/Client/Demo/EntryEvent3_InitClient.cs
  81. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs
  82. 3 3
      Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/FiberInit_DemoView.cs
  83. 4 4
      Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/SceneChangeStart_AddComponent.cs
  84. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelp/UIHelpEvent.cs
  85. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyComponentSystem.cs
  86. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyEvent.cs
  87. 3 3
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/AppStartInitFinish_CreateLoginUI.cs
  88. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs
  89. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginEvent.cs
  90. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/Unit/AfterUnitCreate_CreateUnitView.cs
  91. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSSceneChangeStart_AddComponent.cs
  92. 3 2
      Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs
  93. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyComponentSystem.cs
  94. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyEvent.cs
  95. 3 3
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/AppStartInitFinish_CreateUILSLogin.cs
  96. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILSLoginEvent.cs
  97. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs
  98. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomEvent.cs
  99. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIComponentSystem.cs
  100. 1 1
      Unity/Assets/Scripts/Model/Client/Demo/Router/RouterAddressComponent.cs

+ 4 - 4
Unity/Assets/Scripts/Core/Entity/Entity.cs

@@ -101,12 +101,12 @@ namespace ET
 
         private EntitySystem GetEntitySystem()
         {
-            return (this.iScene.Root as IEntitySystem).EntitySystem;
+            return this.iScene.Fiber.EntitySystem;
         }
         
         private IdGenerater GetIdGenerater()
         {
-            return (this.iScene.Root as IIdGenerater).IdGenerater;
+            return this.iScene.Fiber.IdGenerater;
         }
 
         protected virtual void RegisterSystem()
@@ -220,7 +220,7 @@ namespace ET
 
                 if (this is IScene scene)
                 {
-                    scene.Root = this.parent.iScene.Root;
+                    scene.Fiber = this.parent.iScene.Fiber;
                     this.IScene = scene;
                 }
                 else
@@ -284,7 +284,7 @@ namespace ET
                 
                 if (this is IScene scene)
                 {
-                    scene.Root = this.parent.iScene.Root;
+                    scene.Fiber = this.parent.iScene.Fiber;
                     this.IScene = scene;
                 }
                 else

+ 6 - 1
Unity/Assets/Scripts/Core/Entity/EntityHelper.cs

@@ -17,9 +17,14 @@ namespace ET
             return entity.IScene as T;
         }
         
+        public static Scene Root(this Entity entity)
+        {
+            return entity.IScene.Fiber.Root;
+        }
+        
         public static Fiber Fiber(this Entity entity)
         {
-            return entity.IScene.Root as Fiber;
+            return entity.IScene.Fiber;
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/Core/Entity/IScene.cs

@@ -2,7 +2,7 @@
 {
     public interface IScene
     {
-        IScene Root { get; set; }
+        Fiber Fiber { get; set; }
         SceneType SceneType { get; set; }
     }
 }

+ 0 - 3
Unity/Assets/Scripts/Core/Entity/Scene.cs

@@ -10,9 +10,6 @@ namespace ET
         [BsonIgnore]
         public Fiber Fiber { get; set; }
         
-        [BsonIgnore]
-        public IScene Root { get; set; }
-
         public int Zone
         {
             get;

+ 10 - 18
Unity/Assets/Scripts/Core/Fiber/Fiber.cs

@@ -8,11 +8,11 @@ namespace ET
         public static ActorId GetActorId(this Entity self)
         {
             Fiber root = self.Fiber();
-            return new ActorId(root.Process, (int)root.Id, self.InstanceId);
+            return new ActorId(root.Process, root.Id, self.InstanceId);
         }
     }
     
-    public class Fiber: Entity, IScene, IEntitySystem, IIdGenerater
+    public class Fiber: IDisposable
     {
         [ThreadStatic]
         [StaticField]
@@ -26,18 +26,18 @@ namespace ET
             }
         }
 
+        public int Id;
+
+        public Scene Root { get; }
+
         public Address Address
         {
             get
             {
-                return new Address(this.Process, (int)this.Id);
+                return new Address(this.Process, this.Id);
             }
         }
         
-        public IScene Root { get; set; }
-        public SceneType SceneType { get; set; }
-        public int Zone { get; set; }
-        
         public int Process { get; private set; }
         
         public EntitySystem EntitySystem { get; }
@@ -49,15 +49,14 @@ namespace ET
         
         public Fiber(int id, int process, SceneType sceneType)
         {
-            this.SceneType = sceneType;
             this.Id = id;
-            this.InstanceId = 1;
             this.Process = process;
-            this.Root = this;
             this.EntitySystem = new EntitySystem();
             this.TimeInfo = new TimeInfo();
             this.IdGenerater = new IdGenerater(process, this.TimeInfo);
             this.Mailboxes = new Mailboxes();
+
+            this.Root = new Scene(id, 1, 0, sceneType, "");
         }
 
         public void Update()
@@ -87,15 +86,8 @@ namespace ET
         {
         }
 
-        public override void Dispose()
+        public void Dispose()
         {
-            if (this.IsDisposed)
-            {
-                return;
-            }
-            
-            base.Dispose();
-            
             this.IsRuning = false;
 
             instance = null;

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

@@ -10,7 +10,7 @@
             self.MailBoxType = mailBoxType;
             self.ParentInstanceId = self.Parent.InstanceId;
             fiber.Mailboxes.Add(self);
-            self.CoroutineLockComponent = fiber.GetComponent<CoroutineLockComponent>();
+            self.CoroutineLockComponent = fiber.Root.GetComponent<CoroutineLockComponent>();
         }
         
         [EntitySystem]

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorRecverComponent.cs

@@ -2,7 +2,7 @@
 
 namespace ET
 {
-    [ComponentOf(typeof(Fiber))]
+    [ComponentOf(typeof(Scene))]
     public class ActorRecverComponent: Entity, IAwake, IDestroy, IUpdate
     {
         public readonly List<ActorMessageInfo> list = new();

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorSenderComponent.cs

@@ -14,7 +14,7 @@ namespace ET
     }
 
     
-    [ComponentOf(typeof(Fiber))]
+    [ComponentOf(typeof(Scene))]
     public class ActorSenderComponent: Entity, IAwake, IDestroy
     {
         public const long TIMEOUT_TIME = 40 * 1000;

+ 2 - 2
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockComponent.cs

@@ -3,10 +3,10 @@ using System.Collections.Generic;
 
 namespace ET
 {
-    [ComponentOf(typeof(Fiber))]
+    [ComponentOf(typeof(Scene))]
     public class CoroutineLockComponent: Entity, IAwake, IScene
     {
-        public IScene Root { get; set; }
+        public Fiber Fiber { get; set; }
         public SceneType SceneType { get; set; }
         
         private readonly Queue<(int, long, int)> nextFrameRun = new();

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs

@@ -32,7 +32,7 @@ namespace ET
             if (time > 0)
             {
                 long tillTime = TimeHelper.ClientFrameTime() + time;
-                self.Fiber().GetComponent<TimerComponent>().NewOnceTimer(tillTime, TimerCoreInvokeType.CoroutineTimeout, waitCoroutineLock);
+                self.Root().GetComponent<TimerComponent>().NewOnceTimer(tillTime, TimerCoreInvokeType.CoroutineTimeout, waitCoroutineLock);
             }
             self.CurrentCoroutineLock = await waitCoroutineLock.Wait();
             return self.CurrentCoroutineLock;

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Synchronization/MainThreadSynchronizationContext.cs

@@ -3,7 +3,7 @@ using System.Threading;
 
 namespace ET
 {
-    [ComponentOf(typeof(Fiber))]
+    [ComponentOf(typeof(Scene))]
     public class MainThreadSynchronizationContext: Entity, IAwake
     {
         private readonly ThreadSynchronizationContext threadSynchronizationContext = new();

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/Timer/TimerComponent.cs

@@ -53,7 +53,7 @@ namespace ET
         public object Args;
     }
 
-    [ComponentOf(typeof(Fiber))]
+    [ComponentOf(typeof(Scene))]
     public class TimerComponent: Entity, IAwake
     {
         /// <summary>

+ 1 - 1
Unity/Assets/Scripts/Core/Helper/ETCancelationTokenHelper.cs

@@ -9,7 +9,7 @@ namespace ET
                 return;
             }
 
-            await Fiber.Instance.GetComponent<TimerComponent>().WaitAsync(afterTimeCancel);
+            await Fiber.Instance.Root.GetComponent<TimerComponent>().WaitAsync(afterTimeCancel);
             
             if (self.IsCancel())
             {

+ 11 - 0
Unity/Assets/Scripts/Core/World/Module/Config/ConfigAttribute.cs.meta

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

+ 11 - 0
Unity/Assets/Scripts/Core/World/Module/Config/ConfigComponent.cs.meta

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

+ 11 - 0
Unity/Assets/Scripts/Core/World/Module/Config/ConfigSingleton.cs.meta

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

+ 11 - 0
Unity/Assets/Scripts/Core/World/Module/Config/IConfig.cs.meta

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

+ 11 - 0
Unity/Assets/Scripts/Core/World/Module/Config/IMerge.cs.meta

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

+ 5 - 5
Unity/Assets/Scripts/Core/World/Module/Fiber/FiberManager.cs

@@ -17,11 +17,11 @@ namespace ET
         {
             Fiber fiber = new(fiberId, Options.Instance.Process, sceneType);
             
-            fiber.AddComponent<TimerComponent>();
-            fiber.AddComponent<CoroutineLockComponent>();
-            fiber.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
-            fiber.AddComponent<ActorSenderComponent>();
-            fiber.AddComponent<ActorRecverComponent>();
+            fiber.Root.AddComponent<TimerComponent>();
+            fiber.Root.AddComponent<CoroutineLockComponent>();
+            fiber.Root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
+            fiber.Root.AddComponent<ActorSenderComponent>();
+            fiber.Root.AddComponent<ActorRecverComponent>();
             
             // 根据Fiber的SceneType分发Init
             EventSystem.Instance.Invoke((long)sceneType, new FiberInit() {Fiber = fiber});

+ 4 - 4
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)
         {
-            Fiber fiber = aiComponent.Fiber();
+            Scene root = aiComponent.Root();
 
-            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(fiber);
+            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(root);
             if (myUnit == null)
             {
                 return;
             }
 
             // 停在当前位置
-            fiber.GetComponent<SessionComponent>().Session.Send(new C2M_Stop());
+            root.GetComponent<SessionComponent>().Session.Send(new C2M_Stop());
             
             Log.Debug("开始攻击");
 
@@ -32,7 +32,7 @@ namespace ET.Client
                 Log.Debug($"攻击: {i}次");
 
                 // 因为协程可能被中断,任何协程都要传入cancellationToken,判断如果是中断则要返回
-                await aiComponent.Fiber().GetComponent<TimerComponent>().WaitAsync(1000, cancellationToken);
+                await root.GetComponent<TimerComponent>().WaitAsync(1000, cancellationToken);
                 if (cancellationToken.IsCancel())
                 {
                     return;

+ 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)
         {
-            Fiber fiber = aiComponent.Fiber();
+            Scene root = aiComponent.Root();
 
-            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(fiber);
+            Unit myUnit = UnitHelper.GetMyUnitFromClientScene(root);
             if (myUnit == null)
             {
                 return;

+ 5 - 5
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(Fiber fiber)
+        public static async ETTask EnterMapAsync(Scene root)
         {
             try
             {
-                G2C_EnterMap g2CEnterMap = await fiber.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
+                G2C_EnterMap g2CEnterMap = await root.GetComponent<SessionComponent>().Session.Call(new C2G_EnterMap()) as G2C_EnterMap;
                 
                 // 等待场景切换完成
-                await fiber.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
+                await root.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
                 
-                EventSystem.Instance.Publish(fiber, new EventType.EnterMapFinish());
+                EventSystem.Instance.Publish(root, new EventType.EnterMapFinish());
             }
             catch (Exception e)
             {
@@ -26,7 +26,7 @@ namespace ET.Client
         {
             try
             {
-                G2C_Match g2CEnterMap = await fiber.GetComponent<SessionComponent>().Session.Call(new C2G_Match()) as G2C_Match;
+                G2C_Match g2CEnterMap = await fiber.Root.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(Fiber fiber, string account, string password)
+        public static async ETTask Login(Scene scene, string account, string password)
         {
             try
             {
                 // 创建一个ETModel层的Session
-                fiber.RemoveComponent<RouterAddressComponent>();
+                scene.RemoveComponent<RouterAddressComponent>();
                 // 获取路由跟realmDispatcher地址
-                RouterAddressComponent routerAddressComponent = fiber.GetComponent<RouterAddressComponent>();
+                RouterAddressComponent routerAddressComponent = scene.GetComponent<RouterAddressComponent>();
                 if (routerAddressComponent == null)
                 {
-                    routerAddressComponent = fiber.AddComponent<RouterAddressComponent, string, int>(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort);
+                    routerAddressComponent = scene.AddComponent<RouterAddressComponent, string, int>(ConstValue.RouterHttpHost, ConstValue.RouterHttpPort);
                     await routerAddressComponent.Init();
                     
-                    fiber.AddComponent<NetClientComponent, AddressFamily>(routerAddressComponent.RouterManagerIPAddress.AddressFamily);
+                    scene.AddComponent<NetClientComponent, AddressFamily>(routerAddressComponent.RouterManagerIPAddress.AddressFamily);
                 }
                 IPEndPoint realmAddress = routerAddressComponent.GetRealmAddress(account);
                 
                 R2C_Login r2CLogin;
-                using (Session session = await RouterHelper.CreateRouterSession(fiber, realmAddress))
+                using (Session session = await RouterHelper.CreateRouterSession(scene, realmAddress))
                 {
                     r2CLogin = (R2C_Login) await session.Call(new C2R_Login() { Account = account, Password = password });
                 }
 
                 // 创建一个gate Session,并且保存到SessionComponent中
-                Session gateSession = await RouterHelper.CreateRouterSession(fiber, NetworkHelper.ToIPEndPoint(r2CLogin.Address));
-                fiber.AddComponent<SessionComponent>().Session = gateSession;
+                Session gateSession = await RouterHelper.CreateRouterSession(scene, NetworkHelper.ToIPEndPoint(r2CLogin.Address));
+                scene.AddComponent<SessionComponent>().Session = gateSession;
 				
                 G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(
                     new C2G_LoginGate() { Key = r2CLogin.Key, GateId = r2CLogin.GateId});
                 
-                fiber.GetComponent<PlayerComponent>().MyId = g2CLoginGate.PlayerId;
+                scene.GetComponent<PlayerComponent>().MyId = g2CLoginGate.PlayerId;
 
                 Log.Debug("登陆gate成功!");
 
-                await EventSystem.Instance.PublishAsync(fiber, new EventType.LoginFinish());
+                await EventSystem.Instance.PublishAsync(scene, 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.Fiber().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
+			Unit unit = session.Root().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.Fiber().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
+			Unit unit = session.Root().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.Fiber().GetComponent<SessionComponent>().Session.Send(msg);
+            unit.Root().GetComponent<SessionComponent>().Session.Send(msg);
 
             ObjectWait objectWait = unit.GetComponent<ObjectWait>();
             

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Ping/PingComponentSystem.cs

@@ -45,7 +45,7 @@ namespace ET.Client
                     
                     fiber.TimeInfo.ServerMinusClientTime = response.Time + (time2 - time1) / 2 - time2;
                     
-                    await fiber.GetComponent<TimerComponent>().WaitAsync(2000);
+                    await fiber.Root.GetComponent<TimerComponent>().WaitAsync(2000);
                 }
                 catch (RpcException e)
                 {

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterAddressComponentSystem.cs

@@ -40,7 +40,7 @@ namespace ET.Client
         // 等10分钟再获取一次
         public static async ETTask WaitTenMinGetAllRouter(this RouterAddressComponent self)
         {
-            await self.Fiber().GetComponent<TimerComponent>().WaitAsync(5 * 60 * 1000);
+            await self.Root().GetComponent<TimerComponent>().WaitAsync(5 * 60 * 1000);
             if (self.IsDisposed)
             {
                 return;

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

@@ -15,7 +15,7 @@ namespace ET.Client
         {
             Session session = self.GetParent<Session>();
             long instanceId = self.InstanceId;
-            Fiber fiber = self.Fiber();
+            Scene root = self.Root();
             while (true)
             {
                 if (self.InstanceId != instanceId)
@@ -23,7 +23,7 @@ namespace ET.Client
                     return;
                 }
 
-                await fiber.GetComponent<TimerComponent>().WaitAsync(1000);
+                await root.GetComponent<TimerComponent>().WaitAsync(1000);
                 
                 if (self.InstanceId != instanceId)
                 {
@@ -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: {fiber.Id} {realAddress} {localConn} {remoteConn}");
+                    Log.Info($"get recvLocalConn start: {root.Id} {realAddress} {localConn} {remoteConn}");
 
-                    (uint recvLocalConn, IPEndPoint routerAddress) = await RouterHelper.GetRouterAddress(self.Fiber(), realAddress, localConn, remoteConn);
+                    (uint recvLocalConn, IPEndPoint routerAddress) = await RouterHelper.GetRouterAddress(root, realAddress, localConn, remoteConn);
                     if (recvLocalConn == 0)
                     {
-                        Log.Error($"get recvLocalConn fail: {fiber.Id} {routerAddress} {realAddress} {localConn} {remoteConn}");
+                        Log.Error($"get recvLocalConn fail: {root.Id} {routerAddress} {realAddress} {localConn} {remoteConn}");
                         continue;
                     }
                     
-                    Log.Info($"get recvLocalConn ok: {fiber.Id} {routerAddress} {realAddress} {recvLocalConn} {localConn} {remoteConn}");
+                    Log.Info($"get recvLocalConn ok: {root.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(Fiber fiber, IPEndPoint address)
+        public static async ETTask<Session> CreateRouterSession(Scene root, IPEndPoint address)
         {
-            (uint recvLocalConn, IPEndPoint routerAddress) = await GetRouterAddress(fiber, address, 0, 0);
+            (uint recvLocalConn, IPEndPoint routerAddress) = await GetRouterAddress(root, address, 0, 0);
 
             if (recvLocalConn == 0)
             {
-                throw new Exception($"get router fail: {fiber.Id} {address}");
+                throw new Exception($"get router fail: {root.Id} {address}");
             }
             
             Log.Info($"get router: {recvLocalConn} {routerAddress}");
 
-            Session routerSession = fiber.GetComponent<NetClientComponent>().Create(routerAddress, address, recvLocalConn);
+            Session routerSession = root.GetComponent<NetClientComponent>().Create(routerAddress, address, recvLocalConn);
             routerSession.AddComponent<PingComponent>();
             routerSession.AddComponent<RouterCheckComponent>();
             
             return routerSession;
         }
         
-        public static async ETTask<(uint, IPEndPoint)> GetRouterAddress(Fiber fiber, IPEndPoint address, uint localConn, uint remoteConn)
+        public static async ETTask<(uint, IPEndPoint)> GetRouterAddress(Scene root, IPEndPoint address, uint localConn, uint remoteConn)
         {
-            Log.Info($"start get router address: {fiber.Id} {address} {localConn} {remoteConn}");
+            Log.Info($"start get router address: {root.Id} {address} {localConn} {remoteConn}");
             //return (RandomHelper.RandUInt32(), address);
-            RouterAddressComponent routerAddressComponent = fiber.GetComponent<RouterAddressComponent>();
+            RouterAddressComponent routerAddressComponent = root.GetComponent<RouterAddressComponent>();
             IPEndPoint routerInfo = routerAddressComponent.GetAddress();
             
-            uint recvLocalConn = await Connect(fiber, routerInfo, address, localConn, remoteConn);
+            uint recvLocalConn = await Connect(root, routerInfo, address, localConn, remoteConn);
             
-            Log.Info($"finish get router address: {fiber.Id} {address} {localConn} {remoteConn} {recvLocalConn} {routerInfo}");
+            Log.Info($"finish get router address: {root.Id} {address} {localConn} {remoteConn} {recvLocalConn} {routerInfo}");
             return (recvLocalConn, routerInfo);
         }
 
         // 向router申请
-        private static async ETTask<uint> Connect(Fiber fiber, IPEndPoint routerAddress, IPEndPoint realAddress, uint localConn, uint remoteConn)
+        private static async ETTask<uint> Connect(Scene root, 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 fiber.GetComponent<TimerComponent>().WaitFrameAsync();
+                await root.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.Fiber(), message.SceneName, message.SceneInstanceId);
+			await SceneChangeHelper.SceneChangeTo(session.Root(), 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(Fiber fiber, string sceneName, long sceneInstanceId)
+        public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId)
         {
-            fiber.RemoveComponent<AIComponent>();
+            root.RemoveComponent<AIComponent>();
             
-            CurrentScenesComponent currentScenesComponent = fiber.GetComponent<CurrentScenesComponent>();
+            CurrentScenesComponent currentScenesComponent = root.GetComponent<CurrentScenesComponent>();
             currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
-            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, fiber.Zone, sceneName, currentScenesComponent);
+            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, root.Zone, sceneName, currentScenesComponent);
             UnitComponent unitComponent = currentScene.AddComponent<UnitComponent>();
          
             // 可以订阅这个事件中创建Loading界面
-            EventSystem.Instance.Publish(fiber, new EventType.SceneChangeStart());
+            EventSystem.Instance.Publish(root, new EventType.SceneChangeStart());
             // 等待CreateMyUnit的消息
-            Wait_CreateMyUnit waitCreateMyUnit = await fiber.GetComponent<ObjectWait>().Wait<Wait_CreateMyUnit>();
+            Wait_CreateMyUnit waitCreateMyUnit = await root.GetComponent<ObjectWait>().Wait<Wait_CreateMyUnit>();
             M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;
             Unit unit = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);
             unitComponent.Add(unit);
-            fiber.RemoveComponent<AIComponent>();
+            root.RemoveComponent<AIComponent>();
             
             EventSystem.Instance.Publish(currentScene, new EventType.SceneChangeFinish());
             // 通知等待场景切换的协程
-            fiber.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
+            root.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
         }
     }
 }

+ 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.Fiber().CurrentScene();
+			Scene currentScene = session.Root().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.Fiber().CurrentScene()?.GetComponent<UnitComponent>();
+			UnitComponent unitComponent = session.Root().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(Fiber fiber)
+        public static Unit GetMyUnitFromClientScene(Scene root)
         {
-            PlayerComponent playerComponent = fiber.GetComponent<PlayerComponent>();
-            Scene currentScene = fiber.GetComponent<CurrentScenesComponent>().Scene;
+            PlayerComponent playerComponent = root.GetComponent<PlayerComponent>();
+            Scene currentScene = root.GetComponent<CurrentScenesComponent>().Scene;
             return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
         }
         
         public static Unit GetMyUnitFromCurrentScene(Scene currentScene)
         {
-            PlayerComponent playerComponent = currentScene.Parent.GetParent<Fiber>().GetComponent<PlayerComponent>();
+            PlayerComponent playerComponent = currentScene.Root().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.Fiber(), "Map1", message.ActorId.InstanceId);
+            await LSSceneChangeHelper.SceneChangeTo(session.Root(), "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.Fiber(), message);
+            await LSSceneChangeHelper.SceneChangeToReconnect(session.Root(), 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<Fiber>().GetComponent<SessionComponent>().Session.Send(c2RoomCheckHash);
+            self.Root().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<Fiber>().GetComponent<PlayerComponent>().MyId;
+            self.MyId = room.Root().GetComponent<PlayerComponent>().MyId;
         }
         
         [EntitySystem]
@@ -18,7 +18,7 @@ namespace ET.Client
         {
             Room room = self.GetParent<Room>();
             long timeNow = TimeHelper.ServerNow();
-            Fiber fiber = room.GetParent<Fiber>();
+            Scene root = room.Root();
 
             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;
-                fiber.GetComponent<SessionComponent>().Session.Send(frameMessage);
+                root.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(Fiber fiber, string sceneName, long sceneInstanceId)
+        public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId)
         {
-            fiber.RemoveComponent<Room>();
+            root.RemoveComponent<Room>();
 
-            Room room = fiber.AddComponentWithId<Room>(sceneInstanceId);
+            Room room = root.AddComponentWithId<Room>(sceneInstanceId);
             room.Name = sceneName;
 
             // 等待表现层订阅的事件完成
-            await EventSystem.Instance.PublishAsync(fiber, new EventType.LSSceneChangeStart() {Room = room});
+            await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room});
 
-            fiber.GetComponent<SessionComponent>().Session.Send(new C2Room_ChangeSceneFinish());
+            root.GetComponent<SessionComponent>().Session.Send(new C2Room_ChangeSceneFinish());
             
             // 等待Room2C_EnterMap消息
-            WaitType.Wait_Room2C_Start waitRoom2CStart = await fiber.GetComponent<ObjectWait>().Wait<WaitType.Wait_Room2C_Start>();
+            WaitType.Wait_Room2C_Start waitRoom2CStart = await root.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(fiber, new EventType.LSSceneInitFinish());
+            EventSystem.Instance.Publish(root, new EventType.LSSceneInitFinish());
         }
         
         // 场景切换协程
-        public static async ETTask SceneChangeToReplay(Fiber fiber, Replay replay)
+        public static async ETTask SceneChangeToReplay(Scene root, Replay replay)
         {
-            fiber.RemoveComponent<Room>();
+            root.RemoveComponent<Room>();
 
-            Room room = fiber.AddComponent<Room>();
+            Room room = root.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(fiber, new EventType.LSSceneChangeStart() {Room = room});
+            await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room});
             
 
             room.AddComponent<LSReplayUpdater>();
             // 这个事件中可以订阅取消loading
-            EventSystem.Instance.Publish(fiber, new EventType.LSSceneInitFinish());
+            EventSystem.Instance.Publish(root, new EventType.LSSceneInitFinish());
         }
         
         // 场景切换协程
-        public static async ETTask SceneChangeToReconnect(Fiber fiber, G2C_Reconnect message)
+        public static async ETTask SceneChangeToReconnect(Scene root, G2C_Reconnect message)
         {
-            fiber.RemoveComponent<Room>();
+            root.RemoveComponent<Room>();
 
-            Room room = fiber.AddComponent<Room>();
+            Room room = root.AddComponent<Room>();
             room.Name = "Map1";
             
             room.LSWorld = new LSWorld(SceneType.LockStepClient);
             room.Init(message.UnitInfos, message.StartTime, message.Frame);
             
             // 等待表现层订阅的事件完成
-            await EventSystem.Instance.PublishAsync(fiber, new EventType.LSSceneChangeStart() {Room = room});
+            await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room});
 
 
             room.AddComponent<LSClientUpdater>();
             // 这个事件中可以订阅取消loading
-            EventSystem.Instance.Publish(fiber, new EventType.LSSceneInitFinish());
+            EventSystem.Instance.Publish(root, new EventType.LSSceneInitFinish());
         }
     }
 }

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

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

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

@@ -3,9 +3,9 @@ using System.Net;
 namespace ET.Server
 {
     [Event(SceneType.Main)]
-    public class EntryEvent2_InitServer: AEvent<Fiber, ET.EventType.EntryEvent2>
+    public class EntryEvent2_InitServer: AEvent<Scene, ET.EventType.EntryEvent2>
     {
-        protected override async ETTask Run(Fiber fiber, ET.EventType.EntryEvent2 args)
+        protected override async ETTask Run(Scene root, ET.EventType.EntryEvent2 args)
         {
             await ETTask.CompletedTask;
             
@@ -29,7 +29,7 @@ namespace ET.Server
                     threadPoolScheduler.Add(fiberId);
                     
                     // 根据配置创建纤程
-                    var processScenes = StartSceneConfigCategory.Instance.GetByProcess(fiber.Process);
+                    var processScenes = StartSceneConfigCategory.Instance.GetByProcess(root.Fiber().Process);
                     foreach (StartSceneConfig startConfig in processScenes)
                     {
                         fiberId = FiberManager.Instance.Create(startConfig.Id, startConfig.Type);
@@ -55,7 +55,7 @@ namespace ET.Server
 
             if (Options.Instance.Console == 1)
             {
-                fiber.AddComponent<ConsoleComponent>();
+                root.AddComponent<ConsoleComponent>();
             }
         }
     }

+ 6 - 5
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs

@@ -8,8 +8,8 @@ namespace ET.Server
     {
         protected override async ETTask Run(Session session, C2G_LoginGate request, G2C_LoginGate response)
         {
-            Fiber fiber = session.Fiber();
-            string account = fiber.GetComponent<GateSessionKeyComponent>().Get(request.Key);
+            Scene root = session.Root();
+            string account = root.GetComponent<GateSessionKeyComponent>().Get(request.Key);
             if (account == null)
             {
                 response.Error = ErrorCore.ERR_ConnectGateKeyError;
@@ -19,7 +19,7 @@ namespace ET.Server
             
             session.RemoveComponent<SessionAcceptTimeoutComponent>();
 
-            PlayerComponent playerComponent = fiber.GetComponent<PlayerComponent>();
+            PlayerComponent playerComponent = root.GetComponent<PlayerComponent>();
             Player player = playerComponent.GetByAccount(account);
             if (player == null)
             {
@@ -56,9 +56,10 @@ namespace ET.Server
 
         private static async ETTask CheckRoom(Player player, Session session)
         {
-            await player.Fiber().WaitFrameFinish();
+            Fiber fiber = player.Fiber();
+            await fiber.WaitFrameFinish();
             
-            Room2G_Reconnect room2GateReconnect = await player.Fiber().GetComponent<ActorSenderComponent>().Call(
+            Room2G_Reconnect room2GateReconnect = await fiber.Root.GetComponent<ActorSenderComponent>().Call(
                 player.GetComponent<PlayerRoomComponent>().RoomActorId,
                 new G2Room_Reconnect() { PlayerId = player.Id }) as Room2G_Reconnect;
             session.Send(new G2C_Reconnect() { StartTime = room2GateReconnect.StartTime, UnitInfos = room2GateReconnect.UnitInfos, Frame = room2GateReconnect.Frame});

+ 5 - 5
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/FiberInit_Gate.cs

@@ -7,13 +7,13 @@ namespace ET.Server
     {
         public override void Handle(FiberInit fiberInit)
         {
-            Fiber fiber = fiberInit.Fiber;
+            Scene root = fiberInit.Fiber.Root;
 
-            fiber.AddComponent<PlayerComponent>();
-            fiber.AddComponent<GateSessionKeyComponent>();
+            root.AddComponent<PlayerComponent>();
+            root.AddComponent<GateSessionKeyComponent>();
 
-            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)fiber.Id);
-            fiber.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
+            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id);
+            root.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
         }
     }
 }

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

@@ -23,7 +23,7 @@
 
         private static async ETTask TimeoutRemoveKey(this GateSessionKeyComponent self, long key)
         {
-            await self.Fiber().GetComponent<TimerComponent>().WaitAsync(20000);
+            await self.Root().GetComponent<TimerComponent>().WaitAsync(20000);
             self.sessionKey.Remove(key);
         }
     }

+ 5 - 5
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/NetServerComponentOnReadEvent.cs

@@ -7,7 +7,7 @@
         {
             Session session = args.Session;
             object message = args.Message;
-            Fiber fiber = scene.Fiber();
+            Scene root = scene.Root();
 
             if (message is IResponse response)
             {
@@ -23,7 +23,7 @@
                     Player player = session.GetComponent<SessionPlayerComponent>().Player;
                     ActorId roomActorId = player.GetComponent<PlayerRoomComponent>().RoomActorId;
                     frameMessage.PlayerId = player.Id;
-                    fiber.GetComponent<ActorSenderComponent>().Send(roomActorId, frameMessage);
+                    root.GetComponent<ActorSenderComponent>().Send(roomActorId, frameMessage);
                     break;
                 }
                 case IActorRoom actorRoom:
@@ -31,13 +31,13 @@
                     Player player = session.GetComponent<SessionPlayerComponent>().Player;
                     ActorId roomActorId = player.GetComponent<PlayerRoomComponent>().RoomActorId;
                     actorRoom.PlayerId = player.Id;
-                    fiber.GetComponent<ActorSenderComponent>().Send(roomActorId, actorRoom);
+                    root.GetComponent<ActorSenderComponent>().Send(roomActorId, actorRoom);
                     break;
                 }
                 case IActorLocationMessage actorLocationMessage:
                 {
                     long unitId = session.GetComponent<SessionPlayerComponent>().Player.Id;
-                    fiber.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Send(unitId, actorLocationMessage);
+                    root.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Send(unitId, actorLocationMessage);
                     break;
                 }
                 case IActorLocationRequest actorLocationRequest: // gate session收到actor rpc消息,先向actor 发送rpc请求,再将请求结果返回客户端
@@ -45,7 +45,7 @@
                     long unitId = session.GetComponent<SessionPlayerComponent>().Player.Id;
                     int rpcId = actorLocationRequest.RpcId; // 这里要保存客户端的rpcId
                     long instanceId = session.InstanceId;
-                    IResponse iResponse = await fiber.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Call(unitId, actorLocationRequest);
+                    IResponse iResponse = await root.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Call(unitId, actorLocationRequest);
                     iResponse.RpcId = rpcId;
                     // session可能已经断开了,所以这里需要判断
                     if (session.InstanceId == instanceId)

+ 4 - 4
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/R2G_GetLoginKeyHandler.cs

@@ -4,14 +4,14 @@
 namespace ET.Server
 {
 	[ActorMessageHandler(SceneType.Gate)]
-	public class R2G_GetLoginKeyHandler : ActorMessageHandler<Fiber, R2G_GetLoginKey, G2R_GetLoginKey>
+	public class R2G_GetLoginKeyHandler : ActorMessageHandler<Scene, R2G_GetLoginKey, G2R_GetLoginKey>
 	{
-		protected override async ETTask Run(Fiber fiber, R2G_GetLoginKey request, G2R_GetLoginKey response)
+		protected override async ETTask Run(Scene scene, R2G_GetLoginKey request, G2R_GetLoginKey response)
 		{
 			long key = RandomGenerator.RandInt64();
-			fiber.GetComponent<GateSessionKeyComponent>().Add(key, request.Account);
+			scene.GetComponent<GateSessionKeyComponent>().Add(key, request.Account);
 			response.Key = key;
-			response.GateId = fiber.Id;
+			response.GateId = scene.Id;
 			await ETTask.CompletedTask;
 		}
 	}

+ 3 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs

@@ -5,12 +5,13 @@
         [EntitySystem]
         private static void Destroy(this SessionPlayerComponent self)
         {
-            if (self.Fiber().IsDisposed)
+            Scene root = self.Root();
+            if (root.IsDisposed)
             {
                 return;
             }
             // 发送断线消息
-            self.Fiber().GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Send(self.Player.Id, new G2M_SessionDisconnect());
+            root.GetComponent<ActorLocationSenderComponent>().Get(LocationType.Unit).Send(self.Player.Id, new G2M_SessionDisconnect());
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs

@@ -39,7 +39,7 @@ namespace ET.Server
             unit.AddComponent<AOIEntity, int, float3>(9 * 1000, unit.Position);
 
             // 解锁location,可以接收发给Unit的消息
-            await scene.Fiber().GetComponent<LocationProxyComponent>().UnLock(LocationType.Unit, unit.Id, request.OldActorId, unit.GetActorId());
+            await scene.Root().GetComponent<LocationProxyComponent>().UnLock(LocationType.Unit, unit.Id, request.OldActorId, unit.GetActorId());
         }
     }
 }

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Transfer/TransferHelper.cs

@@ -15,7 +15,7 @@ namespace ET.Server
 
         public static async ETTask Transfer(Unit unit, ActorId sceneInstanceId, string sceneName)
         {
-            Fiber fiber = unit.Fiber();
+            Scene root = unit.Root();
             
             // location加锁
             long unitId = unit.Id;
@@ -32,8 +32,8 @@ namespace ET.Server
             }
             unit.Dispose();
             
-            await fiber.GetComponent<LocationProxyComponent>().Lock(LocationType.Unit, unitId, request.OldActorId);
-            await fiber.GetComponent<ActorSenderComponent>().Call(sceneInstanceId, request);
+            await root.GetComponent<LocationProxyComponent>().Lock(LocationType.Unit, unitId, request.OldActorId);
+            await root.GetComponent<ActorSenderComponent>().Call(sceneInstanceId, request);
         }
     }
 }

+ 4 - 4
Unity/Assets/Scripts/Hotfix/Server/Demo/MessageHelper.cs

@@ -25,7 +25,7 @@ namespace ET.Server
         {
             Dictionary<long, AOIEntity> dict = unit.GetBeSeePlayers();
             // 网络底层做了优化,同一个消息不会多次序列化
-            ActorLocationSenderOneType oneTypeLocationType = unit.Fiber().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession);
+            ActorLocationSenderOneType oneTypeLocationType = unit.Root().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession);
             foreach (AOIEntity u in dict.Values)
             {
                 oneTypeLocationType.Send(u.Unit.Id, message);
@@ -34,15 +34,15 @@ namespace ET.Server
         
         public static void SendToClient(Unit unit, IActorMessage message)
         {
-            unit.Fiber().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(unit.Id, message);
+            unit.Root().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(unit.Id, message);
         }
         
         /// <summary>
         /// 发送协议给Actor
         /// </summary>
-        public static void SendActor(Fiber fiber, ActorId actorId, IActorMessage message)
+        public static void SendActor(Scene root, ActorId actorId, IActorMessage message)
         {
-            fiber.GetComponent<ActorSenderComponent>().Send(actorId, message);
+            root.GetComponent<ActorSenderComponent>().Send(actorId, message);
         }
     }
 }

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

@@ -14,7 +14,7 @@ namespace ET.Server
 			Log.Debug($"gate address: {MongoHelper.ToJson(config)}");
 			
 			// 向gate请求一个key,客户端可以拿着这个key连接gate
-			G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await session.Fiber().GetComponent<ActorSenderComponent>().Call(
+			G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await session.Fiber().Root.GetComponent<ActorSenderComponent>().Call(
 				config.ActorId, new R2G_GetLoginKey() {Account = request.Account});
 
 			response.Address = config.InnerIPOutPort.ToString();

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

@@ -10,7 +10,7 @@ namespace ET.Server
             Fiber fiber = fiberInit.Fiber;
             
             StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)fiber.Id);
-            fiber.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
+            fiber.Root.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
         }
     }
 }

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

@@ -56,5 +56,6 @@ namespace ET.Server
 
             return scene;
         }
+        
     }
 }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs

@@ -9,7 +9,7 @@
 
 			StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Match;
 
-			await session.Fiber().GetComponent<ActorSenderComponent>().Call(startSceneConfig.ActorId,
+			await session.Root().GetComponent<ActorSenderComponent>().Call(startSceneConfig.ActorId,
 				new G2Match_Match() { Id = player.Id });
 		}
 	}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs

@@ -18,7 +18,7 @@ namespace ET.Server
                 return;
             }
             
-            await room.Fiber().GetComponent<TimerComponent>().WaitAsync(1000);
+            await room.Root().GetComponent<TimerComponent>().WaitAsync(1000);
 
             Room2C_Start room2CStart = new() { StartTime = TimeHelper.ServerFrameTime() };
             foreach (RoomPlayer rp in roomServerComponent.Children.Values)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs

@@ -15,7 +15,7 @@ namespace ET.Server
                 long nowFrameTime = room.FixedTimeCounter.FrameTime(message.Frame);
                 int diffTime = (int)(nowFrameTime - TimeHelper.ServerFrameTime());
 
-                room.Fiber().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, new Room2C_AdjustUpdateTime() {DiffTime = diffTime});
+                room.Root().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, new Room2C_AdjustUpdateTime() {DiffTime = diffTime});
             }
 
             if (message.Frame < room.AuthorityFrame)  // 小于AuthorityFrame,丢弃

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/RoomMessageHelper.cs

@@ -7,7 +7,7 @@ namespace ET.Server
         {
             RoomServerComponent roomServerComponent = room.GetComponent<RoomServerComponent>();
 
-            ActorLocationSenderComponent actorLocationSenderComponent = room.Fiber().GetComponent<ActorLocationSenderComponent>();
+            ActorLocationSenderComponent actorLocationSenderComponent = room.Root().GetComponent<ActorLocationSenderComponent>();
             foreach (var kv in roomServerComponent.Children)
             {
                 RoomPlayer roomPlayer = kv.Value as RoomPlayer;

+ 4 - 3
Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs

@@ -29,12 +29,13 @@ namespace ET.Server
                 match2MapGetRoom.PlayerIds.Add(id);
             }
             self.waitMatchPlayers.Clear();
-            
-            Map2Match_GetRoom map2MatchGetRoom = await self.Fiber().GetComponent<ActorSenderComponent>().Call(
+
+            Scene root = self.Root();
+            Map2Match_GetRoom map2MatchGetRoom = await root.GetComponent<ActorSenderComponent>().Call(
                 startSceneConfig.ActorId, match2MapGetRoom) as Map2Match_GetRoom;
 
             Match2G_NotifyMatchSuccess match2GNotifyMatchSuccess = new() { ActorId = map2MatchGetRoom.ActorId };
-            ActorLocationSenderComponent actorLocationSenderComponent = self.Fiber().GetComponent<ActorLocationSenderComponent>();
+            ActorLocationSenderComponent actorLocationSenderComponent = root.GetComponent<ActorLocationSenderComponent>();
             foreach (long id in match2MapGetRoom.PlayerIds) // 这里发送消息线程不会修改PlayerInfo,所以可以直接使用
             {
                 actorLocationSenderComponent.Get(LocationType.Player).Send(id, match2GNotifyMatchSuccess);

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs

@@ -10,7 +10,7 @@ namespace ET.Server
             {
                 byte[] bytes = room.FrameBuffer.Snapshot(message.Frame).ToArray();
                 Room2C_CheckHashFail room2CCheckHashFail = new() { Frame = message.Frame, LSWorldBytes = bytes };
-                room.Fiber().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, room2CCheckHashFail);
+                room.Root().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, room2CCheckHashFail);
             }
             await ETTask.CompletedTask;
         }

+ 25 - 16
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -30,17 +30,18 @@ namespace ET.Server
             self.LocationType = locationType;
             // 每10s扫描一次过期的actorproxy进行回收,过期时间是2分钟
             // 可能由于bug或者进程挂掉,导致ActorLocationSender发送的消息没有确认,结果无法自动删除,每一分钟清理一次这种ActorLocationSender
-            self.CheckTimer = self.Fiber().GetComponent<TimerComponent>().NewRepeatedTimer(10 * 1000, TimerInvokeType.ActorLocationSenderChecker, self);
+            self.CheckTimer = self.Root().GetComponent<TimerComponent>().NewRepeatedTimer(10 * 1000, TimerInvokeType.ActorLocationSenderChecker, self);
         }
         
         [EntitySystem]
         private static void Destroy(this ActorLocationSenderOneType self)
         {
-            if (self.Fiber().InstanceId == 0)
+            Scene root = self.Root();
+            if (root.InstanceId == 0)
             {
                 return;
             }
-            self.Fiber().GetComponent<TimerComponent>().Remove(ref self.CheckTimer);
+            root.GetComponent<TimerComponent>().Remove(ref self.CheckTimer);
         }
 
         private static void Check(this ActorLocationSenderOneType self)
@@ -104,17 +105,19 @@ namespace ET.Server
         {
             ActorLocationSender actorLocationSender = self.GetOrCreate(entityId);
 
+            Scene root = self.Root();
+            
             if (actorLocationSender.ActorId != default)
             {
                 actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
-                self.Fiber().GetComponent<ActorSenderComponent>().Send(actorLocationSender.ActorId, message);
+                root.GetComponent<ActorSenderComponent>().Send(actorLocationSender.ActorId, message);
                 return;
             }
             
             long instanceId = actorLocationSender.InstanceId;
             
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.ActorLocationSender;
-            using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, entityId))
+            using (await root.GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, entityId))
             {
                 if (actorLocationSender.InstanceId != instanceId)
                 {
@@ -123,7 +126,7 @@ namespace ET.Server
                 
                 if (actorLocationSender.ActorId == default)
                 {
-                    actorLocationSender.ActorId = await self.Fiber().GetComponent<LocationProxyComponent>().Get(self.LocationType, actorLocationSender.Id);
+                    actorLocationSender.ActorId = await root.GetComponent<LocationProxyComponent>().Get(self.LocationType, actorLocationSender.Id);
                     if (actorLocationSender.InstanceId != instanceId)
                     {
                         throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{message}");
@@ -131,7 +134,7 @@ namespace ET.Server
                 }
                 
                 actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
-                self.Fiber().GetComponent<ActorSenderComponent>().Send(actorLocationSender.ActorId, message);
+                root.GetComponent<ActorSenderComponent>().Send(actorLocationSender.ActorId, message);
             }
         }
 
@@ -141,16 +144,18 @@ namespace ET.Server
         {
             ActorLocationSender actorLocationSender = self.GetOrCreate(entityId);
 
+            Scene root = self.Root();
+            
             if (actorLocationSender.ActorId != default)
             {
                 actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
-                return await self.Fiber().GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, request);
+                return await root.GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, request);
             }
             
             long instanceId = actorLocationSender.InstanceId;
             
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.ActorLocationSender;
-            using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, entityId))
+            using (await root.GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, entityId))
             {
                 if (actorLocationSender.InstanceId != instanceId)
                 {
@@ -159,7 +164,7 @@ namespace ET.Server
 
                 if (actorLocationSender.ActorId == default)
                 {
-                    actorLocationSender.ActorId = await self.Fiber().GetComponent<LocationProxyComponent>().Get(self.LocationType, actorLocationSender.Id);
+                    actorLocationSender.ActorId = await root.GetComponent<LocationProxyComponent>().Get(self.LocationType, actorLocationSender.Id);
                     if (actorLocationSender.InstanceId != instanceId)
                     {
                         throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{request}");
@@ -168,7 +173,7 @@ namespace ET.Server
             }
 
             actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
-            return await self.Fiber().GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, request);
+            return await root.GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, request);
         }
 
         public static void Send(this ActorLocationSenderOneType self, long entityId, IActorLocationMessage message)
@@ -180,13 +185,15 @@ namespace ET.Server
         {
             ActorLocationSender actorLocationSender = self.GetOrCreate(entityId);
 
+            Scene root = self.Root();
+            
             // 先序列化好
-            int rpcId = self.Fiber().GetComponent<ActorSenderComponent>().GetRpcId();
+            int rpcId = root.GetComponent<ActorSenderComponent>().GetRpcId();
             iActorRequest.RpcId = rpcId;
             
             long actorLocationSenderInstanceId = actorLocationSender.InstanceId;
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.ActorLocationSender;
-            using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, entityId))
+            using (await root.GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, entityId))
             {
                 if (actorLocationSender.InstanceId != actorLocationSenderInstanceId)
                 {
@@ -222,11 +229,13 @@ namespace ET.Server
             long instanceId = actorLocationSender.InstanceId;
             actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
             
+            Scene root = self.Root();
+            
             while (true)
             {
                 if (actorLocationSender.ActorId == default)
                 {
-                    actorLocationSender.ActorId = await self.Fiber().GetComponent<LocationProxyComponent>().Get(self.LocationType, actorLocationSender.Id);
+                    actorLocationSender.ActorId = await root.GetComponent<LocationProxyComponent>().Get(self.LocationType, actorLocationSender.Id);
                     if (actorLocationSender.InstanceId != instanceId)
                     {
                         throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout2, $"{iActorRequest}");
@@ -238,7 +247,7 @@ namespace ET.Server
                     actorLocationSender.Error = ErrorCore.ERR_NotFoundActor;
                     return ActorHelper.CreateResponse(iActorRequest, ErrorCore.ERR_NotFoundActor);
                 }
-                IActorResponse response = await self.Fiber().GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, rpcId, iActorRequest, false);
+                IActorResponse response = await root.GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, rpcId, iActorRequest, false);
                 if (actorLocationSender.InstanceId != instanceId)
                 {
                     throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout3, $"{iActorRequest}");
@@ -259,7 +268,7 @@ namespace ET.Server
                         }
 
                         // 等待0.5s再发送
-                        await self.Fiber().GetComponent<TimerComponent>().WaitAsync(500);
+                        await root.GetComponent<TimerComponent>().WaitAsync(500);
                         if (actorLocationSender.InstanceId != instanceId)
                         {
                             throw new RpcException(ErrorCore.ERR_ActorLocationSenderTimeout4, $"{iActorRequest}");

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorMessageLocationHandler.cs

@@ -22,7 +22,7 @@ namespace ET.Server
             }
             
             ActorResponse response = new() {RpcId = message.RpcId};
-            entity.Fiber().GetComponent<ActorSenderComponent>().Reply(fromAddress, response);
+            entity.Root().GetComponent<ActorSenderComponent>().Reply(fromAddress, response);
 
             await this.Run(e, message);
         }
@@ -75,7 +75,7 @@ namespace ET.Server
                     response.Message = exception.ToString();
                 }
                 response.RpcId = rpcId;
-                entity.Fiber().GetComponent<ActorSenderComponent>().Reply(fromAddress, response);
+                entity.Root().GetComponent<ActorSenderComponent>().Reply(fromAddress, response);
             }
             catch (Exception e)
             {

+ 5 - 5
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationOneTypeSystem.cs

@@ -35,7 +35,7 @@ namespace ET.Server
         public static async ETTask Add(this LocationOneType self, long key, ActorId instanceId)
         {
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location;
-            using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key))
+            using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key))
             {
                 self.locations[key] = instanceId;
                 Log.Info($"location add key: {key} instanceId: {instanceId}");
@@ -45,7 +45,7 @@ namespace ET.Server
         public static async ETTask Remove(this LocationOneType self, long key)
         {
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location;
-            using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key))
+            using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key))
             {
                 self.locations.Remove(key);
                 Log.Info($"location remove key: {key}");
@@ -55,7 +55,7 @@ namespace ET.Server
         public static async ETTask Lock(this LocationOneType self, long key, ActorId actorId, int time = 0)
         {
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location;
-            CoroutineLock coroutineLock = await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key);
+            CoroutineLock coroutineLock = await self.Root().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key);
 
             LockInfo lockInfo = self.AddChild<LockInfo, ActorId, CoroutineLock>(actorId, coroutineLock);
             self.lockInfos.Add(key, lockInfo);
@@ -67,7 +67,7 @@ namespace ET.Server
                 async ETTask TimeWaitAsync()
                 {
                     long lockInfoInstanceId = lockInfo.InstanceId;
-                    await self.Fiber().GetComponent<TimerComponent>().WaitAsync(time);
+                    await self.Root().GetComponent<TimerComponent>().WaitAsync(time);
                     if (lockInfo.InstanceId != lockInfoInstanceId)
                     {
                         return;
@@ -106,7 +106,7 @@ namespace ET.Server
         public static async ETTask<ActorId> Get(this LocationOneType self, long key)
         {
             int coroutineLockType = (self.LocationType << 16) | CoroutineLockType.Location;
-            using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key))
+            using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(coroutineLockType, key))
             {
                 self.locations.TryGetValue(key, out ActorId actorId);
                 Log.Info($"location get key: {key} actorId: {actorId}");

+ 7 - 7
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs

@@ -12,28 +12,28 @@ namespace ET.Server
         public static async ETTask Add(this LocationProxyComponent self, int type, long key, ActorId actorId)
         {
             Log.Info($"location proxy add {key}, {actorId} {TimeHelper.ServerNow()}");
-            await self.Fiber().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
+            await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectAddRequest() { Type = type, Key = key, ActorId = actorId });
         }
 
         public static async ETTask Lock(this LocationProxyComponent self, int type, long key, ActorId actorId, int time = 60000)
         {
             Log.Info($"location proxy lock {key}, {actorId} {TimeHelper.ServerNow()}");
-            await self.Fiber().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
+            await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectLockRequest() { Type = type, Key = key, ActorId = actorId, Time = time });
         }
 
         public static async ETTask UnLock(this LocationProxyComponent self, int type, long key, ActorId oldActorId, ActorId newActorId)
         {
             Log.Info($"location proxy unlock {key}, {newActorId} {TimeHelper.ServerNow()}");
-            await self.Fiber().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
+            await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectUnLockRequest() { Type = type, Key = key, OldActorId = oldActorId, NewActorId = newActorId });
         }
 
         public static async ETTask Remove(this LocationProxyComponent self, int type, long key)
         {
             Log.Info($"location proxy add {key}, {TimeHelper.ServerNow()}");
-            await self.Fiber().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
+            await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectRemoveRequest() { Type = type, Key = key });
         }
 
@@ -46,19 +46,19 @@ namespace ET.Server
 
             // location server配置到共享区,一个大战区可以配置N多个location server,这里暂时为1
             ObjectGetResponse response =
-                    (ObjectGetResponse) await self.Fiber().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
+                    (ObjectGetResponse) await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                         new ObjectGetRequest() { Type = type, Key = key });
             return response.ActorId;
         }
 
         public static async ETTask AddLocation(this Entity self, int type)
         {
-            await self.Fiber().GetComponent<LocationProxyComponent>().Add(type, self.Id, self.GetActorId());
+            await self.Root().GetComponent<LocationProxyComponent>().Add(type, self.Id, self.GetActorId());
         }
 
         public static async ETTask RemoveLocation(this Entity self, int type)
         {
-            await self.Fiber().GetComponent<LocationProxyComponent>().Remove(type, self.Id);
+            await self.Root().GetComponent<LocationProxyComponent>().Remove(type, self.Id);
         }
     }
 }

+ 14 - 14
Unity/Assets/Scripts/Hotfix/Server/Module/DB/DBComponentSystem.cs

@@ -29,7 +29,7 @@ namespace ET.Server
 
 	    public static async ETTask<T> Query<T>(this DBComponent self, long id, string collection = null) where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
 		    {
 			    IAsyncCursor<T> cursor = await self.GetCollection<T>(collection).FindAsync(d => d.Id == id);
 
@@ -40,7 +40,7 @@ namespace ET.Server
 	    public static async ETTask<List<T>> Query<T>(this DBComponent self, Expression<Func<T, bool>> filter, string collection = null)
 			    where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
 		    {
 			    IAsyncCursor<T> cursor = await self.GetCollection<T>(collection).FindAsync(filter);
 
@@ -51,7 +51,7 @@ namespace ET.Server
 	    public static async ETTask<List<T>> Query<T>(this DBComponent self, long taskId, Expression<Func<T, bool>> filter, string collection = null)
 			    where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
 		    {
 			    IAsyncCursor<T> cursor = await self.GetCollection<T>(collection).FindAsync(filter);
 
@@ -66,7 +66,7 @@ namespace ET.Server
 			    return;
 		    }
 
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
 		    {
 			    foreach (string collectionName in collectionNames)
 			    {
@@ -86,7 +86,7 @@ namespace ET.Server
 
 	    public static async ETTask<List<T>> QueryJson<T>(this DBComponent self, string json, string collection = null) where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
 		    {
 			    FilterDefinition<T> filterDefinition = new JsonFilterDefinition<T>(json);
 			    IAsyncCursor<T> cursor = await self.GetCollection<T>(collection).FindAsync(filterDefinition);
@@ -96,7 +96,7 @@ namespace ET.Server
 
 	    public static async ETTask<List<T>> QueryJson<T>(this DBComponent self, long taskId, string json, string collection = null) where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
 		    {
 			    FilterDefinition<T> filterDefinition = new JsonFilterDefinition<T>(json);
 			    IAsyncCursor<T> cursor = await self.GetCollection<T>(collection).FindAsync(filterDefinition);
@@ -115,7 +115,7 @@ namespace ET.Server
 			    collection = typeof (T).Name;
 		    }
 		    
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
 		    {
 			    await self.GetCollection(collection).InsertManyAsync(list);
 		    }
@@ -139,7 +139,7 @@ namespace ET.Server
 			    collection = entity.GetType().FullName;
 		    }
 
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, entity.Id % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, entity.Id % DBComponent.TaskCount))
 		    {
 			    await self.GetCollection(collection).ReplaceOneAsync(d => d.Id == entity.Id, entity, new ReplaceOptions { IsUpsert = true });
 		    }
@@ -159,7 +159,7 @@ namespace ET.Server
 			    collection = entity.GetType().FullName;
 		    }
 
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
 		    {
 			    await self.GetCollection(collection).ReplaceOneAsync(d => d.Id == entity.Id, entity, new ReplaceOptions { IsUpsert = true });
 		    }
@@ -173,7 +173,7 @@ namespace ET.Server
 			    return;
 		    }
 
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
 		    {
 			    foreach (Entity entity in entities)
 			    {
@@ -206,7 +206,7 @@ namespace ET.Server
 	    
 	    public static async ETTask<long> Remove<T>(this DBComponent self, long id, string collection = null) where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, id % DBComponent.TaskCount))
 		    {
 			    DeleteResult result = await self.GetCollection<T>(collection).DeleteOneAsync(d => d.Id == id);
 
@@ -216,7 +216,7 @@ namespace ET.Server
 
 	    public static async ETTask<long> Remove<T>(this DBComponent self, long taskId, long id, string collection = null) where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
 		    {
 			    DeleteResult result = await self.GetCollection<T>(collection).DeleteOneAsync(d => d.Id == id);
 
@@ -226,7 +226,7 @@ namespace ET.Server
 
 	    public static async ETTask<long> Remove<T>(this DBComponent self, Expression<Func<T, bool>> filter, string collection = null) where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, RandomGenerator.RandInt64() % DBComponent.TaskCount))
 		    {
 			    DeleteResult result = await self.GetCollection<T>(collection).DeleteManyAsync(filter);
 
@@ -237,7 +237,7 @@ namespace ET.Server
 	    public static async ETTask<long> Remove<T>(this DBComponent self, long taskId, Expression<Func<T, bool>> filter, string collection = null)
 			    where T : Entity
 	    {
-		    using (await self.Fiber().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
+		    using (await self.Root().GetComponent<CoroutineLockComponent>().Wait(CoroutineLockType.DB, taskId % DBComponent.TaskCount))
 		    {
 			    DeleteResult result = await self.GetCollection<T>(collection).DeleteManyAsync(filter);
 

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

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

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/RobotCase/ARobotCase.cs

@@ -8,7 +8,7 @@ namespace ET.Server
 
         public override async ETTask Handle(RobotInvokeArgs a)
         {
-            using RobotCase robotCase = await a.Fiber.GetComponent<RobotCaseComponent>().New();
+            using RobotCase robotCase = await a.Fiber.Root.GetComponent<RobotCaseComponent>().New();
             
             try
             {

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

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

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Share/FiberInit_Main.cs

@@ -12,9 +12,9 @@
         {
             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());
+            await EventSystem.Instance.PublishAsync(fiber.Root, new EventType.EntryEvent1());
+            await EventSystem.Instance.PublishAsync(fiber.Root, new EventType.EntryEvent2());
+            await EventSystem.Instance.PublishAsync(fiber.Root, new EventType.EntryEvent3());
         }
     }
 }

+ 5 - 4
Unity/Assets/Scripts/Hotfix/Share/Module/AI/AIComponentSystem.cs

@@ -26,17 +26,18 @@ namespace ET
         private static void Awake(this AIComponent self, int aiConfigId)
         {
             self.AIConfigId = aiConfigId;
-            self.Timer = self.Fiber().GetComponent<TimerComponent>().NewRepeatedTimer(1000, TimerInvokeType.AITimer, self);
+            self.Timer = self.Root().GetComponent<TimerComponent>().NewRepeatedTimer(1000, TimerInvokeType.AITimer, self);
         }
 
         [EntitySystem]
         private static void Destroy(this AIComponent self)
         {
-            if (self.Fiber().InstanceId == 0)
+            Scene root = self.Root();
+            if (root.InstanceId == 0)
             {
                 return;
             }
-            self.Fiber().GetComponent<TimerComponent>().Remove(ref self.Timer);
+            root.GetComponent<TimerComponent>().Remove(ref self.Timer);
             self.CancellationToken?.Cancel();
             self.CancellationToken = null;
             self.Current = 0;
@@ -46,7 +47,7 @@ namespace ET
         {
             if (self.Parent == null)
             {
-                self.Fiber().GetComponent<TimerComponent>().Remove(ref self.Timer);
+                self.Root().GetComponent<TimerComponent>().Remove(ref self.Timer);
                 return;
             }
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorMessageHandler.cs

@@ -79,7 +79,7 @@ namespace ET
                 }
                 
                 response.RpcId = rpcId;
-                entity.Fiber().GetComponent<ActorSenderComponent>().Reply(fromAddress, response);
+                entity.Root().GetComponent<ActorSenderComponent>().Reply(fromAddress, response);
             }
             catch (Exception e)
             {

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorRecverComponentSystem.cs

@@ -22,9 +22,9 @@ namespace ET
         {
             self.list.Clear();
             Fiber fiber = self.Fiber();
-            ActorMessageQueue.Instance.Fetch((int)fiber.Id, 1000, self.list);
+            ActorMessageQueue.Instance.Fetch(fiber.Id, 1000, self.list);
 
-            ActorSenderComponent actorSenderComponent = self.Fiber().GetComponent<ActorSenderComponent>();
+            ActorSenderComponent actorSenderComponent = fiber.Root.GetComponent<ActorSenderComponent>();
             foreach (ActorMessageInfo actorMessageInfo in self.list)
             {
                 if (actorMessageInfo.MessageObject is IActorResponse response)

+ 4 - 3
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorSenderComponentSystem.cs

@@ -25,17 +25,18 @@ namespace ET
         [EntitySystem]
         private static void Awake(this ActorSenderComponent self)
         {
-            self.TimeoutCheckTimer = self.Fiber().GetComponent<TimerComponent>().NewRepeatedTimer(1000, TimerInvokeType.ActorMessageSenderChecker, self);
+            self.TimeoutCheckTimer = self.Root().GetComponent<TimerComponent>().NewRepeatedTimer(1000, TimerInvokeType.ActorMessageSenderChecker, self);
         }
         
         [EntitySystem]
         private static void Destroy(this ActorSenderComponent self)
         {
-            if (self.Fiber().InstanceId == 0)
+            Scene root = self.Root();
+            if (root.InstanceId == 0)
             {
                 return;
             }
-            self.Fiber().GetComponent<TimerComponent>().Remove(ref self.TimeoutCheckTimer);
+            root.GetComponent<TimerComponent>().Remove(ref self.TimeoutCheckTimer);
             self.TimeoutCheckTimer = 0;
             self.TimeoutActorMessageSenders.Clear();
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/MailBoxType_OrderedMessageHandler.cs

@@ -29,7 +29,7 @@
                     if (messageObject is IActorRequest request)
                     {
                         IActorResponse resp = ActorHelper.CreateResponse(request, ErrorCore.ERR_NotFoundActor);
-                        mailBoxComponent.Fiber().GetComponent<ActorSenderComponent>().Reply(args.FromAddress, resp);
+                        mailBoxComponent.Root().GetComponent<ActorSenderComponent>().Reply(args.FromAddress, resp);
                     }
                     return;
                 }

+ 4 - 3
Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs

@@ -24,17 +24,18 @@ namespace ET
         [EntitySystem]
         private static void Awake(this SessionAcceptTimeoutComponent self)
         {
-            self.Timer = self.Fiber().GetComponent<TimerComponent>().NewOnceTimer(TimeHelper.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
+            self.Timer = self.Root().GetComponent<TimerComponent>().NewOnceTimer(TimeHelper.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
         }
         
         [EntitySystem]
         private static void Destroy(this SessionAcceptTimeoutComponent self)
         {
-            if (self.Fiber().IsDisposed)
+            Scene root = self.Root();
+            if (root.IsDisposed)
             {
                 return;
             }
-            self.Fiber().GetComponent<TimerComponent>().Remove(ref self.Timer);
+            root.GetComponent<TimerComponent>().Remove(ref self.Timer);
         }
         
     }

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs

@@ -24,7 +24,7 @@ namespace ET
         [EntitySystem]
         private static void Awake(this SessionIdleCheckerComponent self)
         {
-            self.RepeatedTimer = self.Fiber().GetComponent<TimerComponent>().NewRepeatedTimer(SessionIdleCheckerComponentSystem.CheckInteral, TimerInvokeType.SessionIdleChecker, self);
+            self.RepeatedTimer = self.Root().GetComponent<TimerComponent>().NewRepeatedTimer(SessionIdleCheckerComponentSystem.CheckInteral, TimerInvokeType.SessionIdleChecker, self);
         }
         
         [EntitySystem]
@@ -34,7 +34,7 @@ namespace ET
             {
                 return;
             }
-            self.Fiber().GetComponent<TimerComponent>().Remove(ref self.RepeatedTimer);
+            self.Root().GetComponent<TimerComponent>().Remove(ref self.RepeatedTimer);
         }
         
         public const int CheckInteral = 2000;

+ 4 - 3
Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs

@@ -181,7 +181,7 @@ namespace ET
             self.StartTime = self.BeginTime;
             self.SetNextTarget();
 
-            self.MoveTimer = self.Fiber().GetComponent<TimerComponent>().NewFrameTimer(TimerInvokeType.MoveTimer, self);
+            self.MoveTimer = self.Root().GetComponent<TimerComponent>().NewFrameTimer(TimerInvokeType.MoveTimer, self);
         }
 
         private static void SetNextTarget(this MoveComponent self)
@@ -266,7 +266,8 @@ namespace ET
 
         private static void MoveFinish(this MoveComponent self, bool ret)
         {
-            if (self.Fiber().IsDisposed)
+            Scene root = self.Root();
+            if (root.IsDisposed)
             {
                 return;
             }
@@ -279,7 +280,7 @@ namespace ET
             self.StartPos = float3.zero;
             self.BeginTime = 0;
             self.NeedTime = 0;
-            self.Fiber().GetComponent<TimerComponent>().Remove(ref self.MoveTimer);
+            root.GetComponent<TimerComponent>().Remove(ref self.MoveTimer);
             self.Targets.Clear();
             self.Speed = 0;
             self.N = 0;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs

@@ -11,7 +11,7 @@ namespace ET
         private static void Awake(this PathfindingComponent self, string name)
         {
             self.Name = name;
-            self.NavMesh = self.Fiber().GetComponent<NavmeshComponent>().Get(name);
+            self.NavMesh = self.Root().GetComponent<NavmeshComponent>().Get(name);
 
             if (self.NavMesh == 0)
             {

+ 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 Fiber fiber)
+        public static Scene CurrentScene(this Scene root)
         {
-            return fiber.GetComponent<CurrentScenesComponent>()?.Scene;
+            return root.GetComponent<CurrentScenesComponent>()?.Scene;
         }
     }
 }

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

@@ -4,25 +4,25 @@ using System.IO;
 namespace ET.Client
 {
     [Event(SceneType.Main)]
-    public class EntryEvent3_InitClient: AEvent<Fiber, ET.EventType.EntryEvent3>
+    public class EntryEvent3_InitClient: AEvent<Scene, ET.EventType.EntryEvent3>
     {
-        protected override async ETTask Run(Fiber fiber, ET.EventType.EntryEvent3 args)
+        protected override async ETTask Run(Scene root, ET.EventType.EntryEvent3 args)
         {
             World.Instance.AddSingleton<UIEventComponent>();
             
             // 加载配置
-            ResourcesComponent resourcesComponent = fiber.AddComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = root.AddComponent<ResourcesComponent>();
 
             await resourcesComponent.LoadBundleAsync("unit.unity3d");
 
-            GlobalComponent globalComponent = fiber.GetComponent<GlobalComponent>();
+            GlobalComponent globalComponent = root.GetComponent<GlobalComponent>();
 
             SceneType sceneType = EnumHelper.FromString<SceneType>(globalComponent.GlobalConfig.AppType.ToString());
 
             // 根据配置修改掉Main Fiber的SceneType
-            fiber.SceneType = sceneType;
+            root.SceneType = sceneType;
             
-            await EventSystem.Instance.PublishAsync(fiber, new EventType.AppStartInitFinish());
+            await EventSystem.Instance.PublishAsync(root, 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.Fiber().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
+                    self.Root().GetComponent<SessionComponent>().Session.Send(c2MPathfindingResult);
                 }
             }
 
@@ -36,7 +36,7 @@ namespace ET.Client
             if (Input.GetKeyDown(KeyCode.T))
             {
                 C2M_TransferMap c2MTransferMap = new C2M_TransferMap();
-                self.Fiber().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
+                self.Root().GetComponent<SessionComponent>().Session.Call(c2MTransferMap).Coroutine();
             }
         }
     }

+ 3 - 3
Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/FiberInit_DemoView.cs

@@ -7,10 +7,10 @@ namespace ET.Server
     {
         public override void Handle(FiberInit fiberInit)
         {
-            Fiber fiber = fiberInit.Fiber;
+            Scene root = fiberInit.Fiber.Root;
             
-            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)fiber.Id);
-            fiber.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
+            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id);
+            root.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
         }
     }
 }

+ 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<Fiber, EventType.SceneChangeStart>
+    public class SceneChangeStart_AddComponent: AEvent<Scene, EventType.SceneChangeStart>
     {
-        protected override async ETTask Run(Fiber fiber, EventType.SceneChangeStart args)
+        protected override async ETTask Run(Scene root, EventType.SceneChangeStart args)
         {
-            Scene currentScene = fiber.CurrentScene();
+            Scene currentScene = root.CurrentScene();
 
-            ResourcesComponent resourcesComponent = fiber.GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = root.GetComponent<ResourcesComponent>();
             
             // 加载场景资源
             await resourcesComponent.LoadBundleAsync($"{currentScene.Name}.unity3d");

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

@@ -10,7 +10,7 @@ namespace ET.Client
         {
 	        try
 	        {
-		        ResourcesComponent resourcesComponent = uiComponent.Fiber().GetComponent<ResourcesComponent>();
+		        ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
 		        await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UIHelp));
 		        GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UIHelp), UIType.UIHelp);
 		        GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));

+ 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.Fiber());
-            await UIHelper.Remove(self.Fiber(), UIType.UILobby);
+            await EnterMapHelper.EnterMapAsync(self.Root());
+            await UIHelper.Remove(self.Root(), UIType.UILobby);
         }
     }
 }

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

@@ -8,7 +8,7 @@ namespace ET.Client
         public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
         {
             await ETTask.CompletedTask;
-            ResourcesComponent resourcesComponent = uiComponent.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
             await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UILobby));
             GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UILobby), UIType.UILobby);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));

+ 3 - 3
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/AppStartInitFinish_CreateLoginUI.cs

@@ -1,11 +1,11 @@
 namespace ET.Client
 {
 	[Event(SceneType.Demo)]
-	public class AppStartInitFinish_CreateLoginUI: AEvent<Fiber, EventType.AppStartInitFinish>
+	public class AppStartInitFinish_CreateLoginUI: AEvent<Scene, EventType.AppStartInitFinish>
 	{
-		protected override async ETTask Run(Fiber fiber, EventType.AppStartInitFinish args)
+		protected override async ETTask Run(Scene root, EventType.AppStartInitFinish args)
 		{
-			await UIHelper.Create(fiber, UIType.UILogin, UILayer.Mid);
+			await UIHelper.Create(root, UIType.UILogin, UILayer.Mid);
 		}
 	}
 }

+ 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.Fiber(), 
+				self.Root(), 
 				self.account.GetComponent<InputField>().text, 
 				self.password.GetComponent<InputField>().text).Coroutine();
 		}

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

@@ -8,7 +8,7 @@ namespace ET.Client
     {
         public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
         {
-            ResourcesComponent resourcesComponent = uiComponent.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
             await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UILogin));
             GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UILogin), UIType.UILogin);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));

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

@@ -10,11 +10,11 @@ namespace ET.Client
             Unit unit = args.Unit;
             // Unit View层
             // 这里可以改成异步加载,demo就不搞了
-            ResourcesComponent resourcesComponent = scene.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = scene.Root().GetComponent<ResourcesComponent>();
             GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit");
             GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
 
-            GlobalComponent globalComponent = scene.Fiber().GetComponent<GlobalComponent>();
+            GlobalComponent globalComponent = scene.Root().GetComponent<GlobalComponent>();
             GameObject go = UnityEngine.Object.Instantiate(prefab, globalComponent.Unit, true);
             go.transform.position = unit.Position;
             unit.AddComponent<GameObjectComponent>().GameObject = go;

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSSceneChangeStart_AddComponent.cs

@@ -18,7 +18,7 @@ namespace ET.Client
             await UIHelper.Create(args.Room, UIType.UILSRoom, UILayer.Low);
             
             // 加载场景资源
-            ResourcesComponent resourcesComponent = clientScene.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = clientScene.Root().GetComponent<ResourcesComponent>();
             await resourcesComponent.LoadBundleAsync($"{room.Name}.unity3d");
             // 切换到map场景
 

+ 3 - 2
Unity/Assets/Scripts/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs

@@ -9,14 +9,15 @@ namespace ET.Client
         {
             Room room = self.Room();
             LSUnitComponent lsUnitComponent = room.LSWorld.GetComponent<LSUnitComponent>();
+            Scene root = self.Root();
             foreach (long playerId in room.PlayerIds)
             {
                 LSUnit lsUnit = lsUnitComponent.GetChild<LSUnit>(playerId);
-                ResourcesComponent resourcesComponent = self.Fiber().GetComponent<ResourcesComponent>();
+                ResourcesComponent resourcesComponent = root.GetComponent<ResourcesComponent>();
                 GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit");
                 GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
 
-                GlobalComponent globalComponent = self.Fiber().GetComponent<GlobalComponent>();
+                GlobalComponent globalComponent = root.GetComponent<GlobalComponent>();
                 GameObject unitGo = UnityEngine.Object.Instantiate(prefab, globalComponent.Unit, true);
                 unitGo.transform.position = lsUnit.Position.ToVector();
 

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

@@ -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.Fiber(), replay).Coroutine();
+            LSSceneChangeHelper.SceneChangeToReplay(self.Root(), replay).Coroutine();
         }
     }
 }

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyEvent.cs

@@ -8,7 +8,7 @@ namespace ET.Client
         public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
         {
             await ETTask.CompletedTask;
-            ResourcesComponent resourcesComponent = uiComponent.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
             await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UILSLobby));
             GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UILSLobby), UIType.UILSLobby);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));

+ 3 - 3
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/AppStartInitFinish_CreateUILSLogin.cs

@@ -1,11 +1,11 @@
 namespace ET.Client
 {
 	[Event(SceneType.LockStep)]
-	public class AppStartInitFinish_CreateUILSLogin: AEvent<Fiber, EventType.AppStartInitFinish>
+	public class AppStartInitFinish_CreateUILSLogin: AEvent<Scene, EventType.AppStartInitFinish>
 	{
-		protected override async ETTask Run(Fiber fiber, EventType.AppStartInitFinish args)
+		protected override async ETTask Run(Scene root, EventType.AppStartInitFinish args)
 		{
-			await UIHelper.Create(fiber, UIType.UILSLogin, UILayer.Mid);
+			await UIHelper.Create(root, UIType.UILSLogin, UILayer.Mid);
 		}
 	}
 }

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

@@ -8,7 +8,7 @@ namespace ET.Client
     {
         public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
         {
-            ResourcesComponent resourcesComponent = uiComponent.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
             await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UILSLogin));
             GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UILSLogin), UIType.UILSLogin);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));

+ 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.Fiber(),
+                self.Root(),
                 self.account.GetComponent<InputField>().text,
                 self.password.GetComponent<InputField>().text).Coroutine();
         }

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomEvent.cs

@@ -8,7 +8,7 @@ namespace ET.Client
     {
         public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
         {
-            ResourcesComponent resourcesComponent = uiComponent.Fiber().GetComponent<ResourcesComponent>();
+            ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
             await uiComponent.Room().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UILSRoom));
             GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UILSRoom), UIType.UILSRoom);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIComponentSystem.cs

@@ -11,7 +11,7 @@ namespace ET.Client
 		[EntitySystem]
 		private static void Awake(this UIComponent self)
 		{
-			self.UIGlobalComponent = self.Fiber().GetComponent<UIGlobalComponent>();
+			self.UIGlobalComponent = self.Root().GetComponent<UIGlobalComponent>();
 		}
 		
 		public static async ETTask<UI> Create(this UIComponent self, string uiType, UILayer uiLayer)

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

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

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff