Bladeren bron

1.新的移动组件,支持传入多个寻路点
2.客户端消息打印成json
3.创建unit初始化数值,并且同步数值给客户端
4.删除Server.sln,不要再用这个了,请使用Client-Server.sln
测试移动OK,很顺滑

tanghai 4 jaren geleden
bovenliggende
commit
da42dddbdf
66 gewijzigde bestanden met toevoegingen van 1018 en 820 verwijderingen
  1. 18 1
      Proto/OuterMessage.proto
  2. 18 0
      Server/Hotfix/Demo/C2M_PathfindingResultHandler.cs
  3. 0 15
      Server/Hotfix/Demo/Frame_ClickMapHandler.cs
  4. 13 13
      Server/Hotfix/Demo/G2M_CreateUnitHandler.cs
  5. 0 1
      Server/Hotfix/Demo/G2M_SessionDisconnectHandler.cs
  6. 0 4
      Server/Hotfix/Demo/MessageHelper.cs
  7. 66 0
      Server/Hotfix/Demo/Move/MoveHelper.cs
  8. 13 0
      Server/Hotfix/Demo/Move/PathFindHelper.cs
  9. 1 1
      Server/Hotfix/Demo/Scene/SceneFactory.cs
  10. 24 0
      Server/Hotfix/Demo/Unit/UnitHelper.cs
  11. 0 80
      Server/Hotfix/Demo/Unit/UnitPathComponentSystem.cs
  12. 3 0
      Server/Hotfix/Server.Hotfix.csproj
  13. 10 0
      Server/Model/Demo/EventType.cs
  14. 3 2
      Server/Model/Demo/RecastNav/RecastPathComponent.cs
  15. 3 3
      Server/Model/Demo/RecastNav/RecastPathProcessor.cs
  16. 0 93
      Server/Model/Demo/Unit/MoveComponent.cs
  17. 0 2
      Server/Model/Demo/Unit/UnitGateComponent.cs
  18. 0 27
      Server/Model/Demo/Unit/UnitPathComponent.cs
  19. 23 23
      Server/Model/Generate/Message/InnerMessage.cs
  20. 65 26
      Server/Model/Generate/Message/OuterMessage.cs
  21. 17 16
      Server/Model/Generate/Message/OuterOpcode.cs
  22. 4 0
      Server/Model/Server.Model.csproj
  23. 0 162
      Server/Server.sln
  24. 3 3
      Tools/Proto2CS/Program.cs
  25. 12 4
      Unity/Assets/Hotfix/Demo/Move/M2C_PathfindingResultHandler.cs
  26. 28 0
      Unity/Assets/Hotfix/Demo/Move/M2C_StopHandler.cs
  27. 1 1
      Unity/Assets/Hotfix/Demo/Move/M2C_StopHandler.cs.meta
  28. 352 0
      Unity/Assets/Hotfix/Demo/Move/MoveComponentSystem.cs
  29. 1 1
      Unity/Assets/Hotfix/Demo/Move/MoveComponentSystem.cs.meta
  30. 24 0
      Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs
  31. 11 0
      Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs.meta
  32. 0 61
      Unity/Assets/Hotfix/Demo/Unit/MoveComponentSystem.cs
  33. 0 3
      Unity/Assets/Hotfix/Demo/Unit/MoveComponentSystem.cs.meta
  34. 0 103
      Unity/Assets/Hotfix/Demo/Unit/TurnComponentSystem.cs
  35. 5 2
      Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs
  36. 0 50
      Unity/Assets/Hotfix/Demo/Unit/UnitPathComponentSystem.cs
  37. 0 3
      Unity/Assets/Hotfix/Demo/Unit/UnitPathComponentSystem.cs.meta
  38. 1 1
      Unity/Assets/Hotfix/Module/Numeric/NumericWatcher_Hp_ShowUI.cs
  39. 13 0
      Unity/Assets/HotfixView/Unit/ChangePosition_SyncGameObjectPos.cs
  40. 11 0
      Unity/Assets/HotfixView/Unit/ChangePosition_SyncGameObjectPos.cs.meta
  41. 13 0
      Unity/Assets/HotfixView/Unit/ChangeRotation_SyncGameObjectRotation.cs
  42. 11 0
      Unity/Assets/HotfixView/Unit/ChangeRotation_SyncGameObjectRotation.cs.meta
  43. 10 0
      Unity/Assets/Model/Demo/EventType.cs
  44. 8 0
      Unity/Assets/Model/Demo/Move.meta
  45. 82 0
      Unity/Assets/Model/Demo/Move/MoveComponent.cs
  46. 11 0
      Unity/Assets/Model/Demo/Move/MoveComponent.cs.meta
  47. 0 21
      Unity/Assets/Model/Demo/Unit/MoveComponent.cs
  48. 0 3
      Unity/Assets/Model/Demo/Unit/MoveComponent.cs.meta
  49. 0 22
      Unity/Assets/Model/Demo/Unit/TurnComponent.cs
  50. 0 15
      Unity/Assets/Model/Demo/Unit/UnitPathComponent.cs
  51. 0 3
      Unity/Assets/Model/Demo/Unit/UnitPathComponent.cs.meta
  52. 14 0
      Unity/Assets/Model/Demo/WaitType.cs
  53. 11 0
      Unity/Assets/Model/Demo/WaitType.cs.meta
  54. 65 26
      Unity/Assets/Model/Generate/Message/OuterMessage.cs
  55. 17 16
      Unity/Assets/Model/Generate/Message/OuterOpcode.cs
  56. 1 1
      Unity/Assets/Model/Module/Numeric/INumericWatcher.cs
  57. 24 9
      Unity/Assets/Model/Module/Numeric/NumericComponent.cs
  58. 1 1
      Unity/Assets/Model/Module/Numeric/NumericWatcherComponent.cs
  59. 1 1
      Unity/Assets/ModelView/Opera/OperaComponent.cs
  60. 0 0
      Unity/Assets/Plugins/MacOS/libkcp.dylib
  61. 0 0
      Unity/Unity.Hotfix.csproj
  62. 0 0
      Unity/Unity.HotfixView.csproj
  63. 0 0
      Unity/Unity.Model.csproj
  64. 0 0
      Unity/Unity.ModelView.csproj
  65. 0 0
      Unity/Unity.ThirdParty.csproj
  66. 6 1
      Unity/UserSettings/EditorUserSettings.asset

+ 18 - 1
Proto/OuterMessage.proto

@@ -56,6 +56,8 @@ message UnitInfo
 	float X = 3;
 	float Y = 4;
 	float Z = 5;
+	repeated int32 Ks = 6;
+	repeated int64 Vs = 7;
 }
 
 message M2C_CreateUnits // IActorMessage
@@ -65,7 +67,7 @@ message M2C_CreateUnits // IActorMessage
     repeated UnitInfo Units = 1;
 }
 
-message Frame_ClickMap // IActorLocationMessage
+message C2M_PathfindingResult // IActorLocationMessage
 {
 	int32 RpcId = 90;
 	int64 ActorId = 93;
@@ -91,6 +93,21 @@ message M2C_PathfindingResult // IActorMessage
 	repeated float Zs = 7;
 }
 
+message M2C_Stop // IActorMessage
+{
+	int32 Error = 1;
+	
+	int64 Id = 2;
+	float X = 3;
+    float Y = 4;
+    float Z = 5;
+    
+    float A = 6;
+    float B = 7;
+    float C = 8;
+    float W = 9;
+}
+
 //ResponseType G2C_Ping
 message C2G_Ping // IRequest
 {

+ 18 - 0
Server/Hotfix/Demo/C2M_PathfindingResultHandler.cs

@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET
+{
+	[ActorMessageHandler]
+	public class C2M_PathfindingResultHandler : AMActorLocationHandler<Unit, C2M_PathfindingResult>
+	{
+		protected override async ETTask Run(Unit unit, C2M_PathfindingResult message)
+		{
+			Vector3 target = new Vector3(message.X, message.Y, message.Z);
+
+			MoveHelper.FindPathMoveToAsync(unit, target).Coroutine();
+			
+			await ETTask.CompletedTask;
+		}
+	}
+}

+ 0 - 15
Server/Hotfix/Demo/Frame_ClickMapHandler.cs

@@ -1,15 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-	[ActorMessageHandler]
-	public class Frame_ClickMapHandler : AMActorLocationHandler<Unit, Frame_ClickMap>
-	{
-		protected override async ETTask Run(Unit unit, Frame_ClickMap message)
-		{
-			Vector3 target = new Vector3(message.X, message.Y, message.Z);
-			unit.GetComponent<UnitPathComponent>().MoveTo(target).Coroutine();
-			await ETTask.CompletedTask;
-		}
-	}
-}

+ 13 - 13
Server/Hotfix/Demo/G2M_CreateUnitHandler.cs

@@ -10,31 +10,31 @@ namespace ET
 		{
 			Unit unit = EntityFactory.CreateWithId<Unit, int>(scene, IdGenerater.Instance.GenerateId(), 1001);
 			unit.AddComponent<MoveComponent>();
-			unit.AddComponent<UnitPathComponent>();
 			unit.Position = new Vector3(-10, 0, -10);
-
+			
+			NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
+			numericComponent.Set(NumericType.Speed, 6f); // 速度是6米每秒
+			
 			unit.AddComponent<MailBoxComponent>();
 			await unit.AddLocation();
 			unit.AddComponent<UnitGateComponent, long>(request.GateSessionId);
 			scene.GetComponent<UnitComponent>().Add(unit);
 			response.UnitId = unit.Id;
 			
-			
-			// 广播创建的unit
+			// 把自己广播给周围的人
 			M2C_CreateUnits createUnits = new M2C_CreateUnits();
+			createUnits.Units.Add(UnitHelper.CreateUnitInfo(unit));
+			MessageHelper.Broadcast(unit, createUnits);
+			
+			// 把周围的人通知给自己
+			createUnits.Units.Clear();
 			Unit[] units = scene.GetComponent<UnitComponent>().GetAll();
 			foreach (Unit u in units)
 			{
-				UnitInfo unitInfo = new UnitInfo();
-				unitInfo.X = u.Position.x;
-				unitInfo.Y = u.Position.y;
-				unitInfo.Z = u.Position.z;
-				unitInfo.UnitId = u.Id;
-				unitInfo.ConfigId = u.ConfigId;
-				createUnits.Units.Add(unitInfo);
+				createUnits.Units.Add(UnitHelper.CreateUnitInfo(u));
 			}
-			MessageHelper.Broadcast(unit, createUnits);
-			
+			MessageHelper.SendActor(unit.GetComponent<UnitGateComponent>().GateSessionActorId, createUnits);
+
 			reply();
 		}
 	}

+ 0 - 1
Server/Hotfix/Demo/G2M_SessionDisconnectHandler.cs

@@ -7,7 +7,6 @@ namespace ET
 	{
 		protected override async ETTask Run(Unit unit, G2M_SessionDisconnect message)
 		{
-			unit.GetComponent<UnitGateComponent>().IsDisconnect = true;
 			await ETTask.CompletedTask;
 		}
 	}

+ 0 - 4
Server/Hotfix/Demo/MessageHelper.cs

@@ -13,10 +13,6 @@ namespace ET
             foreach (Unit u in units)
             {
                 UnitGateComponent unitGateComponent = u.GetComponent<UnitGateComponent>();
-                if (unitGateComponent.IsDisconnect)
-                {
-                    continue;
-                }
                 SendActor(unitGateComponent.GateSessionActorId, message);
             }
         }

