tanghai 2 лет назад
Родитель
Сommit
df871489c3
33 измененных файлов с 245 добавлено и 126 удалено
  1. 19 31
      Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/BattleSceneClientUpdaterSystem.cs
  2. 2 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/LSSceneChangeHelper.cs
  3. 2 2
      Unity/Assets/Scripts/Codes/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs
  4. 0 2
      Unity/Assets/Scripts/Codes/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs
  5. 5 1
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/LSUnitInputComponentSystem.cs
  6. 3 1
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitFFactory.cs
  7. 13 10
      Unity/Assets/Scripts/Codes/HotfixView/Client/Demo/Camera/CameraComponentSystem.cs
  8. 40 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs
  9. 3 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs.meta
  10. 17 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewSystem.cs
  11. 3 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewSystem.cs.meta
  12. 3 3
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepAfterUnitCreate_CreateUnitFView.cs
  13. 4 4
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepOperaComponentSystem.cs
  14. 1 1
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepSceneChangeStart_AddComponent.cs
  15. 0 8
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView.meta
  16. 0 7
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewComponentSystem.cs
  17. 0 11
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewComponentSystem.cs.meta
  18. 0 17
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewSystem.cs
  19. 1 5
      Unity/Assets/Scripts/Codes/Model/Client/LockStep/BattleSceneClientUpdater.cs
  20. 0 1
      Unity/Assets/Scripts/Codes/Model/Server/LockStep/Map/RoomPlayer.cs
  21. 12 3
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/FrameBuffer.cs
  22. 31 0
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/LSInputInfo.cs
  23. 1 1
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/LSUnitInputComponent.cs
  24. 39 4
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/OneFrameMessage.cs
  25. 18 0
      Unity/Assets/Scripts/Codes/ModelView/Client/Demo/Camera/CameraComponent.cs
  26. 11 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitView.cs
  27. 0 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitView.cs.meta
  28. 8 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitViewComponent.cs
  29. 1 1
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitViewComponent.cs.meta
  30. 0 10
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFView.cs
  31. 1 1
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFViewComponent.cs.meta
  32. 5 0
      Unity/Assets/Scripts/Core/LockStep/LSSington.cs
  33. 2 2
      Unity/ProjectSettings/ProjectSettings.asset

+ 19 - 31
Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/BattleSceneClientUpdaterSystem.cs

@@ -1,4 +1,5 @@
 using System;
+using MongoDB.Bson;
 
 namespace ET.Client
 {
@@ -25,39 +26,22 @@ namespace ET.Client
             {
                 return;
             }
-
-            // 执行到PredictionFrame, 每次update最多执行5帧
-            if (frameBuffer.NowFrame < frameBuffer.RealFrame + frameBuffer.PredictionCount)
-            {
-                int j = 0;
-                for (int i = frameBuffer.NowFrame; i <= frameBuffer.RealFrame + frameBuffer.PredictionCount; ++i)
-                {
-                    if (++j % 5 == 0)
-                    {
-                        break;
-                    }
-
-                    ++frameBuffer.NowFrame;
-                    OneFrameMessages oneFrameMessages = GetOneFrameMessages(self, i);
-                    battleScene.Update(oneFrameMessages);
-                }
-            }
+            
+            OneFrameMessages oneFrameMessages = GetOneFrameMessages(self, frameBuffer.NowFrame);
+            battleScene.Update(oneFrameMessages);
+            ++frameBuffer.NowFrame;
         }
 
         private static OneFrameMessages GetOneFrameMessages(this BattleSceneClientUpdater self, int frame)
         {
             BattleScene battleScene = self.GetParent<BattleScene>();
             FrameBuffer frameBuffer = battleScene.FrameBuffer;
-            if (frame != frameBuffer.NowFrame + 1)
-            {
-                throw new Exception($"get frame error: {frame} {frameBuffer.NowFrame} {frameBuffer.RealFrame}");
-            }
-
+            
             if (frame <= frameBuffer.RealFrame)
             {
                 return frameBuffer.GetFrame(frame);
             }
-
+            
             // predict
             return GetPredictionOneFrameMessage(self, frame);
         }
