tanghai 2 лет назад
Родитель
Сommit
34be8b3a2a
35 измененных файлов с 122 добавлено и 357 удалено
  1. 8 0
      Unity/Assets/Scripts/Core/Fiber/Module/Actor.meta
  2. 0 0
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorHelper.cs
  3. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorHelper.cs.meta
  4. 0 0
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorMessageSender.cs
  5. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorMessageSender.cs.meta
  6. 0 0
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorRecverComponent.cs
  7. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorRecverComponent.cs.meta
  8. 0 0
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorSenderComponent.cs
  9. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorSenderComponent.cs.meta
  10. 3 1
      Unity/Assets/Scripts/Core/World/Module/Fiber/FiberManager.cs
  11. 0 13
      Unity/Assets/Scripts/Hotfix/Client/Demo/Scene/SceneFactory.cs
  12. 0 29
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_FirstCase.cs
  13. 0 40
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_SecondCase.cs
  14. 0 11
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_SecondCase.cs.meta
  15. 0 26
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs
  16. 0 112
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotCaseSystem.cs
  17. 0 47
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotManagerComponentSystem.cs
  18. 0 11
      Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotManagerComponentSystem.cs.meta
  19. 4 3
      Unity/Assets/Scripts/HotfixView/Client/Demo/EntryEvent3_InitClient.cs
  20. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelp/UIHelpEvent.cs
  21. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILobby/UILobbyEvent.cs
  22. 3 3
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/AppStartInitFinish_CreateLoginUI.cs
  23. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UILogin/UILoginEvent.cs
  24. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLobby/UILSLobbyEvent.cs
  25. 3 3
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/AppStartInitFinish_CreateUILSLogin.cs
  26. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSLogin/UILSLoginEvent.cs
  27. 1 1
      Unity/Assets/Scripts/HotfixView/Client/LockStep/UI/UILSRoom/UILSRoomEvent.cs
  28. 9 3
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIComponentSystem.cs
  29. 51 0
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIGlobalComponentSystem.cs
  30. 1 1
      Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIGlobalComponentSystem.cs.meta
  31. 0 3
      Unity/Assets/Scripts/Model/Share/Module/Actor.meta
  32. 15 1
      Unity/Assets/Scripts/ModelView/Client/Module/UI/UIComponent.cs
  33. 4 39
      Unity/Assets/Scripts/ModelView/Client/Module/UI/UIEventComponent.cs
  34. 10 0
      Unity/Assets/Scripts/ModelView/Client/Module/UI/UIGlobalComponent.cs
  35. 1 1
      Unity/Assets/Scripts/ModelView/Client/Module/UI/UIGlobalComponent.cs.meta

+ 8 - 0
Unity/Assets/Scripts/Core/Fiber/Module/Actor.meta

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

+ 0 - 0
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorHelper.cs → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorHelper.cs


+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorHelper.cs.meta → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: dbc8c997e10578a47b04c7b6952a0971
+guid: f4d8da9be96fc5f4083f401a49830d3a
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 0
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorMessageSender.cs → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorMessageSender.cs


+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorMessageSender.cs.meta → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorMessageSender.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: ae4cfe25590664049be5513b8b63e918
+guid: bd90b00e35d82884c89c60e27cd1cd33
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 0
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorRecverComponent.cs → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorRecverComponent.cs


+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorRecverComponent.cs.meta → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorRecverComponent.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 0b0f9883fefab9e47a5c7d5210ca4c93
+guid: 592c0cfa0a783824fbf1def6768fbc38
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 0
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorSenderComponent.cs → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorSenderComponent.cs


+ 1 - 1
Unity/Assets/Scripts/Model/Share/Module/Actor/ActorSenderComponent.cs.meta → Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorSenderComponent.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: db96b9e936786b14994aaabebdd8b6e2
+guid: ec7f497e88b36374e8b14d2a396351b1
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

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

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

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

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

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