+ 66 - 0
Server/Hotfix/Demo/Move/MoveHelper.cs

@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET
+{
+    public static class MoveHelper
+    {
+        // 可以多次调用,多次调用的话会取消上一次的协程
+        public static async ETTask FindPathMoveToAsync(this Unit unit, Vector3 target, ETCancellationToken cancellationToken = null)
+        {
+            float speed = unit.GetComponent<NumericComponent>().GetAsFloat(NumericType.Speed);
+            if (speed < 0.001)
+            {
+                unit.SendStop(-1);
+                return;
+            }
+            
+            using (var list = ListComponent<Vector3>.Create())
+            {
+                unit.Domain.GetComponent<RecastPathComponent>().SearchPath(10001, unit.Position, target, list.List);
+
+                List<Vector3> path = list.List;
+                if (path.Count < 2)
+                {
+                    unit.SendStop(-2);
+                    return;
+                }
+                
+                // 广播寻路路径
+                M2C_PathfindingResult m2CPathfindingResult = new M2C_PathfindingResult();
+                m2CPathfindingResult.Id = unit.Id;
+                for (int i = 0; i < list.List.Count; ++i)
+                {
+                    Vector3 vector3 = list.List[i];
+                    m2CPathfindingResult.Xs.Add(vector3.x);
+                    m2CPathfindingResult.Ys.Add(vector3.y);
+                    m2CPathfindingResult.Zs.Add(vector3.z);
+                }
+                MessageHelper.Broadcast(unit, m2CPathfindingResult);
+
+                bool ret = await unit.GetComponent<MoveComponent>().MoveToAsync(path, speed);
+                if (ret) // 如果返回false,说明被其它移动取消了,这时候不需要通知客户端stop
+                {
+                    unit.SendStop(0);
+                }
+            }
+        }
+
+        public static void SendStop(this Unit unit, int error)
+        {
+            MessageHelper.Broadcast(unit, new M2C_Stop()
+            {
+                Error = error,
+                Id = unit.Id, 
+                X = unit.Position.x,
+                Y = unit.Position.y,
+                Z = unit.Position.z,
+						
+                A = unit.Rotation.x,
+                B = unit.Rotation.y,
+                C = unit.Rotation.z,
+                W = unit.Rotation.w,
+            });
+        }
+    }
+}

+ 13 - 0
Server/Hotfix/Demo/Move/PathFindHelper.cs

@@ -0,0 +1,13 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET
+{
+    public static class PathFindHelper
+    {
+        public static void PathFind(int mapId, Vector3 from, Vector3 to, List<Vector3> result)
+        {
+            
+        }
+    }
+}

+ 1 - 1
Server/Hotfix/Demo/Scene/SceneFactory.cs

@@ -32,7 +32,7 @@ namespace ET
                     break;
                 case SceneType.Map:
                     scene.AddComponent<UnitComponent>();
-                    //scene.AddComponent<RecastPathComponent>();
+                    scene.AddComponent<RecastPathComponent>();
                     break;
                 case SceneType.Location:
                     scene.AddComponent<LocationComponent>();

+ 24 - 0
Server/Hotfix/Demo/Unit/UnitHelper.cs

@@ -0,0 +1,24 @@
+namespace ET
+{
+    public static class UnitHelper
+    {
+        public static UnitInfo CreateUnitInfo(Unit unit)
+        {
+            UnitInfo unitInfo = new UnitInfo();
+            NumericComponent nc = unit.GetComponent<NumericComponent>();
+            unitInfo.X = unit.Position.x;
+            unitInfo.Y = unit.Position.y;
+            unitInfo.Z = unit.Position.z;
+            unitInfo.UnitId = unit.Id;
+            unitInfo.ConfigId = unit.ConfigId;
+
+            foreach ((int key, long value) in nc.NumericDic)
+            {
+                unitInfo.Ks.Add(key);
+                unitInfo.Vs.Add(value);
+            }
+
+            return unitInfo;
+        }
+    }
+}

+ 0 - 80
Server/Hotfix/Demo/Unit/UnitPathComponentSystem.cs

@@ -1,80 +0,0 @@
-using System.Collections.Generic;
-using System.Threading;
-using UnityEngine;
-
-namespace ET
-{
-    public static class UnitPathComponentHelper
-    {
-        public static async ETTask MoveAsync(this UnitPathComponent self, List<Vector3> path)
-        {
-            if (path.Count == 0)
-            {
-                return;
-            }
-            // 第一个点是unit的当前位置,所以不用发送
-            for (int i = 1; i < path.Count; ++i)
-            {
-                // 每移动3个点发送下3个点给客户端
-                if (i % 3 == 1)
-                {
-                    self.BroadcastPath(path, i, 3);
-                }
-                Vector3 v3 = path[i];
-                await self.Parent.GetComponent<MoveComponent>().MoveToAsync(v3, self.CancellationToken);
-            }
-            await ETTask.CompletedTask;
-        }
-        
-        public static async ETVoid MoveTo(this UnitPathComponent self, Vector3 target)
-        {
-            if ((self.Target - target).magnitude < 0.1f)
-            {
-                return;
-            }
-
-            self.Target = target;
-
-            Unit unit = self.GetParent<Unit>();
-
-            RecastPathComponent recastPathComponent = self.Domain.GetComponent<RecastPathComponent>();
-            RecastPath recastPath = EntityFactory.Create<RecastPath>((Entity)self.Domain);
-            recastPath.StartPos = unit.Position;
-            recastPath.EndPos = new Vector3(target.x, target.y, target.z);
-            self.RecastPath = recastPath;
-            //TODO 因为目前阶段只有一张地图,所以默认mapId为10001
-            recastPathComponent.SearchPath(10001, self.RecastPath);
-            //Log.Debug($"------start Pos: {self.RecastPath.StartPos}\n------end Pos: {self.RecastPath.EndPos}\n------find result: {self.RecastPath.Results.ListToString()}");
-
-            self.CancellationToken?.Cancel();
-            self.CancellationToken = new ETCancellationToken();
-            await self.MoveAsync(self.RecastPath.Results);
-            self.CancellationToken = null;
-        }
-
-        // 从index找接下来3个点,广播
-        public static void BroadcastPath(this UnitPathComponent self, List<Vector3> path, int index, int offset)
-        {
-            Unit unit = self.GetParent<Unit>();
-            Vector3 unitPos = unit.Position;
-            M2C_PathfindingResult m2CPathfindingResult = new M2C_PathfindingResult();
-            m2CPathfindingResult.X = unitPos.x;
-            m2CPathfindingResult.Y = unitPos.y;
-            m2CPathfindingResult.Z = unitPos.z;
-            m2CPathfindingResult.Id = unit.Id;
-
-            for (int i = 0; i < offset; ++i)
-            {
-                if (index + i >= self.RecastPath.Results.Count)
-                {
-                    break;
-                }
-                Vector3 v = self.RecastPath.Results[index + i];
-                m2CPathfindingResult.Xs.Add(v.x);
-                m2CPathfindingResult.Ys.Add(v.y);
-                m2CPathfindingResult.Zs.Add(v.z);
-            }
-            MessageHelper.Broadcast(self.GetParent<Unit>(), m2CPathfindingResult) ;
-        }
-    }
-}

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

@@ -20,6 +20,9 @@
   </PropertyGroup>
   <ItemGroup>
     <Compile Remove="Other\**" />
+    <Compile Include="..\..\Unity\Assets\Hotfix\Demo\Move\MoveComponentSystem.cs">
+      <Link>Demo\Move\MoveComponentSystem.cs</Link>
+    </Compile>
     <Compile Include="..\..\Unity\Assets\Hotfix\Module\Config\ConfigComponentSystem.cs">
       <Link>Module\Config\ConfigComponentSystem.cs</Link>
     </Compile>

+ 10 - 0
Server/Model/Demo/EventType.cs

@@ -15,5 +15,15 @@
 		{
 			public Unit Unit;
 		}
+
+		public struct MoveStart
+		{
+			public Unit Unit;
+		}
+
+		public struct MoveStop
+		{
+			public Unit Unit;
+		}
 	}
 }

+ 3 - 2
Server/Model/Demo/RecastNav/RecastPathComponent.cs