@@ -67,18 +51,22 @@ namespace ET.Client
         {
             BattleScene battleScene = self.GetParent<BattleScene>();
             OneFrameMessages preFrame = battleScene.FrameBuffer.GetFrame(frame - 1);
-            if (preFrame == null)
-            {
-                return null;
-            }
-
-            OneFrameMessages predictionFrame = MongoHelper.Clone(preFrame);
-
+            OneFrameMessages predictionFrame  = preFrame != null? MongoHelper.Clone(preFrame) : new OneFrameMessages();
             predictionFrame.Frame = frame;
 
             PlayerComponent playerComponent = battleScene.GetParent<Scene>().GetComponent<PlayerComponent>();
             long myId = playerComponent.MyId;
-            predictionFrame.InputInfos[myId] = self.InputInfo;
+
+            FrameMessage frameMessage = new() { InputInfo = new LSInputInfo(), Frame = frame };
+            frameMessage.InputInfo.V = self.InputInfo.V;
+            frameMessage.InputInfo.Button = self.InputInfo.Button;
+
+            predictionFrame.InputInfos[myId] = frameMessage.InputInfo;
+            
+            
+            self.Parent.GetParent<Scene>().GetComponent<SessionComponent>().Session.Send(frameMessage);
+            
+            
             return predictionFrame;
         }
     }

+ 2 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/LSSceneChangeHelper.cs

@@ -21,6 +21,8 @@ namespace ET.Client
 
             battleScene.LSWorld = new LSWorld(SceneType.LockStepClient);
             battleScene.Init(waitRoom2CEnterMap.Message);
+            
+            battleScene.AddComponent<BattleSceneClientUpdater>();
 
             // 这个事件中可以订阅取消loading
             EventSystem.Instance.Publish(clientScene, new EventType.LockStepSceneInitFinish());

+ 2 - 2
Unity/Assets/Scripts/Codes/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs

@@ -26,12 +26,12 @@ namespace ET.Server
                 Room2C_BattleStart room2CBattleStart = new() {StartTime = TimeHelper.ServerFrameTime()};
                 foreach (RoomPlayer rp in roomServerComponent.Children.Values)
                 {
-                    room2CBattleStart.UnitInfo[rp.Slot] = new LockStepUnitInfo()
+                    room2CBattleStart.UnitInfo.Add(new LockStepUnitInfo()
                     {
                         PlayerId = rp.Id, 
                         Position = new TSVector(10, 0, 10), 
                         Rotation = TSQuaternion.identity
-                    };
+                    });
                 }
                 
                 roomScene.GetComponent<BattleScene>().Init(room2CBattleStart);

+ 0 - 2
Unity/Assets/Scripts/Codes/Hotfix/Server/LockStep/Map/RoomServerComponentSystem.cs

@@ -10,11 +10,9 @@ namespace ET.Server
         {
             protected override void Awake(RoomServerComponent self, Match2Map_GetRoom match2MapGetRoom)
             {
-                int slot = 0;
                 foreach (long id in match2MapGetRoom.PlayerIds)
                 {
                     RoomPlayer roomPlayer = self.AddChildWithId<RoomPlayer>(id);
-                    roomPlayer.Slot = slot++;
                 }
             }
         }

+ 5 - 1
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/LSUnitInputComponentSystem.cs

@@ -1,4 +1,5 @@
 using System;
+using TrueSync;
 
 namespace ET
 {
@@ -9,7 +10,10 @@ namespace ET
         {
             protected override void LSUpdate(LSUnitInputComponent self)
             {
-                
+                LSUnit unit = self.GetParent<LSUnit>();
+
+                TSVector2 v2 = self.LSInputInfo.V * 6 * 50 / 1000;
+                unit.Position += new TSVector(v2.x, 0, v2.y);
             }
         }
     }

