Преглед на файлове

分离Unit的逻辑跟显示层,Unit的GameObject放到GameObjectComponent组件上

tanghai преди 4 години
родител
ревизия
0cce11e223
променени са 37 файла, в които са добавени 429 реда и са изтрити 169 реда
  1. 4 4
      Proto/OuterMessage.proto
  2. 2 1
      Server/Hotfix/Demo/G2M_CreateUnitHandler.cs
  3. 52 0
      Server/Hotfix/Demo/Unit/UnitComponentSystem.cs
  4. 0 0
      Server/Hotfix/Demo/Unit/UnitPathComponentSystem.cs
  5. 10 0
      Server/Hotfix/Demo/Unit/UnitSystem.cs
  6. 0 40
      Server/Model/Demo/Unit.cs
  7. 0 0
      Server/Model/Demo/Unit/MoveComponent.cs
  8. 45 0
      Server/Model/Demo/Unit/Unit.cs
  9. 22 0
      Server/Model/Demo/Unit/UnitComponent.cs
  10. 0 0
      Server/Model/Demo/Unit/UnitGateComponent.cs
  11. 0 0
      Server/Model/Demo/Unit/UnitPathComponent.cs
  12. 0 67
      Server/Model/Demo/UnitComponent.cs
  13. 10 0
      Server/Model/EventType.cs
  14. 5 2
      Server/Model/Generate/Message/OuterMessage.cs
  15. 1 2
      Unity/Assets/Hotfix/Unit/M2C_CreateUnitsHandler.cs
  16. 1 1
      Unity/Assets/Hotfix/Unit/TurnComponentSystem.cs
  17. 5 4
      Unity/Assets/Hotfix/Unit/UnitFactory.cs
  18. 10 0
      Unity/Assets/Hotfix/Unit/UnitSystem.cs
  19. 11 0
      Unity/Assets/Hotfix/Unit/UnitSystem.cs.meta
  20. 2 0
      Unity/Assets/HotfixView/AppStart_Init.cs
  21. 8 0
      Unity/Assets/HotfixView/Global.meta
  22. 16 0
      Unity/Assets/HotfixView/Global/GlobalComponentSystem.cs
  23. 11 0
      Unity/Assets/HotfixView/Global/GlobalComponentSystem.cs.meta
  24. 4 3
      Unity/Assets/HotfixView/Unit/AfterUnitCreate_CreateUnitView.cs
  25. 1 1
      Unity/Assets/HotfixView/Unit/AnimatorComponentSystem.cs
  26. 10 0
      Unity/Assets/Model/EventType.cs
  27. 5 2
      Unity/Assets/Model/Generate/Message/OuterMessage.cs
  28. 38 40
      Unity/Assets/Model/Unit/Unit.cs
  29. 8 0
      Unity/Assets/ModelView/Global.meta
  30. 13 0
      Unity/Assets/ModelView/Global/GlobalComponent.cs
  31. 11 0
      Unity/Assets/ModelView/Global/GlobalComponent.cs.meta
  32. 9 0
      Unity/Assets/ModelView/Unit/GameObjectComponent.cs
  33. 11 0
      Unity/Assets/ModelView/Unit/GameObjectComponent.cs.meta
  34. 100 2
      Unity/Assets/Scenes/Init.unity
  35. 1 0
      Unity/Unity.Hotfix.csproj
  36. 1 0
      Unity/Unity.HotfixView.csproj
  37. 2 0
      Unity/Unity.ModelView.csproj

+ 4 - 4
Proto/OuterMessage.proto

@@ -52,10 +52,10 @@ message G2C_EnterMap // IResponse
 message UnitInfo
 message UnitInfo
 {
 {
 	int64 UnitId  = 1;
 	int64 UnitId  = 1;
-
-	float X = 2;
-	float Y = 3;
-	float Z = 4;
+    int32 ConfigId = 2;
+	float X = 3;
+	float Y = 4;
+	float Z = 5;
 }
 }
 
 
 message M2C_CreateUnits // IActorMessage
 message M2C_CreateUnits // IActorMessage

+ 2 - 1
Server/Hotfix/Demo/G2M_CreateUnitHandler.cs