@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using ET;
+using UnityEngine;
 
 namespace ET
 {
@@ -39,9 +40,9 @@ namespace ET
         /// <summary>
         /// 寻路
         /// </summary>
-        public void SearchPath(int mapId, RecastPath recastPath)
+        public void SearchPath(int mapId, Vector3 from, Vector3 to, List<Vector3> result)
         {
-            GetRecastPathProcessor(mapId).CalculatePath(recastPath);
+            GetRecastPathProcessor(mapId).CalculatePath(from, to, result);
         }
 
         public RecastPathProcessor GetRecastPathProcessor(int mapId)

+ 3 - 3
Server/Model/Demo/RecastNav/RecastPathProcessor.cs

@@ -36,9 +36,9 @@ namespace ET
         /// </summary>
         public int MapId;
 
-        public void CalculatePath(RecastPath recastPath)
+        public void CalculatePath(Vector3 from, Vector3 to, List<Vector3> result)
         {
-            if (RecastInterface.FindPath(this.MapId, recastPath.StartPos, recastPath.EndPos))
+            if (RecastInterface.FindPath(this.MapId, from, to))
             {
                 RecastInterface.Smooth(this.MapId, 2f, 0.5f);
                 {
@@ -47,7 +47,7 @@ namespace ET
                     for (int i = 0; i < smoothCount; ++i)
                     {
                         Vector3 node = new Vector3(smooths[i * 3], smooths[i * 3 + 1], smooths[i * 3 + 2]);
-                        recastPath.Results.Add(node);
+                        result.Add(node);
                     }
                 }
             }

+ 0 - 93
Server/Model/Demo/Unit/MoveComponent.cs

@@ -1,93 +0,0 @@
-using System;
-using System.Threading;
-using UnityEngine;
-
-namespace ET
-{
-    public class MoveComponent: Entity
-    {
-        public Vector3 Target;
-
-        // 开启移动协程的时间
-        public long StartTime;
-
-        // 开启移动协程的Unit的位置
-        public Vector3 StartPos;
-
-        public long needTime;
-
-        // 当前的移动速度
-        public float Speed = 5;
-        
-        // 开启协程移动,每100毫秒移动一次,并且协程取消的时候会计算玩家真实移动
-        // 比方说玩家移动了2500毫秒,玩家有新的目标,这时旧的移动协程结束,将计算250毫秒移动的位置,而不是300毫秒移动的位置
-        public async ETTask StartMove(ETCancellationToken cancellationToken)
-        {
-            Unit unit = this.GetParent<Unit>();
-            this.StartPos = unit.Position;
-            this.StartTime = TimeHelper.ClientNow();
-            float distance = (this.Target - this.StartPos).magnitude;
-            if (Math.Abs(distance) < 0.1f)
-            {
-                return;
-            }
-            
-            this.needTime = (long)(distance / this.Speed * 1000);
-            
-            // 协程如果取消,将算出玩家的真实位置,赋值给玩家
-            cancellationToken?.Add(() =>
-            {
-                long timeNow = TimeHelper.ClientNow();
-                if (timeNow - this.StartTime >= this.needTime)
-                {
-                    unit.Position = this.Target;
-                }
-                else
-                {
-                    float amount = (timeNow - this.StartTime) * 1f / this.needTime;
-                    unit.Position = Vector3.Lerp(this.StartPos, this.Target, amount);
-                }
-            });
-
-            while (true)
-            {
-                //新版TimerComponent实现不同于5.0的TimerComponent,需要自己判断是取消还是自然结束,并且return,否则将不会取消任务,并可能会造成cancellationToken泄漏
-                if (!await TimerComponent.Instance.WaitAsync(50, cancellationToken))
-                {
-                    return;
-                }
-                
-                long timeNow = TimeHelper.ClientNow();
-                
-                if (timeNow - this.StartTime >= this.needTime)
-                {
-                    unit.Position = this.Target;
-                    break;
-                }
-
-                float amount = (timeNow - this.StartTime) * 1f / this.needTime;
-                unit.Position = Vector3.Lerp(this.StartPos, this.Target, amount);
-            }
-        }
-        
-        public async ETTask MoveToAsync(Vector3 target, ETCancellationToken cancellationToken)
-        {
-            // 新目标点离旧目标点太近,不设置新的
-            if ((target - this.Target).sqrMagnitude < 0.01f)
-            {
-                return;
-            }
-
-            // 距离当前位置太近
-            if ((this.GetParent<Unit>().Position - target).sqrMagnitude < 0.01f)
-            {
-                return;
-            }
-            
-            this.Target = target;
-            
-            // 开启协程移动
-            await StartMove(cancellationToken);
-        }
-    }
-}

+ 0 - 2
Server/Model/Demo/Unit/UnitGateComponent.cs

@@ -12,8 +12,6 @@
 	{
 		public long GateSessionActorId;
 
-		public bool IsDisconnect;
-
 		public void Awake(long gateSessionId)
 		{
 			this.GateSessionActorId = gateSessionId;

+ 0 - 27
Server/Model/Demo/Unit/UnitPathComponent.cs

@@ -1,27 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-    public class UnitPathComponent: Entity
-    {
-        public Vector3 Target;
-
-        private RecastPath recastPath;
-
-        public ETCancellationToken CancellationToken;
-
-        public RecastPath RecastPath
-        {
-            get
-            {
-                return this.recastPath;
-            }
-            set
-            {
-                if (recastPath != null)
-                    recastPath.Dispose();
-                this.recastPath = value;
-            }
-        }
-    }
-}

+ 23 - 23
Server/Model/Generate/Message/InnerMessage.cs

@@ -9,7 +9,7 @@ namespace ET
 	[ResponseType(typeof(M2M_TrasferUnitResponse))]
 	[Message(InnerOpcode.M2M_TrasferUnitRequest)]
 	[ProtoContract]
-	public partial class M2M_TrasferUnitRequest: IActorRequest
+	public partial class M2M_TrasferUnitRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -24,7 +24,7 @@ namespace ET
 
 	[Message(InnerOpcode.M2M_TrasferUnitResponse)]
 	[ProtoContract]
-	public partial class M2M_TrasferUnitResponse: IActorResponse
+	public partial class M2M_TrasferUnitResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -43,7 +43,7 @@ namespace ET
 	[ResponseType(typeof(A2M_Reload))]
 	[Message(InnerOpcode.M2A_Reload)]
 	[ProtoContract]
-	public partial class M2A_Reload: IActorRequest
+	public partial class M2A_Reload: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -55,7 +55,7 @@ namespace ET
 
 	[Message(InnerOpcode.A2M_Reload)]
 	[ProtoContract]
-	public partial class A2M_Reload: IActorResponse
+	public partial class A2M_Reload: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -71,7 +71,7 @@ namespace ET
 	[ResponseType(typeof(G2G_LockResponse))]
 	[Message(InnerOpcode.G2G_LockRequest)]
 	[ProtoContract]
-	public partial class G2G_LockRequest: IActorRequest
+	public partial class G2G_LockRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -89,7 +89,7 @@ namespace ET
 
 	[Message(InnerOpcode.G2G_LockResponse)]
 	[ProtoContract]
-	public partial class G2G_LockResponse: IActorResponse
+	public partial class G2G_LockResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -105,7 +105,7 @@ namespace ET
 	[ResponseType(typeof(G2G_LockReleaseResponse))]
 	[Message(InnerOpcode.G2G_LockReleaseRequest)]
 	[ProtoContract]
-	public partial class G2G_LockReleaseRequest: IActorRequest
+	public partial class G2G_LockReleaseRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -123,7 +123,7 @@ namespace ET
 
 	[Message(InnerOpcode.G2G_LockReleaseResponse)]
 	[ProtoContract]
-	public partial class G2G_LockReleaseResponse: IActorResponse
+	public partial class G2G_LockReleaseResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -139,7 +139,7 @@ namespace ET
 	[ResponseType(typeof(ObjectAddResponse))]
 	[Message(InnerOpcode.ObjectAddRequest)]
 	[ProtoContract]
-	public partial class ObjectAddRequest: IActorRequest
+	public partial class ObjectAddRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -157,7 +157,7 @@ namespace ET
 
 	[Message(InnerOpcode.ObjectAddResponse)]
 	[ProtoContract]
-	public partial class ObjectAddResponse: IActorResponse
+	public partial class ObjectAddResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -173,7 +173,7 @@ namespace ET
 	[ResponseType(typeof(ObjectLockResponse))]
 	[Message(InnerOpcode.ObjectLockRequest)]
 	[ProtoContract]
-	public partial class ObjectLockRequest: IActorRequest
+	public partial class ObjectLockRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -194,7 +194,7 @@ namespace ET
 
 	[Message(InnerOpcode.ObjectLockResponse)]
 	[ProtoContract]
-	public partial class ObjectLockResponse: IActorResponse
+	public partial class ObjectLockResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -210,7 +210,7 @@ namespace ET
 	[ResponseType(typeof(ObjectUnLockResponse))]
 	[Message(InnerOpcode.ObjectUnLockRequest)]
 	[ProtoContract]
-	public partial class ObjectUnLockRequest: IActorRequest
+	public partial class ObjectUnLockRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -231,7 +231,7 @@ namespace ET
 
 	[Message(InnerOpcode.ObjectUnLockResponse)]
 	[ProtoContract]
-	public partial class ObjectUnLockResponse: IActorResponse
+	public partial class ObjectUnLockResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -247,7 +247,7 @@ namespace ET
 	[ResponseType(typeof(ObjectRemoveResponse))]
 	[Message(InnerOpcode.ObjectRemoveRequest)]
 	[ProtoContract]
-	public partial class ObjectRemoveRequest: IActorRequest
+	public partial class ObjectRemoveRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -262,7 +262,7 @@ namespace ET
 
 	[Message(InnerOpcode.ObjectRemoveResponse)]
 	[ProtoContract]
-	public partial class ObjectRemoveResponse: IActorResponse
+	public partial class ObjectRemoveResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -278,7 +278,7 @@ namespace ET
 	[ResponseType(typeof(ObjectGetResponse))]
 	[Message(InnerOpcode.ObjectGetRequest)]
 	[ProtoContract]
-	public partial class ObjectGetRequest: IActorRequest
+	public partial class ObjectGetRequest: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -293,7 +293,7 @@ namespace ET
 
 	[Message(InnerOpcode.ObjectGetResponse)]
 	[ProtoContract]
-	public partial class ObjectGetResponse: IActorResponse
+	public partial class ObjectGetResponse: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -312,7 +312,7 @@ namespace ET
 	[ResponseType(typeof(G2R_GetLoginKey))]
 	[Message(InnerOpcode.R2G_GetLoginKey)]
 	[ProtoContract]
-	public partial class R2G_GetLoginKey: IActorRequest
+	public partial class R2G_GetLoginKey: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -327,7 +327,7 @@ namespace ET
 
 	[Message(InnerOpcode.G2R_GetLoginKey)]
 	[ProtoContract]
-	public partial class G2R_GetLoginKey: IActorResponse
+	public partial class G2R_GetLoginKey: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -349,7 +349,7 @@ namespace ET
 	[ResponseType(typeof(M2G_CreateUnit))]
 	[Message(InnerOpcode.G2M_CreateUnit)]
 	[ProtoContract]
-	public partial class G2M_CreateUnit: IActorRequest
+	public partial class G2M_CreateUnit: Object, IActorRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -367,7 +367,7 @@ namespace ET
 
 	[Message(InnerOpcode.M2G_CreateUnit)]
 	[ProtoContract]
-	public partial class M2G_CreateUnit: IActorResponse
+	public partial class M2G_CreateUnit: Object, IActorResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -392,7 +392,7 @@ namespace ET
 
 	[Message(InnerOpcode.G2M_SessionDisconnect)]
 	[ProtoContract]
-	public partial class G2M_SessionDisconnect: IActorLocationMessage
+	public partial class G2M_SessionDisconnect: Object, IActorLocationMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }

+ 65 - 26
Server/Model/Generate/Message/OuterMessage.cs

@@ -6,7 +6,7 @@ namespace ET
 	[ResponseType(typeof(M2C_TestResponse))]
 	[Message(OuterOpcode.C2M_TestRequest)]
 	[ProtoContract]
-	public partial class C2M_TestRequest: IActorLocationRequest
+	public partial class C2M_TestRequest: Object, IActorLocationRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -21,7 +21,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_TestResponse)]
 	[ProtoContract]
-	public partial class M2C_TestResponse: IActorLocationResponse
+	public partial class M2C_TestResponse: Object, IActorLocationResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -40,7 +40,7 @@ namespace ET
 	[ResponseType(typeof(Actor_TransferResponse))]
 	[Message(OuterOpcode.Actor_TransferRequest)]
 	[ProtoContract]
-	public partial class Actor_TransferRequest: IActorLocationRequest
+	public partial class Actor_TransferRequest: Object, IActorLocationRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -55,7 +55,7 @@ namespace ET
 
 	[Message(OuterOpcode.Actor_TransferResponse)]
 	[ProtoContract]
-	public partial class Actor_TransferResponse: IActorLocationResponse
+	public partial class Actor_TransferResponse: Object, IActorLocationResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -71,7 +71,7 @@ namespace ET
 	[ResponseType(typeof(G2C_EnterMap))]
 	[Message(OuterOpcode.C2G_EnterMap)]
 	[ProtoContract]
-	public partial class C2G_EnterMap: IRequest
+	public partial class C2G_EnterMap: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -80,7 +80,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_EnterMap)]
 	[ProtoContract]
-	public partial class G2C_EnterMap: IResponse
+	public partial class G2C_EnterMap: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -105,7 +105,7 @@ namespace ET
 
 	[Message(OuterOpcode.UnitInfo)]
 	[ProtoContract]
-	public partial class UnitInfo
+	public partial class UnitInfo: Object
 	{
 		[ProtoMember(1)]
 		public long UnitId { get; set; }
@@ -122,11 +122,17 @@ namespace ET
 		[ProtoMember(5)]
 		public float Z { get; set; }
 
+		[ProtoMember(6)]
+		public List<int> Ks = new List<int>();
+
+		[ProtoMember(7)]
+		public List<long> Vs = new List<long>();
+
 	}
 
 	[Message(OuterOpcode.M2C_CreateUnits)]
 	[ProtoContract]
-	public partial class M2C_CreateUnits: IActorMessage
+	public partial class M2C_CreateUnits: Object, IActorMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -139,9 +145,9 @@ namespace ET
 
 	}
 
-	[Message(OuterOpcode.Frame_ClickMap)]
+	[Message(OuterOpcode.C2M_PathfindingResult)]
 	[ProtoContract]
