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

1.ConfigComponent加载方式调整
2.机器人Console创建命令: CreateRobot --Num=10

tanghai 4 лет назад
Родитель
Сommit
620552549c
49 измененных файлов с 349 добавлено и 54 удалено
  1. 3 2
      Config/StartProcessConfigCategory.bytes
  2. BIN
      Config/StartSceneConfigCategory.bytes
  3. BIN
      Excel/StartProcessConfig.xlsx
  4. BIN
      Excel/StartSceneConfig.xlsx
  5. 32 0
      Robot/Hotfix/AppStart_Init.cs
  6. 16 2
      Robot/Hotfix/Robot.Hotfix.csproj
  7. 42 0
      Robot/Hotfix/Robot/Console/CreateRobotConsoleHandler.cs
  8. 54 0
      Robot/Hotfix/Robot/RobotManagerComponentSystem.cs
  9. 31 0
      Robot/Hotfix/Robot/Scene/RobotSceneFactory.cs
  10. 4 0
      Robot/Model/Robot.Model.csproj
  11. 7 0
      Robot/Model/Robot/Console/CreateRobotArgs.cs
  12. 0 11
      Robot/Model/Robot/RobotFactory.cs
  13. 7 0
      Robot/Model/Robot/RobotManagerComponent.cs
  14. 1 4
      Server/Hotfix/AppStart_Init.cs
  15. 10 0
      Server/Hotfix/Config/ConfigComponent_SetConfigLoader_Awake.cs
  16. 3 3
      Server/Hotfix/Config/ConfigLoader.cs
  17. 4 5
      Server/Hotfix/Demo/Scene/SceneFactory.cs
  18. 3 0
      Server/Hotfix/Server.Hotfix.csproj
  19. 2 0
      Server/Model/Generate/Config/StartProcessConfig.cs
  20. 5 0
      Server/Model/Generate/ConfigPartial/StartSceneConfig.cs
  21. 1 0
      Server/Model/Module/Console/ConsoleComponent.cs
  22. 8 0
      Tools/ExcelExporter/Program.cs
  23. 3 2
      Unity/Assets/Bundles/Config/StartProcessConfigCategory.bytes
  24. BIN
      Unity/Assets/Bundles/Config/StartSceneConfigCategory.bytes
  25. 7 0
      Unity/Assets/Hotfix/Demo/ConstValue.cs
  26. 1 1
      Unity/Assets/Hotfix/Demo/ConstValue.cs.meta
  27. 8 0
      Unity/Assets/Hotfix/Demo/Login.meta
  28. 2 2
      Unity/Assets/Hotfix/Demo/Login/EnterMapHelper.cs
  29. 1 1
      Unity/Assets/Hotfix/Demo/Login/EnterMapHelper.cs.meta
  30. 2 2
      Unity/Assets/Hotfix/Demo/Login/LoginHelper.cs
  31. 1 1
      Unity/Assets/Hotfix/Demo/Login/LoginHelper.cs.meta
  32. 8 0
      Unity/Assets/Hotfix/Demo/Scene.meta
  33. 2 2
      Unity/Assets/Hotfix/Demo/Scene/SceneFactory.cs
  34. 1 1
      Unity/Assets/Hotfix/Demo/Scene/SceneFactory.cs.meta
  35. 2 2
      Unity/Assets/Hotfix/Module/Config/ConfigComponentSystem.cs
  36. 1 3
      Unity/Assets/HotfixView/AppStart_Init.cs
  37. 8 0
      Unity/Assets/HotfixView/Demo/Config.meta
  38. 10 0
      Unity/Assets/HotfixView/Demo/Config/ConfigComponent_SetConfigLoader_Awake.cs
  39. 11 0
      Unity/Assets/HotfixView/Demo/Config/ConfigComponent_SetConfigLoader_Awake.cs.meta
  40. 4 5
      Unity/Assets/HotfixView/Demo/Config/ConfigLoader.cs
  41. 11 0
      Unity/Assets/HotfixView/Demo/Config/ConfigLoader.cs.meta
  42. 1 1
      Unity/Assets/HotfixView/Demo/UI/UILobby/UILobbyComponentSystem.cs
  43. 6 1
      Unity/Assets/HotfixView/Demo/UI/UILogin/UILoginComponentSystem.cs
  44. 1 0
      Unity/Assets/Model/Core/Entity/SceneType.cs
  45. 2 0
      Unity/Assets/Model/Generate/Config/StartProcessConfig.cs
  46. 1 3
      Unity/Assets/Model/Module/Config/ConfigComponent.cs
  47. 10 0
      Unity/Assets/Model/Module/Config/IConfigLoader.cs
  48. 11 0
      Unity/Assets/Model/Module/Config/IConfigLoader.cs.meta
  49. 1 0
      Unity/Assets/ModelView/Demo/UI/UILogin/UILoginComponent.cs