@@ -8,7 +8,7 @@ namespace ET
 	{
 	{
 		protected override async ETTask Run(Scene scene, G2M_CreateUnit request, M2G_CreateUnit response, Action reply)
 		protected override async ETTask Run(Scene scene, G2M_CreateUnit request, M2G_CreateUnit response, Action reply)
 		{
 		{
-			Unit unit = EntityFactory.CreateWithId<Unit>(scene, IdGenerater.Instance.GenerateId());
+			Unit unit = EntityFactory.CreateWithId<Unit, int>(scene, IdGenerater.Instance.GenerateId(), 1001);
 			unit.AddComponent<MoveComponent>();
 			unit.AddComponent<MoveComponent>();
 			unit.AddComponent<UnitPathComponent>();
 			unit.AddComponent<UnitPathComponent>();
 			unit.Position = new Vector3(-10, 0, -10);
 			unit.Position = new Vector3(-10, 0, -10);
@@ -30,6 +30,7 @@ namespace ET
 				unitInfo.Y = u.Position.y;
 				unitInfo.Y = u.Position.y;
 				unitInfo.Z = u.Position.z;
 				unitInfo.Z = u.Position.z;
 				unitInfo.UnitId = u.Id;
 				unitInfo.UnitId = u.Id;
+				unitInfo.ConfigId = u.ConfigId;
 				createUnits.Units.Add(unitInfo);
 				createUnits.Units.Add(unitInfo);
 			}
 			}
 			MessageHelper.Broadcast(unit, createUnits);
 			MessageHelper.Broadcast(unit, createUnits);

+ 52 - 0
Server/Hotfix/Demo/Unit/UnitComponentSystem.cs

@@ -0,0 +1,52 @@
+using System.Linq;
+
+namespace ET
+{
+    public class UnitComponentAwakeSystem: AwakeSystem<UnitComponent>
+    {
+        public override void Awake(UnitComponent self)
+        {
+        }
+    }
+    
+    public class UnitComponentDestroySystem: DestroySystem<UnitComponent>
+    {
+        public override void Destroy(UnitComponent self)
+        {
+            self.idUnits.Clear();
+        }
+    }
+    
+    public static class UnitComponentSystem
+    {
+        public static void Add(this UnitComponent self, Unit unit)
+        {
+            unit.Parent = self;
+            self.idUnits.Add(unit.Id, unit);
+        }
+
+        public static Unit Get(this UnitComponent self, long id)
+        {
+            self.idUnits.TryGetValue(id, out Unit unit);
+            return unit;
+        }
+
+        public static void Remove(this UnitComponent self, long id)
+        {
+            Unit unit;
+            self.idUnits.TryGetValue(id, out unit);
+            self.idUnits.Remove(id);
+            unit?.Dispose();
+        }
+
+        public static void RemoveNoDispose(this UnitComponent self, long id)
+        {
+            self.idUnits.Remove(id);
+        }
+
+        public static Unit[] GetAll(this UnitComponent self)
+        {
+            return self.idUnits.Values.ToArray();
+        }
+    }
+}

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


+ 10 - 0
Server/Hotfix/Demo/Unit/UnitSystem.cs

@@ -0,0 +1,10 @@
+namespace ET
+{
+    public class UnitSystem: AwakeSystem<Unit, int>
+    {
+        public override void Awake(Unit self, int configId)
+        {
+            self.ConfigId = configId;
+        }
+    }
+}

+ 0 - 40
Server/Model/Demo/Unit.cs

@@ -1,40 +0,0 @@
-using UnityEngine;
-
-namespace ET
-{
-	public enum UnitType
-	{
-		Hero,
-		Npc
-	}
-
-	public class UnitAwakeSystem : AwakeSystem<Unit, UnitType>
-	{
-		public override void Awake(Unit self, UnitType a)
-		{
-			self.Awake(a);
-		}
-	}
-
-	public sealed class Unit: Entity
-	{
-		public UnitType UnitType { get; private set; }
-		
-		public Vector3 Position { get; set; }
-		
-		public void Awake(UnitType unitType)
-		{
-			this.UnitType = unitType;
-		}
-
-		public override void Dispose()
-		{
-			if (this.IsDisposed)
-			{
-				return;
-			}
-
-			base.Dispose();
-		}
-	}
-}

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


+ 45 - 0
Server/Model/Demo/Unit/Unit.cs

@@ -0,0 +1,45 @@
+using System;
+using MongoDB.Bson.Serialization.Attributes;
+using UnityEngine;
+
+namespace ET
+{
+    [BsonIgnoreExtraElements]
+    public sealed class Unit: Entity
+    {
+        public int ConfigId; //配置表id
+
+        [BsonIgnore]
+        public UnitConfig Config => UnitConfigCategory.Instance.Get(this.ConfigId);
+
+        private Vector3 position; //坐标
+
+        public Vector3 Position
+        {
+            get => this.position;
+            set
+            {
+                this.position = value;
+                Game.EventSystem.Publish(new EventType.ChangePosition() { Unit = this }).Coroutine();
+            }
+        }
+
+        [BsonIgnore]
+        public Vector3 Forward
+        {
+            get => this.Rotation * Vector3.forward;
+            set => this.Rotation = Quaternion.LookRotation(value, Vector3.up);
+        }
+
+        private Quaternion rotation;
+        public Quaternion Rotation
+        {
+            get => this.rotation;
+            set
+            {
+                this.rotation = value;
+                Game.EventSystem.Publish(new EventType.ChangeRotation() {Unit = this}).Coroutine();
+            }
+        }
+    }
+}

+ 22 - 0
Server/Model/Demo/Unit/UnitComponent.cs

@@ -0,0 +1,22 @@
+using System.Collections.Generic;
+using System.Linq;
+using MongoDB.Bson.Serialization.Attributes;
+using MongoDB.Bson.Serialization.Options;
+
+namespace ET
+{
+	public class UnitComponent: Entity
+	{
+		[BsonElement]
+		[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
+		public readonly Dictionary<long, Unit> idUnits = new Dictionary<long, Unit>();
+		
+		public int Count
+		{
+			get
+			{
+				return this.idUnits.Count;
+			}
+		}
+	}
+}

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


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


+ 0 - 67
Server/Model/Demo/UnitComponent.cs

@@ -1,67 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using MongoDB.Bson.Serialization.Attributes;
-using MongoDB.Bson.Serialization.Options;
-
-namespace ET
-{
-	public class UnitComponent: Entity
-	{
-		[BsonElement]
-		[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
-		private readonly Dictionary<long, Unit> idUnits = new Dictionary<long, Unit>();
-
-		public override void Dispose()
-		{
-			if (this.IsDisposed)
-			{
-				return;
-			}
-			base.Dispose();
-
-			foreach (Unit unit in this.idUnits.Values)
-			{
-				unit.Dispose();
-			}
-			this.idUnits.Clear();
-		}
-
-		public void Add(Unit unit)
-		{
-			this.idUnits.Add(unit.Id, unit);
-			unit.Parent = this;
-		}
-
-		public Unit Get(long id)
-		{
-			this.idUnits.TryGetValue(id, out Unit unit);
-			return unit;
-		}
-
-		public void Remove(long id)
-		{
-			Unit unit;
-			this.idUnits.TryGetValue(id, out unit);
-			this.idUnits.Remove(id);
-			unit?.Dispose();
-		}
-
-		public void RemoveNoDispose(long id)
-		{
-			this.idUnits.Remove(id);
-		}
-
-		public int Count
-		{
-			get
-			{
-				return this.idUnits.Count;
-			}
-		}
-
-		public Unit[] GetAll()
-		{
-			return this.idUnits.Values.ToArray();
-		}
-	}
-}

+ 10 - 0
Server/Model/EventType.cs

@@ -5,5 +5,15 @@
 		public struct AppStart
 		public struct AppStart
 		{
 		{
 		}
 		}
+		
+		public struct ChangePosition
+		{
+			public Unit Unit;
+		}
+
+		public struct ChangeRotation
+		{
+			public Unit Unit;
+		}
 	}
 	}
 }
 }