@@ -1,29 +0,0 @@
-using System;
-
-namespace ET.Server
-{
-    [Invoke(RobotCaseType.FirstCase)]
-    public class RobotCase_FirstCase: ARobotCase
-    {
-        protected override async ETTask Run(RobotCase robotCase)
-        {
-            await ETTask.CompletedTask;
-            /*
-            using ListComponent<Scene> robots = ListComponent<Scene>.Create();
-            
-            // 创建了两个机器人,生命周期是RobotCase,RobotCase_FirstCase.Run执行结束,机器人就会删除
-            await robotCase.NewRobot(2, robots);
-
-            foreach (Scene robotScene in robots)
-            {
-                M2C_TestRobotCase response = await robotScene.GetComponent<Client.SessionComponent>().Session.Call(new C2M_TestRobotCase() {N = robotScene.Zone}) as M2C_TestRobotCase;
-                if (response.N != robotScene.Zone)
-                {
-                    // 跟预期不一致就抛异常,外层会catch住在控制台上打印
-                    throw new Exception($"robot case: {RobotCaseType.FirstCase} run fail!");
-                }
-            }
-            */
-        }
-    }
-}

+ 0 - 40
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_SecondCase.cs

@@ -1,40 +0,0 @@
-using System;
-
-namespace ET.Server
-{
-    [MessageHandler(SceneType.Demo)]
-    public class M2C_TestRobotCase2Handler: MessageHandler<M2C_TestRobotCase2>
-    {
-        protected override async ETTask Run(Session session, M2C_TestRobotCase2 message)
-        {
-            ObjectWait objectWait = session.Fiber().GetComponent<ObjectWait>();
-            if (objectWait == null)
-            {
-                return;
-            }
-            objectWait.Notify(new RobotCase_SecondCaseWait {Error = WaitTypeError.Success, M2CTestRobotCase2 = message});
-            await ETTask.CompletedTask;
-        }
-    }
-
-    [Invoke(RobotCaseType.SecondCase)]
-    public class RobotCase_SecondCase: ARobotCase
-    {
-        protected override async ETTask Run(RobotCase robotCase)
-        {
-            await ETTask.CompletedTask;
-            /*
-            // 创建了1个机器人,生命周期是RobotCase
-            Scene robotScene = await robotCase.NewRobot(1);
-
-            ObjectWait objectWait = robotScene.GetComponent<ObjectWait>();
-            robotScene.GetComponent<Client.SessionComponent>().Session.Send(new C2M_TestRobotCase2() {N = robotScene.Zone});
-            RobotCase_SecondCaseWait robotCaseSecondCaseWait = await objectWait.Wait<RobotCase_SecondCaseWait>();
-            if (robotCaseSecondCaseWait.M2CTestRobotCase2.N != robotScene.Zone)
-            {
-                throw new Exception($"robot case: {RobotCaseType.SecondCase} run fail!");
-            }
-            */
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_SecondCase.cs.meta

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

+ 0 - 26
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs

@@ -20,32 +20,6 @@ namespace ET.Server
                             .WithNotParsed(error => throw new Exception($"CreateRobotArgs error!"))
                             .WithParsed(o => { options = o; });
 
-                    // 获取当前进程的RobotScene
-                    using (ListComponent<StartSceneConfig> thisProcessRobotScenes = ListComponent<StartSceneConfig>.Create())
-                    {
-                        List<StartSceneConfig> robotSceneConfigs = StartSceneConfigCategory.Instance.Robots;
-                        foreach (StartSceneConfig robotSceneConfig in robotSceneConfigs)
-                        {
-                            if (robotSceneConfig.Process != Options.Instance.Process)
-                            {
-                                continue;
-                            }
-                            thisProcessRobotScenes.Add(robotSceneConfig);
-                        }
-                        
-                        // 创建机器人
-                        TimerComponent timerComponent = fiber.GetComponent<TimerComponent>();
-                        for (int i = 0; i < options.Num; ++i)
-                        {
-                            int index = i % thisProcessRobotScenes.Count;
-                            StartSceneConfig robotSceneConfig = thisProcessRobotScenes[index];
-                            RobotManagerComponent robotManagerComponent = fiber.GetComponent<RobotManagerComponent>();
-                            Scene robot = await robotManagerComponent.NewRobot(Options.Instance.Process * 10000 + i);
-                            robot.AddComponent<AIComponent, int>(1);
-                            Log.Console($"create robot {robot.Zone}");
-                            await timerComponent.WaitAsync(2000);
-                        }
-                    }
                     break;
             }
             contex.Parent.RemoveComponent<ModeContex>();

+ 0 - 112
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotCaseSystem.cs

@@ -1,112 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace ET.Server
-{
-    public static partial class RobotCaseSystem
-    {
-        [EntitySystem]
-        private static void Destroy(this RobotCase self)
-        {
-            Fiber root = self.Fiber();
-            if (root.Id == 0)
-            {
-                return;
-            }
-        }
-
-        // 创建机器人,生命周期是RobotCase
-        public static async ETTask NewRobot(this RobotCase self, int count, List<Scene> scenes)
-        {
-            ETTask[] tasks = new ETTask[count];
-            for (int i = 0; i < count; ++i)
-            {
-                tasks[i] = self.NewRobot(scenes);
-            }
-
-            await ETTaskHelper.WaitAll(tasks);
-        }
-
-        private static async ETTask NewRobot(this RobotCase self, List<Scene> scenes)
-        {
-            try
-            {
-                scenes.Add(await self.NewRobot());
-            }
-            catch (Exception e)
-            {
-                Log.Error(e);
-            }
-        }
-
-        // 创建机器人,生命周期是RobotCase
-        public static async ETTask NewZoneRobot(this RobotCase self, int zone, int count, List<Scene> scenes)
-        {
-            ETTask[] tasks = new ETTask[count];
-            for (int i = 0; i < count; ++i)
-            {
-                tasks[i] = self.NewZoneRobot(zone + i, scenes);
-            }
-
-            await ETTaskHelper.WaitAll(tasks);
-        }
-
-        // 这个方法创建的是进程所属的机器人,建议使用RobotCase.NewRobot来创建
-        private static async ETTask NewZoneRobot(this RobotCase self, int zone, List<Scene> scenes)
-        {
-            try
-            {
-                scenes.Add(await self.NewRobot(zone));
-            }
-            catch (Exception e)
-            {
-                Log.Error(e);
-            }
-        }
-
-        public static async ETTask<Scene> NewRobot(this RobotCase self, int zone)
-        {
-            return await self.NewRobot(zone, $"Robot_{zone}");
-        }
-
-        public static async ETTask<Scene> NewRobot(this RobotCase self, int zone, string name)
-        {
-            Scene clientScene = null;
-            try
-            {
-                clientScene = await Client.SceneFactory.CreateClientFiber(self.Fiber(), zone, SceneType.Robot, name);
-                await Client.LoginHelper.Login(self.Fiber(), zone.ToString(), zone.ToString());
-                await Client.EnterMapHelper.EnterMapAsync(self.Fiber());
-                Log.Debug($"create robot ok: {zone}");
-                self.Scenes.Add(clientScene.Id);
-                return clientScene;
-            }
-            catch (Exception e)
-            {
-                clientScene?.Dispose();
-                throw new Exception($"RobotCase create robot fail, zone: {zone}", e);
-            }
-        }
-
-        private static async ETTask<Scene> NewRobot(this RobotCase self)
-        {
-            int zone = self.GetParent<RobotCaseComponent>().GetN();
-            Scene clientScene = null;
-
-            try
-            {
-                clientScene = await Client.SceneFactory.CreateClientFiber(self.Fiber(), zone, SceneType.Robot, $"Robot_{zone}");
-                await Client.LoginHelper.Login(self.Fiber(), zone.ToString(), zone.ToString());
-                await Client.EnterMapHelper.EnterMapAsync(self.Fiber());
-                Log.Debug($"create robot ok: {zone}");
-                self.Scenes.Add(clientScene.Id);
-                return clientScene;
-            }
-            catch (Exception e)
-            {
-                clientScene?.Dispose();
-                throw new Exception($"RobotCase create robot fail, zone: {zone}", e);
-            }
-        }
-    }
-}

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

@@ -1,47 +0,0 @@
-using System;
-using System.Linq;
-
-namespace ET.Server
-{
-    public static partial class RobotManagerComponentSystem
-    {
-        public static async ETTask<Scene> NewRobot(this RobotManagerComponent self, int zone)
-        {
-            Scene clientScene = null;
-            try
-            {
-                clientScene = await Client.SceneFactory.CreateClientFiber(self.Fiber(), zone, SceneType.Robot, "Robot");
-                await Client.LoginHelper.Login(self.Fiber(), zone.ToString(), zone.ToString());
-                await Client.EnterMapHelper.EnterMapAsync(self.Fiber());
-                Log.Debug($"create robot ok: {zone}");
-                return clientScene;
-            }
-            catch (Exception e)
-            {
-                clientScene?.Dispose();
-                throw new Exception($"RobotSceneManagerComponent create robot fail, zone: {zone}", e);
-            }
-        }
-        
-        public static void RemoveAll(this RobotManagerComponent self)
-        {
-            foreach (Entity robot in self.Children.Values.ToArray())        
-            {
-                robot.Dispose();
-            }
-        }
-        
-        public static void Remove(this RobotManagerComponent self, long id)
-        {
-            self.GetChild<Scene>(id)?.Dispose();
-        }
-
-        public static void Clear(this RobotManagerComponent self)
-        {
-            foreach (Entity entity in self.Children.Values.ToArray())
-            {
-                entity.Dispose();
-            }
-        }
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotManagerComponentSystem.cs.meta

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

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

@@ -18,10 +18,11 @@ namespace ET.Client
             GlobalComponent globalComponent = fiber.GetComponent<GlobalComponent>();
 
             SceneType sceneType = EnumHelper.FromString<SceneType>(globalComponent.GlobalConfig.AppType.ToString());
+
+            // 根据配置修改掉Main Fiber的SceneType
+            fiber.SceneType = sceneType;
             
-            Scene clientScene = await SceneFactory.CreateClientFiber(fiber, 1, sceneType, sceneType.ToString());
-            
-            await EventSystem.Instance.PublishAsync(clientScene, new EventType.AppStartInitFinish());
+            await EventSystem.Instance.PublishAsync(fiber, new EventType.AppStartInitFinish());
         }
     }
 }

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

@@ -13,7 +13,7 @@ namespace ET.Client
 		        ResourcesComponent resourcesComponent = uiComponent.Fiber().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, UIEventComponent.Instance.GetLayer((int)uiLayer));
