tanghai 1 سال پیش
والد
کامیت
7b8e8baa65
42فایلهای تغییر یافته به همراه573 افزوده شده و 954 حذف شده
  1. BIN
      Config/Excel/c/Statesync/UnitConfigCategory.bytes
  2. BIN
      Config/Excel/cs/Statesync/UnitConfigCategory.bytes
  3. BIN
      Config/Excel/s/Statesync/UnitConfigCategory.bytes
  4. 5 0
      Config/Json/c/Statesync/UnitConfig.txt
  5. 6 0
      Config/Json/cs/Statesync/UnitConfig.txt
  6. 5 0
      Config/Json/s/Statesync/UnitConfig.txt
  7. 71 0
      Generate/Client/Excel/Statesync/UnitConfig.cs
  8. 73 0
      Generate/ClientServer/Excel/Statesync/UnitConfig.cs
  9. 71 0
      Generate/Server/Excel/Statesync/UnitConfig.cs
  10. 8 0
      Unity/Assets/Bundles/Config/Statesync.meta
  11. BIN
      Unity/Assets/Bundles/Config/Statesync/UnitConfigCategory.bytes
  12. 7 0
      Unity/Assets/Bundles/Config/Statesync/UnitConfigCategory.bytes.meta
  13. 2 1
      Unity/Assets/Scripts/Hotfix/Unity.Hotfix.asmdef
  14. 127 0
      Unity/Packages/com.et.core/Runtime~/CodeMode/ClientServer/StartSceneConfig.cs
  15. 137 0
      Unity/Packages/com.et.core/Runtime~/CodeMode/Server/StartSceneConfig.cs
  16. 1 1
      Unity/Packages/com.et.loader/Editor/AsmdefEditor/AsmdefEditor.cs
  17. 8 0
      Unity/Packages/com.et.statesync/Excel.meta
  18. BIN
      Unity/Packages/com.et.statesync/Excel/UnitConfig.xlsx
  19. 7 0
      Unity/Packages/com.et.statesync/Excel/UnitConfig.xlsx.meta
  20. 0 12
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Client/Demo/StateSync/Main/Login/EnterMapHelper.cs
  21. 0 3
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Client/Demo/StateSync/Main/Scene/SceneChangeHelper.cs
  22. 1 31
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Gate/C2G_LoginGateHandler.cs
  23. 0 2
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Gate/GateMapFactory.cs
  24. 0 16
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Gate/NetComponentOnReadInvoker_Gate.cs
  25. 0 44
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/Console/CreateRobotConsoleHandler.cs
  26. 0 28
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/FiberInit_Robot.cs
  27. 0 62
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/RobotConsoleHandler.cs
  28. 0 31
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/RobotManagerComponentSystem.cs
  29. 0 32
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Demo/LockStep/LSInputComponentSystem.cs
  30. 0 17
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Demo/LockStep/LSUnitFactory.cs
  31. 0 100
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Demo/LockStep/RoomSystem.cs
  32. 0 92
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/AI/AIComponentSystem.cs
  33. 0 68
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs
  34. 0 34
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs
  35. 0 12
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs
  36. 0 109
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Message/NetComponentSystem.cs
  37. 0 39
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs
  38. 0 54
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs
  39. 2 1
      Unity/Packages/com.et.statesync/Runtime~/Hotfix/Unity.Hotfix.asmdef
  40. 1 3
      Unity/Packages/com.et.statesync/Runtime~/Model/Share/Demo/StateSync/SceneType.cs
  41. 0 162
      Unity/Packages/com.et.statesync/Runtime~/Model/Share/Module/ObjectWait/ObjectWait.cs
  42. 41 0
      Unity/Packages/com.et.statesync/Runtime~/Model/Share/Module/Recast/NavmeshComponent.cs

BIN
Config/Excel/c/Statesync/UnitConfigCategory.bytes


BIN
Config/Excel/cs/Statesync/UnitConfigCategory.bytes


BIN
Config/Excel/s/Statesync/UnitConfigCategory.bytes


+ 5 - 0
Config/Json/c/Statesync/UnitConfig.txt

@@ -0,0 +1,5 @@
+{"dict": [
+[1001, {"_t":"UnitConfig","_id":1001,"Type":1,"Name":"米克尔","Position":1,"Height":178}],
+[1002, {"_t":"UnitConfig","_id":1002,"Type":1,"Name":"米克尔2","Position":2,"Height":278}],
+[1004, {"_t":"UnitConfig","_id":1004,"Type":1,"Name":"米克尔4","Position":2,"Height":278}],
+]}

+ 6 - 0
Config/Json/cs/Statesync/UnitConfig.txt

@@ -0,0 +1,6 @@
+{"dict": [
+[1001, {"_t":"UnitConfig","_id":1001,"Type":1,"Name":"米克尔","Position":1,"Height":178,"Weight":68}],
+[1002, {"_t":"UnitConfig","_id":1002,"Type":1,"Name":"米克尔2","Position":2,"Height":278,"Weight":78}],
+[1003, {"_t":"UnitConfig","_id":1003,"Type":1,"Name":"米克尔3","Position":1,"Height":178,"Weight":68}],
+[1004, {"_t":"UnitConfig","_id":1004,"Type":1,"Name":"米克尔4","Position":2,"Height":278,"Weight":78}],
+]}

+ 5 - 0
Config/Json/s/Statesync/UnitConfig.txt

@@ -0,0 +1,5 @@
+{"dict": [
+[1001, {"_t":"UnitConfig","_id":1001,"Type":1,"Name":"米克尔","Position":1,"Weight":68}],
+[1002, {"_t":"UnitConfig","_id":1002,"Type":1,"Name":"米克尔2","Position":2,"Weight":78}],
+[1003, {"_t":"UnitConfig","_id":1003,"Type":1,"Name":"米克尔3","Position":1,"Weight":68}],
+]}

+ 71 - 0
Generate/Client/Excel/Statesync/UnitConfig.cs

@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+using MongoDB.Bson.Serialization.Options;
+using System.ComponentModel;
+
+namespace ET
+{
+    [Config]
+    public partial class UnitConfigCategory : Singleton<UnitConfigCategory>, IMerge
+    {
+        [BsonElement]
+        [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
+        private Dictionary<int, UnitConfig> dict = new();
+		
+        public void Merge(object o)
+        {
+            UnitConfigCategory s = o as UnitConfigCategory;
+            foreach (var kv in s.dict)
+            {
+                this.dict.Add(kv.Key, kv.Value);
+            }
+        }
+		
+        public UnitConfig Get(int id)
+        {
+            this.dict.TryGetValue(id, out UnitConfig item);
+
+            if (item == null)
+            {
+                throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)},配置id: {id}");
+            }
+
+            return item;
+        }
+		
+        public bool Contain(int id)
+        {
+            return this.dict.ContainsKey(id);
+        }
+
+        public Dictionary<int, UnitConfig> GetAll()
+        {
+            return this.dict;
+        }
+
+        public UnitConfig GetOne()
+        {
+            if (this.dict == null || this.dict.Count <= 0)
+            {
+                return null;
+            }
+            return this.dict.Values.GetEnumerator().Current;
+        }
+    }
+
+	public partial class UnitConfig: ProtoObject, IConfig
+	{
+		/// <summary>Id</summary>
+		public int Id { get; set; }
+		/// <summary>Type</summary>
+		public int Type { get; set; }
+		/// <summary>名字</summary>
+		public string Name { get; set; }
+		/// <summary>位置</summary>
+		public int Position { get; set; }
+		/// <summary>身高</summary>
+		public int Height { get; set; }
+
+	}
+}