-	public partial class Frame_ClickMap: IActorLocationMessage
+	public partial class C2M_PathfindingResult: Object, IActorLocationMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -165,7 +171,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_PathfindingResult)]
 	[ProtoContract]
-	public partial class M2C_PathfindingResult: IActorMessage
+	public partial class M2C_PathfindingResult: Object, IActorMessage
 	{
 		[ProtoMember(93)]
 		public long ActorId { get; set; }
@@ -193,10 +199,43 @@ namespace ET
 
 	}
 
+	[Message(OuterOpcode.M2C_Stop)]
+	[ProtoContract]
+	public partial class M2C_Stop: Object, IActorMessage
+	{
+		[ProtoMember(1)]
+		public int Error { get; set; }
+
+		[ProtoMember(2)]
+		public long Id { get; set; }
+
+		[ProtoMember(3)]
+		public float X { get; set; }
+
+		[ProtoMember(4)]
+		public float Y { get; set; }
+
+		[ProtoMember(5)]
+		public float Z { get; set; }
+
+		[ProtoMember(6)]
+		public float A { get; set; }
+
+		[ProtoMember(7)]
+		public float B { get; set; }
+
+		[ProtoMember(8)]
+		public float C { get; set; }
+
+		[ProtoMember(9)]
+		public float W { get; set; }
+
+	}
+
 	[ResponseType(typeof(G2C_Ping))]
 	[Message(OuterOpcode.C2G_Ping)]
 	[ProtoContract]
-	public partial class C2G_Ping: IRequest
+	public partial class C2G_Ping: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -205,7 +244,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_Ping)]
 	[ProtoContract]
-	public partial class G2C_Ping: IResponse
+	public partial class G2C_Ping: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -223,14 +262,14 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_Test)]
 	[ProtoContract]
-	public partial class G2C_Test: IMessage
+	public partial class G2C_Test: Object, IMessage
 	{
 	}
 
 	[ResponseType(typeof(M2C_Reload))]
 	[Message(OuterOpcode.C2M_Reload)]
 	[ProtoContract]
-	public partial class C2M_Reload: IRequest
+	public partial class C2M_Reload: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -245,7 +284,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_Reload)]
 	[ProtoContract]
-	public partial class M2C_Reload: IResponse
+	public partial class M2C_Reload: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -261,7 +300,7 @@ namespace ET
 	[ResponseType(typeof(R2C_Login))]
 	[Message(OuterOpcode.C2R_Login)]
 	[ProtoContract]
-	public partial class C2R_Login: IRequest
+	public partial class C2R_Login: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -276,7 +315,7 @@ namespace ET
 
 	[Message(OuterOpcode.R2C_Login)]
 	[ProtoContract]
-	public partial class R2C_Login: IResponse
+	public partial class R2C_Login: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -301,7 +340,7 @@ namespace ET
 	[ResponseType(typeof(G2C_LoginGate))]
 	[Message(OuterOpcode.C2G_LoginGate)]
 	[ProtoContract]
-	public partial class C2G_LoginGate: IRequest
+	public partial class C2G_LoginGate: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -316,7 +355,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_LoginGate)]
 	[ProtoContract]
-	public partial class G2C_LoginGate: IResponse
+	public partial class G2C_LoginGate: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -334,7 +373,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_TestHotfixMessage)]
 	[ProtoContract]
-	public partial class G2C_TestHotfixMessage: IMessage
+	public partial class G2C_TestHotfixMessage: Object, IMessage
 	{
 		[ProtoMember(1)]
 		public string Info { get; set; }
@@ -344,7 +383,7 @@ namespace ET
 	[ResponseType(typeof(M2C_TestActorResponse))]
 	[Message(OuterOpcode.C2M_TestActorRequest)]
 	[ProtoContract]
-	public partial class C2M_TestActorRequest: IActorLocationRequest
+	public partial class C2M_TestActorRequest: Object, IActorLocationRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -359,7 +398,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_TestActorResponse)]
 	[ProtoContract]
-	public partial class M2C_TestActorResponse: IActorLocationResponse
+	public partial class M2C_TestActorResponse: Object, IActorLocationResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -377,7 +416,7 @@ namespace ET
 
 	[Message(OuterOpcode.PlayerInfo)]
 	[ProtoContract]
-	public partial class PlayerInfo: IMessage
+	public partial class PlayerInfo: Object, IMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -387,7 +426,7 @@ namespace ET
 	[ResponseType(typeof(G2C_PlayerInfo))]
 	[Message(OuterOpcode.C2G_PlayerInfo)]
 	[ProtoContract]
-	public partial class C2G_PlayerInfo: IRequest
+	public partial class C2G_PlayerInfo: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -396,7 +435,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_PlayerInfo)]
 	[ProtoContract]
-	public partial class G2C_PlayerInfo: IResponse
+	public partial class G2C_PlayerInfo: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }

+ 17 - 16
Server/Model/Generate/Message/OuterOpcode.cs

@@ -10,22 +10,23 @@ namespace ET
 		 public const ushort G2C_EnterMap = 20006;
 		 public const ushort UnitInfo = 20007;
 		 public const ushort M2C_CreateUnits = 20008;
-		 public const ushort Frame_ClickMap = 20009;
+		 public const ushort C2M_PathfindingResult = 20009;
 		 public const ushort M2C_PathfindingResult = 20010;
-		 public const ushort C2G_Ping = 20011;
-		 public const ushort G2C_Ping = 20012;
-		 public const ushort G2C_Test = 20013;
-		 public const ushort C2M_Reload = 20014;
-		 public const ushort M2C_Reload = 20015;
-		 public const ushort C2R_Login = 20016;
-		 public const ushort R2C_Login = 20017;
-		 public const ushort C2G_LoginGate = 20018;
-		 public const ushort G2C_LoginGate = 20019;
-		 public const ushort G2C_TestHotfixMessage = 20020;
-		 public const ushort C2M_TestActorRequest = 20021;
-		 public const ushort M2C_TestActorResponse = 20022;
-		 public const ushort PlayerInfo = 20023;
-		 public const ushort C2G_PlayerInfo = 20024;
-		 public const ushort G2C_PlayerInfo = 20025;
+		 public const ushort M2C_Stop = 20011;
+		 public const ushort C2G_Ping = 20012;
+		 public const ushort G2C_Ping = 20013;
+		 public const ushort G2C_Test = 20014;
+		 public const ushort C2M_Reload = 20015;
+		 public const ushort M2C_Reload = 20016;
+		 public const ushort C2R_Login = 20017;
+		 public const ushort R2C_Login = 20018;
+		 public const ushort C2G_LoginGate = 20019;
+		 public const ushort G2C_LoginGate = 20020;
+		 public const ushort G2C_TestHotfixMessage = 20021;
+		 public const ushort C2M_TestActorRequest = 20022;
+		 public const ushort M2C_TestActorResponse = 20023;
+		 public const ushort PlayerInfo = 20024;
+		 public const ushort C2G_PlayerInfo = 20025;
+		 public const ushort G2C_PlayerInfo = 20026;
 	}
 }

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

@@ -30,6 +30,10 @@
       <Link>Core\%(RecursiveDir)%(FileName)%(Extension)</Link>
     </Compile>
 
+    <Compile Include="..\..\Unity\Assets\Model\Demo\Move\MoveComponent.cs">
+      <Link>Demo\Move\MoveComponent.cs</Link>
+    </Compile>
+
     <Compile Include="..\..\Unity\Assets\Model\Module\Config\**\*.cs">
       <Link>Module\Config\%(RecursiveDir)%(FileName)%(Extension)</Link>
     </Compile>

+ 0 - 162
Server/Server.sln

@@ -1,162 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.27130.2010
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.App", "App\Server.App.csproj", "{11464C2C-E0B6-476E-ABB1-87445E736B76}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.Hotfix", "Hotfix\Server.Hotfix.csproj", "{E383A68D-1928-46F4-8896-4E99DF331476}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.Model", "Model\Server.Model.csproj", "{85CB09B5-6392-4A13-BAF8-025218BFF496}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{5D11E730-0CAA-4A47-BA1A-379004F0F6D9}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Google.Protobuf", "ThirdParty\Google.Protobuf\Google.Protobuf.csproj", "{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KcpLib", "ThirdParty\KcpLib\KcpLib.csproj", "{2B432E70-FA05-4D99-8241-237B0E4F5D84}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Bson", "ThirdParty\MongoDBDriver\MongoDB.Bson\MongoDB.Bson.csproj", "{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MongoDBDriver", "MongoDBDriver", "{BEC42614-36FF-4E7C-BB7D-FDBB59485C06}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Driver", "ThirdParty\MongoDBDriver\MongoDB.Driver\MongoDB.Driver.csproj", "{5EA0C606-F612-4975-95B9-A20D2BFB16F7}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Driver.Core", "ThirdParty\MongoDBDriver\MongoDB.Driver.Core\MongoDB.Driver.Core.csproj", "{E10D4180-6C14-4EBE-83EA-29FFE64D321C}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Driver.GridFS", "ThirdParty\MongoDBDriver\MongoDB.Driver.GridFS\MongoDB.Driver.GridFS.csproj", "{0C335BFA-033C-4C85-B76A-B96065CB69D3}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Debug|x64 = Debug|x64
-		Debug|x86 = Debug|x86
-		Release|Any CPU = Release|Any CPU
-		Release|x64 = Release|x64
-		Release|x86 = Release|x86
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Debug|x64.Build.0 = Debug|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Debug|x86.Build.0 = Debug|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Release|Any CPU.Build.0 = Release|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Release|x64.ActiveCfg = Release|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Release|x64.Build.0 = Release|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Release|x86.ActiveCfg = Release|Any CPU
-		{11464C2C-E0B6-476E-ABB1-87445E736B76}.Release|x86.Build.0 = Release|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Debug|x64.Build.0 = Debug|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Debug|x86.Build.0 = Debug|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Release|Any CPU.Build.0 = Release|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Release|x64.ActiveCfg = Release|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Release|x64.Build.0 = Release|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Release|x86.ActiveCfg = Release|Any CPU
-		{E383A68D-1928-46F4-8896-4E99DF331476}.Release|x86.Build.0 = Release|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Debug|x64.Build.0 = Debug|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Debug|x86.Build.0 = Debug|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Release|Any CPU.Build.0 = Release|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Release|x64.ActiveCfg = Release|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Release|x64.Build.0 = Release|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Release|x86.ActiveCfg = Release|Any CPU
-		{85CB09B5-6392-4A13-BAF8-025218BFF496}.Release|x86.Build.0 = Release|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Debug|x64.Build.0 = Debug|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Debug|x86.Build.0 = Debug|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Release|Any CPU.Build.0 = Release|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Release|x64.ActiveCfg = Release|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Release|x64.Build.0 = Release|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Release|x86.ActiveCfg = Release|Any CPU
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE}.Release|x86.Build.0 = Release|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Debug|x64.Build.0 = Debug|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Debug|x86.Build.0 = Debug|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Release|Any CPU.Build.0 = Release|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Release|x64.ActiveCfg = Release|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Release|x64.Build.0 = Release|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Release|x86.ActiveCfg = Release|Any CPU
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84}.Release|x86.Build.0 = Release|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Debug|x64.Build.0 = Debug|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Debug|x86.Build.0 = Debug|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Release|Any CPU.Build.0 = Release|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Release|x64.ActiveCfg = Release|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Release|x64.Build.0 = Release|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Release|x86.ActiveCfg = Release|Any CPU
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7}.Release|x86.Build.0 = Release|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Debug|x64.Build.0 = Debug|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Debug|x86.Build.0 = Debug|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Release|Any CPU.Build.0 = Release|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Release|x64.ActiveCfg = Release|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Release|x64.Build.0 = Release|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Release|x86.ActiveCfg = Release|Any CPU
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7}.Release|x86.Build.0 = Release|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Debug|x64.Build.0 = Debug|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Debug|x86.Build.0 = Debug|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Release|Any CPU.Build.0 = Release|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Release|x64.ActiveCfg = Release|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Release|x64.Build.0 = Release|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Release|x86.ActiveCfg = Release|Any CPU
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C}.Release|x86.Build.0 = Release|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Debug|x64.Build.0 = Debug|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Debug|x86.Build.0 = Debug|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Release|Any CPU.Build.0 = Release|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Release|x64.ActiveCfg = Release|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Release|x64.Build.0 = Release|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Release|x86.ActiveCfg = Release|Any CPU
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3}.Release|x86.Build.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(NestedProjects) = preSolution
-		{02B4D7EC-AC40-4675-963E-53CAB9A86BDE} = {5D11E730-0CAA-4A47-BA1A-379004F0F6D9}
-		{2B432E70-FA05-4D99-8241-237B0E4F5D84} = {5D11E730-0CAA-4A47-BA1A-379004F0F6D9}
-		{BEC42614-36FF-4E7C-BB7D-FDBB59485C06} = {5D11E730-0CAA-4A47-BA1A-379004F0F6D9}
-		{78F97DF3-2E7F-4FB5-801D-E9CC4FB859F7} = {BEC42614-36FF-4E7C-BB7D-FDBB59485C06}
-		{5EA0C606-F612-4975-95B9-A20D2BFB16F7} = {BEC42614-36FF-4E7C-BB7D-FDBB59485C06}
-		{E10D4180-6C14-4EBE-83EA-29FFE64D321C} = {BEC42614-36FF-4E7C-BB7D-FDBB59485C06}
-		{0C335BFA-033C-4C85-B76A-B96065CB69D3} = {BEC42614-36FF-4E7C-BB7D-FDBB59485C06}
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {EE120158-643A-409C-B8F2-5E654E4D6D70}
-	EndGlobalSection
-EndGlobal