+		        GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
 		        UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UIHelp, gameObject);
 
 				ui.AddComponent<UIHelpComponent>();

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

@@ -11,7 +11,7 @@ namespace ET.Client
             ResourcesComponent resourcesComponent = uiComponent.Fiber().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, UIEventComponent.Instance.GetLayer((int)uiLayer));
+            GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILobby, gameObject);
 
             ui.AddComponent<UILobbyComponent>();

+ 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<Scene, EventType.AppStartInitFinish>
+	public class AppStartInitFinish_CreateLoginUI: AEvent<Fiber, EventType.AppStartInitFinish>
 	{
-		protected override async ETTask Run(Scene scene, EventType.AppStartInitFinish args)
+		protected override async ETTask Run(Fiber fiber, EventType.AppStartInitFinish args)
 		{
-			await UIHelper.Create(scene, UIType.UILogin, UILayer.Mid);
+			await UIHelper.Create(fiber, UIType.UILogin, UILayer.Mid);
 		}
 	}
 }

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

@@ -11,7 +11,7 @@ namespace ET.Client
             ResourcesComponent resourcesComponent = uiComponent.Fiber().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, UIEventComponent.Instance.GetLayer((int)uiLayer));
+            GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILogin, gameObject);
             ui.AddComponent<UILoginComponent>();
             return ui;

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