+ 73 - 0
Generate/ClientServer/Excel/Statesync/UnitConfig.cs

@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+using MongoDB.Bson.Serialization.Options;
+using System.ComponentModel;
+
+namespace ET
+{
+    [Config]
+    public partial class UnitConfigCategory : Singleton<UnitConfigCategory>, IMerge
+    {
+        [BsonElement]
+        [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
+        private Dictionary<int, UnitConfig> dict = new();
+		
+        public void Merge(object o)
+        {
+            UnitConfigCategory s = o as UnitConfigCategory;
+            foreach (var kv in s.dict)
+            {
+                this.dict.Add(kv.Key, kv.Value);
+            }
+        }
+		
+        public UnitConfig Get(int id)
+        {
+            this.dict.TryGetValue(id, out UnitConfig item);
+
+            if (item == null)
+            {
+                throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)},配置id: {id}");
+            }
+
+            return item;
+        }
+		
+        public bool Contain(int id)
+        {
+            return this.dict.ContainsKey(id);
+        }
+
+        public Dictionary<int, UnitConfig> GetAll()
+        {
+            return this.dict;
+        }
+
+        public UnitConfig GetOne()
+        {
+            if (this.dict == null || this.dict.Count <= 0)
+            {
+                return null;
+            }
+            return this.dict.Values.GetEnumerator().Current;
+        }
+    }
+
+	public partial class UnitConfig: ProtoObject, IConfig
+	{
+		/// <summary>Id</summary>
+		public int Id { get; set; }
+		/// <summary>Type</summary>
+		public int Type { get; set; }
+		/// <summary>名字</summary>
+		public string Name { get; set; }
+		/// <summary>位置</summary>
+		public int Position { get; set; }
+		/// <summary>身高</summary>
+		public int Height { get; set; }
+		/// <summary>体重</summary>
+		public int Weight { get; set; }
+
+	}
+}

+ 71 - 0
Generate/Server/Excel/Statesync/UnitConfig.cs

@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+using MongoDB.Bson.Serialization.Options;
+using System.ComponentModel;
+
+namespace ET
+{
+    [Config]
+    public partial class UnitConfigCategory : Singleton<UnitConfigCategory>, IMerge
+    {
+        [BsonElement]
+        [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
+        private Dictionary<int, UnitConfig> dict = new();
+		
+        public void Merge(object o)
+        {
+            UnitConfigCategory s = o as UnitConfigCategory;
+            foreach (var kv in s.dict)
+            {
+                this.dict.Add(kv.Key, kv.Value);
+            }
+        }
+		
+        public UnitConfig Get(int id)
+        {
+            this.dict.TryGetValue(id, out UnitConfig item);
+
+            if (item == null)
+            {
+                throw new Exception($"配置找不到,配置表名: {nameof (UnitConfig)},配置id: {id}");
+            }
+
+            return item;
+        }
+		
+        public bool Contain(int id)
+        {
+            return this.dict.ContainsKey(id);
+        }
+
+        public Dictionary<int, UnitConfig> GetAll()
+        {
+            return this.dict;
+        }
+
+        public UnitConfig GetOne()
+        {
+            if (this.dict == null || this.dict.Count <= 0)
+            {
+                return null;
+            }
+            return this.dict.Values.GetEnumerator().Current;
+        }
+    }
+
+	public partial class UnitConfig: ProtoObject, IConfig
+	{
+		/// <summary>Id</summary>
+		public int Id { get; set; }
+		/// <summary>Type</summary>
+		public int Type { get; set; }
+		/// <summary>名字</summary>
+		public string Name { get; set; }
+		/// <summary>位置</summary>
+		public int Position { get; set; }
+		/// <summary>体重</summary>
+		public int Weight { get; set; }
+
+	}
+}

+ 8 - 0
Unity/Assets/Bundles/Config/Statesync.meta

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

BIN
Unity/Assets/Bundles/Config/Statesync/UnitConfigCategory.bytes


+ 7 - 0
Unity/Assets/Bundles/Config/Statesync/UnitConfigCategory.bytes.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 5a8ec8039c934f44593f568f426ad31c
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 1
Unity/Assets/Scripts/Hotfix/Unity.Hotfix.asmdef

@@ -7,7 +7,8 @@
         "MemoryPack",
         "MemoryPack",
         "Unity.Model",
         "Unity.Model",
         "Unity.ThirdParty",
         "Unity.ThirdParty",
-        "Unity.Loader"
+        "Unity.Loader",
+        "Unity.DotRecast"
     ],
     ],
     "includePlatforms": [],
     "includePlatforms": [],
     "excludePlatforms": [],
     "excludePlatforms": [],

+ 127 - 0
Unity/Packages/com.et.core/Runtime~/CodeMode/ClientServer/StartSceneConfig.cs

@@ -0,0 +1,127 @@
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Net;
+
+namespace ET
+{
+    public partial class StartSceneConfigCategory
+    {
+        public MultiMap<int, StartSceneConfig> Gates = new();
+        
+        public MultiMap<int, StartSceneConfig> ProcessScenes = new();
+        
+        public Dictionary<long, Dictionary<string, StartSceneConfig>> ClientScenesByName = new();
+
+        public StartSceneConfig LocationConfig;
+
+        public List<StartSceneConfig> Realms = new();
+        
+        public List<StartSceneConfig> Routers = new();
+        
+        public List<StartSceneConfig> Maps = new();
+        
+        public List<StartSceneConfig> GetByProcess(int process)
+        {
+            return this.ProcessScenes[process];
+        }
+        
+        public StartSceneConfig GetBySceneName(int zone, string name)
+        {
+            return this.ClientScenesByName[zone][name];
+        }
+
+        public override void EndInit()
+        {
+            foreach (StartSceneConfig startSceneConfig in this.GetAll().Values)
+            {
+                this.ProcessScenes.Add(startSceneConfig.Process, startSceneConfig);
+                
+                if (!this.ClientScenesByName.ContainsKey(startSceneConfig.Zone))
+                {
+                    this.ClientScenesByName.Add(startSceneConfig.Zone, new Dictionary<string, StartSceneConfig>());
+                }
+                this.ClientScenesByName[startSceneConfig.Zone].Add(startSceneConfig.Name, startSceneConfig);
+                
+                switch (startSceneConfig.Type)
+                {
+                    case SceneType.Realm:
+                        this.Realms.Add(startSceneConfig);
+                        break;
+                    case SceneType.Gate:
+                        this.Gates.Add(startSceneConfig.Zone, startSceneConfig);
+                        break;
+                    case SceneType.Location:
+                        this.LocationConfig = startSceneConfig;
+                        break;
+                    case SceneType.Router:
+                        this.Routers.Add(startSceneConfig);
+                        break;
+                    case SceneType.Map:
+                        this.Maps.Add(startSceneConfig);
+                        break;
+                }
+            }
+        }
+    }
+    
+    public partial class StartSceneConfig
+    {
+        public ActorId ActorId;
+        
+        public int Type;
+
+        public StartProcessConfig StartProcessConfig
+        {
+            get
+            {
+                return StartProcessConfigCategory.Instance.Get(this.Process);
+            }
+        }
+        
+        public StartZoneConfig StartZoneConfig
+        {
+            get
+            {
+                return StartZoneConfigCategory.Instance.Get(this.Zone);
+            }
+        }
+
+        // 内网地址外网端口,通过防火墙映射端口过来
+        private IPEndPoint innerIPPort;
+
+        public IPEndPoint InnerIPPort
+        {
+            get
+            {
+                if (innerIPPort == null)
+                {
+                    this.innerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.InnerIP}:{this.Port}");
+                }
+
+                return this.innerIPPort;
+            }
+        }
+
+        private IPEndPoint outerIPPort;
+
+        // 外网地址外网端口
+        public IPEndPoint OuterIPPort
+        {
+            get
+            {
+                if (this.outerIPPort == null)
+                {
+                    this.outerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.OuterIP}:{this.Port}");
+                }
+
+                return this.outerIPPort;
+            }
+        }
+
+        public override void EndInit()
+        {
+            this.ActorId = new ActorId(this.Process, this.Id, 1);
+            this.Type = SceneTypeSingleton.Instance.GetSceneType(this.SceneType);
+        }
+    }
+}