+ 3 - 3
Tools/Proto2CS/Program.cs

@@ -104,14 +104,14 @@ namespace ET
 
                     sb.Append($"\t[Message({opcodeClassName}.{msgName})]\n");
                     sb.Append($"\t[ProtoContract]\n");
-                    sb.Append($"\tpublic partial class {msgName}");
+                    sb.Append($"\tpublic partial class {msgName}: Object");
                     if (parentClass == "IActorMessage" || parentClass == "IActorRequest" || parentClass == "IActorResponse")
                     {
-                        sb.Append($": {parentClass}\n");
+                        sb.Append($", {parentClass}\n");
                     }
                     else if (parentClass != "")
                     {
-                        sb.Append($": {parentClass}\n");
+                        sb.Append($", {parentClass}\n");
                     }
                     else
                     {

+ 12 - 4
Unity/Assets/Hotfix/Demo/Move/M2C_PathfindingResultHandler.cs

@@ -1,4 +1,6 @@
-namespace ET
+using UnityEngine;
+
+namespace ET
 {
 	[MessageHandler]
 	public class M2C_PathfindingResultHandler : AMHandler<M2C_PathfindingResult>
@@ -6,11 +8,17 @@
 		protected override async ETVoid Run(Session session, M2C_PathfindingResult message)
 		{
 			Unit unit = session.Domain.GetComponent<UnitComponent>().Get(message.Id);
-			UnitPathComponent unitPathComponent = unit.GetComponent<UnitPathComponent>();
 
-			unitPathComponent.StartMove(message).Coroutine();
+			float speed = unit.GetComponent<NumericComponent>().GetAsFloat(NumericType.Speed);
+
+			using var list = ListComponent<Vector3>.Create();
+			
+			for (int i = 0; i < message.Xs.Count; ++i)
+			{
+				list.List.Add(new Vector3(message.Xs[i], message.Ys[i], message.Zs[i]));
+			}
 
-			await ETTask.CompletedTask;
+			await unit.GetComponent<MoveComponent>().MoveToAsync(list.List, speed);
 		}
 	}
 }

+ 28 - 0
Unity/Assets/Hotfix/Demo/Move/M2C_StopHandler.cs

@@ -0,0 +1,28 @@
+using UnityEngine;
+
+namespace ET
+{
+	[MessageHandler]
+	public class M2C_StopHandler : AMHandler<M2C_Stop>
+	{
+		protected override async ETVoid Run(Session session, M2C_Stop message)
+		{
+			Unit unit = session.Domain.GetComponent<UnitComponent>().Get(message.Id);
+			
+			if (unit == null)
+			{
+				return;
+			}
+
+			Vector3 pos = new Vector3(message.X, message.Y, message.Z);
+			Quaternion rotation = new Quaternion(message.A, message.B, message.C, message.W);
+
+			MoveComponent moveComponent = unit.GetComponent<MoveComponent>();
+			moveComponent.Stop();
+			unit.Position = pos;
+			unit.Rotation = rotation;
+			unit.GetComponent<ObjectWait>()?.Notify(new WaitType.Wait_UnitStop() {Error = message.Error});
+			await ETTask.CompletedTask;
+		}
+	}
+}

+ 1 - 1
Unity/Assets/Hotfix/Demo/Unit/TurnComponentSystem.cs.meta → Unity/Assets/Hotfix/Demo/Move/M2C_StopHandler.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: e54b583fd88eb400d8581465f56d92a4
+guid: 89dc72c73f6119944993eb9594f0e180
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 352 - 0
Unity/Assets/Hotfix/Demo/Move/MoveComponentSystem.cs