+ 3 - 2
Config/StartProcessConfigCategory.bytes

@@ -1,3 +1,4 @@
 
-¡œ
-¢œ
+¡œ"
+Server.App
+¢œ"	Robot.App

BIN
Config/StartSceneConfigCategory.bytes


BIN
Excel/StartProcessConfig.xlsx


BIN
Excel/StartSceneConfig.xlsx


+ 32 - 0
Robot/Hotfix/AppStart_Init.cs

@@ -0,0 +1,32 @@
+namespace ET
+{
+    public class AppStart_Init: AEvent<EventType.AppStart>
+    {
+        protected override async ETTask Run(EventType.AppStart args)
+        {
+            Game.Scene.AddComponent<TimerComponent>();
+            Game.Scene.AddComponent<CoroutineLockComponent>();
+
+            // 加载配置
+            Game.Scene.AddComponent<ConfigComponent>();
+            await ConfigComponent.Instance.LoadAsync();
+            
+            Game.Scene.AddComponent<OpcodeTypeComponent>();
+            Game.Scene.AddComponent<MessageDispatcherComponent>();
+            Game.Scene.AddComponent<NetThreadComponent>();
+            Game.Scene.AddComponent<ZoneSceneManagerComponent>();
+            Game.Scene.AddComponent<AIDispatcherComponent>();
+            
+            var processScenes = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
+            foreach (StartSceneConfig startConfig in processScenes)
+            {
+                await RobotSceneFactory.Create(Game.Scene, startConfig.Id, startConfig.InstanceId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);
+            }
+            
+            if (Game.Options.Console == 1)
+            {
+                Game.Scene.AddComponent<ConsoleComponent>();
+            }
+        }
+    }
+}

+ 16 - 2
Robot/Hotfix/Robot.Hotfix.csproj

@@ -52,13 +52,27 @@
             <Link>Module\NetworkTCP\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
-        <Compile Include="..\..\Unity\Assets\Hotfix\Demo\**\*.cs">
+        <Compile Include="..\..\Unity\Assets\Hotfix\Demo\**\*.cs"> 
             <Link>Demo\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Hotfix\Module\Config\**\*.cs">
+            <Link>Module\Config\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Hotfix\Module\Console\**\*.cs">
+            <Link>Module\Console\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Hotfix\Config\**\*.cs">
+            <Link>Config\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
     </ItemGroup>
     
     <ItemGroup>
-      <Folder Include="Robot" />
+      <Folder Include="..\..\Server\Hotfix\Helper">
+        <Link>Helper</Link>
+      </Folder>
     </ItemGroup>
 
 </Project>

+ 42 - 0
Robot/Hotfix/Robot/Console/CreateRobotConsoleHandler.cs

@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using CommandLine;
+using NLog;
+
+namespace ET
+{
+    [ConsoleHandler(ConsoleMode.CreateRobot)]
+    public class CreateRobotConsoleHandler: IConsoleHandler
+    {
+        public async ETTask Run(ModeContex contex, string content)
+        {
+            switch (content)
+            {
+                case ConsoleMode.CreateRobot:
+                    contex.Parent.RemoveComponent<ModeContex>();
+                    Log.Console("CreateRobot args error!");
+                    break;
+                default:
+                    CreateRobotArgs options = null;
+                    Parser.Default.ParseArguments<CreateRobotArgs>(content.Split(' '))
+                            .WithNotParsed(error => throw new Exception($"CreateRobotArgs error!"))
+                            .WithParsed(o => { options = o; });
+
+                    // 获取当前进程的RobotScene
+                    List<StartSceneConfig> robotSceneConfigs = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
+                    // 创建机器人
+                    for (int i = 0; i < options.Num; ++i)
+                    {
+                        int index = i % robotSceneConfigs.Count;
+                        StartSceneConfig robotSceneConfig = robotSceneConfigs[index];
+                        Scene robotScene = Game.Scene.Get(robotSceneConfig.Id);
+                        RobotManagerComponent robotManagerComponent = robotScene.GetComponent<RobotManagerComponent>();
+                        await robotManagerComponent.NewRobot(Game.Options.Process * 10000 + i);
+                    }
+                    break;
+            }
+            
+            await ETTask.CompletedTask;
+        }
+    }
+}

