فهرست منبع

修复Numeric组件的一些问题

tanghai 3 سال پیش
والد
کامیت
f22df5ba3c

+ 4 - 0
Unity/.gitignore

@@ -0,0 +1,4 @@
+/Unity.Mono.csproj
+/Unity.ThirdParty.csproj
+/Unity.sln
+/Unity.sln.DotSettings.user

+ 1 - 1
Unity/Codes/Hotfix/Demo/Unit/UnitFactory.cs

@@ -16,7 +16,7 @@ namespace ET
 	        NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
 	        NumericComponent numericComponent = unit.AddComponent<NumericComponent>();
 	        for (int i = 0; i < unitInfo.Ks.Count; ++i)
 	        for (int i = 0; i < unitInfo.Ks.Count; ++i)
 	        {
 	        {
-		        numericComponent.Set((NumericType)unitInfo.Ks[i], unitInfo.Vs[i]);
+		        numericComponent.Set(unitInfo.Ks[i], unitInfo.Vs[i]);
 	        }
 	        }
 	        
 	        
 	        unit.AddComponent<MoveComponent>();
 	        unit.AddComponent<MoveComponent>();

+ 1 - 1
Unity/Codes/Hotfix/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs

@@ -5,7 +5,7 @@
 	{
 	{
 		protected override async ETTask Run(EventType.NumbericChange args)
 		protected override async ETTask Run(EventType.NumbericChange args)
 		{
 		{
-			NumericWatcherComponent.Instance.Run(args.NumericType, args.Parent.Id, args.New);
+			NumericWatcherComponent.Instance.Run(args);
 			await ETTask.CompletedTask;
 			await ETTask.CompletedTask;
 		}
 		}
 	}
 	}

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

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

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

@@ -2,6 +2,6 @@
 {
 {
 	public interface INumericWatcher
 	public interface INumericWatcher
 	{
 	{
-		void Run(long id, long value);
+		void Run(EventType.NumbericChange args);
 	}
 	}
 }
 }

+ 10 - 25
Unity/Codes/Model/Module/Numeric/NumericComponent.cs

@@ -9,7 +9,7 @@ namespace ET
 		public struct NumbericChange
 		public struct NumbericChange
 		{
 		{
 			public Entity Parent;
 			public Entity Parent;
-			public NumericType NumericType;
+			public int NumericType;
 			public long Old;
 			public long Old;
 			public long New;
 			public long New;
 		}
 		}
@@ -34,26 +34,11 @@ namespace ET
 			// 这里初始化base值
 			// 这里初始化base值
 		}
 		}
 
 
-		public float GetAsFloat(NumericType numericType)
-		{
-			return (float)GetByKey((int)numericType) / 10000;
-		}
-		
 		public float GetAsFloat(int numericType)
 		public float GetAsFloat(int numericType)
 		{
 		{
 			return (float)GetByKey(numericType) / 10000;
 			return (float)GetByKey(numericType) / 10000;
 		}
 		}
 
 
-		public int GetAsInt(NumericType numericType)
-		{
-			return (int)GetByKey((int)numericType);
-		}
-		
-		public long GetAsLong(NumericType numericType)
-		{
-			return GetByKey((int)numericType);
-		}
-		
 		public int GetAsInt(int numericType)
 		public int GetAsInt(int numericType)
 		{
 		{
 			return (int)GetByKey(numericType);
 			return (int)GetByKey(numericType);
@@ -64,36 +49,36 @@ namespace ET
 			return GetByKey(numericType);
 			return GetByKey(numericType);
 		}
 		}
 
 
-		public void Set(NumericType nt, float value)
+		public void Set(int nt, float value)
 		{
 		{
 			this[nt] = (int) (value * 10000);
 			this[nt] = (int) (value * 10000);
 		}
 		}
 
 
-		public void Set(NumericType nt, int value)
+		public void Set(int nt, int value)
 		{
 		{
 			this[nt] = value;
 			this[nt] = value;
 		}
 		}
 		
 		
-		public void Set(NumericType nt, long value)
+		public void Set(int nt, long value)
 		{
 		{
 			this[nt] = value;
 			this[nt] = value;
 		}
 		}
 
 