@@ -11,7 +11,7 @@ namespace ET.Client
             ResourcesComponent resourcesComponent = uiComponent.Fiber().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, UIEventComponent.Instance.GetLayer((int)uiLayer));
+            GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILSLobby, gameObject);
 
             ui.AddComponent<UILSLobbyComponent>();

+ 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<Scene, EventType.AppStartInitFinish>
+	public class AppStartInitFinish_CreateUILSLogin: AEvent<Fiber, EventType.AppStartInitFinish>
 	{
-		protected override async ETTask Run(Scene scene, EventType.AppStartInitFinish args)
+		protected override async ETTask Run(Fiber fiber, EventType.AppStartInitFinish args)
 		{
-			await UIHelper.Create(scene, UIType.UILSLogin, UILayer.Mid);
+			await UIHelper.Create(fiber, UIType.UILSLogin, UILayer.Mid);
 		}
 	}
 }

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

@@ -11,7 +11,7 @@ namespace ET.Client
             ResourcesComponent resourcesComponent = uiComponent.Fiber().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, UIEventComponent.Instance.GetLayer((int)uiLayer));
+            GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILSLogin, gameObject);
             ui.AddComponent<UILSLoginComponent>();
             return ui;

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

@@ -11,7 +11,7 @@ namespace ET.Client
             ResourcesComponent resourcesComponent = uiComponent.Fiber().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, UIEventComponent.Instance.GetLayer((int)uiLayer));