+ 54 - 0
Robot/Hotfix/Robot/RobotManagerComponentSystem.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Linq;
+
+namespace ET
+{
+    public class RobotManagerComponentAwakeSystem: AwakeSystem<RobotManagerComponent>
+    {
+        public override void Awake(RobotManagerComponent self)
+        {
+        }
+    }
+
+    public static class RobotManagerComponentSystem
+    {
+        public static async ETTask<Scene> NewRobot(this RobotManagerComponent self, int zone)
+        {
+            Scene zoneScene = null;
+            try
+            {
+                zoneScene = await SceneFactory.CreateZoneScene(zone, "Robot", self);
+                await LoginHelper.Login(zoneScene, ConstValue.LoginAddress, zone.ToString(), zone.ToString());
+                await EnterMapHelper.EnterMapAsync(zoneScene);
+                Log.Debug($"create robot ok: {zone}");
+                return zoneScene;
+            }
+            catch (Exception e)
+            {
+                zoneScene?.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();
+            }
+        }
+    }
+}

+ 31 - 0
Robot/Hotfix/Robot/Scene/RobotSceneFactory.cs

@@ -0,0 +1,31 @@
+namespace ET
+{
+    public static class RobotSceneFactory
+    {
+        public static async ETTask<Scene> Create(
+            Entity parent,
+            long id,
+            long instanceId,
+            int zone,
+            string name,
+            SceneType sceneType,
+            StartSceneConfig startSceneConfig = null
+        )
+        {
+            await ETTask.CompletedTask;
+            Log.Info($"create scene: {sceneType} {name} {zone}");
+            Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent);
+
+            scene.AddComponent<MailBoxComponent, MailboxType>(MailboxType.UnOrderMessageDispatcher);
+
+            switch (scene.SceneType)
+            {
+                case SceneType.Robot:
+                    scene.AddComponent<RobotManagerComponent>();
+                    break;
+            }
+
+            return scene;
+        }
+    }
+}

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

@@ -84,6 +84,10 @@
         <Compile Include="..\..\Unity\Assets\Model\Module\CoroutineLock\**\*.cs">
             <Link>Module\CoroutineLock\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
+
+        <Compile Include="..\..\Server\Model\Module\Console\**\*.cs">
+            <Link>Module\Console\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
     </ItemGroup>
     <ItemGroup>
       <ProjectReference Include="..\..\ThirdParty\protobuf-net\protobuf-net.csproj" />

+ 7 - 0
Robot/Model/Robot/Console/CreateRobotArgs.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public class CreateRobotArgs
+    {
+        public int Num;
+    }
+}

+ 0 - 11
Robot/Model/Robot/RobotFactory.cs

@@ -1,11 +0,0 @@
-namespace ET
-{
-    public static class RobotFactory
-    {
-        public static Scene Create()
-        {
-            return null;
-            //EntitySceneFactory.CreateScene()
-        }
-    }
-}

+ 7 - 0
Robot/Model/Robot/RobotManagerComponent.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public class RobotManagerComponent: Entity
+    {
+        
+    }
+}

+ 1 - 4
Server/Hotfix/Demo/AppStart_Init.cs → Server/Hotfix/AppStart_Init.cs