+ 137 - 0
Unity/Packages/com.et.core/Runtime~/CodeMode/Server/StartSceneConfig.cs

@@ -0,0 +1,137 @@
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Net;
+
+namespace ET
+{
+    public partial class StartSceneConfigCategory
+    {
+        public MultiMap<int, StartSceneConfig> Gates = new();
+        
+        public MultiMap<int, StartSceneConfig> ProcessScenes = new();
+        
+        public Dictionary<long, Dictionary<string, StartSceneConfig>> ClientScenesByName = new();
+
+        public StartSceneConfig LocationConfig;
+
+        public List<StartSceneConfig> Realms = new();
+        
+        public List<StartSceneConfig> Routers = new();
+        
+        public List<StartSceneConfig> Maps = new();
+
+        public StartSceneConfig Match;
+        
+        public StartSceneConfig Benchmark;
+        
+        public List<StartSceneConfig> GetByProcess(int process)
+        {
+            return this.ProcessScenes[process];
+        }
+        
+        public StartSceneConfig GetBySceneName(int zone, string name)
+        {
+            return this.ClientScenesByName[zone][name];
+        }
+
+        public override void EndInit()
+        {
+            foreach (StartSceneConfig startSceneConfig in this.GetAll().Values)
+            {
+                this.ProcessScenes.Add(startSceneConfig.Process, startSceneConfig);
+                
+                if (!this.ClientScenesByName.ContainsKey(startSceneConfig.Zone))
+                {
+                    this.ClientScenesByName.Add(startSceneConfig.Zone, new Dictionary<string, StartSceneConfig>());
+                }
+                this.ClientScenesByName[startSceneConfig.Zone].Add(startSceneConfig.Name, startSceneConfig);
+                
+                switch (startSceneConfig.Type)
+                {
+                    case SceneType.Realm:
+                        this.Realms.Add(startSceneConfig);
+                        break;
+                    case SceneType.Gate:
+                        this.Gates.Add(startSceneConfig.Zone, startSceneConfig);
+                        break;
+                    case SceneType.Location:
+                        this.LocationConfig = startSceneConfig;
+                        break;
+                    case SceneType.Router:
+                        this.Routers.Add(startSceneConfig);
+                        break;
+                    case SceneType.Map:
+                        this.Maps.Add(startSceneConfig);
+                        break;
+                    case SceneType.Match:
+                        this.Match = startSceneConfig;
+                        break;
+                    case SceneType.BenchmarkServer:
+                        this.Benchmark = startSceneConfig;
+                        break;
+                }
+            }
+        }
+    }
+    
+    public partial class StartSceneConfig
+    {
+        public ActorId ActorId;
+        
+        public int Type;
+
+        public StartProcessConfig StartProcessConfig
+        {
+            get
+            {
+                return StartProcessConfigCategory.Instance.Get(this.Process);
+            }
+        }
+        
+        public StartZoneConfig StartZoneConfig
+        {
+            get
+            {
+                return StartZoneConfigCategory.Instance.Get(this.Zone);
+            }
+        }
+
+        // 内网地址外网端口,通过防火墙映射端口过来
+        private IPEndPoint innerIPPort;
+
+        public IPEndPoint InnerIPPort
+        {
+            get
+            {
+                if (innerIPPort == null)
+                {
+                    this.innerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.InnerIP}:{this.Port}");
+                }
+
+                return this.innerIPPort;
+            }
+        }
+
+        private IPEndPoint outerIPPort;
+
+        // 外网地址外网端口
+        public IPEndPoint OuterIPPort
+        {
+            get
+            {
+                if (this.outerIPPort == null)
+                {
+                    this.outerIPPort = NetworkHelper.ToIPEndPoint($"{this.StartProcessConfig.OuterIP}:{this.Port}");
+                }
+
+                return this.outerIPPort;
+            }
+        }
+
+        public override void EndInit()
+        {
+            this.ActorId = new ActorId(this.Process, this.Id, 1);
+            this.Type = SceneTypeSingleton.Instance.GetSceneType(this.SceneType);
+        }
+    }
+}

+ 1 - 1
Unity/Packages/com.et.loader/Editor/AsmdefEditor/AsmdefEditor.cs

@@ -55,7 +55,7 @@ namespace ET.Loader
                 {
                 {
                     foreach (string assName in AssNames)
                     foreach (string assName in AssNames)
                     {
                     {
-                        string p = Path.Combine(directory, "Scripts/" + assName + "~/Unity." + assName + ".asmdef");
+                        string p = Path.Combine(directory, "Runtime~/" + assName + "/Unity." + assName + ".asmdef");
                         if (!File.Exists(p))
                         if (!File.Exists(p))
                         {
                         {
                             continue;
                             continue;

+ 8 - 0
Unity/Packages/com.et.statesync/Excel.meta

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

BIN
Unity/Packages/com.et.statesync/Excel/UnitConfig.xlsx


+ 7 - 0
Unity/Packages/com.et.statesync/Excel/UnitConfig.xlsx.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 8123be5ba23699e4ca7ca3657236a999
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 12
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Client/Demo/StateSync/Main/Login/EnterMapHelper.cs

@@ -21,17 +21,5 @@ namespace ET.Client
                 Log.Error(e);
                 Log.Error(e);
             }	
             }	
         }
         }
-        
-        public static async ETTask Match(Fiber fiber)
-        {
-            try
-            {
-                G2C_Match g2CEnterMap = await fiber.Root.GetComponent<ClientSenderComponent>().Call(C2G_Match.Create()) as G2C_Match;
-            }
-            catch (Exception e)
-            {
-                Log.Error(e);
-            }	
-        }
     }
     }
 }
 }

+ 0 - 3
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Client/Demo/StateSync/Main/Scene/SceneChangeHelper.cs

