Ver código fonte

1.进入了战斗,创建了小人
2.实现一个帧驱动组件,按照创建FixedUpdate的时间来Update,保证Update的顺序

tanghai 2 anos atrás
pai
commit
c1f396e747
55 arquivos alterados com 684 adições e 15 exclusões
  1. 1 1
      DotNet/Model/DotNet.Model.csproj
  2. 32 0
      ET.sln.DotSettings
  3. 4 5
      Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/LockStepSceneChangeHelper.cs
  4. 8 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/UnitF.meta
  5. 19 0
      Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/UnitF/UnitFFactory.cs
  6. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/UnitF/UnitFFactory.cs.meta
  7. 8 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep.meta
  8. 8 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF.meta
  9. 15 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFComponentSystem.cs
  10. 11 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFComponentSystem.cs.meta
  11. 16 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFSystem.cs
  12. 11 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFSystem.cs.meta
  13. 8 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/FixedUpdate.meta
  14. 50 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/FixedUpdate/FixedUpdateComponentSystem.cs
  15. 11 0
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/FixedUpdate/FixedUpdateComponentSystem.cs.meta
  16. 1 1
      Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs
  17. 22 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepAfterUnitCreate_CreateUnitFView.cs
  18. 11 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepAfterUnitCreate_CreateUnitFView.cs.meta
  19. 36 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepOperaComponentSystem.cs
  20. 11 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepOperaComponentSystem.cs.meta
  21. 9 3
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/LockStepSceneChangeStart_AddComponent.cs
  22. 8 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView.meta
  23. 7 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewComponentSystem.cs
  24. 11 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewComponentSystem.cs.meta
  25. 17 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewSystem.cs
  26. 11 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitFView/UnitFViewSystem.cs.meta
  27. 8 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/LockStep/UnitView.meta
  28. 8 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/Module/TrueSync.meta
  29. 58 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/Module/TrueSync/TrueSyncExtensions.cs
  30. 11 0
      Unity/Assets/Scripts/Codes/HotfixView/Client/Module/TrueSync/TrueSyncExtensions.cs.meta
  31. 7 0
      Unity/Assets/Scripts/Codes/Model/Client/LockStep/Command.cs
  32. 11 0
      Unity/Assets/Scripts/Codes/Model/Client/LockStep/Command.cs.meta
  33. 6 1
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/EventType.cs
  34. 2 2
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF.cs
  35. 11 0
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF.cs.meta
  36. 8 0
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF.meta
  37. 7 0
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF/UnitFComponent.cs
  38. 11 0
      Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF/UnitFComponent.cs.meta
  39. 8 0
      Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate.meta
  40. 17 0
      Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/AFixUpdateHandler.cs
  41. 11 0
      Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/AFixUpdateHandler.cs.meta
  42. 30 0
      Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/FixedUpdateComponent.cs
  43. 11 0
      Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/FixedUpdateComponent.cs.meta
  44. 13 1
      Unity/Assets/Scripts/Codes/Model/Share/Module/Scene/CurrentScenesComponent.cs
  45. 8 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep.meta
  46. 7 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/LockStepOperaComponent.cs
  47. 11 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/LockStepOperaComponent.cs.meta
  48. 7 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/TrueSyncHelper.cs
  49. 11 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/TrueSyncHelper.cs.meta
  50. 8 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView.meta
  51. 10 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFView.cs
  52. 11 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFView.cs.meta
  53. 7 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFViewComponent.cs
  54. 11 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitFView/UnitFViewComponent.cs.meta
  55. 8 0
      Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitView.meta

+ 1 - 1
DotNet/Model/DotNet.Model.csproj

@@ -26,7 +26,7 @@
     <ItemGroup>
 
         <Compile Include="..\..\Unity\Assets\Scripts\Codes\Model\Server\**\*.cs"> 
-            <Link>Server\%(RecursiveDir)%(FileName)%(Extension)</Link>
+            <Link>Server\%(RecursiveDir)%(FileName)%(Extension)</Link> 
         </Compile>
 
         <Compile Include="..\..\Unity\Assets\Scripts\Codes\Model\Client\**\*.cs"> 

+ 32 - 0
ET.sln.DotSettings