+            GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
             UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILSRoom, gameObject);
             ui.AddComponent<UILSRoomComponent>();
             return ui;

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

@@ -6,11 +6,17 @@ namespace ET.Client
 	/// 管理Scene上的UI
 	/// </summary>
 	[FriendOf(typeof(UIComponent))]
-	public static class UIComponentSystem
+	public static partial class UIComponentSystem
 	{
+		[EntitySystem]
+		private static void Awake(this UIComponent self)
+		{
+			self.UIGlobalComponent = self.Fiber().GetComponent<UIGlobalComponent>();
+		}
+		
 		public static async ETTask<UI> Create(this UIComponent self, string uiType, UILayer uiLayer)
 		{
-			UI ui = await UIEventComponent.Instance.OnCreate(self, uiType, uiLayer);
+			UI ui = await self.UIGlobalComponent.OnCreate(self, uiType, uiLayer);
 			self.UIs.Add(uiType, ui);
 			return ui;
 		}
@@ -22,7 +28,7 @@ namespace ET.Client
 				return;
 			}
 			
-			UIEventComponent.Instance.OnRemove(self, uiType);
+			self.UIGlobalComponent.OnRemove(self, uiType);
 			
 			self.UIs.Remove(uiType);
 			ui.Dispose();

+ 51 - 0
Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIGlobalComponentSystem.cs