-		public long this[NumericType numericType]
+		public long this[int numericType]
 		{
 		{
 			get
 			get
 			{
 			{
-				return this.GetByKey((int) numericType);
+				return this.GetByKey(numericType);
 			}
 			}
 			set
 			set
 			{
 			{
-				long v = this.GetByKey((int) numericType);
+				long v = this.GetByKey(numericType);
 				if (v == value)
 				if (v == value)
 				{
 				{
 					return;
 					return;
 				}
 				}
 
 
-				NumericDic[(int)numericType] = value;
+				NumericDic[numericType] = value;
 
 
 				Update(numericType);
 				Update(numericType);
 			}
 			}
@@ -106,7 +91,7 @@ namespace ET
 			return value;
 			return value;
 		}
 		}
 
 
-		public void Update(NumericType numericType)
+		public void Update(int numericType)
 		{
 		{
 			if (numericType < NumericType.Max)
 			if (numericType < NumericType.Max)
 			{
 			{
@@ -127,7 +112,7 @@ namespace ET
 			Game.EventSystem.Publish(new EventType.NumbericChange()
 			Game.EventSystem.Publish(new EventType.NumbericChange()
 			{
 			{
 				Parent = this.Parent, 
 				Parent = this.Parent, 
-				NumericType = (NumericType) final,
+				NumericType = final,
 				Old = old,
 				Old = old,
 				New = result
 				New = result
 			});
 			});

+ 26 - 25
Unity/Codes/Model/Module/Numeric/NumericType.cs

@@ -1,31 +1,32 @@
 namespace ET
 namespace ET
 {
 {
-    public enum NumericType
+	// 这个可弄个配置表生成
+    public static class NumericType
     {
     {
-		Max = 10000,
+	    public const int Max = 10000;
 
 
-		Speed = 1000,
-		SpeedBase = Speed * 10 + 1,
-	    SpeedAdd = Speed * 10 + 2,
-	    SpeedPct = Speed * 10 + 3,
-	    SpeedFinalAdd = Speed * 10 + 4,
-	    SpeedFinalPct = Speed * 10 + 5,
- 
-	    Hp = 1001,
-	    HpBase = Hp * 10 + 1,
+	    public const int Speed = 1000;
+	    public const int SpeedBase = Speed * 10 + 1;
+	    public const int SpeedAdd = Speed * 10 + 2;
+	    public const int SpeedPct = Speed * 10 + 3;
+	    public const int SpeedFinalAdd = Speed * 10 + 4;
+	    public const int SpeedFinalPct = Speed * 10 + 5;
 
 
-	    MaxHp = 1002,
-	    MaxHpBase = MaxHp * 10 + 1,
-	    MaxHpAdd = MaxHp * 10 + 2,
-	    MaxHpPct = MaxHp * 10 + 3,
-	    MaxHpFinalAdd = MaxHp * 10 + 4,
-		MaxHpFinalPct = MaxHp * 10 + 5,
-		
-		AOI = 1003,
-		AOIBase = AOI * 10 + 1,
-		AOIAdd = AOI * 10 + 2,
-		AOIPct = AOI * 10 + 3,
-		AOIFinalAdd = AOI * 10 + 4,
-		AOIFinalPct = AOI * 10 + 5,
-	}
+	    public const int Hp = 1001;
+	    public const int HpBase = Hp * 10 + 1;
+
+	    public const int MaxHp = 1002;
+	    public const int MaxHpBase = MaxHp * 10 + 1;
+	    public const int MaxHpAdd = MaxHp * 10 + 2;
+	    public const int MaxHpPct = MaxHp * 10 + 3;
+	    public const int MaxHpFinalAdd = MaxHp * 10 + 4;
+	    public const int MaxHpFinalPct = MaxHp * 10 + 5;
+
+	    public const int AOI = 1003;
+	    public const int AOIBase = AOI * 10 + 1;
+	    public const int AOIAdd = AOI * 10 + 2;
+	    public const int AOIPct = AOI * 10 + 3;
+	    public const int AOIFinalAdd = AOI * 10 + 4;
+	    public const int AOIFinalPct = AOI * 10 + 5;
+    }
 }
 }

+ 2 - 2
Unity/Codes/Model/Module/Numeric/NumericWatcherAttribute.cs

@@ -2,9 +2,9 @@
 {
 {
 	public class NumericWatcherAttribute : BaseAttribute
 	public class NumericWatcherAttribute : BaseAttribute
 	{
 	{
-		public NumericType NumericType { get; }
+		public int NumericType { get; }
 
 
-		public NumericWatcherAttribute(NumericType type)
+		public NumericWatcherAttribute(int type)
 		{
 		{
 			this.NumericType = type;
 			this.NumericType = type;
 		}
 		}

+ 5 - 5
Unity/Codes/Model/Module/Numeric/NumericWatcherComponent.cs

@@ -29,7 +29,7 @@ namespace ET
 	{
 	{
 		public static NumericWatcherComponent Instance { get; set; }
 		public static NumericWatcherComponent Instance { get; set; }
 		
 		
-		private Dictionary<NumericType, List<INumericWatcher>> allWatchers;
+		private Dictionary<int, List<INumericWatcher>> allWatchers;
 
 
 		public void Awake()
 		public void Awake()
 		{
 		{
@@ -38,7 +38,7 @@ namespace ET
 
 
 		public void Load()
 		public void Load()
 		{
 		{
-			this.allWatchers = new Dictionary<NumericType, List<INumericWatcher>>();
+			this.allWatchers = new Dictionary<int, List<INumericWatcher>>();
 
 
 			HashSet<Type> types = Game.EventSystem.GetTypes(typeof(NumericWatcherAttribute));
 			HashSet<Type> types = Game.EventSystem.GetTypes(typeof(NumericWatcherAttribute));
 			foreach (Type type in types)
 			foreach (Type type in types)
@@ -58,16 +58,16 @@ namespace ET
 			}
 			}
 		}
 		}
 
 
-		public void Run(NumericType numericType, long id, long value)
+		public void Run(EventType.NumbericChange args)
 		{
 		{
 			List<INumericWatcher> list;
 			List<INumericWatcher> list;
-			if (!this.allWatchers.TryGetValue(numericType, out list))
+			if (!this.allWatchers.TryGetValue(args.NumericType, out list))
 			{
 			{
 				return;
 				return;
 			}
 			}
 			foreach (INumericWatcher numericWatcher in list)
 			foreach (INumericWatcher numericWatcher in list)
 			{
 			{
-				numericWatcher.Run(id, value);
+				numericWatcher.Run(args);
 			}
 			}
 		}
 		}
 	}
 	}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 28
Unity/Unity.Mono.csproj


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 28
Unity/Unity.ThirdParty.csproj


+ 0 - 29
Unity/Unity.sln

@@ -1,29 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Mono", "Unity.Mono.csproj", "{5910fa29-5797-199c-985b-fc9fc473328e}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{d2ad5be1-263a-9a30-ab0f-dc5b08044350}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{041131cd-3018-19b1-81b6-5dbee2467ffb}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{03938ccd-4b40-8dfb-6b9b-21988d5cac0a}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{5910fa29-5797-199c-985b-fc9fc473328e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5910fa29-5797-199c-985b-fc9fc473328e}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{d2ad5be1-263a-9a30-ab0f-dc5b08044350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{d2ad5be1-263a-9a30-ab0f-dc5b08044350}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{041131cd-3018-19b1-81b6-5dbee2467ffb}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{041131cd-3018-19b1-81b6-5dbee2467ffb}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{03938ccd-4b40-8dfb-6b9b-21988d5cac0a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{03938ccd-4b40-8dfb-6b9b-21988d5cac0a}.Debug|Any CPU.Build.0 = Debug|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal

+ 0 - 29
Unity/Unity.sln.DotSettings.user

@@ -1,29 +0,0 @@
-<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=TypesAndNamespaces/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=TypesAndNamespaces/@EntryIndexRemoved">True</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Interfaces/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=TypeParameters/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Method/@EntryIndexRemoved">True</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Property/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Event/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Event/@EntryIndexRemoved">True</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Locals/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=LocalConstants/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=LocalConstants/@EntryIndexRemoved">True</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Parameters/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PublicFields/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PublicFields/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateInstanceFields/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateStaticFields/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateStaticFields/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Constants/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=Constants/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateConstants/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateConstants/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=StaticReadonly/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=StaticReadonly/@EntryIndexRemoved">True</s:Boolean>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue"></s:String>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=PrivateStaticReadonly/@EntryIndexRemoved">True</s:Boolean>
-	<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/AutoDetectedNamingRules/=EnumMember/@EntryIndexRemoved">True</s:Boolean>
-	<s:Int64 x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/AutoNamingCompletedVersion/@EntryValue">2</s:Int64></wpf:ResourceDictionary>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است