Просмотр исходного кода

1.Root改成RootEntity,直接作为VProcess的Singleton
2.IScene接口加上Root属性,这样所有的Entity都可以获得所属的VProcess

tanghai 2 лет назад
Родитель
Сommit
01fb264b58
80 измененных файлов с 212 добавлено и 207 удалено
  1. 1 1
      Share/Analyzer/Analyzer/EntityClassDeclarationAnalyzer.cs
  2. 1 1
      Unity/Assets/Scripts/Core/MainVProcessInit.cs
  3. 11 3
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/Entity.cs
  4. 25 0
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/EntityHelper.cs
  5. 1 1
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/EntityHelper.cs.meta
  6. 4 4
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/EntitySceneFactory.cs
  7. 0 20
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/Root.cs
  8. 28 0
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/RootEntity.cs
  9. 1 1
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/RootEntity.cs.meta
  10. 6 4
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/Scene.cs
  11. 0 20
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/SceneHelper.cs
  12. 0 11
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/SceneHelper.cs.meta
  13. 1 0
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/SceneType.cs
  14. 0 27
      Unity/Assets/Scripts/Core/VProcess/Module/Entity/SingletonEntity.cs
  15. 3 2
      Unity/Assets/Scripts/Core/VProcess/Module/IdGenerater/IdGenerater.cs
  16. 4 4
      Unity/Assets/Scripts/Core/VProcess/VProcess.cs
  17. 15 12
      Unity/Assets/Scripts/Core/VProcess/VProcessSingleton.cs
  18. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs
  19. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_XunLuo.cs
  20. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_PathfindingResultHandler.cs
  21. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Move/M2C_StopHandler.cs
  22. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneChangeHelper.cs
  23. 4 6
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneFactory.cs
  24. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_CreateMyUnitHandler.cs
  25. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_CreateUnitsHandler.cs
  26. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/M2C_RemoveUnitsHandler.cs
  27. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Unit/UnitFactory.cs
  28. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/G2C_ChangeSceneHandler.cs
  29. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/OneFrameInputsHandler.cs
  30. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/Room2C_AdjustUpdateTimeHandler.cs
  31. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/Room2C_EnterMapHandler.cs
  32. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs
  33. 12 11
      Unity/Assets/Scripts/Hotfix/Server/Demo/EntryEvent2_InitServer.cs
  34. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Helper/SceneFactory.cs
  35. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Benchmark/C2G_BenchmarkHandler.cs
  36. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/C2G_LoginGateHandler.cs
  37. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/AOI/ChangePosition_NotifyAOI.cs
  38. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Transfer/C2M_TransferMapHandler.cs
  39. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Transfer/TransferHelper.cs
  40. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotCaseSystem.cs
  41. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotManagerComponentSystem.cs
  42. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/Scene/RobotSceneFactory.cs
  43. 4 4
      Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIEntitySystem.cs
  44. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs
  45. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetInnerComponentSystem.cs
  46. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetServerComponentSystem.cs
  47. 6 5
      Unity/Assets/Scripts/Hotfix/Share/Demo/EntryEvent1_InitShare.cs
  48. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs
  49. 6 6
      Unity/Assets/Scripts/Hotfix/Share/Module/Recast/PathfindingComponentSystem.cs
  50. 3 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/EntryEvent3_InitClient.cs
  51. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs
  52. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelp/UIHelpEvent.cs
  53. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyEvent.cs
  54. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginComponentSystem.cs
  55. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginEvent.cs
  56. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyEvent.cs
  57. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILSLoginEvent.cs
  58. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILoginComponentSystem.cs
  59. 8 0
      Unity/Assets/Scripts/Loader/Module.meta
  60. 1 1
      Unity/Assets/Scripts/Model/Server/Demo/Watcher/WatcherComponent.cs
  61. 1 1
      Unity/Assets/Scripts/Model/Server/Module/Actor/ActorMessageDispatcherComponent.cs
  62. 1 1
      Unity/Assets/Scripts/Model/Server/Module/Actor/ActorMessageSenderComponent.cs
  63. 1 1
      Unity/Assets/Scripts/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs
  64. 1 1
      Unity/Assets/Scripts/Model/Server/Module/ActorLocation/LocationProxyComponent.cs
  65. 1 1
      Unity/Assets/Scripts/Model/Server/Module/Message/NetInnerComponent.cs
  66. 1 1
      Unity/Assets/Scripts/Model/Server/Module/RobotCase/RobotCaseComponent.cs
  67. 4 4
      Unity/Assets/Scripts/Model/Share/Entry.cs
  68. 3 0
      Unity/Assets/Scripts/Model/Share/LockStep/LSWorld.cs
  69. 1 0
      Unity/Assets/Scripts/Model/Share/LockStep/Room.cs
  70. 1 1
      Unity/Assets/Scripts/Model/Share/Module/AI/AIDispatcherComponent.cs
  71. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Console/ConsoleComponent.cs
  72. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Message/MessageDispatcherComponent.cs
  73. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Message/OpcodeTypeComponent.cs
  74. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Numeric/NumericComponent.cs
  75. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Numeric/NumericWatcherComponent.cs
  76. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Recast/NavmeshComponent.cs
  77. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Scene/ClientSceneManagerComponent.cs
  78. 1 1
      Unity/Assets/Scripts/Model/Share/Module/Scene/ServerSceneManagerComponent.cs
  79. 2 2
      Unity/Assets/Scripts/Model/Share/Module/Unit/Unit.cs
  80. 3 1
      Unity/Assets/Scripts/ModelView/Client/Demo/Config/ConfigLoader.cs

+ 1 - 1
Share/Analyzer/Analyzer/EntityClassDeclarationAnalyzer.cs

@@ -19,7 +19,7 @@ namespace ET.Analyzer
 
              context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
              context.EnableConcurrentExecution();
-             context.RegisterSymbolAction(this.Analyzer, SymbolKind.NamedType);
+             //context.RegisterSymbolAction(this.Analyzer, SymbolKind.NamedType);
          }
 
          private void Analyzer(SymbolAnalysisContext context)

+ 1 - 1
Unity/Assets/Scripts/Core/MainVProcessInit.cs