@@ -5,8 +5,6 @@
         // 场景切换协程
         // 场景切换协程
         public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId)
         public static async ETTask SceneChangeTo(Scene root, string sceneName, long sceneInstanceId)
         {
         {
-            root.RemoveComponent<AIComponent>();
-            
             CurrentScenesComponent currentScenesComponent = root.GetComponent<CurrentScenesComponent>();
             CurrentScenesComponent currentScenesComponent = root.GetComponent<CurrentScenesComponent>();
             currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
             currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
             Scene currentScene = CurrentSceneFactory.Create(sceneInstanceId, sceneName, currentScenesComponent);
             Scene currentScene = CurrentSceneFactory.Create(sceneInstanceId, sceneName, currentScenesComponent);
@@ -19,7 +17,6 @@
             M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;
             M2C_CreateMyUnit m2CCreateMyUnit = waitCreateMyUnit.Message;
             Unit unit = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);
             Unit unit = UnitFactory.Create(currentScene, m2CCreateMyUnit.Unit);
             unitComponent.Add(unit);
             unitComponent.Add(unit);
-            root.RemoveComponent<AIComponent>();
             
             
             EventSystem.Instance.Publish(currentScene, new SceneChangeFinish());
             EventSystem.Instance.Publish(currentScene, new SceneChangeFinish());
             // 通知等待场景切换的协程
             // 通知等待场景切换的协程

+ 1 - 31
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Gate/C2G_LoginGateHandler.cs

@@ -37,41 +37,11 @@ namespace ET.Server
             }
             }
             else
             else
             {
             {
-                // 判断是否在战斗
-                PlayerRoomComponent playerRoomComponent = player.GetComponent<PlayerRoomComponent>();
-                if (playerRoomComponent.RoomActorId != default)
-                {
-                    CheckRoom(player, session).Coroutine();
-                }
-                else
-                {
-                    PlayerSessionComponent playerSessionComponent = player.GetComponent<PlayerSessionComponent>();
-                    playerSessionComponent.Session = session;
-                }
+                throw new Exception("not write");
             }
             }
 
 
             response.PlayerId = player.Id;
             response.PlayerId = player.Id;
             await ETTask.CompletedTask;
             await ETTask.CompletedTask;
         }
         }
-
-        private static async ETTask CheckRoom(Player player, Session session)
-        {
-            Fiber fiber = player.Fiber();
-            await fiber.WaitFrameFinish();
-
-            G2Room_Reconnect g2RoomReconnect = G2Room_Reconnect.Create();
-            g2RoomReconnect.PlayerId = player.Id;
-            using Room2G_Reconnect room2GateReconnect = await fiber.Root.GetComponent<MessageSender>().Call(
-                player.GetComponent<PlayerRoomComponent>().RoomActorId,
-                g2RoomReconnect) as Room2G_Reconnect;
-            G2C_Reconnect g2CReconnect = G2C_Reconnect.Create();
-            g2CReconnect.StartTime = room2GateReconnect.StartTime;
-            g2CReconnect.Frame = room2GateReconnect.Frame;
-            g2CReconnect.UnitInfos.AddRange(room2GateReconnect.UnitInfos);
-            session.Send(g2CReconnect);
-            
-            session.AddComponent<SessionPlayerComponent>().Player = player;
-            player.GetComponent<PlayerSessionComponent>().Session = session;
-        }
     }
     }
 }
 }

+ 0 - 2
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Gate/GateMapFactory.cs

@@ -9,8 +9,6 @@ namespace ET.Server
 
 
             scene.AddComponent<UnitComponent>();
             scene.AddComponent<UnitComponent>();
             scene.AddComponent<AOIManagerComponent>();
             scene.AddComponent<AOIManagerComponent>();
-            scene.AddComponent<RoomManagerComponent>();
-            
             scene.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             scene.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
             
             
             return scene;
             return scene;

+ 0 - 16
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Gate/NetComponentOnReadInvoker_Gate.cs

@@ -23,22 +23,6 @@ namespace ET.Server
                     MessageSessionDispatcher.Instance.Handle(session, message);
                     MessageSessionDispatcher.Instance.Handle(session, message);
                     break;
                     break;
                 }
                 }
-                case FrameMessage frameMessage:
-                {
-                    Player player = session.GetComponent<SessionPlayerComponent>().Player;
-                    ActorId roomActorId = player.GetComponent<PlayerRoomComponent>().RoomActorId;
-                    frameMessage.PlayerId = player.Id;
-                    root.GetComponent<MessageSender>().Send(roomActorId, frameMessage);
-                    break;
-                }
-                case IRoomMessage actorRoom:
-                {
-                    Player player = session.GetComponent<SessionPlayerComponent>().Player;
-                    ActorId roomActorId = player.GetComponent<PlayerRoomComponent>().RoomActorId;
-                    actorRoom.PlayerId = player.Id;
-                    root.GetComponent<MessageSender>().Send(roomActorId, actorRoom);
-                    break;
-                }
                 case ILocationMessage actorLocationMessage:
                 case ILocationMessage actorLocationMessage:
                 {
                 {
                     long unitId = session.GetComponent<SessionPlayerComponent>().Player.Id;
                     long unitId = session.GetComponent<SessionPlayerComponent>().Player.Id;

+ 0 - 44
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/Console/CreateRobotConsoleHandler.cs

@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using CommandLine;
-
-namespace ET.Server
-{
-    [ConsoleHandler(ConsoleMode.CreateRobot)]
-    public class CreateRobotConsoleHandler: IConsoleHandler
-    {
-        public async ETTask Run(Fiber fiber, ModeContex contex, string content)
-        {
-            switch (content)
-            {
-                case ConsoleMode.CreateRobot:
-                {
-                    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; });
-
-                    RobotManagerComponent robotManagerComponent =
-                            fiber.Root.GetComponent<RobotManagerComponent>() ?? fiber.Root.AddComponent<RobotManagerComponent>();
-
-                    // 创建机器人
-                    TimerComponent timerComponent = fiber.Root.GetComponent<TimerComponent>();
-                    for (int i = 0; i < options.Num; ++i)
-                    {
-                        await robotManagerComponent.NewRobot($"Robot_{i}");
-                        Log.Console($"create robot {i}");
-                        await timerComponent.WaitAsync(2000);
-                    }
-                    break;
-                }
-            }
-            contex.Parent.RemoveComponent<ModeContex>();
-            await ETTask.CompletedTask;
-        }
-    }
-}

+ 0 - 28
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/FiberInit_Robot.cs

@@ -1,28 +0,0 @@
-namespace ET.Client
-{
-    [Invoke(SceneType.Robot)]
-    public class FiberInit_Robot: AInvokeHandler<FiberInit, ETTask>
-    {
-        public override async ETTask Handle(FiberInit fiberInit)
-        {
-            Scene root = fiberInit.Fiber.Root;
-            root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
-            root.AddComponent<TimerComponent>();
-            root.AddComponent<CoroutineLockComponent>();
-            root.AddComponent<ProcessInnerSender>();
-            root.AddComponent<PlayerComponent>();
-            root.AddComponent<CurrentScenesComponent>();
-            root.AddComponent<ObjectWait>();
-            
-            root.SceneType = SceneType.StateSync;
-
-            await EventSystem.Instance.PublishAsync(root, new AppStartInitFinish());
-            
-            await LoginHelper.Login(root, root.Name, "");
-            
-            await EnterMapHelper.EnterMapAsync(root);
-            
-            root.AddComponent<AIComponent, int>(1);
-        }
-    }
-}