+ 3 - 1
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitFFactory.cs

@@ -6,9 +6,11 @@
         {
 	        LSUnitComponent lsUnitComponent = lsWorld.AddComponent<LSUnitComponent>();
 	        LSUnit lsUnit = lsUnitComponent.AddChildWithId<LSUnit>(unitInfo.PlayerId);
-	        
+			
 	        lsUnit.Position = unitInfo.Position;
 	        lsUnit.Rotation = unitInfo.Rotation;
+
+			lsUnit.AddComponent<LSUnitInputComponent>();
 	        
 	        EventSystem.Instance.Publish(lsUnit.DomainScene(), new EventType.LSAfterUnitCreate() {LsUnit = lsUnit});
             return lsUnit;

+ 13 - 10
Unity/Assets/Scripts/Codes/HotfixView/Client/Demo/Camera/CameraComponentSystem.cs

@@ -31,18 +31,21 @@ namespace ET.Client
 		private static void LateUpdate(this CameraComponent self)
 		{
 			// 摄像机每帧更新位置
-			LSUnit lsUnit = self.GetMyUnit();
-			if (lsUnit != null)
+
+			LSUnitView lsUnit = self.MyUnitView;
+			if (lsUnit == null)
 			{
-				Vector3 pos = lsUnit.Position.ToVector();
-				Vector3 cameraPos = self.Transform.position;
-				self.Transform.position = new Vector3(pos.x, cameraPos.y, pos.z - 10);
+				self.MyUnitView = self.GetParent<BattleScene>().GetComponent<LSUnitViewComponent>().GetMyLsUnitView();
 			}
-		}
-		
-		private static LSUnit GetMyUnit(this CameraComponent self)
-		{
-			return self.GetParent<BattleScene>().GetMyUnitF();
+
+			if (lsUnit == null)
+			{
+				return;
+			}
+
+			Vector3 pos = lsUnit.Transform.position;
+			Vector3 cameraPos = self.Transform.position;
+			self.Transform.position = new Vector3(pos.x, cameraPos.y, pos.z - 10);
 		}
 	}
 }

+ 40 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs

@@ -0,0 +1,40 @@
+using System;
+using UnityEngine;
+
+namespace ET.Client
+{
+    [FriendOf(typeof(LSUnitViewComponent))]
+    public static class LSUnitViewComponentSystem
+    {
+        public class AwakeSystem: AwakeSystem<LSUnitViewComponent>
+        {
+            protected override void Awake(LSUnitViewComponent self)
+            {
+                self.MyId = self.Parent.GetParent<Scene>().GetComponent<PlayerComponent>().MyId;
+            }
+        }
+        
+        public class UpdateSystem: UpdateSystem<LSUnitViewComponent>
+        {
+            protected override void Update(LSUnitViewComponent self)
+            {
+                LSWorld lsWorld = self.GetParent<BattleScene>().LSWorld;
+                foreach (LSUnitView child in self.Children.Values)
+                {
+                    LSUnit unit = lsWorld.Get(child.Id) as LSUnit;
+
+                    Vector3 pos = child.Transform.position;
+                    Vector3 to = unit.Position.ToVector();
+                    float t = (to - pos).magnitude / 6f;
+                    
+                    child.Transform.position = Vector3.Lerp(pos, unit.Position.ToVector(), Time.deltaTime / t);
+                }
+            }
+        }
+
+        public static LSUnitView GetMyLsUnitView(this LSUnitViewComponent self)
+        {
+            return self.GetChild<LSUnitView>(self.MyId);
+        }
+    }
+}

+ 3 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewComponentSystem.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: c5d4602f44d143618a25090314acdbd8
+timeCreated: 1682060043

+ 17 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewSystem.cs