@@ -4,7 +4,7 @@
     {
         public static void Init(VProcess vProcess)
         {
-
+            vProcess.AddSingleton<RootEntity>();
         }
     }
 }

+ 11 - 3
Unity/Assets/Scripts/Core/VProcess/Module/Entity/Entity.cs

@@ -17,6 +17,7 @@ namespace ET
 
     public interface IScene
     {
+        RootEntity Root { get; set; }
         SceneType SceneType { get; set; }
     }
 
@@ -161,8 +162,6 @@ namespace ET
         [BsonIgnore]
         public bool IsDisposed => this.InstanceId == 0;
         
-        public VProcess VProcess { get; protected set; }
-
         [BsonIgnore]
         private Entity parent;
 
@@ -205,8 +204,17 @@ namespace ET
                 this.IsComponent = false;
                 this.parent.AddToChildren(this);
 
+                if (this is IScene scene)
+                {
+                    scene.Root = this.parent.iScene.Root;
+                    this.IScene = scene;
+                }
+                else
+                {
+                    this.IScene = this.parent.iScene;
+                }
+
                 this.IScene = this is IScene? this as IScene : this.parent.iScene;
-                this.VProcess = this.parent.VProcess;
 
 #if ENABLE_VIEW && UNITY_EDITOR
                 this.viewGO.GetComponent<ComponentView>().Component = this;

+ 25 - 0
Unity/Assets/Scripts/Core/VProcess/Module/Entity/EntityHelper.cs