+ 0 - 62
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/RobotConsoleHandler.cs

@@ -1,62 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace ET.Server
-{
-    [ConsoleHandler(ConsoleMode.Robot)]
-    public class RobotConsoleHandler: IConsoleHandler
-    {
-        public async ETTask Run(Fiber fiber, ModeContex contex, string content)
-        {
-            string[] ss = content.Split(" ");
-            switch (ss[0])
-            {
-                case ConsoleMode.Robot:
-                    break;
-
-                case "Run":
-                {
-                    int caseType = int.Parse(ss[1]);
-
-                    try
-                    {
-                        Log.Debug($"run case start: {caseType}");
-                        await EventSystem.Instance.Invoke<RobotInvokeArgs, ETTask>(caseType, new RobotInvokeArgs() { Fiber = fiber, Content = content });
-                        Log.Debug($"run case finish: {caseType}");
-                    }
-                    catch (Exception e)
-                    {
-                        Log.Debug($"run case error: {caseType}\n{e}");
-                    }
-                    break;
-                }
-                case "RunAll":
-                {
-                    FieldInfo[] fieldInfos = typeof (RobotCaseType).GetFields();
-                    foreach (FieldInfo fieldInfo in fieldInfos)
-                    {
-                        int caseType = (int)fieldInfo.GetValue(null);
-                        if (caseType > RobotCaseType.MaxCaseType)
-                        {
-                            Log.Debug($"case > {RobotCaseType.MaxCaseType}: {caseType}");
-                            break;
-                        }
-                        try
-                        {
-                            Log.Debug($"run case start: {caseType}");
-                            await EventSystem.Instance.Invoke<RobotInvokeArgs, ETTask>(caseType, new RobotInvokeArgs() { Fiber = fiber, Content = content});
-                            Log.Debug($"---------run case finish: {caseType}");
-                        }
-                        catch (Exception e)
-                        {
-                            Log.Debug($"run case error: {caseType}\n{e}");
-                            break;
-                        }
-                    }
-                    break;
-                }
-            }
-            await ETTask.CompletedTask;
-        }
-    }
-}

+ 0 - 31
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Server/Demo/StateSync/Robot/RobotManagerComponentSystem.cs

@@ -1,31 +0,0 @@
-namespace ET.Server
-{
-    [EntitySystemOf(typeof(RobotManagerComponent))]
-    public static partial class RobotManagerComponentSystem
-    {
-        [EntitySystem]
-        private static void Awake(this RobotManagerComponent self)
-        {
-        }
-        
-        [EntitySystem]
-        private static void Destroy(this RobotManagerComponent self)
-        {
-            async ETTask Remove(int f)
-            {
-                await FiberManager.Instance.Remove(f);
-            }
-            
-            foreach (int fiberId in self.robots)
-            {
-                Remove(fiberId).Coroutine();
-            }
-        }
-
-        public static async ETTask NewRobot(this RobotManagerComponent self, string account)
-        {
-            int robot = await FiberManager.Instance.Create(SchedulerType.ThreadPool, self.Zone(), SceneType.Robot, account);
-            self.robots.Add(robot);
-        }
-    }
-}

+ 0 - 32
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Demo/LockStep/LSInputComponentSystem.cs

@@ -1,32 +0,0 @@
-using System;
-using ET.Client;
-using TrueSync;
-
-namespace ET
-{
-    [EntitySystemOf(typeof(LSInputComponent))]
-    [LSEntitySystemOf(typeof(LSInputComponent))]
-    public static partial class LSInputComponentSystem
-    {
-        [EntitySystem]
-        private static void Awake(this LSInputComponent self)
-        {
-
-        }
-        
-        [LSEntitySystem]
-        private static void LSUpdate(this LSInputComponent self)
-        {
-            LSUnit unit = self.GetParent<LSUnit>();
-
-            TSVector2 v2 = self.LSInput.V * 6 * 50 / 1000;
-            if (v2.LengthSquared() < 0.0001f)
-            {
-                return;
-            }
-            TSVector oldPos = unit.Position;
-            unit.Position += new TSVector(v2.x, 0, v2.y);
-            unit.Forward = unit.Position - oldPos;
-        }
-    }
-}

+ 0 - 17
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Demo/LockStep/LSUnitFactory.cs

@@ -1,17 +0,0 @@
-namespace ET
-{
-    public static partial class LSUnitFactory
-    {
-        public static LSUnit Init(LSWorld lsWorld, LockStepUnitInfo unitInfo)
-        {
-	        LSUnitComponent lsUnitComponent = lsWorld.GetComponent<LSUnitComponent>();
-	        LSUnit lsUnit = lsUnitComponent.AddChildWithId<LSUnit>(unitInfo.PlayerId);
-			
-	        lsUnit.Position = unitInfo.Position;
-	        lsUnit.Rotation = unitInfo.Rotation;
-
-			lsUnit.AddComponent<LSInputComponent>();
-            return lsUnit;
-        }
-    }
-}

+ 0 - 100
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Demo/LockStep/RoomSystem.cs

@@ -1,100 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace ET
-{
-    [FriendOf(typeof(Room))]
-    public static partial class RoomSystem
-    {
-        public static Room Room(this Entity entity)
-        {
-            return entity.IScene as Room;
-        }
-        
-        public static void Init(this Room self, List<LockStepUnitInfo> unitInfos, long startTime, int frame = -1)
-        {
-            self.StartTime = startTime;
-            self.AuthorityFrame = frame;
-            self.PredictionFrame = frame;
-            self.Replay.UnitInfos = unitInfos;
-            self.FrameBuffer = new FrameBuffer(frame);
-            self.FixedTimeCounter = new FixedTimeCounter(self.StartTime, 0, LSConstValue.UpdateInterval);
-            LSWorld lsWorld = self.LSWorld;
-            lsWorld.Frame = frame + 1;
-            lsWorld.AddComponent<LSUnitComponent>();
-            for (int i = 0; i < unitInfos.Count; ++i)
-            {
-                LockStepUnitInfo unitInfo = unitInfos[i];
-                LSUnitFactory.Init(lsWorld, unitInfo);
-                self.PlayerIds.Add(unitInfo.PlayerId);
-            }
-        }
-
-        public static void Update(this Room self, OneFrameInputs oneFrameInputs)
-        {
-            LSWorld lsWorld = self.LSWorld;
-            // 设置输入到每个LSUnit身上
-            LSUnitComponent unitComponent = lsWorld.GetComponent<LSUnitComponent>();
-            foreach (var kv in oneFrameInputs.Inputs)
-            {
-                LSUnit lsUnit = unitComponent.GetChild<LSUnit>(kv.Key);
-                LSInputComponent lsInputComponent = lsUnit.GetComponent<LSInputComponent>();
-                lsInputComponent.LSInput = kv.Value;
-            }
-            
-            if (!self.IsReplay)
-            {
-                // 保存当前帧场景数据
-                self.SaveLSWorld();
-                self.Record(self.LSWorld.Frame);
-            }
-
-            lsWorld.Update();
-        }
-        
-        public static LSWorld GetLSWorld(this Room self, int sceneType, int frame)
-        {
-            MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame);
-            memoryBuffer.Seek(0, SeekOrigin.Begin);
-            LSWorld lsWorld = MemoryPackHelper.Deserialize(typeof (LSWorld), memoryBuffer) as LSWorld;
-            lsWorld.SceneType = sceneType;
-            memoryBuffer.Seek(0, SeekOrigin.Begin);
-            return lsWorld;
-        }
-
-        private static void SaveLSWorld(this Room self)
-        {
-            int frame = self.LSWorld.Frame;
-            MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame);
-            memoryBuffer.Seek(0, SeekOrigin.Begin);
-            memoryBuffer.SetLength(0);
-            
-            MemoryPackHelper.Serialize(self.LSWorld, memoryBuffer);
-            memoryBuffer.Seek(0, SeekOrigin.Begin);
-
-            long hash = memoryBuffer.GetBuffer().Hash(0, (int) memoryBuffer.Length);
-            
-            self.FrameBuffer.SetHash(frame, hash);
-        }
-
-        // 记录需要存档的数据
-        public static void Record(this Room self, int frame)
-        {
-            if (frame > self.AuthorityFrame)
-            {
-                return;
-            }
-            OneFrameInputs oneFrameInputs = self.FrameBuffer.FrameInputs(frame);
-            OneFrameInputs saveInput = OneFrameInputs.Create();
-            oneFrameInputs.CopyTo(saveInput);
-            self.Replay.FrameInputs.Add(saveInput);
-            if (frame % LSConstValue.SaveLSWorldFrameCount == 0)
-            {
-                MemoryBuffer memoryBuffer = self.FrameBuffer.Snapshot(frame);
-                byte[] bytes = memoryBuffer.ToArray();
-                self.Replay.Snapshots.Add(bytes);
-            }
-        }
-    }
-}