@@ -0,0 +1,17 @@
+using System;
+using UnityEngine;
+
+namespace ET.Client
+{
+    public static class LSUnitViewSystem
+    {
+        public class AwakeSystem: AwakeSystem<LSUnitView, GameObject>
+        {
+            protected override void Awake(LSUnitView self, GameObject go)
+            {
+                self.GameObject = go;
+                self.Transform = go.transform;
+            }
+        }
+    }
+}

+ 3 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LSUnitViewSystem.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 9390f59e3a1a443c9b9f89316a2512c7
+timeCreated: 1682061228

+ 3 - 3
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepAfterUnitCreate_CreateUnitFView.cs

@@ -9,9 +9,9 @@ namespace ET.Client
         protected override async ETTask Run(LSWorld lsWorld, LSAfterUnitCreate args)
         {
             BattleScene battleScene = lsWorld.GetParent<BattleScene>();
-            UnitFViewComponent unitFViewComponent = battleScene.GetComponent<UnitFViewComponent>();
+            LSUnitViewComponent lsUnitViewComponent = battleScene.GetComponent<LSUnitViewComponent>();
 
-            if (unitFViewComponent == null)
+            if (lsUnitViewComponent == null)
             {
                 return;
             }
@@ -22,7 +22,7 @@ namespace ET.Client
             GameObject go = UnityEngine.Object.Instantiate(prefab, GlobalComponent.Instance.Unit, true);
             go.transform.position = args.LsUnit.Position.ToVector();
 
-            unitFViewComponent.AddChild<UnitFView, GameObject>(go);
+            lsUnitViewComponent.AddChildWithId<LSUnitView, GameObject>(args.LsUnit.Id, go);
 
             await ETTask.CompletedTask;
         }

+ 4 - 4
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepOperaComponentSystem.cs

@@ -12,22 +12,22 @@ namespace ET.Client
             protected override void Update(LockStepOperaComponent self)
             {
                 TSVector2 v = new();
-                if (Input.GetKeyDown(KeyCode.W))
+                if (Input.GetKey(KeyCode.W))
                 {
                     v.y += 1;
                 }
                 
-                if (Input.GetKeyDown(KeyCode.A))
+                if (Input.GetKey(KeyCode.A))
                 {
                     v.x -= 1;
                 }
                 
-                if (Input.GetKeyDown(KeyCode.S))
+                if (Input.GetKey(KeyCode.S))
                 {
                     v.y -= 1;
                 }
                 
-                if (Input.GetKeyDown(KeyCode.D))
+                if (Input.GetKey(KeyCode.D))
                 {
                     v.x += 1;
                 }

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepSceneChangeStart_AddComponent.cs

@@ -20,7 +20,7 @@ namespace ET.Client
 
             await SceneManager.LoadSceneAsync(battleScene.Name);
 
-            battleScene.AddComponent<UnitFViewComponent>();
+            battleScene.AddComponent<LSUnitViewComponent>();
         }
     }
 }

+ 0 - 8
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView.meta

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

+ 0 - 7
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewComponentSystem.cs

@@ -1,7 +0,0 @@
-namespace ET.Client
-{
-    public static class UnitFViewComponentSystem
-    {
-        
-    }
-}

+ 0 - 11
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewComponentSystem.cs.meta

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

+ 0 - 17
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewSystem.cs

@@ -1,17 +0,0 @@
-using System;
-using UnityEngine;
-
-namespace ET.Client
-{
-    public static class UnitFViewSystem
-    {
-        [ObjectSystem]
-        public class AwakeSystem: AwakeSystem<UnitFView, GameObject>
-        {
-            protected override void Awake(UnitFView self, GameObject go)
-            {
-                self.GameObject = go;
-            }
-        }
-    }
-}

+ 1 - 5
Unity/Assets/Scripts/Codes/Model/Client/LockStep/BattleSceneClientUpdater.cs