@@ -9,9 +9,6 @@ namespace ET
         protected override async ETTask Run(EventType.AppStart args)
         {
             Game.Scene.AddComponent<ConfigComponent>();
-            
-            ConfigComponent.GetAllConfigBytes = LoadConfigHelper.GetAllConfigBytes;
-            ConfigComponent.GetOneConfigBytes = LoadConfigHelper.GetOneConfigBytes;
             await ConfigComponent.Instance.LoadAsync();
 
             StartProcessConfig processConfig = StartProcessConfigCategory.Instance.Get(Game.Options.Process);
@@ -36,7 +33,7 @@ namespace ET
             var processScenes = StartSceneConfigCategory.Instance.GetByProcess(Game.Options.Process);
             foreach (StartSceneConfig startConfig in processScenes)
             {
-                await SceneFactory.Create(Game.Scene, startConfig.InstanceId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);
+                await SceneFactory.Create(Game.Scene, startConfig.Id, startConfig.InstanceId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);
             }
 
             switch (Game.Options.AppType)

+ 10 - 0
Server/Hotfix/Config/ConfigComponent_SetConfigLoader_Awake.cs

@@ -0,0 +1,10 @@
+namespace ET
+{
+    public class ConfigComponent_SetConfigLoader_Awake: AwakeSystem<ConfigComponent>
+    {
+        public override void Awake(ConfigComponent self)
+        {
+            self.ConfigLoader = new ConfigLoader();
+        }
+    }
+}

+ 3 - 3
Server/Hotfix/Helper/LoadConfigHelper.cs → Server/Hotfix/Config/ConfigLoader.cs

@@ -3,9 +3,9 @@ using System.IO;
 
 namespace ET
 {
-    public static class LoadConfigHelper
+    public class ConfigLoader: IConfigLoader
     {
-        public static void GetAllConfigBytes(Dictionary<string, byte[]> output)
+        public void GetAllConfigBytes(Dictionary<string, byte[]> output)
         {
             foreach (string file in Directory.GetFiles($"../Config", "*.bytes"))
             {
@@ -14,7 +14,7 @@ namespace ET
             }
         }
         
-        public static byte[] GetOneConfigBytes(string configName)
+        public byte[] GetOneConfigBytes(string configName)
         {
             byte[] configBytes = File.ReadAllBytes($"../Config/{configName}.bytes");
             return configBytes;

+ 4 - 5
Server/Hotfix/Demo/Scene/SceneFactory.cs

@@ -8,15 +8,14 @@ namespace ET
     {
         public static async ETTask<Scene> Create(Entity parent, string name, SceneType sceneType)
         {
-            long id = IdGenerater.Instance.GenerateInstanceId();
-            return await Create(parent, id, parent.DomainZone(), name, sceneType);
+            long instanceId = IdGenerater.Instance.GenerateInstanceId();
+            return await Create(parent, instanceId, instanceId, parent.DomainZone(), name, sceneType);
         }
         
-        public static async ETTask<Scene> Create(Entity parent, long instanceId, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null)
+        public static async ETTask<Scene> Create(Entity parent, long id, long instanceId, int zone, string name, SceneType sceneType, StartSceneConfig startSceneConfig = null)
         {
             await ETTask.CompletedTask;
-            Scene scene = EntitySceneFactory.CreateScene(instanceId, zone, sceneType, name);
-            scene.Parent = parent;
+            Scene scene = EntitySceneFactory.CreateScene(id, instanceId, zone, sceneType, name, parent);
 
             scene.AddComponent<MailBoxComponent, MailboxType>(MailboxType.UnOrderMessageDispatcher);
 

+ 3 - 0
Server/Hotfix/Server.Hotfix.csproj

@@ -54,4 +54,7 @@
   <ItemGroup>
     <ProjectReference Include="..\Model\Server.Model.csproj" />
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Helper" />
+  </ItemGroup>
 </Project>

+ 2 - 0
Server/Model/Generate/Config/StartProcessConfig.cs

@@ -76,6 +76,8 @@ namespace ET
 		public int MachineId { get; set; }
 		[ProtoMember(3, IsRequired  = true)]
 		public int InnerPort { get; set; }
+		[ProtoMember(4, IsRequired  = true)]
+		public string AppName { get; set; }
 
 
 		[ProtoAfterDeserialization]

+ 5 - 0
Server/Model/Generate/ConfigPartial/StartSceneConfig.cs

@@ -14,6 +14,8 @@ namespace ET
 
         public StartSceneConfig LocationConfig;
         
+        public List<StartSceneConfig> Robots = new List<StartSceneConfig>();
+        
         public List<StartSceneConfig> GetByProcess(int process)
         {
             return this.ProcessScenes[process];
@@ -44,6 +46,9 @@ namespace ET
                     case SceneType.Location:
                         this.LocationConfig = startSceneConfig;
                         break;
+                    case SceneType.Robot:
+                        this.Robots.Add(startSceneConfig);
+                        break;
                 }
             }
         }

+ 1 - 0
Server/Model/Module/Console/ConsoleComponent.cs

@@ -10,6 +10,7 @@ namespace ET
         public const string ShowMemory = "M";
         public const string Repl = "Repl";
         public const string Debugger = "Debugger";
+        public const string CreateRobot = "CreateRobot";
     }
 
     public class ConsoleComponent: Entity

+ 8 - 0
Tools/ExcelExporter/Program.cs

@@ -210,6 +210,10 @@ namespace ET
             
             for (int row = 6; row <= worksheet.Dimension.End.Row; ++row)
             {
+                if (worksheet.Cells[row, 3].Text.Trim() == "")
+                {
+                    continue;
+                }
                 sb.Append("{");
                 for (int col = 3; col <= worksheet.Dimension.End.Column; ++col)
                 {
@@ -253,6 +257,10 @@ namespace ET
                 case "long":
                 case "float":
                 case "double":
+                    if (value == "")
+                    {
+                        return "0";
+                    }
                     return value;
                 case "string":
                     return $"\"{value}\"";

+ 3 - 2
Unity/Assets/Bundles/Config/StartProcessConfigCategory.bytes

@@ -1,3 +1,4 @@
 
-¡œ
-¢œ
+¡œ"
+Server.App
+¢œ"	Robot.App

BIN
Unity/Assets/Bundles/Config/StartSceneConfigCategory.bytes


+ 7 - 0
Unity/Assets/Hotfix/Demo/ConstValue.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public static class ConstValue
+    {
+        public const string LoginAddress = "127.0.0.1:10002";
+    }
+}

+ 1 - 1
Unity/Assets/Hotfix/Demo/MapHelper.cs.meta → Unity/Assets/Hotfix/Demo/ConstValue.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 0d136fec7f99046548485929ddf46bfc
+guid: c458fc9978c0d4209855663037162bf1
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 8 - 0
Unity/Assets/Hotfix/Demo/Login.meta

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

+ 2 - 2
Unity/Assets/Hotfix/Demo/MapHelper.cs → Unity/Assets/Hotfix/Demo/Login/EnterMapHelper.cs

@@ -3,9 +3,9 @@ using System;
 
 namespace ET
 {
-    public static class MapHelper
+    public static class EnterMapHelper
     {
-        public static async ETVoid EnterMapAsync(Scene zoneScene, string sceneName)
+        public static async ETTask EnterMapAsync(Scene zoneScene)
         {
             try
             {

+ 1 - 1
Unity/Assets/HotfixView/Demo/Helper/LoadConfigHelper.cs.meta → Unity/Assets/Hotfix/Demo/Login/EnterMapHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: f56c40256a22744419cdc0c3051219cf
+guid: 558604abbd4ac410b9ea671aabbc6885
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 2
Unity/Assets/Hotfix/Demo/LoginHelper.cs → Unity/Assets/Hotfix/Demo/Login/LoginHelper.cs

@@ -5,7 +5,7 @@ namespace ET
 {
     public static class LoginHelper
     {
-        public static async ETVoid Login(Scene zoneScene, string address, string account)
+        public static async ETTask Login(Scene zoneScene, string address, string account, string password)
         {
             try
             {
@@ -13,7 +13,7 @@ namespace ET
                 R2C_Login r2CLogin;
                 using (Session session = zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(address)))
                 {
-                    r2CLogin = (R2C_Login) await session.Call(new C2R_Login() { Account = account, Password = "111111" });
+                    r2CLogin = (R2C_Login) await session.Call(new C2R_Login() { Account = account, Password = password });
                 }
 
                 // 创建一个gate Session,并且保存到SessionComponent中

+ 1 - 1
Unity/Assets/Hotfix/Demo/LoginHelper.cs.meta → Unity/Assets/Hotfix/Demo/Login/LoginHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: c492ea9d6f1564b4eb017e75abcfa6ca
+guid: a4a548674166948fd9403adc71b94e83
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 8 - 0
Unity/Assets/Hotfix/Demo/Scene.meta

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

+ 2 - 2
Unity/Assets/HotfixView/Demo/Scene/SceneFactory.cs → Unity/Assets/Hotfix/Demo/Scene/SceneFactory.cs

@@ -2,9 +2,9 @@ namespace ET
 {
     public static class SceneFactory
     {
-        public static async ETTask<Scene> CreateZoneScene(int zone, string name)
+        public static async ETTask<Scene> CreateZoneScene(int zone, string name, Entity parent)
         {
-            Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateId(), zone, SceneType.Zone, name, Game.Scene);
+            Scene zoneScene = EntitySceneFactory.CreateScene(Game.IdGenerater.GenerateInstanceId(), zone, SceneType.Zone, name, parent);
             zoneScene.AddComponent<ZoneSceneFlagComponent>();
             zoneScene.AddComponent<NetKcpComponent>();
             zoneScene.AddComponent<UnitComponent>();

+ 1 - 1
Unity/Assets/HotfixView/Demo/Scene/SceneFactory.cs.meta → Unity/Assets/Hotfix/Demo/Scene/SceneFactory.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 6132d5efb1bae460db2ef73d954f24e0
+guid: f06119eb582e34b6b9895a1105e994af
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 2
Unity/Assets/Hotfix/Module/Config/ConfigComponentSystem.cs

@@ -24,7 +24,7 @@ namespace ET
 	{
 		public static void LoadOneConfig(this ConfigComponent self, Type configType)
 		{
-			byte[] oneConfigBytes = ConfigComponent.GetOneConfigBytes(configType.FullName);
+			byte[] oneConfigBytes = self.ConfigLoader.GetOneConfigBytes(configType.FullName);
 
 			object category = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);
 
@@ -37,7 +37,7 @@ namespace ET
 			HashSet<Type> types = Game.EventSystem.GetTypes(typeof (ConfigAttribute));
 			
 			Dictionary<string, byte[]> configBytes = new Dictionary<string, byte[]>();
-			ConfigComponent.GetAllConfigBytes(configBytes);
+			self.ConfigLoader.GetAllConfigBytes(configBytes);
 
 			List<Task> listTasks = new List<Task>();
 

+ 1 - 3
Unity/Assets/HotfixView/Demo/AppStart_Init.cs → Unity/Assets/HotfixView/AppStart_Init.cs

@@ -11,8 +11,6 @@ namespace ET
             Game.Scene.AddComponent<ResourcesComponent>();
             ResourcesComponent.Instance.LoadBundle("config.unity3d");
             Game.Scene.AddComponent<ConfigComponent>();
-            ConfigComponent.GetAllConfigBytes = LoadConfigHelper.GetAllConfigBytes;
-            ConfigComponent.GetOneConfigBytes = LoadConfigHelper.GetOneConfigBytes;
             await ConfigComponent.Instance.LoadAsync();
             ResourcesComponent.Instance.UnloadBundle("config.unity3d");
             
@@ -29,7 +27,7 @@ namespace ET
 
             ResourcesComponent.Instance.LoadBundle("unit.unity3d");
 
-            Scene zoneScene = await SceneFactory.CreateZoneScene(1, "Process");
+            Scene zoneScene = await SceneFactory.CreateZoneScene(1, "Game", Game.Scene);
 
             await Game.EventSystem.Publish(new EventType.AppStartInitFinish() { ZoneScene = zoneScene });
         }

+ 8 - 0
Unity/Assets/HotfixView/Demo/Config.meta

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

+ 10 - 0
Unity/Assets/HotfixView/Demo/Config/ConfigComponent_SetConfigLoader_Awake.cs

@@ -0,0 +1,10 @@
+namespace ET
+{
+    public class ConfigComponent_SetConfigLoader_Awake: AwakeSystem<ConfigComponent>
+    {
+        public override void Awake(ConfigComponent self)
+        {
+            self.ConfigLoader = new ConfigLoader();
+        }
+    }
+}

+ 11 - 0
Unity/Assets/HotfixView/Demo/Config/ConfigComponent_SetConfigLoader_Awake.cs.meta

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

+ 4 - 5
Unity/Assets/HotfixView/Demo/Helper/LoadConfigHelper.cs → Unity/Assets/HotfixView/Demo/Config/ConfigLoader.cs

@@ -1,12 +1,11 @@
 using System.Collections.Generic;
-using System.IO;
 using UnityEngine;
 
 namespace ET
 {
-    public static class LoadConfigHelper
+    public class ConfigLoader: IConfigLoader
     {
-        public static void GetAllConfigBytes(Dictionary<string, byte[]> output)
+        public void GetAllConfigBytes(Dictionary<string, byte[]> output)
         {
             Dictionary<string, UnityEngine.Object> keys = ResourcesComponent.Instance.GetBundleAll("config.unity3d");
 
@@ -17,8 +16,8 @@ namespace ET
                 output[key] = v.bytes;
             }
         }
-        
-        public static byte[] GetOneConfigBytes(string configName)
+
+        public byte[] GetOneConfigBytes(string configName)
         {
             TextAsset v = ResourcesComponent.Instance.GetAsset("config.unity3d", configName) as TextAsset;
             return v.bytes;

+ 11 - 0
Unity/Assets/HotfixView/Demo/Config/ConfigLoader.cs.meta

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

+ 1 - 1
Unity/Assets/HotfixView/Demo/UI/UILobby/UILobbyComponentSystem.cs

@@ -19,7 +19,7 @@ namespace ET
     {
         public static void EnterMap(this UILobbyComponent self)
         {
-            MapHelper.EnterMapAsync(self.ZoneScene(), "Map").Coroutine();
+            EnterMapHelper.EnterMapAsync(self.ZoneScene()).Coroutine();
         }
     }
 }

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

@@ -14,6 +14,7 @@ namespace ET
 			self.loginBtn = rc.Get<GameObject>("LoginBtn");
 			self.loginBtn.GetComponent<Button>().onClick.AddListener(self.OnLogin);
 			self.account = rc.Get<GameObject>("Account");
+			self.password = rc.Get<GameObject>("Password");
 		}
 	}
 	
@@ -21,7 +22,11 @@ namespace ET
 	{
 		public static void OnLogin(this UILoginComponent self)
 		{
-			LoginHelper.Login(self.DomainScene(), "127.0.0.1:10002", self.account.GetComponent<InputField>().text).Coroutine();
+			LoginHelper.Login(
+				self.DomainScene(), 
+				ConstValue.LoginAddress, 
+				self.account.GetComponent<InputField>().text, 
+				self.password.GetComponent<InputField>().text).Coroutine();
 		}
 	}
 }

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

@@ -14,5 +14,6 @@
 		Client = 30,
 		Zone = 31,
 		Login = 32,
+		Robot = 33,
 	}
 }

+ 2 - 0
Unity/Assets/Model/Generate/Config/StartProcessConfig.cs

@@ -76,6 +76,8 @@ namespace ET
 		public int MachineId { get; set; }
 		[ProtoMember(3, IsRequired  = true)]
 		public int InnerPort { get; set; }
+		[ProtoMember(4, IsRequired  = true)]
+		public string AppName { get; set; }
 
 
 		[ProtoAfterDeserialization]

+ 1 - 3
Unity/Assets/Model/Module/Config/ConfigComponent.cs

@@ -8,9 +8,7 @@ namespace ET
     /// </summary>
     public class ConfigComponent: Entity
     {
-        public static Action<Dictionary<string, byte[]>> GetAllConfigBytes;
-        
-        public static Func<string, byte[]> GetOneConfigBytes;
+        public IConfigLoader ConfigLoader;
         
         public static ConfigComponent Instance;
 		

+ 10 - 0
Unity/Assets/Model/Module/Config/IConfigLoader.cs

@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+
+namespace ET
+{
+    public interface IConfigLoader
+    {
+        void GetAllConfigBytes(Dictionary<string, byte[]> output);
+        byte[] GetOneConfigBytes(string configName);
+    }
+}

+ 11 - 0
Unity/Assets/Model/Module/Config/IConfigLoader.cs.meta

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

+ 1 - 0
Unity/Assets/ModelView/Demo/UI/UILogin/UILoginComponent.cs

@@ -9,6 +9,7 @@ namespace ET
 	public class UILoginComponent: Entity
 	{
 		public GameObject account;
+		public GameObject password;
 		public GameObject loginBtn;
 	}
 }