+ 0 - 92
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/AI/AIComponentSystem.cs

@@ -1,92 +0,0 @@
-using System;
-
-namespace ET
-{
-    [EntitySystemOf(typeof(AIComponent))]
-    [FriendOf(typeof(AIDispatcherComponent))]
-    public static partial class AIComponentSystem
-    {
-        [Invoke(TimerInvokeType.AITimer)]
-        public class AITimer: ATimer<AIComponent>
-        {
-            protected override void Run(AIComponent self)
-            {
-                try
-                {
-                    self.Check();
-                }
-                catch (Exception e)
-                {
-                    Log.Error($"move timer error: {self.Id}\n{e}");
-                }
-            }
-        }
-    
-        [EntitySystem]
-        private static void Awake(this AIComponent self, int aiConfigId)
-        {
-            self.AIConfigId = aiConfigId;
-            self.Timer = self.Root().GetComponent<TimerComponent>().NewRepeatedTimer(1000, TimerInvokeType.AITimer, self);
-        }
-
-        [EntitySystem]
-        private static void Destroy(this AIComponent self)
-        {
-            self.Root().GetComponent<TimerComponent>()?.Remove(ref self.Timer);
-            self.CancellationToken?.Cancel();
-            self.CancellationToken = null;
-            self.Current = 0;
-        }
-
-        private static void Check(this AIComponent self)
-        {
-            Fiber fiber = self.Fiber();
-            if (self.Parent == null)
-            {
-                fiber.Root.GetComponent<TimerComponent>().Remove(ref self.Timer);
-                return;
-            }
-
-            var oneAI = AIConfigCategory.Instance.AIConfigs[self.AIConfigId];
-
-            foreach (AIConfig aiConfig in oneAI.Values)
-            {
-
-                AAIHandler aaiHandler = AIDispatcherComponent.Instance.Get(aiConfig.Name);
-
-                if (aaiHandler == null)
-                {
-                    Log.Error($"not found aihandler: {aiConfig.Name}");
-                    continue;
-                }
-
-                int ret = aaiHandler.Check(self, aiConfig);
-                if (ret != 0)
-                {
-                    continue;
-                }
-
-                if (self.Current == aiConfig.Id)
-                {
-                    break;
-                }
-
-                self.Cancel(); // 取消之前的行为
-                ETCancellationToken cancellationToken = new();
-                self.CancellationToken = cancellationToken;
-                self.Current = aiConfig.Id;
-
-                aaiHandler.Execute(self, aiConfig, cancellationToken).Coroutine();
-                return;
-            }
-            
-        }
-
-        private static void Cancel(this AIComponent self)
-        {
-            self.CancellationToken?.Cancel();
-            self.Current = 0;
-            self.CancellationToken = null;
-        }
-    }
-} 

+ 0 - 68
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs

@@ -1,68 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace ET
-{
-    [EntitySystemOf(typeof(ConsoleComponent))]
-    [FriendOf(typeof(ModeContex))]
-    public static partial class ConsoleComponentSystem
-    {
-        [EntitySystem]
-        private static void Awake(this ConsoleComponent self)
-        {
-            self.Start().Coroutine();
-        }
-
-        
-        private static async ETTask Start(this ConsoleComponent self)
-        {
-            self.CancellationTokenSource = new CancellationTokenSource();
-
-            while (true)
-            {
-                try
-                {
-                    ModeContex modeContex = self.GetComponent<ModeContex>();
-                    string line = await Task.Factory.StartNew(() =>
-                    {
-                        Console.Write($"{modeContex?.Mode ?? ""}> ");
-                        return Console.In.ReadLine();
-                    }, self.CancellationTokenSource.Token);
-                    
-                    line = line.Trim();
-
-                    switch (line)
-                    {
-                        case "":
-                            break;
-                        case "exit":
-                            self.RemoveComponent<ModeContex>();
-                            break;
-                        default:
-                        {
-                            string[] lines = line.Split(" ");
-                            string mode = modeContex == null? lines[0] : modeContex.Mode;
-
-                            IConsoleHandler iConsoleHandler = ConsoleDispatcher.Instance.Get(mode);
-                            if (modeContex == null)
-                            {
-                                modeContex = self.AddComponent<ModeContex>();
-                                modeContex.Mode = mode;
-                            }
-                            await iConsoleHandler.Run(self.Fiber(), modeContex, line);
-                            break;
-                        }
-                    }
-
-
-                }
-                catch (Exception e)
-                {
-                    Log.Console(e.ToString());
-                }
-            }
-        }
-    }
-}

+ 0 - 34
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs

@@ -1,34 +0,0 @@
-using System;
-
-namespace ET
-{
-    [ConsoleHandler(ConsoleMode.ReloadConfig)]
-    public class ReloadConfigConsoleHandler: IConsoleHandler
-    {
-        public async ETTask Run(Fiber fiber, ModeContex contex, string content)
-        {
-            switch (content)
-            {
-                case ConsoleMode.ReloadConfig:
-                    contex.Parent.RemoveComponent<ModeContex>();
-                    Log.Console("C must have config name, like: C UnitConfig");
-                    break;
-                default:
-                    string[] ss = content.Split(" ");
-                    string configName = ss[1];
-                    string category = $"{configName}Category";
-                    Type type = CodeTypes.Instance.GetType($"ET.{category}");
-                    if (type == null)
-                    {
-                        Log.Console($"reload config but not find {category}");
-                        return;
-                    }
-                    await ConfigLoader.Instance.Reload(type);
-                    Log.Console($"reload config {configName} finish!");
-                    break;
-            }
-            
-            await ETTask.CompletedTask;
-        }
-    }
-}