+ 5 - 2
Server/Model/Generate/Message/OuterMessage.cs

@@ -111,12 +111,15 @@ namespace ET
 		public long UnitId { get; set; }
 		public long UnitId { get; set; }
 
 
 		[ProtoMember(2)]
 		[ProtoMember(2)]
-		public float X { get; set; }
+		public int ConfigId { get; set; }
 
 
 		[ProtoMember(3)]
 		[ProtoMember(3)]
-		public float Y { get; set; }
+		public float X { get; set; }
 
 
 		[ProtoMember(4)]
 		[ProtoMember(4)]
+		public float Y { get; set; }
+
+		[ProtoMember(5)]
 		public float Z { get; set; }
 		public float Z { get; set; }
 
 
 	}
 	}

+ 1 - 2
Unity/Assets/Hotfix/Unit/M2C_CreateUnitsHandler.cs

@@ -16,8 +16,7 @@ namespace ET
 				{
 				{
 					continue;
 					continue;
 				}
 				}
-				Unit unit = UnitFactory.Create(session.Domain, unitInfo.UnitId);
-				unit.Position = new Vector3(unitInfo.X, unitInfo.Y, unitInfo.Z);
+				Unit unit = UnitFactory.Create(session.Domain, unitInfo);
 			}
 			}
 
 
 			await ETTask.CompletedTask;
 			await ETTask.CompletedTask;