@@ -0,0 +1,352 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET
+{
+    [ObjectSystem]
+    public class MoveComponentDestroySystem: DestroySystem<MoveComponent>
+    {
+        public override void Destroy(MoveComponent self)
+        {
+            self.Clear();
+        }
+    }
+
+    [ObjectSystem]
+    public class MoveComponentAwakeSystem: AwakeSystem<MoveComponent>
+    {
+        public override void Awake(MoveComponent self)
+        {
+            self.StartTime = 0;
+            self.StartPos = Vector3.zero;
+            self.NeedTime = 0;
+            self.MoveTimer = 0;
+            self.Callback = null;
+            self.Targets.Clear();
+            self.Speed = 0;
+            self.N = 0;
+            self.TurnTime = 0;
+        }
+    }
+
+    public static class MoveComponentSystem
+    {
+        public static bool IsArrived(this MoveComponent self)
+        {
+            return self.Targets.Count == 0;
+        }
+
+        public static bool ChangeSpeed(this MoveComponent self, float speed)
+        {
+            if (self.IsArrived())
+            {
+                return false;
+            }
+
+            if (speed < 0.0001)
+            {
+                return false;
+            }
+            
+            Unit unit = self.GetParent<Unit>();
+            using (ListComponent<Vector3> path = ListComponent<Vector3>.Create())
+            {
+                self.MoveForward(true);
+                
+                path.List.Add(unit.Position); // 第一个是Unit的pos
+                for (int i = self.N; i < self.Targets.Count; ++i)
+                {
+                    path.List.Add(self.Targets[i]);
+                }
+                self.MoveToAsync(path.List, speed).Coroutine();
+            }
+
+            return true;
+        }
+
+        public static async ETTask<bool> MoveToAsync(this MoveComponent self, List<Vector3> target, float speed, int turnTime = 100, ETCancellationToken cancellationToken = null)
+        {
+            self.Stop();
+
+            foreach (Vector3 v in target)
+            {
+                self.Targets.Add(v);
+            }
+
+            self.IsTurnHorizontal = true;
+            self.TurnTime = turnTime;
+            self.Speed = speed;
+            ETTaskCompletionSource<bool> tcs = new ETTaskCompletionSource<bool>();
+            self.Callback = (ret) => { tcs.SetResult(ret); };
+
+            Game.EventSystem.Publish(new EventType.MoveStart(){Unit = self.GetParent<Unit>()}).Coroutine();
+            
+            self.StartMove();
+            
+            void CancelAction()
+            {
+                self.Stop();
+            }
+            
+            bool moveRet;
+            try
+            {
+                cancellationToken?.Add(CancelAction);
+                moveRet = await tcs.Task;
+            }
+            finally
+            {
+                cancellationToken?.Remove(CancelAction);
+            }
+
+            if (moveRet)
+            {
+                Game.EventSystem.Publish(new EventType.MoveStop(){Unit = self.GetParent<Unit>()}).Coroutine();
+            }
+            return moveRet;
+        }
+
+        public static void MoveForward(this MoveComponent self, bool needCancel)
+        {
+            Unit unit = self.GetParent<Unit>();
+            
+            long timeNow = TimeHelper.ClientNow();
+            long moveTime = timeNow - self.StartTime;
+
+            while (true)
+            {
+                if (moveTime <= 0)
+                {
+                    return;
+                }
+                
+                // 计算位置插值
+                if (moveTime >= self.NeedTime)
+                {
+                    unit.Position = self.NextTarget;
+                    if (self.TurnTime > 0)
+                    {
+                        unit.Rotation = self.To;
+                    }
+                }
+                else
+                {
+                    // 计算位置插值
+                    float amount = moveTime * 1f / self.NeedTime;
+                    if (amount > 0)
+                    {
+                        Vector3 newPos = Vector3.Lerp(self.StartPos, self.NextTarget, amount);
+                        unit.Position = newPos;
+                    }
+                    
+                    // 计算方向插值
+                    if (self.TurnTime > 0)
+                    {
+                        amount = moveTime * 1f / self.TurnTime;
+                        Quaternion q = Quaternion.Slerp(self.From, self.To, amount);
+                        unit.Rotation = q;
+                    }
+                }
+
+                moveTime -= self.NeedTime;
+
+                // 表示这个点还没走完,等下一帧再来
+                if (moveTime < 0)
+                {
+                    return;
+                }
+                
+                // 到这里说明这个点已经走完
+                
+                // 如果是最后一个点
+                if (self.N >= self.Targets.Count - 1)
+                {
+                    unit.Position = self.NextTarget;
+                    unit.Rotation = self.To;
+
+                    Action<bool> callback = self.Callback;
+                    self.Callback = null;
+
+                    self.Clear();
+                    callback?.Invoke(!needCancel);
+                    return;
+                }
+
+                self.SetNextTarget();
+            }
+        }
+
+        private static void StartMove(this MoveComponent self)
+        {
+            Unit unit = self.GetParent<Unit>();
+            
+            self.BeginTime = TimeHelper.ClientNow();
+            self.StartTime = self.BeginTime;
+            self.SetNextTarget();
+
+            self.MoveTimer = TimerComponent.Instance.NewFrameTimer(() =>
+                    {
+                        try
+                        {
+                            self.MoveForward(false);
+                        }
+                        catch (Exception e)
+                        {
+                            Log.Error($"move timer error: {unit.Id}\n{e}");
+                        }
+                    }
+            );
+        }
+
+        private static void SetNextTarget(this MoveComponent self)
+        {
+
+            Unit unit = self.GetParent<Unit>();
+
+            ++self.N;
+
+            // 时间计算用服务端的位置, 但是移动要用客户端的位置来插值
+            Vector3 v = self.GetFaceV();
+            float distance = v.magnitude;
+            
+            // 插值的起始点要以unit的真实位置来算
+            self.StartPos = unit.Position;
+
+            self.StartTime += self.NeedTime;
+            
+            self.NeedTime = (long) (distance / self.Speed * 1000);
+
+            
+            if (self.TurnTime > 0)
+            {
+                // 要用unit的位置
+                Vector3 faceV = self.GetFaceV();
+                if (faceV.sqrMagnitude < 0.0001f)
+                {
+                    return;
+                }
+                self.From = unit.Rotation;
+                
+                if (self.IsTurnHorizontal)
+                {
+                    faceV.y = 0;
+                }
+
+                if (Math.Abs(faceV.x) > 0.01 || Math.Abs(faceV.z) > 0.01)
+                {
+                    self.To = Quaternion.LookRotation(faceV, Vector3.up);
+                }
+
+                return;
+            }
+            
+            if (self.TurnTime == 0) // turn time == 0 立即转向
+            {
+                Vector3 faceV = self.GetFaceV();
+                if (self.IsTurnHorizontal)
+                {
+                    faceV.y = 0;
+                }
+
+                if (Math.Abs(faceV.x) > 0.01 || Math.Abs(faceV.z) > 0.01)
+                {
+                    self.To = Quaternion.LookRotation(faceV, Vector3.up);
+                    unit.Rotation = self.To;
+                }
+            }
+        }
+
+        private static Vector3 GetFaceV(this MoveComponent self)
+        {
+            return self.NextTarget - self.PreTarget;
+        }
+
+        public static bool FlashTo(this MoveComponent self, Vector3 target)
+        {
+            Unit unit = self.GetParent<Unit>();
+            unit.Position = target;
+            return true;
+        }
+
+        public static bool MoveTo(this MoveComponent self, Vector3 target, float speed, int turnTime = 0, bool isTurnHorizontal = false)
+        {
+            if (speed < 0.001)
+            {
+                Log.Error($"speed is 0 {self.GetParent<Unit>().Config.Id} {self.GetParent<Unit>().Id} {speed}");
+                return false;
+            }
+
+            self.Stop();
+
+            self.IsTurnHorizontal = isTurnHorizontal;
+            self.TurnTime = turnTime;
+            self.Targets.Add(self.GetParent<Unit>().Position);
+            self.Targets.Add(target);
+            self.Speed = speed;
+
+            self.StartMove();
+            return true;
+        }
+
+        public static bool MoveTo(this MoveComponent self, List<Vector3> target, float speed, int turnTime = 0)
+        {
+            if (target.Count == 0)
+            {
+                return true;
+            }
+
+            if (Math.Abs(speed) < 0.001)
+            {
+                Log.Error($"speed is 0 {self.GetParent<Unit>().Config.Id} {self.GetParent<Unit>().Id}");
+                return false;
+            }
+
+            self.Stop();
+
+            foreach (Vector3 v in target)
+            {
+                self.Targets.Add(v);
+            }
+
+            self.IsTurnHorizontal = true;
+            self.TurnTime = turnTime;
+            self.Speed = speed;
+
+            self.StartMove();
+
+            return true;
+        }
+
+        public static void Stop(this MoveComponent self)
+        {
+            if (self.Targets.Count > 0)
+            {
+                self.MoveForward(true);
+            }
+
+            self.Clear();
+        }
+
+        public static void Clear(this MoveComponent self)
+        {
+            self.StartTime = 0;
+            self.StartPos = Vector3.zero;
+            self.BeginTime = 0;
+            self.NeedTime = 0;
+            TimerComponent.Instance.Remove(ref self.MoveTimer);
+            self.Targets.Clear();
+            self.Speed = 0;
+            self.N = 0;
+            self.TurnTime = 0;
+            self.IsTurnHorizontal = false;
+
+            if (self.Callback != null)
+            {
+                Action<bool> callback = self.Callback;
+                self.Callback = null;
+                callback.Invoke(false);
+            }
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Model/Demo/Unit/TurnComponent.cs.meta → Unity/Assets/Hotfix/Demo/Move/MoveComponentSystem.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: e6eda4a4a738447e288884644ba20843
+guid: cebbd9f8d25ebf544b617415eaca4624
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 24 - 0
Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs

@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET
+{
+    public static class MoveHelper
+    {
+        // 可以多次调用,多次调用的话会取消上一次的协程
+        public static async ETTask<int> MoveToAsync(this Unit unit, Vector3 targetPos, ETCancellationToken cancellationToken = null)
+        {
+            C2M_PathfindingResult msg = new C2M_PathfindingResult();
+            unit.Domain.GetComponent<SessionComponent>().Session.Send(msg);
+
+            ObjectWait objectWait = unit.GetComponent<ObjectWait>();
+            
+            // 要取消上一次的移动协程
+            objectWait.Notify(new WaitType.Wait_UnitStop() { Error = WaitTypeError.Cancel });
+            
+            // 一直等到unit发送stop
+            WaitType.Wait_UnitStop waitUnitStop = await objectWait.Wait<WaitType.Wait_UnitStop>();
+            return waitUnitStop.Error;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Hotfix/Demo/Move/MoveHelper.cs.meta

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

+ 0 - 61
Unity/Assets/Hotfix/Demo/Unit/MoveComponentSystem.cs

@@ -1,61 +0,0 @@
-using System;
-using UnityEngine;
-
-namespace ET
-{
-    public class MoveComponentUpdateSystem: UpdateSystem<MoveComponent>
-    {
-        public override void Update(MoveComponent self)
-        {
-            if (self.moveTcs == null)
-            {
-                return;
-            }
-
-            Unit unit = self.GetParent<Unit>();
-            long timeNow = TimeHelper.ClientNow();
-
-            if (timeNow - self.StartTime >= self.needTime)
-            {
-                unit.Position = self.Target;
-                ETTaskCompletionSource tcs = self.moveTcs;
-                self.moveTcs = null;
-                tcs.SetResult();
-                return;
-            }
-
-            float amount = (timeNow - self.StartTime) * 1f / self.needTime;
-            unit.Position = Vector3.Lerp(self.StartPos, self.Target, amount);
-        }
-    }
-
-    public static class MoveComponentSystem
-    {
-        public static async ETTask MoveToAsync(this MoveComponent self,Vector3 target, float speedValue, ETCancellationToken cancellationToken)
-        {
-            Unit unit = self.GetParent<Unit>();
-
-            if ((target - self.Target).magnitude < 0.1f)
-            {
-                await ETTask.CompletedTask;
-            }
-
-            self.Target = target;
-
-            self.StartPos = unit.Position;
-            self.StartTime = TimeHelper.ClientNow();
-            float distance = (self.Target - self.StartPos).magnitude;
-            if (Math.Abs(distance) < 0.1f)
-            {
-                await ETTask.CompletedTask;
-            }
-
-            self.needTime = (long) (distance / speedValue * 1000);
-
-            self.moveTcs = new ETTaskCompletionSource();
-
-            cancellationToken.Add(() => { self.moveTcs = null; });
-            await self.moveTcs.Task;
-        }
-    }
-}

+ 0 - 3
Unity/Assets/Hotfix/Demo/Unit/MoveComponentSystem.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 62f8916663f948668024f2996df036a5
-timeCreated: 1615185666

+ 0 - 103
Unity/Assets/Hotfix/Demo/Unit/TurnComponentSystem.cs

@@ -1,103 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-	public class TurnComponentUpdateSystem : UpdateSystem<TurnComponent>
-	{
-		public override void Update(TurnComponent self)
-		{
-			self.Update();
-		}
-	}
-	
-    public static class TurnComponentSystem
-    {
-        
-		public static void Update(this TurnComponent self)
-		{
-			self.UpdateTurn();
-		}
-
-		private static void UpdateTurn(this TurnComponent self)
-		{
-			//Log.Debug($"update turn: {this.t} {this.TurnTime}");
-			if (self.t > self.TurnTime)
-			{
-				return;
-			}
-
-			self.t += Time.deltaTime;
-
-			Quaternion v = Quaternion.Slerp(self.From, self.To, self.t / self.TurnTime);
-			self.GetParent<Unit>().Rotation = v;
-		}
-
-		/// <summary>
-		/// 改变Unit的朝向
-		/// </summary>
-		public static void Turn2D(this TurnComponent self, Vector3 dir, float turnTime = 0.1f)
-		{
-			Vector3 nexpos = self.GetParent<Unit>().Position + dir;
-			self.Turn(nexpos, turnTime);
-		}
-
-		/// <summary>
-		/// 改变Unit的朝向
-		/// </summary>
-		public static void Turn(this TurnComponent self, Vector3 target, float turnTime = 0.1f)
-		{
-			Quaternion quaternion = PositionHelper.GetVector3ToQuaternion(self.GetParent<Unit>().Position, target);
-
-			self.To = quaternion;
-			self.From = self.GetParent<Unit>().Rotation;
-			self.t = 0;
-			self.TurnTime = turnTime;
-		}
-
-		/// <summary>
-		/// 改变Unit的朝向
-		/// </summary>
-		/// <param name="angle">与X轴正方向的夹角</param>
-		public static void Turn(this TurnComponent self, float angle, float turnTime = 0.1f)
-		{
-			Quaternion quaternion = PositionHelper.GetAngleToQuaternion(angle);
-
-			self.To = quaternion;
-			self.From = self.GetParent<Unit>().Rotation;
-			self.t = 0;
-			self.TurnTime = turnTime;
-		}
-
-		public static void Turn(this TurnComponent self, Quaternion quaternion, float turnTime = 0.1f)
-		{
-			self.To = quaternion;
-			self.From = self.GetParent<Unit>().Rotation;
-			self.t = 0;
-			self.TurnTime = turnTime;
-		}
-
-		public static void TurnImmediately(this TurnComponent self, Quaternion quaternion)
-		{
-			self.GetParent<Unit>().Rotation = quaternion;
-		}
-
-		public static void TurnImmediately(this TurnComponent self, Vector3 target)
-		{
-			Vector3 nowPos = self.GetParent<Unit>().Position;
-			if (nowPos == target)
-			{
-				return;
-			}
-
-			Quaternion quaternion = PositionHelper.GetVector3ToQuaternion(self.GetParent<Unit>().Position, target);
-			self.GetParent<Unit>().Rotation = quaternion;
-		}
-
-		public static void TurnImmediately(this TurnComponent self, float angle)
-		{
-			Quaternion quaternion = PositionHelper.GetAngleToQuaternion(angle);
-			self.GetParent<Unit>().Rotation = quaternion;
-		}
-
-    }
-}

+ 5 - 2
Unity/Assets/Hotfix/Demo/Unit/UnitFactory.cs

@@ -10,8 +10,11 @@ namespace ET
 	        unit.Position = new Vector3(unitInfo.X, unitInfo.Y, unitInfo.Z);
 	        
 	        unit.AddComponent<MoveComponent>();
-	        unit.AddComponent<TurnComponent>();
-	        unit.AddComponent<UnitPathComponent>();
+	        NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
+	        for (int i = 0; i < unitInfo.Ks.Count; ++i)
+	        {
+		        numericComponent.Set((NumericType)unitInfo.Ks[i], unitInfo.Vs[i]);
+	        }
 
 	        UnitComponent unitComponent = domain.GetComponent<UnitComponent>();
             unitComponent.Add(unit);

+ 0 - 50
Unity/Assets/Hotfix/Demo/Unit/UnitPathComponentSystem.cs

@@ -1,50 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-    public static class UnitPathComponentSystem
-    {
-        private static async ETTask StartMove_Internal(this UnitPathComponent self, ETCancellationToken cancellationToken)
-        {
-            for (int i = 0; i < self.Path.Count; ++i)
-            {
-                Vector3 v = self.Path[i];
-
-                float speed = 5;
-
-                if (i == 0)
-                {
-                    // 矫正移动速度
-                    Vector3 clientPos = self.GetParent<Unit>().Position;
-                    float serverf = (self.ServerPos - v).magnitude;
-                    if (serverf > 0.1f)
-                    {
-                        float clientf = (clientPos - v).magnitude;
-                        speed = clientf / serverf * speed;
-                    }
-                }
-
-                self.Parent.GetComponent<TurnComponent>().Turn(v);
-                await self.Parent.GetComponent<MoveComponent>().MoveToAsync(v, speed, cancellationToken);
-            }
-        }
-
-        public static async ETVoid StartMove(this UnitPathComponent self, M2C_PathfindingResult message)
-        {
-            // 取消之前的移动协程
-            self.ETCancellationToken?.Cancel();
-            self.ETCancellationToken = new ETCancellationToken();
-
-            self.Path.Clear();
-            for (int i = 0; i < message.Xs.Count; ++i)
-            {
-                self.Path.Add(new Vector3(message.Xs[i], message.Ys[i], message.Zs[i]));
-            }
-
-            self.ServerPos = new Vector3(message.X, message.Y, message.Z);
-
-            await self.StartMove_Internal(self.ETCancellationToken);
-            self.ETCancellationToken = null;
-        }
-    }
-}

+ 0 - 3
Unity/Assets/Hotfix/Demo/Unit/UnitPathComponentSystem.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: c2bef7fd272648b9889dba8c74175f41
-timeCreated: 1615185872

+ 1 - 1
Unity/Assets/Hotfix/Module/Numeric/NumericWatcher_Hp_ShowUI.cs

@@ -6,7 +6,7 @@
 	[NumericWatcher(NumericType.Hp)]
 	public class NumericWatcher_Hp_ShowUI : INumericWatcher
 	{
-		public void Run(long id, int value)
+		public void Run(long id, long value)
 		{
 		}
 	}

+ 13 - 0
Unity/Assets/HotfixView/Unit/ChangePosition_SyncGameObjectPos.cs

@@ -0,0 +1,13 @@
+using UnityEngine;
+
+namespace ET
+{
+    public class ChangePosition_SyncGameObjectPos: AEvent<EventType.ChangePosition>
+    {
+        protected override async ETTask Run(EventType.ChangePosition args)
+        {
+            Transform transform = args.Unit.GetComponent<GameObjectComponent>().GameObject.transform;
+            transform.position = args.Unit.Position;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/HotfixView/Unit/ChangePosition_SyncGameObjectPos.cs.meta

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

+ 13 - 0
Unity/Assets/HotfixView/Unit/ChangeRotation_SyncGameObjectRotation.cs

@@ -0,0 +1,13 @@
+using UnityEngine;
+
+namespace ET
+{
+    public class ChangeRotation_SyncGameObjectRotation: AEvent<EventType.ChangeRotation>
+    {
+        protected override async ETTask Run(EventType.ChangeRotation args)
+        {
+            Transform transform = args.Unit.GetComponent<GameObjectComponent>().GameObject.transform;
+            transform.rotation = args.Unit.Rotation;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/HotfixView/Unit/ChangeRotation_SyncGameObjectRotation.cs.meta

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

+ 10 - 0
Unity/Assets/Model/Demo/EventType.cs

@@ -61,5 +61,15 @@
         {
             public Unit Unit;
         }
+        
+        public struct MoveStart
+        {
+            public Unit Unit;
+        }
+
+        public struct MoveStop
+        {
+            public Unit Unit;
+        }
     }
 }

+ 8 - 0
Unity/Assets/Model/Demo/Move.meta

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

+ 82 - 0
Unity/Assets/Model/Demo/Move/MoveComponent.cs

@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace ET
+{
+    public class MoveComponent: Entity
+    {
+        public Vector3 PreTarget
+        {
+            get
+            {
+                return this.Targets[this.N - 1];
+            }
+        }
+
+        public Vector3 NextTarget
+        {
+            get
+            {
+                return this.Targets[this.N];
+            }
+        }
+
+        // 开启移动协程的时间
+        public long BeginTime;
+
+        // 每个点的开始时间
+        public long StartTime { get; set; }
+
+        // 开启移动协程的Unit的位置
+        public Vector3 StartPos;
+
+        public Vector3 RealPos
+        {
+            get
+            {
+                return this.Targets[0];
+            }
+        }
+
+        private long needTime;
+
+        public long NeedTime
+        {
+            get
+            {
+                return this.needTime;
+            }
+            set
+            {
+                this.needTime = value;
+            }
+        }
+
+        public long MoveTimer;
+
+        public float Speed; // m/s
+
+        public Action<bool> Callback;
+
+        public List<Vector3> Targets = new List<Vector3>();
+
+        public Vector3 FinalTarget
+        {
+            get
+            {
+                return this.Targets[this.Targets.Count - 1];
+            }
+        }
+
+        public int N;
+
+        public int TurnTime;
+
+        public bool IsTurnHorizontal;
+
+        public Quaternion From;
+
+        public Quaternion To;
+    }
+}

+ 11 - 0
Unity/Assets/Model/Demo/Move/MoveComponent.cs.meta

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

+ 0 - 21
Unity/Assets/Model/Demo/Unit/MoveComponent.cs

@@ -1,21 +0,0 @@
-using System;
-using System.Threading;
-using UnityEngine;
-
-namespace ET
-{
-    public class MoveComponent: Entity
-    {
-        public Vector3 Target;
-
-        // 开启移动协程的时间
-        public long StartTime;
-
-        // 开启移动协程的Unit的位置
-        public Vector3 StartPos;
-
-        public long needTime;
-
-        public ETTaskCompletionSource moveTcs;
-    }
-}

+ 0 - 3
Unity/Assets/Model/Demo/Unit/MoveComponent.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: cbc073877ed2402c8451d89d6690a9b9
-timeCreated: 1615184550

+ 0 - 22
Unity/Assets/Model/Demo/Unit/TurnComponent.cs

@@ -1,22 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-	public class TurnComponent : Entity
-	{
-		// turn
-		public Quaternion To;
-		public Quaternion From;
-		public float t = float.MaxValue;
-		public float TurnTime = 0.1f;
-
-		public override void Dispose()
-		{
-			if (this.IsDisposed)
-			{
-				return;
-			}
-			base.Dispose();
-		}
-	}
-}

+ 0 - 15
Unity/Assets/Model/Demo/Unit/UnitPathComponent.cs

@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using System.Threading;
-using UnityEngine;
-
-namespace ET
-{
-    public class UnitPathComponent: Entity
-    {
-        public List<Vector3> Path = new List<Vector3>();
-
-        public Vector3 ServerPos;
-
-        public ETCancellationToken ETCancellationToken;
-    }
-}

+ 0 - 3
Unity/Assets/Model/Demo/Unit/UnitPathComponent.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: cef7ee107f53416094d59449c92ba07b
-timeCreated: 1615184266

+ 14 - 0
Unity/Assets/Model/Demo/WaitType.cs

@@ -0,0 +1,14 @@
+namespace ET
+{
+    namespace WaitType
+    {
+        public struct Wait_UnitStop: IWaitType
+        {
+            public int Error
+            {
+                get;
+                set;
+            }
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Model/Demo/WaitType.cs.meta

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

+ 65 - 26
Unity/Assets/Model/Generate/Message/OuterMessage.cs

@@ -6,7 +6,7 @@ namespace ET
 	[ResponseType(typeof(M2C_TestResponse))]
 	[Message(OuterOpcode.C2M_TestRequest)]
 	[ProtoContract]
-	public partial class C2M_TestRequest: IActorLocationRequest
+	public partial class C2M_TestRequest: Object, IActorLocationRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -21,7 +21,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_TestResponse)]
 	[ProtoContract]
-	public partial class M2C_TestResponse: IActorLocationResponse
+	public partial class M2C_TestResponse: Object, IActorLocationResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -40,7 +40,7 @@ namespace ET
 	[ResponseType(typeof(Actor_TransferResponse))]
 	[Message(OuterOpcode.Actor_TransferRequest)]
 	[ProtoContract]
-	public partial class Actor_TransferRequest: IActorLocationRequest
+	public partial class Actor_TransferRequest: Object, IActorLocationRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -55,7 +55,7 @@ namespace ET
 
 	[Message(OuterOpcode.Actor_TransferResponse)]
 	[ProtoContract]
-	public partial class Actor_TransferResponse: IActorLocationResponse
+	public partial class Actor_TransferResponse: Object, IActorLocationResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -71,7 +71,7 @@ namespace ET
 	[ResponseType(typeof(G2C_EnterMap))]
 	[Message(OuterOpcode.C2G_EnterMap)]
 	[ProtoContract]
-	public partial class C2G_EnterMap: IRequest
+	public partial class C2G_EnterMap: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -80,7 +80,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_EnterMap)]
 	[ProtoContract]
-	public partial class G2C_EnterMap: IResponse
+	public partial class G2C_EnterMap: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -105,7 +105,7 @@ namespace ET
 
 	[Message(OuterOpcode.UnitInfo)]
 	[ProtoContract]
-	public partial class UnitInfo
+	public partial class UnitInfo: Object
 	{
 		[ProtoMember(1)]
 		public long UnitId { get; set; }
@@ -122,11 +122,17 @@ namespace ET
 		[ProtoMember(5)]
 		public float Z { get; set; }
 
+		[ProtoMember(6)]
+		public List<int> Ks = new List<int>();
+
+		[ProtoMember(7)]
+		public List<long> Vs = new List<long>();
+
 	}
 
 	[Message(OuterOpcode.M2C_CreateUnits)]
 	[ProtoContract]
-	public partial class M2C_CreateUnits: IActorMessage
+	public partial class M2C_CreateUnits: Object, IActorMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -139,9 +145,9 @@ namespace ET
 
 	}
 
-	[Message(OuterOpcode.Frame_ClickMap)]
+	[Message(OuterOpcode.C2M_PathfindingResult)]
 	[ProtoContract]
-	public partial class Frame_ClickMap: IActorLocationMessage
+	public partial class C2M_PathfindingResult: Object, IActorLocationMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -165,7 +171,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_PathfindingResult)]
 	[ProtoContract]
-	public partial class M2C_PathfindingResult: IActorMessage
+	public partial class M2C_PathfindingResult: Object, IActorMessage
 	{
 		[ProtoMember(93)]
 		public long ActorId { get; set; }
@@ -193,10 +199,43 @@ namespace ET
 
 	}
 
+	[Message(OuterOpcode.M2C_Stop)]
+	[ProtoContract]
+	public partial class M2C_Stop: Object, IActorMessage
+	{
+		[ProtoMember(1)]
+		public int Error { get; set; }
+
+		[ProtoMember(2)]
+		public long Id { get; set; }
+
+		[ProtoMember(3)]
+		public float X { get; set; }
+
+		[ProtoMember(4)]
+		public float Y { get; set; }
+
+		[ProtoMember(5)]
+		public float Z { get; set; }
+
+		[ProtoMember(6)]
+		public float A { get; set; }
+
+		[ProtoMember(7)]
+		public float B { get; set; }
+
+		[ProtoMember(8)]
+		public float C { get; set; }
+
+		[ProtoMember(9)]
+		public float W { get; set; }
+
+	}
+
 	[ResponseType(typeof(G2C_Ping))]
 	[Message(OuterOpcode.C2G_Ping)]
 	[ProtoContract]
-	public partial class C2G_Ping: IRequest
+	public partial class C2G_Ping: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -205,7 +244,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_Ping)]
 	[ProtoContract]
-	public partial class G2C_Ping: IResponse
+	public partial class G2C_Ping: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -223,14 +262,14 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_Test)]
 	[ProtoContract]