+ 0 - 12
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Console/ReloadDllConsoleHandler.cs

@@ -1,12 +0,0 @@
-namespace ET
-{
-    [ConsoleHandler(ConsoleMode.ReloadDll)]
-    public class ReloadDllConsoleHandler: IConsoleHandler
-    {
-        public async ETTask Run(Fiber fiber, ModeContex contex, string content)
-        {
-            await ETTask.CompletedTask;
-            CodeLoader.Instance.Reload();
-        }
-    }
-}

+ 0 - 109
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Message/NetComponentSystem.cs

@@ -1,109 +0,0 @@
-using System.Net;
-using System.Net.Sockets;
-
-namespace ET
-{
-    [EntitySystemOf(typeof(NetComponent))]
-    public static partial class NetComponentSystem
-    {
-        [EntitySystem]
-        private static void Awake(this NetComponent self, IPEndPoint address, NetworkProtocol protocol)
-        {
-            self.AService = new KService(address, protocol, ServiceType.Outer);
-            self.AService.AcceptCallback = self.OnAccept;
-            self.AService.ReadCallback = self.OnRead;
-            self.AService.ErrorCallback = self.OnError;
-        }
-        
-        [EntitySystem]
-        private static void Awake(this NetComponent self, AddressFamily addressFamily, NetworkProtocol protocol)
-        {
-            self.AService = new KService(addressFamily, protocol, ServiceType.Outer);
-            self.AService.ReadCallback = self.OnRead;
-            self.AService.ErrorCallback = self.OnError;
-        }
-        
-        [EntitySystem]
-        private static void Update(this NetComponent self)
-        {
-            self.AService.Update();
-        }
-
-        [EntitySystem]
-        private static void Destroy(this NetComponent self)
-        {
-            self.AService.Dispose();
-        }
-
-        private static void OnError(this NetComponent self, long channelId, int error)
-        {
-            Session session = self.GetChild<Session>(channelId);
-            if (session == null)
-            {
-                return;
-            }
-
-            session.Error = error;
-            session.Dispose();
-        }
-
-        // 这个channelId是由CreateAcceptChannelId生成的
-        private static void OnAccept(this NetComponent self, long channelId, IPEndPoint ipEndPoint)
-        {
-            Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
-            session.RemoteAddress = ipEndPoint;
-
-            if (self.IScene.SceneType != SceneType.BenchmarkServer)
-            {
-                // 挂上这个组件,5秒就会删除session,所以客户端验证完成要删除这个组件。该组件的作用就是防止外挂一直连接不发消息也不进行权限验证
-                session.AddComponent<SessionAcceptTimeoutComponent>();
-                // 客户端连接,2秒检查一次recv消息,10秒没有消息则断开
-                session.AddComponent<SessionIdleCheckerComponent>();
-            }
-        }
-        
-        private static void OnRead(this NetComponent self, long channelId, MemoryBuffer memoryBuffer)
-        {
-            Session session = self.GetChild<Session>(channelId);
-            if (session == null)
-            {
-                return;
-            }
-            session.LastRecvTime = TimeInfo.Instance.ClientNow();
-            
-            (ActorId _, object message) = MessageSerializeHelper.ToMessage(self.AService, memoryBuffer);
-            
-            LogMsg.Instance.Debug(self.Fiber(), message);
-            
-            EventSystem.Instance.Invoke((long)self.IScene.SceneType, new NetComponentOnRead() {Session = session, Message = message});
-        }
-        
-        public static Session Create(this NetComponent self, IPEndPoint realIPEndPoint)
-        {
-            long channelId = NetServices.Instance.CreateConnectChannelId();
-            Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
-            session.RemoteAddress = realIPEndPoint;
-            if (self.IScene.SceneType != SceneType.BenchmarkClient)
-            {
-                session.AddComponent<SessionIdleCheckerComponent>();
-            }
-            
-            self.AService.Create(session.Id, session.RemoteAddress);
-
-            return session;
-        }
-
-        public static Session Create(this NetComponent self, IPEndPoint routerIPEndPoint, IPEndPoint realIPEndPoint, uint localConn)
-        {
-            long channelId = localConn;
-            Session session = self.AddChildWithId<Session, AService>(channelId, self.AService);
-            session.RemoteAddress = realIPEndPoint;
-            if (self.IScene.SceneType != SceneType.BenchmarkClient)
-            {
-                session.AddComponent<SessionIdleCheckerComponent>();
-            }
-            self.AService.Create(session.Id, routerIPEndPoint);
-            return session;
-        }
-    }
-}

+ 0 - 39
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs

@@ -1,39 +0,0 @@
-using System;
-
-namespace ET
-{
-    [EntitySystemOf(typeof(SessionAcceptTimeoutComponent))]
-    public static partial class SessionAcceptTimeoutComponentHelper
-    {
-        [Invoke(TimerInvokeType.SessionAcceptTimeout)]
-        public class SessionAcceptTimeout: ATimer<SessionAcceptTimeoutComponent>
-        {
-            protected override void Run(SessionAcceptTimeoutComponent self)
-            {
-                try
-                {
-                    self.Parent.Dispose();
-                }
-                catch (Exception e)
-                {
-                    Log.Error($"move timer error: {self.Id}\n{e}");
-                }
-            }
-        }
-        
-        [EntitySystem]
-        private static void Awake(this SessionAcceptTimeoutComponent self)
-        {
-            self.Timer = self.Root().GetComponent<TimerComponent>().NewOnceTimer(TimeInfo.Instance.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
-        }
-        
-        [EntitySystem]
-        private static void Destroy(this SessionAcceptTimeoutComponent self)
-        {
-            self.Root().GetComponent<TimerComponent>()?.Remove(ref self.Timer);
-        }
-        
-    }
-    
-    
-}

+ 0 - 54
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs

@@ -1,54 +0,0 @@
-using System;
-
-namespace ET
-{
-    [EntitySystemOf(typeof(SessionIdleCheckerComponent))]
-    public static partial class SessionIdleCheckerComponentSystem
-    {
-        [Invoke(TimerInvokeType.SessionIdleChecker)]
-        public class SessionIdleChecker: ATimer<SessionIdleCheckerComponent>
-        {
-            protected override void Run(SessionIdleCheckerComponent self)
-            {
-                try
-                {
-                    self.Check();
-                }
-                catch (Exception e)
-                {
-                    Log.Error($"session idle checker timer error: {self.Id}\n{e}");
-                }
-            }
-        }
-    
-        [EntitySystem]
-        private static void Awake(this SessionIdleCheckerComponent self)
-        {
-            self.RepeatedTimer = self.Root().GetComponent<TimerComponent>().NewRepeatedTimer(CheckInteral, TimerInvokeType.SessionIdleChecker, self);
-        }
-        
-        [EntitySystem]
-        private static void Destroy(this SessionIdleCheckerComponent self)
-        {
-            self.Root().GetComponent<TimerComponent>()?.Remove(ref self.RepeatedTimer);
-        }
-
-        private const int CheckInteral = 2000;
-
-        private static void Check(this SessionIdleCheckerComponent self)
-        {
-            Session session = self.GetParent<Session>();
-            long timeNow = TimeInfo.Instance.ClientNow();
-
-            if (timeNow - session.LastRecvTime < ConstValue.SessionTimeoutTime && timeNow - session.LastSendTime < ConstValue.SessionTimeoutTime)
-            {
-                return;
-            }
-
-            Log.Info($"session timeout: {session.Id} {timeNow} {session.LastRecvTime} {session.LastSendTime} {timeNow - session.LastRecvTime} {timeNow - session.LastSendTime}");
-            session.Error = ErrorCore.ERR_SessionSendOrRecvTimeout;
-
-            session.Dispose();
-        }
-    }
-}

+ 2 - 1
Unity/Packages/com.et.statesync/Runtime~/Hotfix/Unity.Hotfix.asmdef

@@ -4,6 +4,7 @@
         "Unity.Mathematics",
         "Unity.Mathematics",
         "Unity.Loader",
         "Unity.Loader",
         "MemoryPack",
         "MemoryPack",
-        "Unity.Model"
+        "Unity.Model",
+        "Unity.DotRecast"
     ]
     ]
 }
 }