@@ -5,10 +5,6 @@ namespace ET.Client
     [ComponentOf(typeof(BattleScene))]
     public class BattleSceneClientUpdater: Entity, IAwake, IUpdate
     {
-        public LSInputInfo InputInfo;
-
-        public int PreditionFrameCount;
-
-        public FrameBuffer PreditionFrame;
+        public LSInputInfo InputInfo = new LSInputInfo();
     }
 }

+ 0 - 1
Unity/Assets/Scripts/Codes/Model/Server/LockStep/Map/RoomPlayer.cs

@@ -5,6 +5,5 @@ namespace ET.Server
     public class RoomPlayer: Entity, IAwake
     {
         public bool IsJoinRoom { get; set; }
-        public int Slot { get; set; }
     }
 }

+ 12 - 3
Unity/Assets/Scripts/Codes/Model/Share/LockStep/FrameBuffer.cs

@@ -6,15 +6,24 @@ namespace ET
     public class FrameBuffer
     {
         public int NowFrame { get; set; }
-        
-        public int RealFrame { get; set; }
+
+        public int RealFrame { get; set; } = -1;
         
         public int PredictionCount { get; set; }
         
         private const int TotalFrameCount = 128;
         
-        private readonly List<OneFrameMessages> messageBuffer = new(TotalFrameCount);
+        private readonly List<OneFrameMessages> messageBuffer = new List<OneFrameMessages>(TotalFrameCount);
         private readonly List<byte[]> dataBuffer = new(TotalFrameCount);
+
+        public FrameBuffer()
+        {
+            for (int i = 0; i < this.dataBuffer.Capacity; ++i)
+            {
+                this.messageBuffer.Add(null);
+                this.dataBuffer.Add(null);
+            }
+        }
         
         private bool CheckFrame(int frame)
         {

+ 31 - 0
Unity/Assets/Scripts/Codes/Model/Share/LockStep/LSInputInfo.cs

@@ -1,9 +1,40 @@
+using System;
 using TrueSync;
 
 namespace ET
 {
     public partial class LSInputInfo
     {
+        protected bool Equals(LSInputInfo other)
+        {
+            return this.V.Equals(other.V) && this.Button == other.Button;
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj))
+            {
+                return false;
+            }
+
+            if (ReferenceEquals(this, obj))
+            {
+                return true;
+            }
+
+            if (obj.GetType() != this.GetType())
+            {
+                return false;
+            }
+
+            return Equals((LSInputInfo) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return HashCode.Combine(this.V, this.Button);
+        }
+
         public static bool operator==(LSInputInfo a, LSInputInfo b)
         {
             if (a.V != b.V)

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Share/LockStep/LSUnitInputComponent.cs

@@ -1,6 +1,6 @@
 namespace ET
 {
-    public class LSUnitInputComponent: LSEntity, ILSUpdate
+    public class LSUnitInputComponent: LSEntity, ILSUpdate, IAwake
     {
         public LSInputInfo LSInputInfo { get; set; } = new LSInputInfo();
 

+ 39 - 4
Unity/Assets/Scripts/Codes/Model/Share/LockStep/OneFrameMessage.cs

@@ -5,6 +5,36 @@ namespace ET
 {
     public partial class OneFrameMessages
     {
+        protected bool Equals(OneFrameMessages other)
+        {
+            return this.Frame == other.Frame && Equals(this.InputInfos, other.InputInfos);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj))
+            {
+                return false;
+            }
+
+            if (ReferenceEquals(this, obj))
+            {
+                return true;
+            }
+
+            if (obj.GetType() != this.GetType())
+            {
+                return false;
+            }
+
+            return Equals((OneFrameMessages) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return HashCode.Combine(this.Frame, this.InputInfos);
+        }
+
         public OneFrameMessages()
         {
             this.InputInfos = new Dictionary<long, LSInputInfo>(LSConstValue.MatchCount);
@@ -12,6 +42,15 @@ namespace ET
 
         public static bool operator==(OneFrameMessages a, OneFrameMessages b)
         {
+            if (a is null || b is null)
+            {
+                if (a is null && b is null)
+                {
+                    return true;
+                }
+                return false;
+            }
+            
             if (a.Frame != b.Frame)
             {
                 return false;
@@ -38,10 +77,6 @@ namespace ET
         public Room2C_BattleStart()
         {
             this.UnitInfo = new List<LockStepUnitInfo>(LSConstValue.MatchCount);
-            for (int i = 0; i < LSConstValue.MatchCount; ++i)
-            {
-                this.UnitInfo.Add(null);
-            }
         }
     }
 }

+ 18 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/Demo/Camera/CameraComponent.cs

@@ -22,5 +22,23 @@ namespace ET.Client
 				this.Transform = this.camera.transform;
 			}
 		}
+
+		private long unitViewInstanceId;
+
+		public LSUnitView MyUnitView
+		{
+			get
+			{
+				return Root.Instance.Get(this.unitViewInstanceId) as LSUnitView;
+			}
+			set
+			{
+				if (value == null)
+				{
+					return;
+				}
+				this.unitViewInstanceId = value.InstanceId;
+			}
+		}
 	}
 }

+ 11 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitView.cs

@@ -0,0 +1,11 @@
+using UnityEngine;
+
+namespace ET
+{
+    [ChildOf(typeof(LSUnitViewComponent))]
+    public class LSUnitView: Entity, IAwake<GameObject>, IUpdate
+    {
+        public GameObject GameObject { get; set; }
+        public Transform Transform { get; set; }
+    }
+}

+ 0 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFView.cs.meta → Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitView.cs.meta


+ 8 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitViewComponent.cs

@@ -0,0 +1,8 @@
+namespace ET
+{
+	[ComponentOf(typeof(BattleScene))]
+	public class LSUnitViewComponent: Entity, IAwake, IDestroy, IUpdate
+	{
+		public long MyId;
+	}
+}

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewSystem.cs.meta → Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/LSUnitViewComponent.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: c319416d3d53d484bb50ed292c21a3d8
+guid: ebb6432c4bdfb4ad798f25881448de25
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 10
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFView.cs

@@ -1,10 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-    [ChildOf(typeof(UnitFViewComponent))]
-    public class UnitFView: Entity, IAwake<GameObject>
-    {
-        public GameObject GameObject;
-    }
-}

+ 1 - 1
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFViewComponent.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: ebb6432c4bdfb4ad798f25881448de25
+guid: 3889609216ea34aa1942d81632124ae4
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 5 - 0
Unity/Assets/Scripts/Core/LockStep/LSSington.cs

@@ -16,6 +16,11 @@ namespace ET
                 {
                     TypeSystems.OneTypeSystems oneTypeSystems = this.TypeSystems.GetOrCreateOneTypeSystems(iSystemType.Type());
                     oneTypeSystems.Map.Add(iSystemType.SystemType(), obj);
+                    int index = iSystemType.GetInstanceQueueIndex();
+                    if (index > InstanceQueueIndex.None && index < InstanceQueueIndex.Max)
+                    {
+                        oneTypeSystems.QueueFlag[index] = true;
+                    }
                 }
             }
         }

+ 2 - 2
Unity/ProjectSettings/ProjectSettings.asset

@@ -841,9 +841,9 @@ PlayerSettings:
   scriptingDefineSymbols:
     Android: UNITY;SINGLE_THREAD
     Server: UNITY
-    Standalone: UNITY;SINGLE_THREAD
+    Standalone: UNITY;SINGLE_THREAD;ENABLE_CODES
     WebGL: UNITY
-    iPhone: UNITY;SINGLE_THREAD
+    iPhone: UNITY;SINGLE_THREAD;ENABLE_CODES
   additionalCompilerArguments: {}
   platformArchitecture:
     iPhone: 1