+ 1 - 1
Unity/Assets/Hotfix/Unit/TurnComponentSystem.cs

@@ -37,7 +37,7 @@ namespace ET
 		/// </summary>
 		/// </summary>
 		public static void Turn2D(this TurnComponent self, Vector3 dir, float turnTime = 0.1f)
 		public static void Turn2D(this TurnComponent self, Vector3 dir, float turnTime = 0.1f)
 		{
 		{
-			Vector3 nexpos = self.GetParent<Unit>().GameObject.transform.position + dir;
+			Vector3 nexpos = self.GetParent<Unit>().Position + dir;
 			self.Turn(nexpos, turnTime);
 			self.Turn(nexpos, turnTime);
 		}
 		}
 
 

+ 5 - 4
Unity/Assets/Hotfix/Unit/UnitFactory.cs

@@ -4,18 +4,19 @@ namespace ET
 {
 {
     public static class UnitFactory
     public static class UnitFactory
     {
     {
-        public static Unit Create(Entity domain, long id)
+        public static Unit Create(Entity domain, UnitInfo unitInfo)
         {
         {
-	        Unit unit = EntityFactory.CreateWithId<Unit>(domain, id);
+	        Unit unit = EntityFactory.CreateWithId<Unit, int>(domain, unitInfo.UnitId, unitInfo.ConfigId);
+	        unit.Position = new Vector3(unitInfo.X, unitInfo.Y, unitInfo.Z);
 	        
 	        
 	        unit.AddComponent<MoveComponent>();
 	        unit.AddComponent<MoveComponent>();
 	        unit.AddComponent<TurnComponent>();
 	        unit.AddComponent<TurnComponent>();
 	        unit.AddComponent<UnitPathComponent>();
 	        unit.AddComponent<UnitPathComponent>();
 
 
-	        Game.EventSystem.Publish(new EventType.AfterUnitCreate() {Unit = unit});
-	        
 	        UnitComponent unitComponent = domain.GetComponent<UnitComponent>();
 	        UnitComponent unitComponent = domain.GetComponent<UnitComponent>();
             unitComponent.Add(unit);
             unitComponent.Add(unit);
+            
+            Game.EventSystem.Publish(new EventType.AfterUnitCreate() {Unit = unit});
             return unit;
             return unit;
         }
         }
     }
     }

+ 10 - 0
Unity/Assets/Hotfix/Unit/UnitSystem.cs

@@ -0,0 +1,10 @@
+namespace ET
+{
+    public class UnitSystem: AwakeSystem<Unit, int>
+    {
+        public override void Awake(Unit self, int configId)
+        {
+            self.ConfigId = configId;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Hotfix/Unit/UnitSystem.cs.meta

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

+ 2 - 0
Unity/Assets/HotfixView/AppStart_Init.cs

@@ -21,6 +21,8 @@ namespace ET
             Game.Scene.AddComponent<NetThreadComponent>();
             Game.Scene.AddComponent<NetThreadComponent>();
 
 
             Game.Scene.AddComponent<ZoneSceneManagerComponent>();
             Game.Scene.AddComponent<ZoneSceneManagerComponent>();
+            
+            Game.Scene.AddComponent<GlobalComponent>();
 
 
             ResourcesComponent.Instance.LoadBundle("unit.unity3d");
             ResourcesComponent.Instance.LoadBundle("unit.unity3d");
 
 

+ 8 - 0
Unity/Assets/HotfixView/Global.meta

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

+ 16 - 0
Unity/Assets/HotfixView/Global/GlobalComponentSystem.cs

@@ -0,0 +1,16 @@
+using UnityEngine;
+
+namespace ET
+{
+    public class GlobalComponentAwakeSystem: AwakeSystem<GlobalComponent>
+    {
+        public override void Awake(GlobalComponent self)
+        {
+            GlobalComponent.Instance = self;
+            
+            self.Global = GameObject.Find("/Global").transform;
+            self.Unit = GameObject.Find("/Global/Unit").transform;
+            self.UI = GameObject.Find("/Global/UI").transform;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/HotfixView/Global/GlobalComponentSystem.cs.meta

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

+ 4 - 3
Unity/Assets/HotfixView/Unit/AfterUnitCreate_CreateUnitView.cs

@@ -7,12 +7,13 @@ namespace ET
         protected override async ETTask Run(EventType.AfterUnitCreate args)
         protected override async ETTask Run(EventType.AfterUnitCreate args)
         {
         {
             // Unit View层
             // Unit View层
+            // 这里可以改成异步加载,demo就不搞了
             GameObject bundleGameObject = (GameObject)ResourcesComponent.Instance.GetAsset("Unit.unity3d", "Unit");
             GameObject bundleGameObject = (GameObject)ResourcesComponent.Instance.GetAsset("Unit.unity3d", "Unit");
             GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
             GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
 	        
 	        
-            GameObject go = UnityEngine.Object.Instantiate(prefab);
-            GameObject.DontDestroyOnLoad(go);
-            args.Unit.GameObject = go;
+            GameObject go = UnityEngine.Object.Instantiate(prefab, GlobalComponent.Instance.Unit, true);
+            go.transform.position = args.Unit.Position;
+            args.Unit.AddComponent<GameObjectComponent>().GameObject = go;
             args.Unit.AddComponent<AnimatorComponent>();
             args.Unit.AddComponent<AnimatorComponent>();
             await ETTask.CompletedTask;
             await ETTask.CompletedTask;
         }
         }

+ 1 - 1
Unity/Assets/HotfixView/Unit/AnimatorComponentSystem.cs

@@ -33,7 +33,7 @@ namespace ET
 	{
 	{
 		public static void Awake(this AnimatorComponent self)
 		public static void Awake(this AnimatorComponent self)
 		{
 		{
-			Animator animator = self.GetParent<Unit>().GameObject.GetComponent<Animator>();
+			Animator animator = self.Parent.GetComponent<GameObjectComponent>().GameObject.GetComponent<Animator>();
 
 
 			if (animator == null)
 			if (animator == null)
 			{
 			{

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

@@ -6,6 +6,16 @@
         {
         {
         }
         }
 
 
+        public struct ChangePosition
+        {
+            public Unit Unit;
+        }
+
+        public struct ChangeRotation
+        {
+            public Unit Unit;
+        }
+
         public struct PingChange
         public struct PingChange
         {
         {
             public Scene ZoneScene;
             public Scene ZoneScene;

+ 5 - 2
Unity/Assets/Model/Generate/Message/OuterMessage.cs

@@ -111,12 +111,15 @@ namespace ET
 		public long UnitId { get; set; }
 		public long UnitId { get; set; }
 
 
 		[ProtoMember(2)]
 		[ProtoMember(2)]
-		public float X { get; set; }
+		public int ConfigId { get; set; }
 
 
 		[ProtoMember(3)]
 		[ProtoMember(3)]
-		public float Y { get; set; }
+		public float X { get; set; }
 
 
 		[ProtoMember(4)]
 		[ProtoMember(4)]
+		public float Y { get; set; }
+
+		[ProtoMember(5)]
 		public float Z { get; set; }
 		public float Z { get; set; }
 
 
 	}
 	}

+ 38 - 40
Unity/Assets/Model/Unit/Unit.cs

@@ -1,47 +1,45 @@
-using UnityEngine;
-using Quaternion = UnityEngine.Quaternion;
-using Vector3 = UnityEngine.Vector3;
+using System;
+using MongoDB.Bson.Serialization.Attributes;
+using UnityEngine;
 
 
 namespace ET
 namespace ET
 {
 {
-	public sealed class Unit: Entity
-	{
-		// 先放这里,去掉ViewGO,后面挪到显示层
-		public GameObject GameObject;
-		
-		public int ConfigId;
+    [BsonIgnoreExtraElements]
+    public sealed class Unit: Entity
+    {
+        public int ConfigId; //配置表id
 
 
-		public UnitConfig Config
-		{
-			get
-			{
-				return UnitConfigCategory.Instance.Get(this.ConfigId);
-			}
-		}
-		
-		public Vector3 Position
-		{
-			get
-			{
-				return GameObject.transform.position;
-			}
-			set
-			{
-				GameObject.transform.position = value;
-			}
-		}
+        [BsonIgnore]
+        public UnitConfig Config => UnitConfigCategory.Instance.Get(this.ConfigId);
 
 
-		public Quaternion Rotation
-		{
-			get
-			{
-				return GameObject.transform.rotation;
-			}
-			set
-			{
-				GameObject.transform.rotation = value;
-			}
-		}
+        private Vector3 position; //坐标
 
 
-	}
+        public Vector3 Position
+        {
+            get => this.position;
+            set
+            {
+                this.position = value;
+                Game.EventSystem.Publish(new EventType.ChangePosition() { Unit = this }).Coroutine();
+            }
+        }
+
+        [BsonIgnore]
+        public Vector3 Forward
+        {
+            get => this.Rotation * Vector3.forward;
+            set => this.Rotation = Quaternion.LookRotation(value, Vector3.up);
+        }
+
+        private Quaternion rotation;
+        public Quaternion Rotation
+        {
+            get => this.rotation;
+            set
+            {
+                this.rotation = value;
+                Game.EventSystem.Publish(new EventType.ChangeRotation() {Unit = this}).Coroutine();
+            }
+        }
+    }
 }
 }

+ 8 - 0
Unity/Assets/ModelView/Global.meta

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

+ 13 - 0
Unity/Assets/ModelView/Global/GlobalComponent.cs

@@ -0,0 +1,13 @@
+using UnityEngine;
+
+namespace ET
+{
+    public class GlobalComponent: Entity
+    {
+        public static GlobalComponent Instance;
+        
+        public Transform Global;
+        public Transform Unit;
+        public Transform UI;
+    }
+}

+ 11 - 0
Unity/Assets/ModelView/Global/GlobalComponent.cs.meta

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

+ 9 - 0
Unity/Assets/ModelView/Unit/GameObjectComponent.cs

@@ -0,0 +1,9 @@
+using UnityEngine;
+
+namespace ET
+{
+    public class GameObjectComponent: Entity
+    {
+        public GameObject GameObject;
+    }
+}

+ 11 - 0
Unity/Assets/ModelView/Unit/GameObjectComponent.cs.meta

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

+ 100 - 2
Unity/Assets/Scenes/Init.unity

@@ -43,7 +43,7 @@ RenderSettings:
 --- !u!157 &3
 --- !u!157 &3
 LightmapSettings:
 LightmapSettings:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
-  serializedVersion: 11
+  serializedVersion: 12
   m_GIWorkflowMode: 0
   m_GIWorkflowMode: 0
   m_GISettings:
   m_GISettings:
     serializedVersion: 2
     serializedVersion: 2
@@ -98,7 +98,7 @@ LightmapSettings:
     m_TrainingDataDestination: TrainingData
     m_TrainingDataDestination: TrainingData
     m_LightProbeSampleCountMultiplier: 4
     m_LightProbeSampleCountMultiplier: 4
   m_LightingDataAsset: {fileID: 0}
   m_LightingDataAsset: {fileID: 0}
-  m_UseShadowmask: 0
+  m_LightingSettings: {fileID: 94338416}
 --- !u!196 &4
 --- !u!196 &4
 NavMeshSettings:
 NavMeshSettings:
   serializedVersion: 2
   serializedVersion: 2
@@ -118,9 +118,72 @@ NavMeshSettings:
     manualTileSize: 0
     manualTileSize: 0
     tileSize: 256
     tileSize: 256
     accuratePlacement: 0
     accuratePlacement: 0
+    maxJobWorkers: 0
+    preserveTilesOutsideBounds: 0
     debug:
     debug:
       m_Flags: 0
       m_Flags: 0
   m_NavMeshData: {fileID: 0}
   m_NavMeshData: {fileID: 0}
+--- !u!850595691 &94338416
+LightingSettings:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: Settings.lighting
+  serializedVersion: 3
+  m_GIWorkflowMode: 0
+  m_EnableBakedLightmaps: 1
+  m_EnableRealtimeLightmaps: 1
+  m_RealtimeEnvironmentLighting: 1
+  m_BounceScale: 1
+  m_AlbedoBoost: 1
+  m_IndirectOutputScale: 1
+  m_UsingShadowmask: 0
+  m_BakeBackend: 0
+  m_LightmapMaxSize: 1024
+  m_BakeResolution: 40
+  m_Padding: 2
+  m_TextureCompression: 1
+  m_AO: 0
+  m_AOMaxDistance: 1
+  m_CompAOExponent: 0
+  m_CompAOExponentDirect: 0
+  m_ExtractAO: 0
+  m_MixedBakeMode: 1
+  m_LightmapsBakeMode: 1
+  m_FilterMode: 1
+  m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
+  m_ExportTrainingData: 0
+  m_TrainingDataDestination: TrainingData
+  m_RealtimeResolution: 2
+  m_ForceWhiteAlbedo: 0
+  m_ForceUpdates: 0
+  m_FinalGather: 0
+  m_FinalGatherRayCount: 1024
+  m_FinalGatherFiltering: 1
+  m_PVRCulling: 1
+  m_PVRSampling: 1
+  m_PVRDirectSampleCount: 32
+  m_PVRSampleCount: 500
+  m_PVREnvironmentSampleCount: 500
+  m_PVREnvironmentReferencePointCount: 2048
+  m_LightProbeSampleCountMultiplier: 4
+  m_PVRBounces: 2
+  m_PVRMinBounces: 2
+  m_PVREnvironmentMIS: 0
+  m_PVRFilteringMode: 2
+  m_PVRDenoiserTypeDirect: 0
+  m_PVRDenoiserTypeIndirect: 0
+  m_PVRDenoiserTypeAO: 0
+  m_PVRFilterTypeDirect: 0
+  m_PVRFilterTypeIndirect: 0
+  m_PVRFilterTypeAO: 0
+  m_PVRFilteringGaussRadiusDirect: 1
+  m_PVRFilteringGaussRadiusIndirect: 5
+  m_PVRFilteringGaussRadiusAO: 2
+  m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+  m_PVRFilteringAtrousPositionSigmaIndirect: 2
+  m_PVRFilteringAtrousPositionSigmaAO: 1
 --- !u!1 &251107983
 --- !u!1 &251107983
 GameObject:
 GameObject:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -198,6 +261,7 @@ MonoBehaviour:
   m_FallbackScreenDPI: 96
   m_FallbackScreenDPI: 96
   m_DefaultSpriteDPI: 96
   m_DefaultSpriteDPI: 96
   m_DynamicPixelsPerUnit: 1
   m_DynamicPixelsPerUnit: 1
+  m_PresetInfoIsWorld: 0
 --- !u!223 &251107987
 --- !u!223 &251107987
 Canvas:
 Canvas:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -362,6 +426,7 @@ MonoBehaviour:
   m_FallbackScreenDPI: 96
   m_FallbackScreenDPI: 96
   m_DefaultSpriteDPI: 96
   m_DefaultSpriteDPI: 96
   m_DynamicPixelsPerUnit: 1
   m_DynamicPixelsPerUnit: 1
+  m_PresetInfoIsWorld: 0
 --- !u!223 &493985073
 --- !u!223 &493985073
 Canvas:
 Canvas:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -425,6 +490,7 @@ Transform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children:
   m_Children:
   - {fileID: 1784017108}
   - {fileID: 1784017108}
+  - {fileID: 630054496}
   m_Father: {fileID: 0}
   m_Father: {fileID: 0}
   m_RootOrder: 1
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -444,6 +510,36 @@ MonoBehaviour:
   - key: Unit
   - key: Unit
     gameObject: {fileID: 1610378981859644, guid: cfaf4529ce2243c4c85126e9d008897b,
     gameObject: {fileID: 1610378981859644, guid: cfaf4529ce2243c4c85126e9d008897b,
       type: 3}
       type: 3}
+--- !u!1 &630054495
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 630054496}
+  m_Layer: 0
+  m_Name: Unit
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &630054496
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 630054495}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 575235020}
+  m_RootOrder: 1
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
 --- !u!1 &872594939
 --- !u!1 &872594939
 GameObject:
 GameObject:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -521,6 +617,7 @@ MonoBehaviour:
   m_FallbackScreenDPI: 96
   m_FallbackScreenDPI: 96
   m_DefaultSpriteDPI: 96
   m_DefaultSpriteDPI: 96
   m_DynamicPixelsPerUnit: 1
   m_DynamicPixelsPerUnit: 1
+  m_PresetInfoIsWorld: 0
 --- !u!223 &872594943
 --- !u!223 &872594943
 Canvas:
 Canvas:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -711,6 +808,7 @@ MonoBehaviour:
   m_FallbackScreenDPI: 96
   m_FallbackScreenDPI: 96
   m_DefaultSpriteDPI: 96
   m_DefaultSpriteDPI: 96
   m_DynamicPixelsPerUnit: 1
   m_DynamicPixelsPerUnit: 1
+  m_PresetInfoIsWorld: 0
 --- !u!223 &1439952252
 --- !u!223 &1439952252
 Canvas:
 Canvas:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0

+ 1 - 0
Unity/Unity.Hotfix.csproj

@@ -74,6 +74,7 @@
      <Compile Include="Assets\Hotfix\Module\Message\SessionAcceptTimeoutComponentSystem.cs" />
      <Compile Include="Assets\Hotfix\Module\Message\SessionAcceptTimeoutComponentSystem.cs" />
      <Compile Include="Assets\Hotfix\Scene\ZoneSceneFlagComponentSystem.cs" />
      <Compile Include="Assets\Hotfix\Scene\ZoneSceneFlagComponentSystem.cs" />
      <Compile Include="Assets\Hotfix\Scene\ZoneSceneManagerComponentSystem.cs" />
      <Compile Include="Assets\Hotfix\Scene\ZoneSceneManagerComponentSystem.cs" />
+     <Compile Include="Assets\Hotfix\Unit\UnitSystem.cs" />
      <None Include="Assets\Hotfix\Unity.Hotfix.asmdef" />
      <None Include="Assets\Hotfix\Unity.Hotfix.asmdef" />
  <Reference Include="UnityEngine">
  <Reference Include="UnityEngine">
  <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>
  <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>

+ 1 - 0
Unity/Unity.HotfixView.csproj

@@ -76,6 +76,7 @@
      <Compile Include="Assets\HotfixView\Helper\LoadConfigHelper.cs" />
      <Compile Include="Assets\HotfixView\Helper\LoadConfigHelper.cs" />
      <Compile Include="Assets\HotfixView\Unit\AnimatorComponentSystem.cs" />
      <Compile Include="Assets\HotfixView\Unit\AnimatorComponentSystem.cs" />
      <Compile Include="Assets\HotfixView\Scene\AfterCreateZoneScene_AddComponent.cs" />
      <Compile Include="Assets\HotfixView\Scene\AfterCreateZoneScene_AddComponent.cs" />
+     <Compile Include="Assets\HotfixView\Global\GlobalComponentSystem.cs" />
      <None Include="Assets\HotfixView\Unity.HotfixView.asmdef" />
      <None Include="Assets\HotfixView\Unity.HotfixView.asmdef" />
  <Reference Include="UnityEngine">
  <Reference Include="UnityEngine">
  <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>
  <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>

+ 2 - 0
Unity/Unity.ModelView.csproj

@@ -71,6 +71,8 @@
      <Compile Include="Assets\ModelView\UI\UILoading\UILoadingComponent.cs" />
      <Compile Include="Assets\ModelView\UI\UILoading\UILoadingComponent.cs" />
      <Compile Include="Assets\ModelView\Module\UI\CanvasConfig.cs" />
      <Compile Include="Assets\ModelView\Module\UI\CanvasConfig.cs" />
      <Compile Include="Assets\ModelView\Module\UI\UIEventAttribute.cs" />
      <Compile Include="Assets\ModelView\Module\UI\UIEventAttribute.cs" />
+     <Compile Include="Assets\ModelView\Unit\GameObjectComponent.cs" />
+     <Compile Include="Assets\ModelView\Global\GlobalComponent.cs" />
      <None Include="Assets\ModelView\Unity.ModelView.asmdef" />
      <None Include="Assets\ModelView\Unity.ModelView.asmdef" />
  <Reference Include="UnityEngine">
  <Reference Include="UnityEngine">
  <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>
  <HintPath>/Applications/Unity/Hub/Editor/2020.2.2f1c1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>