+ 1 - 3
Unity/Packages/com.et.statesync/Runtime~/Model/Share/Demo/StateSync/SceneType.cs

@@ -12,13 +12,11 @@
 		public const int Robot = 11;
 		public const int Robot = 11;
 		public const int BenchmarkClient = 12;
 		public const int BenchmarkClient = 12;
 		public const int BenchmarkServer = 13;
 		public const int BenchmarkServer = 13;
-		public const int Match = 14;
-		public const int Room = 15;
 		public const int LockStepClient = 16;
 		public const int LockStepClient = 16;
 		public const int LockStepServer = 17;
 		public const int LockStepServer = 17;
-		public const int RoomRoot = 18;
 		public const int Watcher = 19;
 		public const int Watcher = 19;
 		public const int GameTool = 20;
 		public const int GameTool = 20;
+		public const int Server = 21;
 		
 		
 
 
 		// 客户端
 		// 客户端

+ 0 - 162
Unity/Packages/com.et.statesync/Runtime~/Model/Share/Module/ObjectWait/ObjectWait.cs

@@ -1,162 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace ET
-{
-    public static class WaitTypeError
-    {
-        public const int Success = 0;
-        public const int Destroy = 1;
-        public const int Cancel = 2;
-        public const int Timeout = 3;
-    }
-    
-    public interface IWaitType
-    {
-        int Error
-        {
-            get;
-            set;
-        }
-    }
-
-    [EntitySystemOf(typeof(ObjectWait))]
-    public static partial class ObjectWaitSystem
-    {
-        [EntitySystem]
-        private static void Awake(this ObjectWait self)
-        {
-            self.tcss.Clear();
-        }
-        
-        [EntitySystem]
-        private static void Destroy(this ObjectWait self)
-        {
-            foreach (object v in self.tcss.Values.ToArray())
-            {
-                ((IDestroyRun) v).SetResult();
-            }
-        }
-
-        private interface IDestroyRun
-        {
-            void SetResult();
-        }
-
-        private class ResultCallback<K>: Object, IDestroyRun where K : struct, IWaitType
-        {
-            private ETTask<K> tcs;
-
-            public ResultCallback()
-            {
-                this.tcs = ETTask<K>.Create(true);
-            }
-
-            public bool IsDisposed
-            {
-                get
-                {
-                    return this.tcs == null;
-                }
-            }
-
-            public ETTask<K> Task => this.tcs;
-
-            public void SetResult(K k)
-            {
-                var t = tcs;
-                this.tcs = null;
-                t.SetResult(k);
-            }
-
-            public void SetResult()
-            {
-                var t = tcs;
-                this.tcs = null;
-                t.SetResult(new K() { Error = WaitTypeError.Destroy });
-            }
-        }
-        
-        public static async ETTask<T> Wait<T>(this ObjectWait self, ETCancellationToken cancellationToken = null) where T : struct, IWaitType
-        {
-            ResultCallback<T> tcs = new ResultCallback<T>();
-            Type type = typeof (T);
-            self.tcss.Add(type, tcs);
-
-            void CancelAction()
-            {
-                self.Notify(new T() { Error = WaitTypeError.Cancel });
-            }
-
-            T ret;
-            try
-            {
-                cancellationToken?.Add(CancelAction);
-                ret = await tcs.Task;
-            }
-            finally
-            {
-                cancellationToken?.Remove(CancelAction);    
-            }
-            return ret;
-        }
-
-        public static async ETTask<T> Wait<T>(this ObjectWait self, int timeout, ETCancellationToken cancellationToken = null) where T : struct, IWaitType
-        {
-            ResultCallback<T> tcs = new ResultCallback<T>();
-            async ETTask WaitTimeout()
-            {
-                await self.Root().GetComponent<TimerComponent>().WaitAsync(timeout, cancellationToken);
-                if (cancellationToken.IsCancel())
-                {
-                    return;
-                }
-                if (tcs.IsDisposed)
-                {
-                    return;
-                }
-                self.Notify(new T() { Error = WaitTypeError.Timeout });
-            }
-            
-            WaitTimeout().Coroutine();
-            
-            self.tcss.Add(typeof (T), tcs);
-            
-            void CancelAction()
-            {
-                self.Notify(new T() { Error = WaitTypeError.Cancel });
-            }
-            
-            T ret;
-            try
-            {
-                cancellationToken?.Add(CancelAction);
-                ret = await tcs.Task;
-            }
-            finally
-            {
-                cancellationToken?.Remove(CancelAction);    
-            }
-            return ret;
-        }
-
-        public static void Notify<T>(this ObjectWait self, T obj) where T : struct, IWaitType
-        {
-            Type type = typeof (T);
-            if (!self.tcss.TryGetValue(type, out object tcs))
-            {
-                return;
-            }
-
-            self.tcss.Remove(type);
-            ((ResultCallback<T>) tcs).SetResult(obj);
-        }
-    }
-
-    [ComponentOf]
-    public class ObjectWait: Entity, IAwake, IDestroy
-    {
-        public Dictionary<Type, object> tcss = new Dictionary<Type, object>();
-    }
-}

+ 41 - 0
Unity/Packages/com.et.statesync/Runtime~/Model/Share/Module/Recast/NavmeshComponent.cs

@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+
+namespace ET
+{
+    public class NavmeshComponent: Singleton<NavmeshComponent>, ISingletonAwake
+    {
+        public struct RecastFileLoader
+        {
+            public string Name { get; set; }
+        }
+
+        private readonly Dictionary<string, byte[]> navmeshs = new();
+        
+        public void Awake()
+        {
+        }
+        
+        public byte[] Get(string name)
+        {
+            lock (this)
+            {
+                if (this.navmeshs.TryGetValue(name, out byte[] bytes))
+                {
+                    return bytes;
+                }
+
+                byte[] buffer =
+                        EventSystem.Instance.Invoke<NavmeshComponent.RecastFileLoader, byte[]>(
+                            new NavmeshComponent.RecastFileLoader() { Name = name });
+                if (buffer.Length == 0)
+                {
+                    throw new Exception($"no nav data: {name}");
+                }
+
+                this.navmeshs[name] = buffer;
+                return buffer;
+            }
+        }
+    }
+}