Просмотр исходного кода

增加BehaviorTreeLayout,用于调整行为树界面布局

tanghai 14 лет назад
Родитель
Сommit
9c183a27b1

+ 1 - 0
CSharp/Modules/BehaviorTree/BehaviorTree.csproj

@@ -68,6 +68,7 @@
     <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BehaviorTreeLayout.cs" />
     <Compile Include="BehaviorTreeViewModel.cs" />
     <Compile Include="BehaviorTreeModule.cs" />
     <Compile Include="BehaviorTreeView.xaml.cs">

+ 20 - 0
CSharp/Modules/BehaviorTree/BehaviorTreeLayout.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace BehaviorTree
+{
+	class BehaviorTreeLayout
+	{
+		private TreeNodeViewModel root = null;
+		public BehaviorTreeLayout(TreeNodeViewModel root)
+		{
+			this.root = root;
+		}
+
+		public void ExcuteLayout()
+		{
+		}
+	}
+}

+ 2 - 2
CSharp/Modules/BehaviorTree/BehaviorTreeView.xaml

@@ -50,12 +50,12 @@
 						<Rectangle Name="rectNode" Width="{Binding Width}" Height="{Binding Height}" Cursor="Hand" StrokeThickness="4" RadiusX="4" RadiusY="4"
 								Stroke="{StaticResource treeNodeBorderBrush}" Fill="{StaticResource treeNodeFillBrush}" />
 						<Line X1="{Binding ConnectorX1}" Y1="{Binding ConnectorY1}" X2="{Binding ConnectorX2}" Y2="{Binding ConnectorY2}" 
-							  Stroke="Black" StrokeThickness="2" />
+								Stroke="Black" StrokeThickness="2" />
 					</Canvas>
 					<DataTemplate.Triggers>
 						<DataTrigger  Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
 							<Setter TargetName="rectNode" Property="Stroke" Value="Green" />
-						</DataTrigger >
+						</DataTrigger>
 					</DataTemplate.Triggers>
 				</DataTemplate>
 			</ListBox.ItemTemplate>

+ 1 - 1
CSharp/Modules/BehaviorTree/BehaviorTreeView.xaml.cs

@@ -184,4 +184,4 @@ namespace BehaviorTree
 			}
 		}
 	}
-}
+}

+ 8 - 0
CSharp/Modules/BehaviorTree/BehaviorTreeViewModel.cs

@@ -19,6 +19,14 @@ namespace BehaviorTree
 			{
 				treeNodes = value;
 			}
+		}
+
+		public TreeNodeViewModel Root
+		{
+			get
+			{
+				return treeNodes.Count > 0? treeNodes[0] : null;
+			}
 		}
 
 		public void Add(TreeNode treeNode, TreeNodeViewModel parent)