-	public partial class G2C_Test: IMessage
+	public partial class G2C_Test: Object, IMessage
 	{
 	}
 
 	[ResponseType(typeof(M2C_Reload))]
 	[Message(OuterOpcode.C2M_Reload)]
 	[ProtoContract]
-	public partial class C2M_Reload: IRequest
+	public partial class C2M_Reload: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -245,7 +284,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_Reload)]
 	[ProtoContract]
-	public partial class M2C_Reload: IResponse
+	public partial class M2C_Reload: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -261,7 +300,7 @@ namespace ET
 	[ResponseType(typeof(R2C_Login))]
 	[Message(OuterOpcode.C2R_Login)]
 	[ProtoContract]
-	public partial class C2R_Login: IRequest
+	public partial class C2R_Login: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -276,7 +315,7 @@ namespace ET
 
 	[Message(OuterOpcode.R2C_Login)]
 	[ProtoContract]
-	public partial class R2C_Login: IResponse
+	public partial class R2C_Login: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -301,7 +340,7 @@ namespace ET
 	[ResponseType(typeof(G2C_LoginGate))]
 	[Message(OuterOpcode.C2G_LoginGate)]
 	[ProtoContract]
-	public partial class C2G_LoginGate: IRequest
+	public partial class C2G_LoginGate: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -316,7 +355,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_LoginGate)]
 	[ProtoContract]