@@ -0,0 +1,25 @@
+namespace ET
+{
+    public static class EntityHelper
+    {
+        public static int DomainZone(this Entity entity)
+        {
+            return (entity.IScene as Scene)?.Zone ?? 0;
+        }
+
+        public static Scene Scene(this Entity entity)
+        {
+            return entity.IScene as Scene;
+        }
+        
+        public static RootEntity Root(this Entity entity)
+        {
+            return entity.IScene.Root;
+        }
+        
+        public static VProcess VProcess(this Entity entity)
+        {
+            return entity.Root().VProcess;
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Core/VProcess/Module/Entity/SingletonEntity.cs.meta → Unity/Assets/Scripts/Core/VProcess/Module/Entity/EntityHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: d86de9deead0da44aae57ff954999773
+guid: 3ac02684a9489804d80e99f7ae99b548
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 4 - 4
Unity/Assets/Scripts/Core/VProcess/Module/Entity/EntitySceneFactory.cs

@@ -2,17 +2,17 @@
 {
     public static class EntitySceneFactory
     {
-        public static Scene CreateScene(VProcess vProcess, long id, long instanceId, int zone, SceneType sceneType, string name, Entity parent = null)
+        public static Scene CreateScene(long id, long instanceId, int zone, SceneType sceneType, string name, Entity parent = null)
         {
-            Scene scene = new Scene(vProcess, id, instanceId, zone, sceneType, name);
+            Scene scene = new(id, instanceId, zone, sceneType, name);
             parent?.AddChild(scene);
             return scene;
         }
 
-        public static Scene CreateScene(VProcess vProcess, int zone, SceneType sceneType, string name, Entity parent = null)
+        public static Scene CreateScene(int zone, SceneType sceneType, string name, Entity parent = null)
         {
             long instanceId = IdGenerater.Instance.GenerateInstanceId();
-            Scene scene = new Scene(vProcess, zone, instanceId, zone, sceneType, name);
+            Scene scene = new(zone, instanceId, zone, sceneType, name);
             parent?.AddChild(scene);
             return scene;
         }

+ 0 - 20
Unity/Assets/Scripts/Core/VProcess/Module/Entity/Root.cs

@@ -1,20 +0,0 @@
-using System.Collections.Generic;
-
-namespace ET
-{
-    // 管理根部的Scene
-    public class Root: VProcessSingleton<Root>, ISingletonAwake
-    {
-        public Scene Scene { get; private set; }
-
-        public void Awake()
-        {
-            this.Scene = EntitySceneFactory.CreateScene(this.VProcess, 0, SceneType.Process, "Process");
-        }
-
-        public override void Dispose()
-        {
-            this.Scene.Dispose();
-        }
-    }
-}

+ 28 - 0
Unity/Assets/Scripts/Core/VProcess/Module/Entity/RootEntity.cs

@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+
+namespace ET
+{
+    // 管理根部的Scene
+    [EnableMethod]
+    public class RootEntity: Entity, IScene, IVProcessSingleton
+    {
+        public RootEntity Root { get; set; }
+        
+        public VProcess VProcess { get; set; }
+
+        public SceneType SceneType { get; set; }
+
+        public RootEntity()
+        {
+            this.Root = this;
+            this.Id = 0;
+            this.InstanceId = IdGenerater.Instance.GenerateInstanceId();
+            this.SceneType = SceneType.Root;
+            this.IsCreated = true;
+            this.IsNew = true;
+            this.IsRegister = true;
+            this.IScene = this;
+            Log.Info($"Root create: {this.SceneType} {this.Id} {this.InstanceId}");
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Core/VProcess/Module/Entity/Root.cs.meta → Unity/Assets/Scripts/Core/VProcess/Module/Entity/RootEntity.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 02e24b5acad87864a8fa3ac0196795e5
+guid: 1c0208d9ebaff0c4b94c527c6e9d1354
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 6 - 4
Unity/Assets/Scripts/Core/VProcess/Module/Entity/Scene.cs

@@ -1,4 +1,5 @@
 using System.Diagnostics;
+using MongoDB.Bson.Serialization.Attributes;
 
 namespace ET
 {
@@ -6,6 +7,9 @@ namespace ET
     [ChildOf]
     public class Scene: Entity, IScene
     {
+        [BsonIgnore]
+        public RootEntity Root { get; set; }
+        
         public int Zone
         {
             get;
@@ -22,14 +26,12 @@ namespace ET
             get;
         }
 
-        public Scene(VProcess vProcess)
+        public Scene()
         {
-            this.VProcess = vProcess;
         }
 
-        public Scene(VProcess vProcess, long id, long instanceId, int zone, SceneType sceneType, string name)
+        public Scene(long id, long instanceId, int zone, SceneType sceneType, string name)
         {
-            this.VProcess = vProcess;
             this.Id = id;
             this.InstanceId = instanceId;
             this.Zone = zone;

+ 0 - 20
Unity/Assets/Scripts/Core/VProcess/Module/Entity/SceneHelper.cs

@@ -1,20 +0,0 @@
-namespace ET
-{
-    public static class SceneHelper
-    {
-        public static int DomainZone(this Entity entity)
-        {
-            return (entity.IScene as Scene)?.Zone ?? 0;
-        }
-
-        public static Scene DomainScene(this Entity entity)
-        {
-            return entity.IScene as Scene;
-        }
-        
-        public static SceneType DomainSceneType(this Entity entity)
-        {
-            return entity.IScene.SceneType;
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Core/VProcess/Module/Entity/SceneHelper.cs.meta

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

+ 1 - 0
Unity/Assets/Scripts/Core/VProcess/Module/Entity/SceneType.cs

@@ -23,6 +23,7 @@ namespace ET
 		Room = 1 << 15,
 		LockStepClient = 1 << 16,
 		LockStepServer = 1 << 17,
+		Root = 1 << 18,
 
 		// 客户端Model层
 		Demo = 1 << 30,

+ 0 - 27
Unity/Assets/Scripts/Core/VProcess/Module/Entity/SingletonEntity.cs

@@ -1,27 +0,0 @@
-using System;
-
-namespace ET
-{
-    public class SingletonEntity<T>: Entity where T : SingletonEntity<T>
-    {
-        public static T Instance
-        {
-            get
-            {
-                return VProcess.Instance.GetInstance<T>();
-            }
-        }
-
-        public SingletonEntity()
-        {
-            VProcess.Instance.AddInstance((T)this);
-        }
-
-        public override void Dispose()
-        {
-            base.Dispose();
-
-            VProcess.Instance.RemoveInstance(typeof(T));
-        }
-    }
-}

+ 3 - 2
Unity/Assets/Scripts/Core/VProcess/Module/IdGenerater/IdGenerater.cs

@@ -1,13 +1,14 @@
 using System;
 using System.Runtime.InteropServices;
+using MongoDB.Bson;
 
 namespace ET
 {
     [StructLayout(LayoutKind.Sequential, Pack = 1)]
     public struct IdStruct
     {
-        public uint Time;    // 30bit
         public int Process;  // 18bit
+        public uint Time;    // 30bit
         public ushort Value; // 16bit
 
         public long ToLong()
@@ -45,8 +46,8 @@ namespace ET
     [StructLayout(LayoutKind.Sequential, Pack = 1)]
     public struct InstanceIdStruct
     {
-        public uint Time;   // 当年开始的tick 28bit
         public int Process; // 18bit
+        public uint Time;   // 当年开始的tick 28bit
         public uint Value;  // 18bit
 
         public long ToLong()

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

@@ -35,7 +35,7 @@ namespace ET
             Instance = this;
         }
         
-        public T AddSingleton<T>() where T: VProcessSingleton<T>, new()
+        public T AddSingleton<T>() where T: IVProcessSingleton, new()
         {
             T singleton = new T();
             AddSingleton(singleton);
@@ -104,7 +104,7 @@ namespace ET
             {
                 IVProcessSingleton singleton = updates.Dequeue();
 
-                if (singleton.IsDisposed())
+                if (singleton.IsDisposed)
                 {
                     continue;
                 }
@@ -135,7 +135,7 @@ namespace ET
             {
                 IVProcessSingleton singleton = lateUpdates.Dequeue();
                 
-                if (singleton.IsDisposed())
+                if (singleton.IsDisposed)
                 {
                     continue;
                 }
@@ -200,7 +200,7 @@ namespace ET
             while (singletons.Count > 0)
             {
                 IVProcessSingleton iSingleton = singletons.Pop();
-                iSingleton.Destroy();
+                iSingleton.Dispose();
             }
         }
     }

+ 15 - 12
Unity/Assets/Scripts/Core/VProcess/VProcessSingleton.cs

@@ -5,11 +5,15 @@ namespace ET
     public interface IVProcessSingleton: IDisposable
     {
         VProcess VProcess { get; set; }
-        void Destroy();
-        bool IsDisposed();
+        bool IsDisposed { get; }
     }
     
-    public abstract class VProcessSingleton<T>: IVProcessSingleton where T: VProcessSingleton<T>, new()
+    public interface IInstance<T> where T: class
+    {
+
+    }
+    
+    public abstract class VProcessSingleton<T>: IVProcessSingleton, IInstance<T> where T: VProcessSingleton<T>, new()
     {
         public VProcess VProcess { get; set; }
 
@@ -21,22 +25,21 @@ namespace ET
             }
         }
 
-        void IVProcessSingleton.Destroy()
+        bool IVProcessSingleton.IsDisposed
         {
-            if (this.VProcess == null)
+            get
             {
-                return;
+                return this.VProcess == null;
             }
-            this.VProcess = null;
-        }
-
-        bool IVProcessSingleton.IsDisposed()
-        {
-            return this.VProcess == null;
         }
 
         public virtual void Dispose()
         {
+            if (this.VProcess == null)
+            {
+                return;
+            }
+            this.VProcess = null;
         }
     }
 }

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

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

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

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

+ 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.DomainScene().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
+			Unit unit = session.Scene().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.DomainScene().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
+			Unit unit = session.Scene().CurrentScene().GetComponent<UnitComponent>().Get(message.Id);
 			if (unit == null)
 			{
 				return;

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

@@ -9,7 +9,7 @@
             
             CurrentScenesComponent currentScenesComponent = clientScene.GetComponent<CurrentScenesComponent>();
             currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
-            Scene currentScene = SceneFactory.CreateCurrentScene(clientScene.VProcess, sceneInstanceId, clientScene.Zone, sceneName, currentScenesComponent);
+            Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, clientScene.Zone, sceneName, currentScenesComponent);
             UnitComponent unitComponent = currentScene.AddComponent<UnitComponent>();
          
             // 可以订阅这个事件中创建Loading界面

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

@@ -1,14 +1,12 @@
-using System.Net.Sockets;
-
 namespace ET.Client
 {
     public static partial class SceneFactory
     {
-        public static async ETTask<Scene> CreateClientScene(VProcess vProcess, int zone, SceneType sceneType, string name)
+        public static async ETTask<Scene> CreateClientScene(int zone, SceneType sceneType, string name)
         {
             await ETTask.CompletedTask;
             
-            Scene clientScene = EntitySceneFactory.CreateScene(vProcess, zone, sceneType, name, ClientSceneManagerComponent.Instance);
+            Scene clientScene = EntitySceneFactory.CreateScene(zone, sceneType, name, ClientSceneManagerComponent.Instance);
             clientScene.AddComponent<ObjectWait>();
             clientScene.AddComponent<PlayerComponent>();
             clientScene.AddComponent<CurrentScenesComponent>();
@@ -17,9 +15,9 @@ namespace ET.Client
             return clientScene;
         }
         
-        public static Scene CreateCurrentScene(VProcess vProcess, long id, int zone, string name, CurrentScenesComponent currentScenesComponent)
+        public static Scene CreateCurrentScene(long id, int zone, string name, CurrentScenesComponent currentScenesComponent)
         {
-            Scene currentScene = EntitySceneFactory.CreateScene(vProcess, id, IdGenerater.Instance.GenerateInstanceId(), zone, SceneType.Current, name, currentScenesComponent);
+            Scene currentScene = EntitySceneFactory.CreateScene(id, IdGenerater.Instance.GenerateInstanceId(), zone, SceneType.Current, name, currentScenesComponent);
             currentScenesComponent.Scene = currentScene;
             
             EventSystem.Instance.Publish(currentScene, new EventType.AfterCreateCurrentScene());

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

@@ -6,7 +6,7 @@
 		protected override async ETTask Run(Session session, M2C_CreateMyUnit message)
 		{
 			// 通知场景切换协程继续往下走
-			session.DomainScene().GetComponent<ObjectWait>().Notify(new Wait_CreateMyUnit() {Message = message});
+			session.Scene().GetComponent<ObjectWait>().Notify(new Wait_CreateMyUnit() {Message = message});
 			await ETTask.CompletedTask;
 		}
 	}

+ 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.DomainScene().CurrentScene();
+			Scene currentScene = session.Scene().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.DomainScene().CurrentScene()?.GetComponent<UnitComponent>();
+			UnitComponent unitComponent = session.Scene().CurrentScene()?.GetComponent<UnitComponent>();
 			if (unitComponent == null)
 			{
 				return;

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

@@ -34,7 +34,7 @@ namespace ET.Client
 
 	        unit.AddComponent<XunLuoPathComponent>();
 	        
-	        EventSystem.Instance.Publish(unit.DomainScene(), new EventType.AfterUnitCreate() {Unit = unit});
+	        EventSystem.Instance.Publish(unit.Scene(), new EventType.AfterUnitCreate() {Unit = unit});
             return unit;
         }
     }

+ 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.DomainScene(), "Map1", message.InstanceId);
+            await LSSceneChangeHelper.SceneChangeTo(session.Scene(), "Map1", message.InstanceId);
         }
     }
 }

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

@@ -9,7 +9,7 @@ namespace ET.Client
         {
             using var _ = input ; // 方法结束时回收消息
             
-            Room room = session.DomainScene().GetComponent<Room>();
+            Room room = session.Scene().GetComponent<Room>();
             
             Log.Debug($"OneFrameInputs: {room.AuthorityFrame + 1} {input.ToJson()}");
                         

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

@@ -5,7 +5,7 @@ namespace ET.Client
     {
         protected override async ETTask Run(Session session, Room2C_AdjustUpdateTime message)
         {
-            Room room = session.DomainScene().GetComponent<Room>();
+            Room room = session.Scene().GetComponent<Room>();
             int newInterval = (1000 + (message.DiffTime - LSConstValue.UpdateInterval)) * LSConstValue.UpdateInterval / 1000;
 
             if (newInterval < 40)

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

@@ -5,7 +5,7 @@ namespace ET.Client
     {
         protected override async ETTask Run(Session session, Room2C_Start message)
         {
-            session.DomainScene().GetComponent<ObjectWait>().Notify(new WaitType.Wait_Room2C_Start() {Message = message});
+            session.Scene().GetComponent<ObjectWait>().Notify(new WaitType.Wait_Room2C_Start() {Message = message});
             await ETTask.CompletedTask;
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs

@@ -32,7 +32,7 @@ namespace ET.Client
             
             self.LogMsg(message);
             
-            EventSystem.Instance.Publish(Root.Instance.Scene, new NetClientComponentOnRead() {Session = session, Message = message});
+            EventSystem.Instance.Publish(self.IScene, new NetClientComponentOnRead() {Session = session, Message = message});
         }
 
         private static void OnError(this NetClientComponent self, long channelId, int error)

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

@@ -7,24 +7,25 @@ namespace ET.Server
     {
         protected override async ETTask Run(Scene scene, ET.EventType.EntryEvent2 args)
         {
+            RootEntity root = scene.Root;
             // 发送普通actor消息
-            Root.Instance.Scene.AddComponent<ActorMessageSenderComponent>();
+            root.AddComponent<ActorMessageSenderComponent>();
             // 发送location actor消息
-            Root.Instance.Scene.AddComponent<ActorLocationSenderComponent>();
+            root.AddComponent<ActorLocationSenderComponent>();
             // 访问location server的组件
-            Root.Instance.Scene.AddComponent<LocationProxyComponent>();
-            Root.Instance.Scene.AddComponent<ActorMessageDispatcherComponent>();
-            Root.Instance.Scene.AddComponent<ServerSceneManagerComponent>();
-            Root.Instance.Scene.AddComponent<RobotCaseComponent>();
+            root.AddComponent<LocationProxyComponent>();
+            root.AddComponent<ActorMessageDispatcherComponent>();
+            root.AddComponent<ServerSceneManagerComponent>();
+            root.AddComponent<RobotCaseComponent>();
 
-            Root.Instance.Scene.AddComponent<NavmeshComponent>();
+            root.AddComponent<NavmeshComponent>();
 
             StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(Options.Instance.Process);
             switch (Options.Instance.AppType)
             {
                 case AppType.Server:
                 {
-                    Root.Instance.Scene.AddComponent<NetInnerComponent, IPEndPoint>(processConfig.InnerIPPort);
+                    root.AddComponent<NetInnerComponent, IPEndPoint>(processConfig.InnerIPPort);
 
                     var processScenes = StartSceneConfigCategory.Instance.GetByProcess(Options.Instance.Process);
                     foreach (StartSceneConfig startConfig in processScenes)
@@ -38,9 +39,9 @@ namespace ET.Server
                 case AppType.Watcher:
                 {
                     StartMachineConfig startMachineConfig = WatcherHelper.GetThisMachineConfig();
-                    WatcherComponent watcherComponent = Root.Instance.Scene.AddComponent<WatcherComponent>();
+                    WatcherComponent watcherComponent = root.AddComponent<WatcherComponent>();
                     watcherComponent.Start(Options.Instance.CreateScenes);
-                    Root.Instance.Scene.AddComponent<NetInnerComponent, IPEndPoint>(NetworkHelper.ToIPEndPoint($"{startMachineConfig.InnerIP}:{startMachineConfig.WatcherPort}"));
+                    root.AddComponent<NetInnerComponent, IPEndPoint>(NetworkHelper.ToIPEndPoint($"{startMachineConfig.InnerIP}:{startMachineConfig.WatcherPort}"));
                     break;
                 }
                 case AppType.GameTool:
@@ -49,7 +50,7 @@ namespace ET.Server
 
             if (Options.Instance.Console == 1)
             {
-                Root.Instance.Scene.AddComponent<ConsoleComponent>();
+                root.AddComponent<ConsoleComponent>();
             }
         }
     }

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

@@ -8,7 +8,7 @@ namespace ET.Server
         public static async ETTask<Scene> CreateServerScene(Entity parent, long id, long instanceId, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null)
         {
             await ETTask.CompletedTask;
-            Scene scene = EntitySceneFactory.CreateScene(parent.VProcess, id, instanceId, zone, sceneType, name, parent);
+            Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent);
 
             scene.AddComponent<MailBoxComponent, MailboxType>(MailboxType.UnOrderMessageDispatcher);
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Benchmark/C2G_BenchmarkHandler.cs

@@ -8,7 +8,7 @@ namespace ET.Server
         protected override async ETTask Run(Session session, C2G_Benchmark request, G2C_Benchmark response)
         {
             using C2G_Benchmark _ = request;
-            BenchmarkServerComponent benchmarkServerComponent = session.DomainScene().GetComponent<BenchmarkServerComponent>();
+            BenchmarkServerComponent benchmarkServerComponent = session.Scene().GetComponent<BenchmarkServerComponent>();
             if (benchmarkServerComponent.Count++ % 1000000 == 0)
             {
                 Log.Debug($"benchmark count: {benchmarkServerComponent.Count} {TimeHelper.ClientNow()}");

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Gate/C2G_LoginGateHandler.cs

@@ -8,7 +8,7 @@ namespace ET.Server
     {
         protected override async ETTask Run(Session session, C2G_LoginGate request, G2C_LoginGate response)
         {
-            Scene scene = session.DomainScene();
+            Scene scene = session.Scene();
             string account = scene.GetComponent<GateSessionKeyComponent>().Get(request.Key);
             if (account == null)
             {
@@ -56,7 +56,7 @@ namespace ET.Server
 
         private static async ETTask CheckRoom(Player player, Session session)
         {
-            await player.VProcess.WaitFrameFinish();
+            await player.VProcess().WaitFrameFinish();
             
             Room2G_Reconnect room2GateReconnect = await ActorMessageSenderComponent.Instance.Call(
                 player.GetComponent<PlayerRoomComponent>().RoomInstanceId,

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/AOI/ChangePosition_NotifyAOI.cs

@@ -24,7 +24,7 @@ namespace ET.Server
                 return;
             }
 
-            unit.DomainScene().GetComponent<AOIManagerComponent>().Move(aoiEntity, newCellX, newCellY);
+            unit.Scene().GetComponent<AOIManagerComponent>().Move(aoiEntity, newCellX, newCellY);
             await ETTask.CompletedTask;
         }
     }

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Map/Transfer/C2M_TransferMapHandler.cs

@@ -9,7 +9,7 @@ namespace ET.Server
 		{
 			await ETTask.CompletedTask;
 
-			string currentMap = unit.DomainScene().Name;
+			string currentMap = unit.Scene().Name;
 			string toMap = null;
 			if (currentMap == "Map1")
 			{
@@ -20,7 +20,7 @@ namespace ET.Server
 				toMap = "Map1";
 			}
 
-			StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetBySceneName(unit.DomainScene().Zone, toMap);
+			StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.GetBySceneName(unit.Scene().Zone, toMap);
 			
 			TransferHelper.TransferAtFrameFinish(unit, startSceneConfig.InstanceId, toMap).Coroutine();
 		}

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

@@ -7,7 +7,7 @@ namespace ET.Server
     {
         public static async ETTask TransferAtFrameFinish(Unit unit, long sceneInstanceId, string sceneName)
         {
-            await unit.VProcess.WaitFrameFinish();
+            await unit.VProcess().WaitFrameFinish();
 
             await TransferHelper.Transfer(unit, sceneInstanceId, sceneName);
         }

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/RobotCaseSystem.cs

@@ -73,7 +73,7 @@ namespace ET.Server
             Scene clientScene = null;
             try
             {
-                clientScene = await Client.SceneFactory.CreateClientScene(self.VProcess, zone, SceneType.Robot, name);
+                clientScene = await Client.SceneFactory.CreateClientScene(zone, SceneType.Robot, name);
                 await Client.LoginHelper.Login(clientScene, zone.ToString(), zone.ToString());
                 await Client.EnterMapHelper.EnterMapAsync(clientScene);
                 Log.Debug($"create robot ok: {zone}");
@@ -94,7 +94,7 @@ namespace ET.Server
 
             try
             {
-                clientScene = await Client.SceneFactory.CreateClientScene(self.VProcess, zone, SceneType.Robot, $"Robot_{zone}");
+                clientScene = await Client.SceneFactory.CreateClientScene(zone, SceneType.Robot, $"Robot_{zone}");
                 await Client.LoginHelper.Login(clientScene, zone.ToString(), zone.ToString());
                 await Client.EnterMapHelper.EnterMapAsync(clientScene);
                 Log.Debug($"create robot ok: {zone}");

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

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

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Scenes/Robot/Scene/RobotSceneFactory.cs

@@ -14,7 +14,7 @@ namespace ET.Server
         {
             await ETTask.CompletedTask;
             Log.Info($"create scene: {sceneType} {name} {zone}");
-            Scene scene = EntitySceneFactory.CreateScene(parent.VProcess, id, instanceId, zone, sceneType, name, parent);
+            Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent);
 
             scene.AddComponent<MailBoxComponent, MailboxType>(MailboxType.UnOrderMessageDispatcher);
 

+ 4 - 4
Unity/Assets/Scripts/Hotfix/Server/Module/AOI/AOIEntitySystem.cs

@@ -10,13 +10,13 @@ namespace ET.Server
         private static void Awake(this AOIEntity self, int distance, float3 pos)
         {
             self.ViewDistance = distance;
-            self.DomainScene().GetComponent<AOIManagerComponent>().Add(self, pos.x, pos.z);
+            self.Scene().GetComponent<AOIManagerComponent>().Add(self, pos.x, pos.z);
         }
         
         [EntitySystem]
         private static void Destroy(this AOIEntity self)
         {
-            self.DomainScene().GetComponent<AOIManagerComponent>()?.Remove(self);
+            self.Scene().GetComponent<AOIManagerComponent>()?.Remove(self);
             self.ViewDistance = 0;
             self.SeeUnits.Clear();
             self.SeePlayers.Clear();
@@ -133,7 +133,7 @@ namespace ET.Server
                     enter.BeSeeUnits.Add(self.Id, self);
                 }
             }
-            EventSystem.Instance.Publish(self.DomainScene(), new EventType.UnitEnterSightRange() { A = self, B = enter });
+            EventSystem.Instance.Publish(self.Scene(), new EventType.UnitEnterSightRange() { A = self, B = enter });
         }
 
         // leave离开self视野
@@ -161,7 +161,7 @@ namespace ET.Server
                 leave.BeSeePlayers.Remove(self.Id);
             }
 
-            EventSystem.Instance.Publish(self.DomainScene(), new EventType.UnitLeaveSightRange { A = self, B = leave });
+            EventSystem.Instance.Publish(self.Scene(), new EventType.UnitLeaveSightRange { A = self, B = leave });
         }
 
         /// <summary>

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs

@@ -104,7 +104,7 @@ namespace ET.Server
                 IHttpHandler handler;
                 if (self.dispatcher.TryGetValue(context.Request.Url.AbsolutePath, out handler))
                 {
-                    await handler.Handle(self.DomainScene(), context);
+                    await handler.Handle(self.Scene(), context);
                 }
             }
             catch (Exception e)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetInnerComponentSystem.cs

@@ -74,7 +74,7 @@ namespace ET.Server
 
         public static void HandleMessage(this NetInnerComponent self, long actorId, object message)
         {
-            EventSystem.Instance.Publish(Root.Instance.Scene, new NetInnerComponentOnRead() { ActorId = actorId, Message = message });
+            EventSystem.Instance.Publish(self.Root(), new NetInnerComponentOnRead() { ActorId = actorId, Message = message });
         }
 
         private static void OnError(this NetInnerComponent self, long channelId, int error)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetServerComponentSystem.cs

@@ -58,7 +58,7 @@ namespace ET.Server
             
             self.LogMsg(message);
 			
-            EventSystem.Instance.Publish(Root.Instance.Scene, new NetServerComponentOnRead() {Session = session, Message = message});
+            EventSystem.Instance.Publish(self.IScene, new NetServerComponentOnRead() {Session = session, Message = message});
         }
     }
 }

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

@@ -5,11 +5,12 @@ namespace ET
     {
         protected override async ETTask Run(Scene scene, EventType.EntryEvent1 args)
         {
-            Root.Instance.Scene.AddComponent<OpcodeTypeComponent>();
-            Root.Instance.Scene.AddComponent<MessageDispatcherComponent>();
-            Root.Instance.Scene.AddComponent<NumericWatcherComponent>();
-            Root.Instance.Scene.AddComponent<AIDispatcherComponent>();
-            Root.Instance.Scene.AddComponent<ClientSceneManagerComponent>();
+            RootEntity root = scene.Root();
+            root.AddComponent<OpcodeTypeComponent>();
+            root.AddComponent<MessageDispatcherComponent>();
+            root.AddComponent<NumericWatcherComponent>();
+            root.AddComponent<AIDispatcherComponent>();
+            root.AddComponent<ClientSceneManagerComponent>();
 
             await ETTask.CompletedTask;
         }

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

@@ -91,7 +91,7 @@ namespace ET
             self.Speed = speed;
             self.tcs = ETTask<bool>.Create(true);
 
-            EventSystem.Instance.Publish(self.DomainScene(), new EventType.MoveStart() {Unit = self.GetParent<Unit>()});
+            EventSystem.Instance.Publish(self.Scene(), new EventType.MoveStart() {Unit = self.GetParent<Unit>()});
             
             self.StartMove();
             
@@ -99,7 +99,7 @@ namespace ET
 
             if (moveRet)
             {
-                EventSystem.Instance.Publish(self.DomainScene(), new EventType.MoveStop() {Unit = self.GetParent<Unit>()});
+                EventSystem.Instance.Publish(self.Scene(), new EventType.MoveStop() {Unit = self.GetParent<Unit>()});
             }
             return moveRet;
         }

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

@@ -31,7 +31,7 @@ namespace ET
             if (self.NavMesh == 0)
             {
                 Log.Debug("寻路| Find 失败 pathfinding ptr is zero");
-                throw new Exception($"pathfinding ptr is zero: {self.DomainScene().Name}");
+                throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}");
             }
 
             self.StartPos[0] = -start.x;
@@ -65,7 +65,7 @@ namespace ET
         {
             if (self.NavMesh == 0)
             {
-                throw new Exception($"pathfinding ptr is zero: {self.DomainScene().Name}");
+                throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}");
             }
 
             if (raduis > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f)
@@ -97,7 +97,7 @@ namespace ET
         {
             if (self.NavMesh == 0)
             {
-                throw new Exception($"pathfinding ptr is zero: {self.DomainScene().Name}");
+                throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}");
             }
 
             if (width > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f || height > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f)
@@ -117,7 +117,7 @@ namespace ET
         {
             if (self.NavMesh == 0)
             {
-                throw new Exception($"pathfinding ptr is zero: {self.DomainScene().Name}");
+                throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}");
             }
 
             if (maxRadius > PathfindingComponent.FindRandomNavPosMaxRadius * 0.001f)
@@ -140,7 +140,7 @@ namespace ET
         {
             if (self.NavMesh == 0)
             {
-                throw new Exception($"pathfinding ptr is zero: {self.DomainScene().Name}");
+                throw new Exception($"pathfinding ptr is zero: {self.Scene().Name}");
             }
 
             self.StartPos[0] = -pos.x;
@@ -150,7 +150,7 @@ namespace ET
             int ret = Recast.RecastFindNearestPoint(self.NavMesh, PathfindingComponent.extents, self.StartPos, self.EndPos);
             if (ret == 0)
             {
-                throw new Exception($"RecastFindNearestPoint fail, 可能是位置配置有问题: sceneName:{self.DomainScene().Name} {pos} {self.Name} {self.GetParent<Unit>().Id} {self.GetParent<Unit>().Config.Id} {self.EndPos.ArrayToString()}");
+                throw new Exception($"RecastFindNearestPoint fail, 可能是位置配置有问题: sceneName:{self.Scene().Name} {pos} {self.Name} {self.GetParent<Unit>().Id} {self.GetParent<Unit>().Config.Id} {self.EndPos.ArrayToString()}");
             }
             
             return new float3(-self.EndPos[0], self.EndPos[1], self.EndPos[2]);

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

@@ -8,14 +8,15 @@ namespace ET.Client
     {
         protected override async ETTask Run(Scene scene, ET.EventType.EntryEvent3 args)
         {
+            RootEntity root = scene.Root();
             // 加载配置
-            Root.Instance.Scene.AddComponent<ResourcesComponent>();
+            root.AddComponent<ResourcesComponent>();
 
             await ResourcesComponent.Instance.LoadBundleAsync("unit.unity3d");
 
             SceneType sceneType = EnumHelper.FromString<SceneType>(GlobalComponent.Instance.GlobalConfig.AppType.ToString());
             
-            Scene clientScene = await SceneFactory.CreateClientScene(scene.VProcess, 1, sceneType, sceneType.ToString());
+            Scene clientScene = await SceneFactory.CreateClientScene(1, sceneType, sceneType.ToString());
             
             await EventSystem.Instance.PublishAsync(clientScene, new EventType.AppStartInitFinish());
         }

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

@@ -29,7 +29,7 @@ namespace ET.Client
 
             if (Input.GetKeyDown(KeyCode.R))
             {
-                self.VProcess.Load();
+                self.VProcess().Load();
                 Log.Debug("hot reload success!");
             }
         

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

@@ -10,7 +10,7 @@ namespace ET.Client
         {
 	        try
 	        {
-		        await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UIHelp.StringToAB());
+		        await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UIHelp.StringToAB());
 		        GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UIHelp.StringToAB(), UIType.UIHelp);
 		        GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
 		        UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UIHelp, gameObject);

+ 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;
-            await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILobby.StringToAB());
+            await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILobby.StringToAB());
             GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILobby, gameObject);

+ 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.DomainScene(), 
+				self.Scene(), 
 				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)
         {
-            await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILogin.StringToAB());
+            await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILogin.StringToAB());
             GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILogin, gameObject);

+ 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;
-            await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILSLobby.StringToAB());
+            await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILSLobby.StringToAB());
             GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILSLobby.StringToAB(), UIType.UILSLobby);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILSLobby, gameObject);

+ 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)
         {
-            await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILSLogin.StringToAB());
+            await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILSLogin.StringToAB());
             GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILSLogin.StringToAB(), UIType.UILSLogin);
             GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILSLogin, gameObject);

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

+ 8 - 0
Unity/Assets/Scripts/Loader/Module.meta

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

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Demo/Watcher/WatcherComponent.cs

@@ -3,7 +3,7 @@ using System.Diagnostics;
 
 namespace ET.Server
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class WatcherComponent: Entity, IAwake, IDestroy
     {
         public static WatcherComponent Instance { get; set; }

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/Actor/ActorMessageDispatcherComponent.cs

@@ -19,7 +19,7 @@ namespace ET.Server
     /// <summary>
     /// Actor消息分发组件
     /// </summary>
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class ActorMessageDispatcherComponent: Entity, IAwake, IDestroy, ILoad
     {
         [ThreadStatic]

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/Actor/ActorMessageSenderComponent.cs

@@ -2,7 +2,7 @@
 
 namespace ET.Server
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class ActorMessageSenderComponent: Entity, IAwake, IDestroy
     {
         public const long TIMEOUT_TIME = 40 * 1000;

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/ActorLocation/ActorLocationSenderOneType.cs

@@ -14,7 +14,7 @@ namespace ET.Server
     }
     
     
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class ActorLocationSenderComponent: Entity, IAwake, IDestroy
     {
         public const long TIMEOUT_TIME = 60 * 1000;

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/ActorLocation/LocationProxyComponent.cs

@@ -2,7 +2,7 @@
 
 namespace ET.Server
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class LocationProxyComponent: Entity, IAwake, IDestroy
     {
         [ThreadStatic]

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/Message/NetInnerComponent.cs

@@ -23,7 +23,7 @@ namespace ET.Server
         public object Message;
     }
     
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class NetInnerComponent: Entity, IAwake<IPEndPoint>, IAwake, IDestroy
     {
         public int ServiceId;

+ 1 - 1
Unity/Assets/Scripts/Model/Server/Module/RobotCase/RobotCaseComponent.cs

@@ -4,7 +4,7 @@ using System.Collections.Generic;
 namespace ET.Server
 {
     
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class RobotCaseComponent: Entity, IAwake, IDestroy
     {
         [ThreadStatic]

+ 4 - 4
Unity/Assets/Scripts/Model/Share/Entry.cs

@@ -48,13 +48,13 @@ namespace ET
             vProcess.AddSingleton<LSEntitySystemSington>();
 
             vProcess.AddSingleton<NetServices>();
-            vProcess.AddSingleton<Root>();
+            RootEntity root = vProcess.AddSingleton<RootEntity>();
 
             await World.Instance.AddSingleton<ConfigComponent>().LoadAsync();
 
-            await EventSystem.Instance.PublishAsync(Root.Instance.Scene, new EventType.EntryEvent1());
-            await EventSystem.Instance.PublishAsync(Root.Instance.Scene, new EventType.EntryEvent2());
-            await EventSystem.Instance.PublishAsync(Root.Instance.Scene, new EventType.EntryEvent3());
+            await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent1());
+            await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent2());
+            await EventSystem.Instance.PublishAsync(root, new EventType.EntryEvent3());
         }
     }
 }

+ 3 - 0
Unity/Assets/Scripts/Model/Share/LockStep/LSWorld.cs

@@ -42,6 +42,9 @@ namespace ET
         }
 
         private readonly LSUpdater updater = new();
+        
+        [BsonIgnore]
+        public RootEntity Root { get; set; }
 
         [BsonElement]
         private long idGenerator;

+ 1 - 0
Unity/Assets/Scripts/Model/Share/LockStep/Room.cs

@@ -6,6 +6,7 @@ namespace ET
     [ComponentOf]
     public class Room: Entity, IScene, IAwake, IUpdate
     {
+        public RootEntity Root { get; set; }
         public SceneType SceneType { get; set; } = SceneType.Room;
         public string Name { get; set; }
         

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/AI/AIDispatcherComponent.cs

@@ -2,7 +2,7 @@ using System.Collections.Generic;
 
 namespace ET
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class AIDispatcherComponent: Entity, IAwake, IDestroy, ILoad
     {
         [StaticField]

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Console/ConsoleComponent.cs

@@ -14,7 +14,7 @@ namespace ET
         public const string Robot = "Robot";
     }
 
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class ConsoleComponent: Entity, IAwake, ILoad
     {
         public CancellationTokenSource CancellationTokenSource;

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Message/MessageDispatcherComponent.cs

@@ -17,7 +17,7 @@ namespace ET
     /// <summary>
     /// 消息分发组件
     /// </summary>
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class MessageDispatcherComponent: Entity, IAwake, IDestroy, ILoad
     {
         public static MessageDispatcherComponent Instance

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Message/OpcodeTypeComponent.cs

@@ -80,7 +80,7 @@ namespace ET
         }
     }
 
-    [ComponentOf(typeof (Scene))]
+    [ComponentOf(typeof (RootEntity))]
     public class OpcodeTypeComponent: Entity, IAwake, IDestroy
     {
         [ThreadStatic]

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Numeric/NumericComponent.cs

@@ -60,7 +60,7 @@ namespace ET
 
             if (isPublicEvent)
             {
-                EventSystem.Instance.Publish(self.DomainScene(),
+                EventSystem.Instance.Publish(self.Scene(),
                     new EventType.NumbericChange() { Unit = self.GetParent<Unit>(), New = value, Old = oldValue, NumericType = numericType });
             }
         }

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Numeric/NumericWatcherComponent.cs

@@ -78,7 +78,7 @@ namespace ET
     /// <summary>
     /// 监视数值变化组件,分发监听
     /// </summary>
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class NumericWatcherComponent : Entity, IAwake, ILoad
     {
         public static NumericWatcherComponent Instance { get; set; }

+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Recast/NavmeshComponent.cs

@@ -3,7 +3,7 @@ using System.Collections.Generic;
 
 namespace ET
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class NavmeshComponent: Entity, IAwake
     {
         [ThreadStatic]

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

@@ -2,7 +2,7 @@ using System;
 
 namespace ET
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class ClientSceneManagerComponent: Entity, IAwake, IDestroy
     {
         [ThreadStatic]

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

@@ -2,7 +2,7 @@ using System;
 
 namespace ET
 {
-    [ComponentOf(typeof(Scene))]
+    [ComponentOf(typeof(RootEntity))]
     public class ServerSceneManagerComponent: Entity, IAwake, IDestroy
     {
         [ThreadStatic]

+ 2 - 2
Unity/Assets/Scripts/Model/Share/Module/Unit/Unit.cs

@@ -26,7 +26,7 @@ namespace ET
             {
                 float3 oldPos = this.position;
                 this.position = value;
-                EventSystem.Instance.Publish(this.DomainScene(), new EventType.ChangePosition() { Unit = this, OldPos = oldPos });
+                EventSystem.Instance.Publish(this.Scene(), new EventType.ChangePosition() { Unit = this, OldPos = oldPos });
             }
         }
 
@@ -47,7 +47,7 @@ namespace ET
             set
             {
                 this.rotation = value;
-                EventSystem.Instance.Publish(this.DomainScene(), new EventType.ChangeRotation() { Unit = this });
+                EventSystem.Instance.Publish(this.Scene(), new EventType.ChangeRotation() { Unit = this });
             }
         }
 

+ 3 - 1
Unity/Assets/Scripts/ModelView/Client/Demo/Config/ConfigLoader.cs

@@ -5,6 +5,7 @@ using UnityEngine;
 
 namespace ET.Client
 {
+    /*
     [Invoke]
     public class GetAllConfigBytes: AInvokeHandler<ConfigComponent.GetAllConfigBytes, Dictionary<Type, byte[]>>
     {
@@ -55,7 +56,7 @@ namespace ET.Client
             }
             else
             {
-                using (Root.Instance.Scene.AddComponent<ResourcesComponent>())
+                using (RootEntity.Instance.AddComponent<ResourcesComponent>())
                 {
                     const string configBundleName = "config.unity3d";
                     ResourcesComponent.Instance.LoadBundle(configBundleName);
@@ -82,4 +83,5 @@ namespace ET.Client
             throw new NotImplementedException("client cant use LoadOneConfig");
         }
     }
+    */
 }