Explorar el Código

AOI抽成模块

tanghai hace 3 años
padre
commit
16a3e535ef

+ 8 - 0
Apps/Hotfix/Apps.Hotfix.csproj

@@ -40,6 +40,14 @@
             <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
+        <Compile Include="..\..\Unity\Codes\Hotfix\Module\Move\**\*.cs">
+            <Link>Module\Move\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Codes\Hotfix\Module\Unit\**\*.cs">
+            <Link>Module\Unit\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
         <Compile Include="..\..\Unity\Codes\Hotfix\Client\**\*.cs">
             <Link>Client\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>

+ 1 - 1
Apps/Hotfix/Server/AOI/AOIEntitySystem.cs → Apps/Hotfix/Module/AOI/AOIEntitySystem.cs

@@ -1,7 +1,7 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace ET.Server
+namespace ET
 {
     [FriendClass(typeof(AOIEntity))]
     [FriendClass(typeof(Cell))]

+ 1 - 1
Apps/Hotfix/Server/AOI/AOIHelper.cs → Apps/Hotfix/Module/AOI/AOIHelper.cs

@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace ET.Server
+namespace ET
 {
     [FriendClass(typeof(AOIEntity))]
     public static class AOIHelper

+ 1 - 1
Apps/Hotfix/Server/AOI/AOIManagerComponentSystem.cs → Apps/Hotfix/Module/AOI/AOIManagerComponentSystem.cs

@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace ET.Server
+namespace ET
 {
     [FriendClass(typeof(AOIManagerComponent))]
     [FriendClass(typeof(AOIEntity))]

+ 1 - 1
Apps/Hotfix/Server/AOI/AOISeeCheckHelper.cs → Apps/Hotfix/Module/AOI/AOISeeCheckHelper.cs

@@ -1,4 +1,4 @@
-namespace ET.Server
+namespace ET
 {
     public static class AOISeeCheckHelper
     {

+ 1 - 1
Apps/Hotfix/Server/AOI/CellSystem.cs → Apps/Hotfix/Module/AOI/CellSystem.cs

@@ -1,7 +1,7 @@
 using System.Collections.Generic;
 using System.Text;
 
-namespace ET.Server
+namespace ET
 {
     [FriendClass(typeof(Cell))]
     public static class CellSystem

+ 8 - 0
Apps/Model/Apps.Model.csproj

@@ -81,6 +81,14 @@
             <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>
 
+        <Compile Include="..\..\Unity\Codes\Model\Module\Move\**\*.cs">
+            <Link>Module\Move\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Codes\Model\Module\Unit\**\*.cs">
+            <Link>Module\Unit\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
         <Compile Include="..\..\Unity\Codes\Model\Client\**\*.cs"> 
             <Link>Client\%(RecursiveDir)%(FileName)%(Extension)</Link>
         </Compile>

+ 1 - 1
Apps/Model/Server/AOI/AOIEntity.cs → Apps/Model/Module/AOI/AOIEntity.cs

@@ -1,7 +1,7 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace ET.Server
+namespace ET
 {
     [ComponentOf(typeof(Unit))]
     public class AOIEntity: Entity, IAwake<int, Vector3>, IDestroy

+ 1 - 1
Apps/Model/Server/EventType.cs → Apps/Model/Module/AOI/AOIEventType.cs

@@ -1,4 +1,4 @@
-namespace ET.Server
+namespace ET
 {
 	namespace EventType
 	{

+ 1 - 1
Apps/Model/Server/AOI/AOIManagerComponent.cs → Apps/Model/Module/AOI/AOIManagerComponent.cs

@@ -1,4 +1,4 @@
-namespace ET.Server
+namespace ET
 {
     [ChildType(typeof(Cell))]
     [ComponentOf(typeof(Scene))]

+ 1 - 1
Apps/Model/Server/AOI/Cell.cs → Apps/Model/Module/AOI/Cell.cs

@@ -1,6 +1,6 @@
 using System.Collections.Generic;
 
-namespace ET.Server
+namespace ET
 {
     public class Cell: Entity, IAwake, IDestroy
     {

+ 1 - 1
Apps/Model/Server/Unit/UnitGateComponent.cs

@@ -1,4 +1,4 @@
-namespace ET
+namespace ET.Server
 {
     [ComponentOf(typeof(Unit))]
     public class UnitGateComponent : Entity, IAwake<long>, ITransfer

+ 0 - 0
Unity/Codes/Hotfix/Share/Move/MoveComponentSystem.cs → Unity/Codes/Hotfix/Module/Move/MoveComponentSystem.cs


+ 0 - 0
Unity/Codes/Hotfix/Share/Unit/UnitComponentSystem.cs → Unity/Codes/Hotfix/Module/Unit/UnitComponentSystem.cs


+ 0 - 0
Unity/Codes/Hotfix/Share/Unit/UnitSystem.cs → Unity/Codes/Hotfix/Module/Unit/UnitSystem.cs


+ 0 - 0
Unity/Codes/Model/Share/Move/MoveComponent.cs → Unity/Codes/Model/Module/Move/MoveComponent.cs


+ 13 - 0
Unity/Codes/Model/Module/Move/MoveEventType.cs

@@ -0,0 +1,13 @@
+namespace ET
+{
+    namespace EventType
+    {
+        public struct MoveStart
+        {
+        }
+
+        public struct MoveStop
+        {
+        }
+    }
+}

+ 113 - 112
Unity/Codes/Model/Module/Numeric/NumericComponent.cs

@@ -1,119 +1,120 @@
 using System.Collections.Generic;
-using ET.EventType;
 using MongoDB.Bson.Serialization.Attributes;
 using MongoDB.Bson.Serialization.Options;
 
 namespace ET
 {
-	namespace EventType
-	{
-		public struct NumbericChange
-		{
-			public int NumericType;
-			public long Old;
-			public long New;
-		}
-	}
-
-	[FriendClass(typeof(NumericComponent))]
-	public static class NumericComponentSystem
-	{
-		public static float GetAsFloat(this NumericComponent self, int numericType)
-		{
-			return (float)self.GetByKey(numericType) / 10000;
-		}
-
-		public static int GetAsInt(this NumericComponent self, int numericType)
-		{
-			return (int)self.GetByKey(numericType);
-		}
-		
-		public static long GetAsLong(this NumericComponent self, int numericType)
-		{
-			return self.GetByKey(numericType);
-		}
-
-		public static void Set(this NumericComponent self, int nt, float value)
-		{
-			self[nt] = (int) (value * 10000);
-		}
-
-		public static void Set(this NumericComponent self, int nt, int value)
-		{
-			self[nt] = value;
-		}
-		
-		public static void Set(this NumericComponent self, int nt, long value)
-		{
-			self[nt] = value;
-		}
-
-		public static void SetNoEvent(this NumericComponent self, int numericType, long value)
-		{
-			self.Insert(numericType,value,false);
-		}
-		
-		public static void Insert(this NumericComponent self, int numericType, long value,bool isPublicEvent = true)
-		{
-			long oldValue = self.GetByKey(numericType);
-			if (oldValue == value)
-			{
-				return;
-			}
-
-			self.NumericDic[numericType] = value;
-
-			if (numericType >= NumericType.Max)
-			{
-				self.Update(numericType,isPublicEvent);
-				return;
-			}
-
-			if (isPublicEvent)
-			{
-				Game.EventSystem.Publish(self.GetParent<Unit>(), new NumbericChange() {New = value, Old = oldValue, NumericType = numericType});
-			}
-		}
-		
-		public static long GetByKey(this NumericComponent self, int key)
-		{
-			long value = 0;
-			self.NumericDic.TryGetValue(key, out value);
-			return value;
-		}
-
-		public static void Update(this NumericComponent self, int numericType,bool isPublicEvent)
-		{
-			int final = (int) numericType / 10;
-			int bas = final * 10 + 1; 
-			int add = final * 10 + 2;
-			int pct = final * 10 + 3;
-			int finalAdd = final * 10 + 4;
-			int finalPct = final * 10 + 5;
-
-			// 一个数值可能会多种情况影响,比如速度,加个buff可能增加速度绝对值100,也有些buff增加10%速度,所以一个值可以由5个值进行控制其最终结果
-			// final = (((base + add) * (100 + pct) / 100) + finalAdd) * (100 + finalPct) / 100;
-			long result = (long)(((self.GetByKey(bas) + self.GetByKey(add)) * (100 + self.GetAsFloat(pct)) / 100f + self.GetByKey(finalAdd)) * (100 + self.GetAsFloat(finalPct)) / 100f);
-			self.Insert(final,result,isPublicEvent);
-		}
-	}
-	
-	[ComponentOf(typeof(Unit))]
-	public class NumericComponent: Entity, IAwake, ITransfer
-	{
-		[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
-		public Dictionary<int, long> NumericDic = new Dictionary<int, long>();
-
-		public long this[int numericType]
-		{
-			get
-			{
-				return this.GetByKey(numericType);
-			}
-			set
-			{
-				this.Insert(numericType,value);
-			}
-		}
-	}
+    [FriendClass(typeof (NumericComponent))]
+    public static class NumericComponentSystem
+    {
+        public static float GetAsFloat(this NumericComponent self, int numericType)
+        {
+            return (float)self.GetByKey(numericType) / 10000;
+        }
+
+        public static int GetAsInt(this NumericComponent self, int numericType)
+        {
+            return (int)self.GetByKey(numericType);
+        }
+
+        public static long GetAsLong(this NumericComponent self, int numericType)
+        {
+            return self.GetByKey(numericType);
+        }
+
+        public static void Set(this NumericComponent self, int nt, float value)
+        {
+            self[nt] = (int)(value * 10000);
+        }
+
+        public static void Set(this NumericComponent self, int nt, int value)
+        {
+            self[nt] = value;
+        }
+
+        public static void Set(this NumericComponent self, int nt, long value)
+        {
+            self[nt] = value;
+        }
+
+        public static void SetNoEvent(this NumericComponent self, int numericType, long value)
+        {
+            self.Insert(numericType, value, false);
+        }
+
+        public static void Insert(this NumericComponent self, int numericType, long value, bool isPublicEvent = true)
+        {
+            long oldValue = self.GetByKey(numericType);
+            if (oldValue == value)
+            {
+                return;
+            }
+
+            self.NumericDic[numericType] = value;
+
+            if (numericType >= NumericType.Max)
+            {
+                self.Update(numericType, isPublicEvent);
+                return;
+            }
+
+            if (isPublicEvent)
+            {
+                Game.EventSystem.Publish(self.GetParent<Unit>(),
+                    new EventType.NumbericChange() { New = value, Old = oldValue, NumericType = numericType });
+            }
+        }
+
+        public static long GetByKey(this NumericComponent self, int key)
+        {
+            long value = 0;
+            self.NumericDic.TryGetValue(key, out value);
+            return value;
+        }
+
+        public static void Update(this NumericComponent self, int numericType, bool isPublicEvent)
+        {
+            int final = (int)numericType / 10;
+            int bas = final * 10 + 1;
+            int add = final * 10 + 2;
+            int pct = final * 10 + 3;
+            int finalAdd = final * 10 + 4;
+            int finalPct = final * 10 + 5;
+
+            // 一个数值可能会多种情况影响,比如速度,加个buff可能增加速度绝对值100,也有些buff增加10%速度,所以一个值可以由5个值进行控制其最终结果
+            // final = (((base + add) * (100 + pct) / 100) + finalAdd) * (100 + finalPct) / 100;
+            long result = (long)(((self.GetByKey(bas) + self.GetByKey(add)) * (100 + self.GetAsFloat(pct)) / 100f + self.GetByKey(finalAdd)) *
+                (100 + self.GetAsFloat(finalPct)) / 100f);
+            self.Insert(final, result, isPublicEvent);
+        }
+    }
+    
+    namespace EventType
+    {
+        public struct NumbericChange
+        {
+            public int NumericType;
+            public long Old;
+            public long New;
+        }
+    }
+
+    [ComponentOf(typeof (Unit))]
+    public class NumericComponent: Entity, IAwake, ITransfer
+    {
+        [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
+        public Dictionary<int, long> NumericDic = new Dictionary<int, long>();
+
+        public long this[int numericType]
+        {
+            get
+            {
+                return this.GetByKey(numericType);
+            }
+            set
+            {
+                this.Insert(numericType, value);
+            }
+        }
+    }
 }

+ 0 - 0
Unity/Codes/Model/Share/Unit/Unit.cs → Unity/Codes/Model/Module/Unit/Unit.cs


+ 0 - 0
Unity/Codes/Model/Share/Unit/UnitComponent.cs → Unity/Codes/Model/Module/Unit/UnitComponent.cs


+ 16 - 0
Unity/Codes/Model/Module/Unit/UnitEventType.cs

@@ -0,0 +1,16 @@
+using UnityEngine;
+
+namespace ET
+{
+    namespace EventType
+    {
+        public struct ChangePosition
+        {
+            public Vector3 OldPos;
+        }
+
+        public struct ChangeRotation
+        {
+        }
+    }
+}

+ 0 - 0
Unity/Codes/Model/Share/Unit/UnitType.cs → Unity/Codes/Model/Module/Unit/UnitType.cs


+ 0 - 0
Unity/Codes/Model/Helper/ETCancelationTokenHelper.cs → Unity/Codes/Model/Share/ETCancelationTokenHelper.cs


+ 0 - 18
Unity/Codes/Model/Share/EventType.cs

@@ -7,33 +7,15 @@ namespace ET
         public struct AppStart
         {
         }
-		
-        public struct MoveStart
-        {
-        }
 
-        public struct MoveStop
-        {
-        }
-        
         public struct SceneChangeStart
         {
         }
         
-        
         public struct SceneChangeFinish
         {
         }
 
-        public struct ChangePosition
-        {
-            public Vector3 OldPos;
-        }
-
-        public struct ChangeRotation
-        {
-        }
-
         public struct PingChange
         {
             public long Ping;