@@ -1006,6 +1006,38 @@ II.2.12 &lt;HandlesEvent /&gt;&#xD;
 	<s:Boolean x:Key="/Default/Housekeeping/VsActionManager/KeyboardShortcutToVsCommand/=Subtract/@KeyIndexDefined">True</s:Boolean>
 	<s:Boolean x:Key="/Default/Housekeeping/VsActionManager/KeyboardShortcutToVsCommand/=Tab/@KeyIndexDefined">True</s:Boolean>
 	<s:Boolean x:Key="/Default/Housekeeping/VsActionManager/KeyboardShortcutToVsCommand/=Up/@KeyIndexDefined">True</s:Boolean>
+	<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=A250F653CAF27546A7BBA145E3FE2EAC/Text/@EntryValue">[ObjectSystem]
+    public class DestroySystem: DestroySystem&lt;$name$&gt;
+    {
+        protected override void Destroy($name$ self)
+        {
+            throw new System.NotImplementedException();
+        }
+    }</s:String>
+	<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=AD278F5071B8A94A8D97347126B64213/Text/@EntryValue">[ObjectSystem]
+    public class DeserializeSystem: DeserializeSystem&lt;$name$&gt;
+    {
+        protected override void Deserialize($name$ self)
+        {
+            throw new System.NotImplementedException();
+        }
+    }</s:String>
+	<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=C9AD3A6A561FAF4E9291C094532B2782/Text/@EntryValue">[ObjectSystem]
+public class AwakeSystem: AwakeSystem&lt;$name$&gt;
+    {
+        protected override void Awake($name$ self)
+        {
+            throw new System.NotImplementedException();
+        }
+    }</s:String>
+	<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=DE79363016CF7642B2EAEA51A418E7A0/Text/@EntryValue">[ObjectSystem]
+    public class UpdateSystem: UpdateSystem&lt;$name$&gt;
+    {
+        protected override void Update($name$ self)
+        {
+            throw new System.NotImplementedException();
+        }
+    }</s:String>
 	<s:Boolean x:Key="/Default/RiderDebugger/RiderRestoreDecompile/RestoreDecompileSetting/@EntryValue">False</s:Boolean>
 	<s:String x:Key="/Default/SnapshotsStore/CurrentStore/@EntryValue">C:\Users\USER-PC\AppData\Local\JetBrains\Shared\vAny\Sessions</s:String>
 	<s:Boolean x:Key="/Default/SymbolServers/RestoreDecompileSetting/@EntryValue">False</s:Boolean>

+ 4 - 5
Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/LockStepSceneChangeHelper.cs

@@ -11,7 +11,7 @@ namespace ET.Client
             CurrentScenesComponent currentScenesComponent = clientScene.GetComponent<CurrentScenesComponent>();
             currentScenesComponent.Scene?.Dispose(); // 删除之前的CurrentScene,创建新的
             Scene currentScene = SceneFactory.CreateCurrentScene(sceneInstanceId, clientScene.Zone, sceneName, currentScenesComponent);
-            UnitComponent unitComponent = currentScene.AddComponent<UnitComponent>();
+            UnitFComponent unitComponent = currentScene.AddComponent<UnitFComponent>();
 
             // 等待表现层订阅的事件完成
             await EventSystem.Instance.PublishAsync(clientScene, new EventType.LockStepSceneChangeStart());
@@ -23,11 +23,10 @@ namespace ET.Client
 
             foreach (LockStepUnitInfo lockStepUnitInfo in waitRoom2CEnterMap.Message.UnitInfo)
             {
-                FUnit unit = unitComponent.AddChild<FUnit>();
-                unit.Position = lockStepUnitInfo.Position;
-                unit.Rotation = lockStepUnitInfo.Rotation;
+                UnitFFactory.Create(currentScene, lockStepUnitInfo);
             }
-            
+
+            EventSystem.Instance.Publish(currentScene, new EventType.LockStepSceneInitFinish());
         }
     }
 }

+ 8 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/UnitF.meta

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

+ 19 - 0
Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/UnitF/UnitFFactory.cs