-	public partial class G2C_LoginGate: IResponse
+	public partial class G2C_LoginGate: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -334,7 +373,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_TestHotfixMessage)]
 	[ProtoContract]
-	public partial class G2C_TestHotfixMessage: IMessage
+	public partial class G2C_TestHotfixMessage: Object, IMessage
 	{
 		[ProtoMember(1)]
 		public string Info { get; set; }
@@ -344,7 +383,7 @@ namespace ET
 	[ResponseType(typeof(M2C_TestActorResponse))]
 	[Message(OuterOpcode.C2M_TestActorRequest)]
 	[ProtoContract]
-	public partial class C2M_TestActorRequest: IActorLocationRequest
+	public partial class C2M_TestActorRequest: Object, IActorLocationRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -359,7 +398,7 @@ namespace ET
 
 	[Message(OuterOpcode.M2C_TestActorResponse)]
 	[ProtoContract]
-	public partial class M2C_TestActorResponse: IActorLocationResponse
+	public partial class M2C_TestActorResponse: Object, IActorLocationResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -377,7 +416,7 @@ namespace ET
 
 	[Message(OuterOpcode.PlayerInfo)]
 	[ProtoContract]
-	public partial class PlayerInfo: IMessage
+	public partial class PlayerInfo: Object, IMessage
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -387,7 +426,7 @@ namespace ET
 	[ResponseType(typeof(G2C_PlayerInfo))]
 	[Message(OuterOpcode.C2G_PlayerInfo)]
 	[ProtoContract]
-	public partial class C2G_PlayerInfo: IRequest
+	public partial class C2G_PlayerInfo: Object, IRequest
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }
@@ -396,7 +435,7 @@ namespace ET
 
 	[Message(OuterOpcode.G2C_PlayerInfo)]
 	[ProtoContract]
-	public partial class G2C_PlayerInfo: IResponse
+	public partial class G2C_PlayerInfo: Object, IResponse
 	{
 		[ProtoMember(90)]
 		public int RpcId { get; set; }

+ 17 - 16
Unity/Assets/Model/Generate/Message/OuterOpcode.cs

@@ -10,22 +10,23 @@ namespace ET
 		 public const ushort G2C_EnterMap = 20006;
 		 public const ushort UnitInfo = 20007;
 		 public const ushort M2C_CreateUnits = 20008;
-		 public const ushort Frame_ClickMap = 20009;
+		 public const ushort C2M_PathfindingResult = 20009;
 		 public const ushort M2C_PathfindingResult = 20010;
-		 public const ushort C2G_Ping = 20011;
-		 public const ushort G2C_Ping = 20012;
-		 public const ushort G2C_Test = 20013;
-		 public const ushort C2M_Reload = 20014;
-		 public const ushort M2C_Reload = 20015;
-		 public const ushort C2R_Login = 20016;
-		 public const ushort R2C_Login = 20017;
-		 public const ushort C2G_LoginGate = 20018;
-		 public const ushort G2C_LoginGate = 20019;
-		 public const ushort G2C_TestHotfixMessage = 20020;
-		 public const ushort C2M_TestActorRequest = 20021;
-		 public const ushort M2C_TestActorResponse = 20022;
-		 public const ushort PlayerInfo = 20023;
-		 public const ushort C2G_PlayerInfo = 20024;
-		 public const ushort G2C_PlayerInfo = 20025;
+		 public const ushort M2C_Stop = 20011;
+		 public const ushort C2G_Ping = 20012;
+		 public const ushort G2C_Ping = 20013;
+		 public const ushort G2C_Test = 20014;
+		 public const ushort C2M_Reload = 20015;
+		 public const ushort M2C_Reload = 20016;
+		 public const ushort C2R_Login = 20017;
+		 public const ushort R2C_Login = 20018;
+		 public const ushort C2G_LoginGate = 20019;
+		 public const ushort G2C_LoginGate = 20020;
+		 public const ushort G2C_TestHotfixMessage = 20021;
+		 public const ushort C2M_TestActorRequest = 20022;
+		 public const ushort M2C_TestActorResponse = 20023;
+		 public const ushort PlayerInfo = 20024;
+		 public const ushort C2G_PlayerInfo = 20025;
+		 public const ushort G2C_PlayerInfo = 20026;
 	}
 }

+ 1 - 1
Unity/Assets/Model/Module/Numeric/INumericWatcher.cs

@@ -2,6 +2,6 @@
 {
 	public interface INumericWatcher
 	{
-		void Run(long id, int value);
+		void Run(long id, long value);
 	}
 }

+ 24 - 9
Unity/Assets/Model/Module/Numeric/NumericComponent.cs

@@ -8,8 +8,8 @@ namespace ET
 		{
 			public Entity Parent;
 			public NumericType NumericType;
-			public int Old;
-			public int New;
+			public long Old;
+			public long New;
 		}
 	}
 	
@@ -24,7 +24,7 @@ namespace ET
 
 	public class NumericComponent: Entity
 	{
-		public Dictionary<int, int> NumericDic = new Dictionary<int, int>();
+		public Dictionary<int, long> NumericDic = new Dictionary<int, long>();
 
 		public void Awake()
 		{
@@ -42,11 +42,21 @@ namespace ET
 		}
 
 		public int GetAsInt(NumericType numericType)
+		{
+			return (int)GetByKey((int)numericType);
+		}
+		
+		public long GetAsLong(NumericType numericType)
 		{
 			return GetByKey((int)numericType);
 		}
 		
 		public int GetAsInt(int numericType)
+		{
+			return (int)GetByKey(numericType);
+		}
+		
+		public long GetAsLong(int numericType)
 		{
 			return GetByKey(numericType);
 		}
@@ -60,8 +70,13 @@ namespace ET
 		{
 			this[nt] = value;
 		}
+		
+		public void Set(NumericType nt, long value)
+		{
+			this[nt] = value;
+		}
 
-		public int this[NumericType numericType]
+		public long this[NumericType numericType]
 		{
 			get
 			{
@@ -69,7 +84,7 @@ namespace ET
 			}
 			set
 			{
-				int v = this.GetByKey((int) numericType);
+				long v = this.GetByKey((int) numericType);
 				if (v == value)
 				{
 					return;
@@ -81,9 +96,9 @@ namespace ET
 			}
 		}
 
-		private int GetByKey(int key)
+		private long GetByKey(int key)
 		{
-			int value = 0;
+			long value = 0;
 			this.NumericDic.TryGetValue(key, out value);
 			return value;
 		}
@@ -103,8 +118,8 @@ namespace ET
 
 			// 一个数值可能会多种情况影响,比如速度,加个buff可能增加速度绝对值100,也有些buff增加10%速度,所以一个值可以由5个值进行控制其最终结果
 			// final = (((base + add) * (100 + pct) / 100) + finalAdd) * (100 + finalPct) / 100;
-			int old = this.NumericDic[final];
-			int result = (int)(((this.GetByKey(bas) + this.GetByKey(add)) * (100 + this.GetAsFloat(pct)) / 100f + this.GetByKey(finalAdd)) * (100 + this.GetAsFloat(finalPct)) / 100f * 10000);
+			long old = this.NumericDic[final];
+			long result = (long)(((this.GetByKey(bas) + this.GetByKey(add)) * (100 + this.GetAsFloat(pct)) / 100f + this.GetByKey(finalAdd)) * (100 + this.GetAsFloat(finalPct)) / 100f * 10000);
 			this.NumericDic[final] = result;
 			Game.EventSystem.Publish(new EventType.NumbericChange()
 			{

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

@@ -58,7 +58,7 @@ namespace ET
 			}
 		}
 
-		public void Run(NumericType numericType, long id, int value)
+		public void Run(NumericType numericType, long id, long value)
 		{
 			List<INumericWatcher> list;
 			if (!this.allWatchers.TryGetValue(numericType, out list))

+ 1 - 1
Unity/Assets/ModelView/Opera/OperaComponent.cs

@@ -10,6 +10,6 @@ namespace ET
 
 	    public int mapMask;
 
-	    public readonly Frame_ClickMap frameClickMap = new Frame_ClickMap();
+	    public readonly C2M_PathfindingResult frameClickMap = new C2M_PathfindingResult();
     }
 }

File diff suppressed because it is too large
+ 0 - 0
Unity/Assets/Plugins/MacOS/libkcp.dylib


File diff suppressed because it is too large
+ 0 - 0
Unity/Unity.Hotfix.csproj


File diff suppressed because it is too large
+ 0 - 0
Unity/Unity.HotfixView.csproj


File diff suppressed because it is too large
+ 0 - 0
Unity/Unity.Model.csproj


File diff suppressed because it is too large
+ 0 - 0
Unity/Unity.ModelView.csproj


File diff suppressed because it is too large
+ 0 - 0
Unity/Unity.ThirdParty.csproj


+ 6 - 1
Unity/UserSettings/EditorUserSettings.asset

@@ -5,6 +5,9 @@ EditorUserSettings:
   m_ObjectHideFlags: 0
   serializedVersion: 4
   m_ConfigSettings:
+    RecentlyUsedScenePath-0:
+      value: 22424703114646680e0b0227036c761e1f03563f22213229
+      flags: 0
     vcSharedLogLevel:
       value: 0d5e400f0650
       flags: 0
@@ -15,5 +18,7 @@ EditorUserSettings:
   m_SemanticMergeMode: 2
   m_VCShowFailedCheckout: 1
   m_VCOverwriteFailedCheckoutAssets: 1
-  m_VCOverlayIcons: 1
+  m_VCProjectOverlayIcons: 1
+  m_VCHierarchyOverlayIcons: 1
+  m_VCOtherOverlayIcons: 1
   m_VCAllowAsyncUpdate: 0

Some files were not shown because too many files changed in this diff