Răsfoiți Sursa

行为树配置文件修正

tanghai 10 ani în urmă
părinte
comite
4a2b7a7a7f

+ 1 - 1
CSharp/App/Editor/app.config

@@ -36,7 +36,7 @@
     <add key="Port" value="8888" />
     <add key="Account" value="egametang@163.com" />
     <add key="Password" value="163bio1" />
-    <add key="NodePath" value="D:\Source\SLOL\Program\Unity\Assets\Resources\Config\NodeProto.txt" />
+    <add key="NodePath" value="D:\Source\SLOL\Program\Unity\Assets\Resources\Config\TreeProto.txt" />
     <add key="ClientSettingsProvider.ServiceUri" value="" />
   </appSettings>
   <system.serviceModel>

+ 1 - 1
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml

@@ -34,7 +34,7 @@
 						<DataTemplate DataType="Tree:TreeViewModel">
 							<StackPanel MouseLeftButtonDown="ListBoxItem_OnMouseLeftButtonDown" 
 									Orientation="Horizontal" Margin="1,0">
-								<Label Content="{Binding TreeId}" VerticalAlignment="Stretch" Width="30"/>
+								<Label Content="{Binding Id}" VerticalAlignment="Stretch" Width="30"/>
 								<Label Content="{Binding Comment}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
 							</StackPanel>
 						</DataTemplate>

+ 1 - 1
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml.cs

@@ -83,7 +83,7 @@ namespace Modules.BehaviorTreeModule
 			TreeViewModel treeViewModel = item.DataContext as TreeViewModel;
 			if (this.treeView.ViewModel != null)
 			{
-				if (this.treeView.ViewModel.TreeId == treeViewModel.TreeId)
+				if (this.treeView.ViewModel.Id == treeViewModel.Id)
 				{
 					return;
 				}

+ 4 - 4
CSharp/App/Modules/BehaviorTreeModule/AllTreeViewModel.cs

@@ -42,9 +42,9 @@ namespace Modules.BehaviorTreeModule
 				this.treeViewModels.Add(treeViewModel);
 				TreeLayout layout = new TreeLayout(treeViewModel);
 				layout.ExcuteLayout();
-				if (treeViewModel.TreeId > this.MaxTreeId)
+				if (treeViewModel.Id > this.MaxTreeId)
 				{
-					this.MaxTreeId = treeViewModel.TreeId;
+					this.MaxTreeId = treeViewModel.Id;
 				}
 			}
 		}
@@ -65,7 +65,7 @@ namespace Modules.BehaviorTreeModule
 		public TreeViewModel New()
 		{
 			TreeViewModel treeViewModel = new TreeViewModel();
-			treeViewModel.TreeId = ++this.MaxTreeId;
+			treeViewModel.Id = ++this.MaxTreeId;
 			this.treeViewModels.Add(treeViewModel);
 			return treeViewModel;
 		}
@@ -78,7 +78,7 @@ namespace Modules.BehaviorTreeModule
 		public TreeViewModel Clone(TreeViewModel treeViewModel)
 		{
 			TreeViewModel newTreeViewModel = (TreeViewModel)treeViewModel.Clone();
-			newTreeViewModel.TreeId = ++this.MaxTreeId;
+			newTreeViewModel.Id = ++this.MaxTreeId;
 			this.treeViewModels.Add(newTreeViewModel);
 			return newTreeViewModel;
 		}

+ 1 - 1
CSharp/App/Modules/BehaviorTreeModule/TreeNodeViewModel.cs

@@ -9,7 +9,7 @@ namespace Modules.BehaviorTreeModule
 	[BsonDiscriminator("NodeProto", RootClass = true)]
 	public class TreeNodeViewModel: BindableBase, ICloneable
 	{
-		[BsonElement]
+		[BsonId]
 		private int id;
 		[BsonElement]
 		private int type;

+ 10 - 9
CSharp/App/Modules/BehaviorTreeModule/TreeViewModel.cs

@@ -13,12 +13,12 @@ namespace Modules.BehaviorTreeModule
 	[Export(typeof (TreeViewModel)), PartCreationPolicy(CreationPolicy.NonShared)]
 	public class TreeViewModel: BindableBase, ICloneable, ISupportInitialize
 	{
-		[BsonElement]
-		private TreeNodeViewModel root;
-		[BsonElement]
-		private int treeId;
+		[BsonId]
+		private int id;
 		[BsonElement]
 		private int maxNodeId;
+		[BsonElement]
+		private TreeNodeViewModel root;
         [BsonIgnore]
 		public ObservableCollection<TreeNodeViewModel> allNodes = new ObservableCollection<TreeNodeViewModel>();
 
@@ -32,20 +32,20 @@ namespace Modules.BehaviorTreeModule
 		}
 
 		[BsonIgnore]
-		public int TreeId
+		public int Id
 		{
 			get
 			{
-				return this.treeId;
+				return this.id;
 			}
 			set
 			{
-				if (this.treeId == value)
+				if (this.id == value)
 				{
 					return;
 				}
-				this.treeId = value;
-				this.OnPropertyChanged("TreeId");
+				this.id = value;
+				this.OnPropertyChanged("id");
 			}
 		}
 
@@ -66,6 +66,7 @@ namespace Modules.BehaviorTreeModule
 			}
 		}
 
+		[BsonIgnore]
 		public int MaxNodeId 
 		{
 			get