Quellcode durchsuchen

行为树节点按字母排序

tanghai vor 11 Jahren
Ursprung
Commit
cf17b5b487

+ 2 - 2
CSharp/App/Modules/BehaviorTreeModule/ListToStringConverter.cs

@@ -15,7 +15,7 @@ namespace Modules.BehaviorTreeModule
 			{
 				return "";
 			}
-			var list = (List<string>) value;
+			var list = ((List<string>) value);
 			return String.Join(",", list);
 		}
 
@@ -25,7 +25,7 @@ namespace Modules.BehaviorTreeModule
 			{
 				return new List<string>();
 			}
-			var s = (string) value;
+			string s = (string) value;
 			s = s.Trim();
 			if (s == "")
 			{

+ 7 - 3
CSharp/App/Modules/BehaviorTreeModule/NodeDataEditor.xaml.cs

@@ -1,7 +1,6 @@
 using System;
 using System.Windows;
 using System.Windows.Controls;
-using Common.Helper;
 
 namespace Modules.BehaviorTreeModule
 {
@@ -10,11 +9,14 @@ namespace Modules.BehaviorTreeModule
 	/// </summary>
 	public partial class NodeDataEditor
 	{
+		private readonly string[] nodeTypes;
+
 		public NodeDataEditor()
 		{
 			this.InitializeComponent();
 
-			string[] nodeTypes = Enum.GetNames(typeof (NodeType));
+			nodeTypes = Enum.GetNames(typeof (NodeType));
+			Array.Sort(nodeTypes);
 			this.cbType.ItemsSource = nodeTypes;
 		}
 
@@ -38,7 +40,9 @@ namespace Modules.BehaviorTreeModule
 			{
 				return;
 			}
-			this.cbType.SelectedIndex = EnumHelper.EnumIndex<NodeType>(this.TreeNodeViewModel.Type);
+			string typeStr = ((NodeType) this.TreeNodeViewModel.Type).ToString();
+			int selectIndex = Array.IndexOf(nodeTypes, typeStr);
+			this.cbType.SelectedIndex = selectIndex;
 		}
 
 		private void CbType_OnSelectionChanged(object sender, SelectionChangedEventArgs e)

+ 0 - 2
CSharp/Platform/Network/IService.cs

@@ -19,8 +19,6 @@ namespace Network
 
 		Task<IChannel> GetChannel(string host, int port);
 
-		Task<IChannel> GetChannel(string address);
-
 		Task<IChannel> GetChannel();
 
 		void Remove(IChannel channel);

+ 0 - 7
CSharp/Platform/TNet/TService.cs

@@ -108,13 +108,6 @@ namespace TNet
 			return await ConnectAsync(host, port);
 		}
 
-		public async Task<IChannel> GetChannel(string address)
-		{
-			string[] ss = address.Split(':');
-			int port = Convert.ToInt32(ss[1]);
-			return await GetChannel(ss[0], port);
-		}
-
 		public void RunOnce(int timeout)
 		{
 			poller.Run(timeout);

+ 0 - 7
CSharp/Platform/UNet/UService.cs

@@ -67,13 +67,6 @@ namespace UNet
 			return channel;
 		}
 
-		public async Task<IChannel> GetChannel(string address)
-		{
-			string[] ss = address.Split(':');
-			int port = Convert.ToInt32(ss[1]);
-			return await GetChannel(ss[0], port);
-		}
-
 		public async Task<IChannel> GetChannel(string host, int port)
 		{
 			UChannel channel = null;