@@ -0,0 +1,19 @@
+using Unity.Mathematics;
+
+namespace ET.Client
+{
+    public static class UnitFFactory
+    {
+        public static UnitF Create(Scene currentScene, LockStepUnitInfo unitInfo)
+        {
+	        UnitFComponent unitComponent = currentScene.GetComponent<UnitFComponent>();
+	        UnitF unit = unitComponent.AddChildWithId<UnitF>(unitInfo.PlayerId);
+	        
+	        unit.Position = unitInfo.Position;
+	        unit.Rotation = unitInfo.Rotation;
+	        
+	        EventSystem.Instance.Publish(unit.DomainScene(), new EventType.LockStepAfterUnitCreate() {UnitF = unit});
+            return unit;
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Share/LockStep/FUnit.cs.meta → Unity/Assets/Scripts/Codes/Hotfix/Client/LockStep/UnitF/UnitFFactory.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 1c177b0717f7e4c758520338222af95a
+guid: 1a93a389ec0e241f099646159dae6dcd
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 8 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep.meta

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

+ 8 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF.meta

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

+ 15 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFComponentSystem.cs

@@ -0,0 +1,15 @@
+using System;
+
+namespace ET
+{
+    public static class UnitFComponentSystem
+    {
+        [ObjectSystem]
+        public class AwakeSystem: AwakeSystem<UnitFComponent>
+        {
+            protected override void Awake(UnitFComponent self)
+            {
+            }
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFComponentSystem.cs.meta

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

+ 16 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFSystem.cs

@@ -0,0 +1,16 @@
+using System;
+
+namespace ET
+{
+    public static class UnitFSystem
+    {
+        [ObjectSystem]
+        public class AwakeSystem: AwakeSystem<UnitF>
+        {
+            protected override void Awake(UnitF self)
+            {
+                
+            }
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/LockStep/UnitF/UnitFSystem.cs.meta

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

+ 8 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/FixedUpdate.meta

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

+ 50 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/FixedUpdate/FixedUpdateComponentSystem.cs

@@ -0,0 +1,50 @@
+using System;
+
+namespace ET
+{
+    [FriendOf(typeof(FixedUpdateComponent))]
+    public static class FixedUpdateComponentSystem
+    {
+        public static void Update(this FixedUpdateComponent self)
+        {
+            ++self.NowFrame;
+
+            // 让id保持从小到大update,后加进来的在一帧后面Update
+            while (self.addUpdateIds.Count > 0)
+            {
+                self.updateIds.Add(self.addUpdateIds.Dequeue());
+            }
+
+            foreach (long updateId in self.updateIds)
+            {
+                if (!self.updateEntities.TryGetValue(updateId, out FixedUpdateComponent.UpdateInfo updateInfo))
+                {
+                    self.removeUpdateIds.Enqueue(updateId);
+                    continue;
+                }
+                EventSystem.Instance.Invoke(updateInfo.Type, new FixUpdateInvokerArgs() {Entity = updateInfo.Entity});
+            }
+
+            while (self.removeUpdateIds.Count > 0)
+            {
+                self.updateIds.Remove(self.removeUpdateIds.Dequeue());
+            }
+        }
+        
+        public static long Add(this FixedUpdateComponent self, int type, Entity entity)
+        {
+            long updateId = ++self.idGenerator;
+            FixedUpdateComponent.UpdateInfo updateInfo = new() { UpdateId = updateId, Entity = entity, Type = type };
+            
+            self.updateEntities.Add(updateId, updateInfo);
+            
+            self.addUpdateIds.Enqueue(updateId);
+            return updateId;
+        }
+        
+        public static void Remove(this FixedUpdateComponent self, long updateId)
+        {
+            self.updateEntities.Remove(updateId);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/FixedUpdate/FixedUpdateComponentSystem.cs.meta

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

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Scene/CurrentScenesComponentSystem.cs

@@ -4,7 +4,7 @@ namespace ET
 {
     public static class CurrentScenesComponentSystem
     {
-        public static Scene CurrentScene(this Scene clientScene)
+        public static Scene  CurrentScene(this Scene clientScene)
         {
             return clientScene.GetComponent<CurrentScenesComponent>()?.Scene;
         }

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

@@ -0,0 +1,22 @@
+using ET.EventType;
+using UnityEngine;
+
+namespace ET.Client
+{
+    [Event(SceneType.Current)]
+    public class LockStepAfterUnitCreate_CreateUnitFView: AEvent<LockStepAfterUnitCreate>
+    {
+        protected override async ETTask Run(Scene currentScene, LockStepAfterUnitCreate args)
+        {
+            UnitFViewComponent unitFViewComponent = currentScene.GetComponent<UnitFViewComponent>();
+            
+            GameObject bundleGameObject = (GameObject)ResourcesComponent.Instance.GetAsset("Unit.unity3d", "Unit");
+            GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
+            
+            GameObject go = UnityEngine.Object.Instantiate(prefab, GlobalComponent.Instance.Unit, true);
+            go.transform.position = args.UnitF.Position.ToVector();
+
+            unitFViewComponent.AddChild<UnitFView, GameObject>(go);
+        }
+    }
+}

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

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

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

@@ -0,0 +1,36 @@
+using System;
+using UnityEngine;
+
+namespace ET.Client
+{
+    public static class LockStepOperaComponentSystem
+    {
+        [ObjectSystem]
+        public class UpdateSystem: UpdateSystem<LockStepOperaComponent>
+        {
+            protected override void Update(LockStepOperaComponent self)
+            {
+                int degree = 0;
+                if (Input.GetKeyDown(KeyCode.W))
+                {
+                    degree = 90;
+                }
+                
+                if (Input.GetKeyDown(KeyCode.A))
+                {
+                    degree = 180;
+                }
+                
+                if (Input.GetKeyDown(KeyCode.S))
+                {
+                    degree = 270;
+                }
+                
+                if (Input.GetKeyDown(KeyCode.D))
+                {
+                    degree = 360;
+                }
+            }
+        }
+    }
+}

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

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

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

@@ -5,16 +5,22 @@ namespace ET.Client
     [Event(SceneType.Client)]
     public class LockStepSceneChangeStart_AddComponent: AEvent<EventType.LockStepSceneChangeStart>
     {
-        protected override async ETTask Run(Scene scene, EventType.LockStepSceneChangeStart args)
+        protected override async ETTask Run(Scene clientScene, EventType.LockStepSceneChangeStart args)
         {
-            Scene currentScene = scene.CurrentScene();
+            Scene currentScene = clientScene.CurrentScene();
+            
+            // 创建loading界面
+            
+            // 删除大厅UI
+            await UIHelper.Remove(clientScene, UIType.UILobby);
             
             // 加载场景资源
             await ResourcesComponent.Instance.LoadBundleAsync($"{currentScene.Name}.unity3d");
             // 切换到map场景
 
             await SceneManager.LoadSceneAsync(currentScene.Name);
-			
+
+            currentScene.AddComponent<UnitFViewComponent>();
 
             currentScene.AddComponent<OperaComponent>();
         }

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

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

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

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

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

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

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

@@ -0,0 +1,17 @@
+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;
+            }
+        }
+    }
+}

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

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

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

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

+ 8 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/Module/TrueSync.meta

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

+ 58 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/Module/TrueSync/TrueSyncExtensions.cs

@@ -0,0 +1,58 @@
+using TrueSync;
+using System.Reflection;
+using UnityEngine;
+
+/**
+* @brief Extensions added by TrueSync.
+**/
+public static class TrueSyncExtensions {
+
+    public static TSVector ToTSVector(this Vector3 vector) {
+        return new TSVector(vector.x, vector.y, vector.z);
+    }
+
+    public static TSVector2 ToTSVector2(this Vector3 vector) {
+        return new TSVector2(vector.x, vector.y);
+    }
+
+    public static TSVector ToTSVector(this Vector2 vector) {
+        return new TSVector(vector.x, vector.y, 0);
+    }
+
+    public static TSVector2 ToTSVector2(this Vector2 vector) {
+        return new TSVector2(vector.x, vector.y);
+    }
+
+    public static Vector3 Abs(this Vector3 vector) {
+		return new Vector3(Mathf.Abs(vector.x), Mathf.Abs(vector.y), Mathf.Abs(vector.z));
+	}
+
+    public static TSQuaternion ToTSQuaternion(this Quaternion rot) {
+        return new TSQuaternion(rot.x, rot.y, rot.z, rot.w);
+    }
+
+    public static Quaternion ToQuaternion(this TSQuaternion rot) {
+        return new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.w);
+    }
+
+    public static TSMatrix ToTSMatrix(this Quaternion rot) {
+        return TSMatrix.CreateFromQuaternion(rot.ToTSQuaternion());
+    }
+
+    public static Vector3 ToVector(this TSVector jVector) {
+        return new Vector3((float) jVector.x, (float) jVector.y, (float) jVector.z);
+    }
+
+    public static Vector3 ToVector(this TSVector2 jVector) {
+        return new Vector3((float)jVector.x, (float)jVector.y, 0);
+    }
+
+    public static void Set(this TSVector jVector, TSVector otherVector) {
+        jVector.Set(otherVector.x, otherVector.y, otherVector.z);
+    }
+
+    public static Quaternion ToQuaternion(this TSMatrix jMatrix) {
+        return TSQuaternion.CreateFromMatrix(jMatrix).ToQuaternion();
+    }
+
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/HotfixView/Client/Module/TrueSync/TrueSyncExtensions.cs.meta

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

+ 7 - 0
Unity/Assets/Scripts/Codes/Model/Client/LockStep/Command.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public struct Command
+    {
+
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Client/LockStep/Command.cs.meta

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

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

@@ -6,8 +6,13 @@
         {
         }
         
-        public struct LockStepSceneChangeFinish
+        public struct LockStepSceneInitFinish
         {
         }
+
+        public struct LockStepAfterUnitCreate
+        {
+            public UnitF UnitF;
+        }
     }
 }

+ 2 - 2
Unity/Assets/Scripts/Codes/Model/Share/LockStep/FUnit.cs → Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF.cs

@@ -3,8 +3,8 @@ using TrueSync;
 
 namespace ET
 {
-    [ChildOf(typeof(UnitComponent))]
-    public class FUnit: Entity, IAwake, ISerializeToEntity
+    [ChildOf(typeof(UnitFComponent))]
+    public class UnitF: Entity, IAwake, ISerializeToEntity
     {
         public TSVector Position
         {

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF.cs.meta

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

+ 8 - 0
Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF.meta

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

+ 7 - 0
Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF/UnitFComponent.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+	[ComponentOf(typeof(Scene))]
+	public class UnitFComponent: Entity, IAwake, IDestroy, ISerializeToEntity
+	{
+	}
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Share/LockStep/UnitF/UnitFComponent.cs.meta

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

+ 8 - 0
Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate.meta

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

+ 17 - 0
Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/AFixUpdateHandler.cs

@@ -0,0 +1,17 @@
+namespace ET
+{
+    public struct FixUpdateInvokerArgs
+    {
+        public Entity Entity;
+    }
+    
+    public abstract class AFixUpdateHandler<T>: AInvokeHandler<FixUpdateInvokerArgs> where T: Entity
+    {
+        public override void Handle(FixUpdateInvokerArgs args)
+        {
+            this.Run(args.Entity as T);
+        }
+
+        protected abstract void Run(T t);
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/AFixUpdateHandler.cs.meta

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

+ 30 - 0
Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/FixedUpdateComponent.cs

@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace ET
+{
+    [ComponentOf(typeof(Scene))]
+    public class FixedUpdateComponent: Entity
+    {
+        public long idGenerator;
+        
+        public int ToFrame;
+        public int NowFrame;
+        
+        public struct UpdateInfo
+        {
+            public long UpdateId;
+            public int Type;
+            public Entity Entity;
+        }
+
+        [BsonIgnore]
+        public SortedSet<long> updateIds = new SortedSet<long>();
+        [BsonIgnore]
+        public Queue<long> addUpdateIds = new Queue<long>();
+        [BsonIgnore]
+        public Queue<long> removeUpdateIds = new Queue<long>();
+        [BsonIgnore]
+        public Dictionary<long, UpdateInfo> updateEntities = new Dictionary<long, UpdateInfo>();
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/Model/Share/Module/FixedUpdate/FixedUpdateComponent.cs.meta

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

+ 13 - 1
Unity/Assets/Scripts/Codes/Model/Share/Module/Scene/CurrentScenesComponent.cs

@@ -4,6 +4,18 @@
     [ComponentOf(typeof(Scene))]
     public class CurrentScenesComponent: Entity, IAwake
     {
-        public Scene Scene { get; set; }
+        private long sceneInstanceId;
+
+        public Scene Scene
+        {
+            get
+            {
+                return Root.Instance.Get(this.sceneInstanceId) as Scene;
+            }
+            set
+            {
+                this.sceneInstanceId = value.InstanceId;
+            }
+        }
     }
 }

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

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

+ 7 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/LockStepOperaComponent.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    [ComponentOf(typeof(Scene))]
+    public class LockStepOperaComponent: Entity, IUpdate
+    {
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/LockStepOperaComponent.cs.meta

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

+ 7 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/TrueSyncHelper.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public static class TrueSyncHelper
+    {
+        
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/TrueSyncHelper.cs.meta

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

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

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

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

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

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

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

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

@@ -0,0 +1,7 @@
+namespace ET
+{
+	[ComponentOf(typeof(Scene))]
+	public class UnitFViewComponent: Entity, IAwake, IDestroy
+	{
+	}
+}

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

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

+ 8 - 0
Unity/Assets/Scripts/Codes/ModelView/Client/LockStep/UnitView.meta

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