@@ -0,0 +1,51 @@
+using System;
+using UnityEngine;
+
+namespace ET.Client
+{
+
+    public static partial class UIGlobalComponentSystem
+    {
+        [EntitySystem]
+        public static void Awake(this UIGlobalComponent self)
+        {
+            GameObject uiRoot = GameObject.Find("/Global/UI");
+            ReferenceCollector referenceCollector = uiRoot.GetComponent<ReferenceCollector>();
+
+            self.UILayers.Add((int)UILayer.Hidden, referenceCollector.Get<GameObject>(UILayer.Hidden.ToString()).transform);
+            self.UILayers.Add((int)UILayer.Low, referenceCollector.Get<GameObject>(UILayer.Low.ToString()).transform);
+            self.UILayers.Add((int)UILayer.Mid, referenceCollector.Get<GameObject>(UILayer.Mid.ToString()).transform);
+            self.UILayers.Add((int)UILayer.High, referenceCollector.Get<GameObject>(UILayer.High.ToString()).transform);
+        }
+        
+        public static async ETTask<UI> OnCreate(this UIGlobalComponent self, UIComponent uiComponent, string uiType, UILayer uiLayer)
+        {
+            try
+            {
+                UI ui = await UIEventComponent.Instance.UIEvents[uiType].OnCreate(uiComponent, uiLayer);
+                return ui;
+            }
+            catch (Exception e)
+            {
+                throw new Exception($"on create ui error: {uiType}", e);
+            }
+        }
+
+        public static Transform GetLayer(this UIGlobalComponent self, int layer)
+        {
+            return self.UILayers[layer];
+        }
+
+        public static void OnRemove(this UIGlobalComponent self, UIComponent uiComponent, string uiType)
+        {
+            try
+            {
+                UIEventComponent.Instance.UIEvents[uiType].OnRemove(uiComponent);
+            }
+            catch (Exception e)
+            {
+                throw new Exception($"on remove ui error: {uiType}", e);
+            }
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/RobotCaseSystem.cs.meta → Unity/Assets/Scripts/HotfixView/Client/Module/UI/UIGlobalComponentSystem.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: c6b9436318e2b4b53bb95aac6ffccdfb
+guid: fa60717154e90ab45bfc8d98e410c026
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 3
Unity/Assets/Scripts/Model/Share/Module/Actor.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 82f5cc72d81648e9a4d4836ded8b281e
-timeCreated: 1687787576

+ 15 - 1
Unity/Assets/Scripts/ModelView/Client/Module/UI/UIComponent.cs

@@ -8,6 +8,20 @@ namespace ET.Client
 	[ComponentOf]
 	public class UIComponent: Entity, IAwake
 	{
-		public Dictionary<string, UI> UIs = new Dictionary<string, UI>();
+		public Dictionary<string, UI> UIs = new();
+
+		private EntityRef<UIGlobalComponent> uiGlobalComponent;
+
+		public UIGlobalComponent UIGlobalComponent
+		{
+			get
+			{
+				return this.uiGlobalComponent;
+			}
+			set
+			{
+				this.uiGlobalComponent = value;
+			}
+		}
 	}
 }

+ 4 - 39
Unity/Assets/Scripts/ModelView/Client/Module/UI/UIEventComponent.cs

@@ -7,22 +7,12 @@ namespace ET.Client
 	/// <summary>
 	/// 管理所有UI GameObject
 	/// </summary>
-	public class UIEventComponent: Singleton<UIEventComponent>, ISingletonAwake
+	public class UIEventComponent: Singleton<UIEventComponent>, ISingletonAwake, ISingletonLoad
 	{
-		public Dictionary<string, AUIEvent> UIEvents = new Dictionary<string, AUIEvent>();
-		
-		public Dictionary<int, Transform> UILayers = new Dictionary<int, Transform>();
+		public Dictionary<string, AUIEvent> UIEvents { get; } = new();
 		
         public void Awake()
         {
-            GameObject uiRoot = GameObject.Find("/Global/UI");
-            ReferenceCollector referenceCollector = uiRoot.GetComponent<ReferenceCollector>();
-
-            this.UILayers.Add((int)UILayer.Hidden, referenceCollector.Get<GameObject>(UILayer.Hidden.ToString()).transform);
-            this.UILayers.Add((int)UILayer.Low, referenceCollector.Get<GameObject>(UILayer.Low.ToString()).transform);
-            this.UILayers.Add((int)UILayer.Mid, referenceCollector.Get<GameObject>(UILayer.Mid.ToString()).transform);
-            this.UILayers.Add((int)UILayer.High, referenceCollector.Get<GameObject>(UILayer.High.ToString()).transform);
-
             var uiEvents = EventSystem.Instance.GetTypes(typeof (UIEventAttribute));
             foreach (Type type in uiEvents)
             {
@@ -38,34 +28,9 @@ namespace ET.Client
             }
         }
 
-        public async ETTask<UI> OnCreate(UIComponent uiComponent, string uiType, UILayer uiLayer)
+        public void Load()
         {
-            try
-            {
-                UI ui = await this.UIEvents[uiType].OnCreate(uiComponent, uiLayer);
-                return ui;
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"on create ui error: {uiType}", e);
-            }
-        }
-
-        public Transform GetLayer(int layer)
-        {
-            return this.UILayers[layer];
-        }
-
-        public void OnRemove(UIComponent uiComponent, string uiType)
-        {
-            try
-            {
-                this.UIEvents[uiType].OnRemove(uiComponent);
-            }
-            catch (Exception e)
-            {
-                throw new Exception($"on remove ui error: {uiType}", e);
-            }
+	        World.Instance.AddSingleton<UIEventComponent>();
         }
 	}
 }

+ 10 - 0
Unity/Assets/Scripts/ModelView/Client/Module/UI/UIGlobalComponent.cs

@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET.Client
+{
+    public class UIGlobalComponent: Entity, IAwake
+    {
+        public Dictionary<int, Transform> UILayers = new Dictionary<int, Transform>();
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Case/RobotCase_FirstCase.cs.meta → Unity/Assets/Scripts/ModelView/Client/Module/UI/UIGlobalComponent.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: e3b5d1f6ba870b241a8a5bb9ae8e2a90
+guid: 7845421001b24634383e0c4084607e2a
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2