Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
9a439db1
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9a439db1
编写于
2月 03, 2015
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加行为树复制功能
上级
7d12e8f4
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
127 addition
and
58 deletion
+127
-58
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml
+6
-9
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml.cs
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml.cs
+13
-3
CSharp/App/Modules/BehaviorTreeModule/AllTreeViewModel.cs
CSharp/App/Modules/BehaviorTreeModule/AllTreeViewModel.cs
+17
-12
CSharp/App/Modules/BehaviorTreeModule/NodeType.cs
CSharp/App/Modules/BehaviorTreeModule/NodeType.cs
+1
-0
CSharp/App/Modules/BehaviorTreeModule/TreeNodeData.cs
CSharp/App/Modules/BehaviorTreeModule/TreeNodeData.cs
+9
-2
CSharp/App/Modules/BehaviorTreeModule/TreeNodeViewModel.cs
CSharp/App/Modules/BehaviorTreeModule/TreeNodeViewModel.cs
+21
-10
CSharp/App/Modules/BehaviorTreeModule/TreeView.xaml.cs
CSharp/App/Modules/BehaviorTreeModule/TreeView.xaml.cs
+3
-3
CSharp/App/Modules/BehaviorTreeModule/TreeViewModel.cs
CSharp/App/Modules/BehaviorTreeModule/TreeViewModel.cs
+57
-19
未找到文件。
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml
浏览文件 @
9a439db1
...
...
@@ -9,12 +9,6 @@
d:DesignWidth="1280"
d:DataContext="{d:DesignInstance Tree:AllTreeViewModel}">
<DockPanel>
<Menu DockPanel.Dock="Top" Height="24">
<MenuItem Header="File">
<MenuItem Header="打开" Click="MenuItem_Open" />
<MenuItem Header="保存" Click="MenuItem_Save" />
</MenuItem>
</Menu>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
...
...
@@ -29,15 +23,18 @@
<ListBox Name="lbTreeRoots" ItemsSource="{Binding RootList}" VerticalAlignment="Stretch" >
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="新建树" Click="MenuItem_New" />
<MenuItem Header="删除树" Click="MenuItem_Remove" />
<MenuItem Header="打开" Click="MenuItem_Open" />
<MenuItem Header="保存" Click="MenuItem_Save" />
<MenuItem Header="新建" Click="MenuItem_New" />
<MenuItem Header="删除" Click="MenuItem_Remove" />
<MenuItem Header="复制" Click="MenuItem_Copy" />
</ContextMenu>
</ListBox.ContextMenu>
<ListBox.ItemTemplate>
<DataTemplate DataType="Tree:TreeNodeViewModel">
<StackPanel MouseLeftButtonDown="ListBoxItem_OnMouseLeftButtonDown" MouseLeftButtonUp="ListBoxItem_OnMouseLeftButtonUp"
Orientation="Horizontal" Margin="1,0">
<Label Content="{Binding TreeId}" VerticalAlignment="Stretch" Width="
2
0"/>
<Label Content="{Binding TreeId}" VerticalAlignment="Stretch" Width="
3
0"/>
<Label Content="{Binding Comment}" VerticalAlignment="Stretch" Width="150"/>
</StackPanel>
</DataTemplate>
...
...
CSharp/App/Modules/BehaviorTreeModule/AllTreeView.xaml.cs
浏览文件 @
9a439db1
...
...
@@ -49,8 +49,18 @@ namespace Modules.BehaviorTreeModule
private
void
MenuItem_New
(
object
sender
,
RoutedEventArgs
e
)
{
TreeViewModel
treeViewModel
=
new
TreeViewModel
(
this
.
ViewModel
);
this
.
ViewModel
.
Add
(
treeViewModel
);
TreeViewModel
treeViewModel
=
this
.
ViewModel
.
New
();
this
.
treeView
.
ViewModel
=
treeViewModel
;
}
private
void
MenuItem_Copy
(
object
sender
,
RoutedEventArgs
e
)
{
if
(
this
.
lbTreeRoots
.
SelectedItem
==
null
)
{
return
;
}
TreeNodeViewModel
treeNodeViewModel
=
this
.
lbTreeRoots
.
SelectedItem
as
TreeNodeViewModel
;
TreeViewModel
treeViewModel
=
this
.
ViewModel
.
Copy
(
treeNodeViewModel
);
this
.
treeView
.
ViewModel
=
treeViewModel
;
}
...
...
@@ -60,7 +70,7 @@ namespace Modules.BehaviorTreeModule
{
return
;
}
var
treeNodeViewModel
=
this
.
lbTreeRoots
.
SelectedItem
as
TreeNodeViewModel
;
TreeNodeViewModel
treeNodeViewModel
=
this
.
lbTreeRoots
.
SelectedItem
as
TreeNodeViewModel
;
this
.
ViewModel
.
Remove
(
treeNodeViewModel
);
this
.
lbTreeRoots
.
SelectedItem
=
null
;
e
.
Handled
=
true
;
...
...
CSharp/App/Modules/BehaviorTreeModule/AllTreeViewModel.cs
浏览文件 @
9a439db1
...
...
@@ -6,8 +6,7 @@ using Common.Helper;
namespace
Modules.BehaviorTreeModule
{
[
Export
(
contractType
:
typeof
(
AllTreeViewModel
)),
PartCreationPolicy
(
creationPolicy
:
CreationPolicy
.
NonShared
)]
[
Export
(
typeof
(
AllTreeViewModel
)),
PartCreationPolicy
(
CreationPolicy
.
NonShared
)]
public
class
AllTreeViewModel
{
public
int
MaxNodeId
{
get
;
set
;
}
...
...
@@ -35,7 +34,7 @@ namespace Modules.BehaviorTreeModule
var
treeDict
=
new
Dictionary
<
int
,
List
<
TreeNodeData
>>();
byte
[]
bytes
=
File
.
ReadAllBytes
(
file
);
var
allTreeData
=
ProtobufHelper
.
FromBytes
<
AllTreeData
>(
bytes
);
AllTreeData
allTreeData
=
ProtobufHelper
.
FromBytes
<
AllTreeData
>(
bytes
);
this
.
MaxNodeId
=
0
;
this
.
MaxTreeId
=
0
;
...
...
@@ -61,7 +60,7 @@ namespace Modules.BehaviorTreeModule
foreach
(
KeyValuePair
<
int
,
List
<
TreeNodeData
>>
pair
in
treeDict
)
{
var
treeViewModel
=
new
TreeViewModel
(
pair
.
Value
)
{
AllTreeViewModel
=
this
,
TreeId
=
pair
.
Key
}
;
TreeViewModel
treeViewModel
=
new
TreeViewModel
(
this
,
pair
.
Value
)
;
this
.
treeViewModelsDict
[
pair
.
Key
]
=
treeViewModel
;
this
.
RootList
.
Add
(
treeViewModel
.
Root
);
}
...
...
@@ -70,7 +69,7 @@ namespace Modules.BehaviorTreeModule
public
void
Save
(
string
file
)
{
AllTreeData
allTreeData
=
new
AllTreeData
();
foreach
(
var
value
in
this
.
treeViewModelsDict
.
Values
)
foreach
(
TreeViewModel
value
in
this
.
treeViewModelsDict
.
Values
)
{
List
<
TreeNodeData
>
list
=
value
.
GetDatas
();
allTreeData
.
TreeNodeDatas
.
AddRange
(
list
);
...
...
@@ -83,20 +82,26 @@ namespace Modules.BehaviorTreeModule
}
}
public
void
New
(
TreeViewModel
treeViewModel
)
public
TreeViewModel
New
(
)
{
TreeViewModel
treeViewModel
=
new
TreeViewModel
(
this
);
this
.
treeViewModelsDict
[
treeViewModel
.
TreeId
]
=
treeViewModel
;
this
.
rootList
.
Add
(
treeViewModel
.
Root
);
return
treeViewModel
;
}
public
void
Add
(
TreeViewModel
tre
eViewModel
)
public
void
Remove
(
TreeNodeViewModel
treeNod
eViewModel
)
{
this
.
treeViewModelsDict
[
treeViewModel
.
TreeId
]
=
treeViewModel
;
this
.
rootList
.
Add
(
treeViewModel
.
Root
);
this
.
treeViewModelsDict
.
Remove
(
treeNodeViewModel
.
TreeId
)
;
this
.
rootList
.
Remove
(
treeNodeViewModel
);
}
public
void
Remove
(
TreeNodeViewModel
tre
eViewModel
)
public
TreeViewModel
Copy
(
TreeNodeViewModel
treeNod
eViewModel
)
{
this
.
treeViewModelsDict
.
Remove
(
treeViewModel
.
TreeId
);
this
.
rootList
.
Remove
(
treeViewModel
);
TreeViewModel
treeViewModel
=
new
TreeViewModel
(
this
,
treeNodeViewModel
.
TreeViewModel
);
this
.
treeViewModelsDict
[
treeViewModel
.
TreeId
]
=
treeViewModel
;
this
.
rootList
.
Add
(
treeViewModel
.
Root
);
return
treeViewModel
;
}
public
TreeViewModel
Get
(
int
treeId
)
...
...
CSharp/App/Modules/BehaviorTreeModule/NodeType.cs
浏览文件 @
9a439db1
...
...
@@ -54,5 +54,6 @@
// 跟随unit
FollowUnit
=
20012
,
LookAtTarget
=
20013
,
CastNumSpell
=
20014
,
}
}
\ No newline at end of file
CSharp/App/Modules/BehaviorTreeModule/TreeNodeData.cs
浏览文件 @
9a439db1
using
System.Collections.Generic
;
using
System
;
using
System.Collections.Generic
;
using
System.Runtime.Serialization
;
using
Common.Helper
;
namespace
Modules.BehaviorTreeModule
{
[
DataContract
]
public
class
TreeNodeData
public
class
TreeNodeData
:
ICloneable
{
private
readonly
List
<
int
>
children
=
new
List
<
int
>();
...
...
@@ -55,5 +57,10 @@ namespace Modules.BehaviorTreeModule
/// </summary>
[
DataMember
(
Order
=
7
)]
public
string
Comment
{
get
;
set
;
}
public
object
Clone
()
{
return
ProtobufHelper
.
FromBytes
<
TreeNodeData
>(
ProtobufHelper
.
ToBytes
(
this
));
}
}
}
\ No newline at end of file
CSharp/App/Modules/BehaviorTreeModule/TreeNodeViewModel.cs
浏览文件 @
9a439db1
...
...
@@ -8,7 +8,7 @@ namespace Modules.BehaviorTreeModule
{
private
static
double
width
=
80
;
private
static
double
height
=
50
;
p
rivate
readonly
TreeViewModel
treeViewModel
;
p
ublic
TreeViewModel
TreeViewModel
{
get
;
private
set
;
}
private
readonly
TreeNodeData
data
;
private
double
x
;
private
double
y
;
...
...
@@ -21,7 +21,7 @@ namespace Modules.BehaviorTreeModule
public
TreeNodeViewModel
(
TreeViewModel
treeViewModel
,
double
x
,
double
y
)
{
this
.
t
reeViewModel
=
treeViewModel
;
this
.
T
reeViewModel
=
treeViewModel
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
data
=
new
TreeNodeData
();
...
...
@@ -34,7 +34,7 @@ namespace Modules.BehaviorTreeModule
public
TreeNodeViewModel
(
TreeViewModel
treeViewModel
,
TreeNodeViewModel
parent
)
{
this
.
t
reeViewModel
=
treeViewModel
;
this
.
T
reeViewModel
=
treeViewModel
;
this
.
data
=
new
TreeNodeData
();
this
.
data
.
Id
=
++
treeViewModel
.
AllTreeViewModel
.
MaxNodeId
;
this
.
data
.
TreeId
=
treeViewModel
.
TreeId
;
...
...
@@ -46,7 +46,7 @@ namespace Modules.BehaviorTreeModule
public
TreeNodeViewModel
(
TreeViewModel
treeViewModel
,
TreeNodeData
data
)
{
this
.
t
reeViewModel
=
treeViewModel
;
this
.
T
reeViewModel
=
treeViewModel
;
this
.
data
=
data
;
if
(
this
.
IsRoot
)
{
...
...
@@ -62,6 +62,17 @@ namespace Modules.BehaviorTreeModule
}
}
public
TreeNodeViewModel
(
TreeViewModel
treeViewModel
,
TreeNodeViewModel
parent
,
TreeNodeViewModel
treeNodeViewModel
)
{
this
.
TreeViewModel
=
treeViewModel
;
this
.
data
=
new
TreeNodeData
();
this
.
data
.
Id
=
++
treeViewModel
.
AllTreeViewModel
.
MaxNodeId
;
this
.
data
.
TreeId
=
treeViewModel
.
TreeId
;
this
.
Parent
=
parent
;
this
.
ConnectorX2
=
treeNodeViewModel
.
ConnectorX2
;
this
.
connectorY2
=
treeNodeViewModel
.
ConnectorY2
;
}
public
TreeNodeData
Data
{
get
...
...
@@ -182,7 +193,7 @@ namespace Modules.BehaviorTreeModule
foreach
(
var
childId
in
this
.
Children
)
{
TreeNodeViewModel
child
=
this
.
t
reeViewModel
.
Get
(
childId
);
TreeNodeViewModel
child
=
this
.
T
reeViewModel
.
Get
(
childId
);
child
.
ConnectorX2
=
Width
/
2
+
this
.
X
-
child
.
X
;
}
}
...
...
@@ -211,7 +222,7 @@ namespace Modules.BehaviorTreeModule
foreach
(
var
childId
in
this
.
Children
)
{
TreeNodeViewModel
child
=
this
.
t
reeViewModel
.
Get
(
childId
);
TreeNodeViewModel
child
=
this
.
T
reeViewModel
.
Get
(
childId
);
child
.
ConnectorY2
=
Height
+
this
.
Y
-
child
.
Y
;
}
}
...
...
@@ -307,7 +318,7 @@ namespace Modules.BehaviorTreeModule
{
return
null
;
}
TreeNodeViewModel
parent
=
this
.
t
reeViewModel
.
Get
(
this
.
data
.
Parent
);
TreeNodeViewModel
parent
=
this
.
T
reeViewModel
.
Get
(
this
.
data
.
Parent
);
return
parent
;
}
set
...
...
@@ -362,7 +373,7 @@ namespace Modules.BehaviorTreeModule
}
int
index
=
this
.
Parent
.
Children
.
IndexOf
(
this
.
Id
);
return
index
==
0
?
null
:
this
.
t
reeViewModel
.
Get
(
this
.
Parent
.
Children
[
index
-
1
]);
return
index
==
0
?
null
:
this
.
T
reeViewModel
.
Get
(
this
.
Parent
.
Children
[
index
-
1
]);
}
}
...
...
@@ -376,7 +387,7 @@ namespace Modules.BehaviorTreeModule
}
int
maxIndex
=
this
.
Children
.
Count
-
1
;
return
this
.
t
reeViewModel
.
Get
(
this
.
Children
[
maxIndex
]);
return
this
.
T
reeViewModel
.
Get
(
this
.
Children
[
maxIndex
]);
}
}
...
...
@@ -384,7 +395,7 @@ namespace Modules.BehaviorTreeModule
{
get
{
return
this
.
Children
.
Count
==
0
?
null
:
this
.
t
reeViewModel
.
Get
(
this
.
Children
[
0
]);
return
this
.
Children
.
Count
==
0
?
null
:
this
.
T
reeViewModel
.
Get
(
this
.
Children
[
0
]);
}
}
...
...
CSharp/App/Modules/BehaviorTreeModule/TreeView.xaml.cs
浏览文件 @
9a439db1
...
...
@@ -161,7 +161,7 @@ namespace Modules.BehaviorTreeModule
// one root node
if
(
this
.
ViewModel
.
TreeNodes
.
Count
==
0
)
{
var
addTreeNode
=
new
TreeNodeViewModel
(
this
.
ViewModel
,
point
.
X
,
point
.
Y
)
TreeNodeViewModel
addTreeNode
=
new
TreeNodeViewModel
(
this
.
ViewModel
,
point
.
X
,
point
.
Y
)
{
Type
=
(
int
)
NodeType
.
Selector
};
...
...
@@ -171,8 +171,8 @@ namespace Modules.BehaviorTreeModule
{
if
(
this
.
listBox
.
SelectedItem
!=
null
)
{
var
parentNode
=
this
.
listBox
.
SelectedItem
as
TreeNodeViewModel
;
var
addTreeNode
=
new
TreeNodeViewModel
(
this
.
ViewModel
,
parentNode
)
TreeNodeViewModel
parentNode
=
this
.
listBox
.
SelectedItem
as
TreeNodeViewModel
;
TreeNodeViewModel
addTreeNode
=
new
TreeNodeViewModel
(
this
.
ViewModel
,
parentNode
)
{
Type
=
(
int
)
NodeType
.
Selector
,
};
...
...
CSharp/App/Modules/BehaviorTreeModule/TreeViewModel.cs
浏览文件 @
9a439db1
...
...
@@ -22,7 +22,7 @@ namespace Modules.BehaviorTreeModule
}
}
public
int
TreeId
{
get
;
set
;
}
public
int
TreeId
{
get
;
private
set
;
}
public
TreeViewModel
(
AllTreeViewModel
allTreeViewModel
)
{
...
...
@@ -32,28 +32,66 @@ namespace Modules.BehaviorTreeModule
this
.
treeNodes
.
Add
(
treeNodeViewModel
);
this
.
treeNodeDict
[
treeNodeViewModel
.
Id
]
=
treeNodeViewModel
;
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
public
TreeViewModel
(
List
<
TreeNodeData
>
treeNodeDatas
)
public
TreeViewModel
(
AllTreeViewModel
allTreeViewModel
,
List
<
TreeNodeData
>
treeNodeDatas
)
{
this
.
AllTreeViewModel
=
allTreeViewModel
;
this
.
TreeId
=
treeNodeDatas
[
0
].
TreeId
;
foreach
(
TreeNodeData
treeNodeData
in
treeNodeDatas
)
{
TreeNodeViewModel
treeNodeViewModel
=
new
TreeNodeViewModel
(
this
,
treeNodeData
);
this
.
treeNodes
.
Add
(
treeNodeViewModel
);
this
.
treeNodeDict
[
treeNodeViewModel
.
Id
]
=
treeNodeViewModel
;
}
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
public
TreeViewModel
(
AllTreeViewModel
allTreeViewModel
,
TreeViewModel
copyTree
)
{
this
.
AllTreeViewModel
=
allTreeViewModel
;
this
.
TreeId
=
++
this
.
AllTreeViewModel
.
MaxTreeId
;
// 旧id和新id的映射关系
var
idMapping
=
new
Dictionary
<
int
,
int
>();
idMapping
[
0
]
=
0
;
List
<
TreeNodeData
>
treeNodeDatas
=
copyTree
.
GetDatas
();
foreach
(
TreeNodeData
treeNodeData
in
treeNodeDatas
)
{
int
newId
=
++
this
.
AllTreeViewModel
.
MaxNodeId
;
idMapping
[
treeNodeData
.
Id
]
=
newId
;
treeNodeData
.
Id
=
newId
;
treeNodeData
.
TreeId
=
this
.
TreeId
;
}
foreach
(
TreeNodeData
treeNodeData
in
treeNodeDatas
)
{
treeNodeData
.
Parent
=
idMapping
[
treeNodeData
.
Parent
];
for
(
int
i
=
0
;
i
<
treeNodeData
.
Children
.
Count
;
++
i
)
{
treeNodeData
.
Children
[
i
]
=
idMapping
[
treeNodeData
.
Children
[
i
]];
}
}
foreach
(
TreeNodeData
treeNodeData
in
treeNodeDatas
)
{
TreeNodeViewModel
treeNodeViewModel
=
new
TreeNodeViewModel
(
this
,
treeNodeData
);
this
.
treeNodes
.
Add
(
treeNodeViewModel
);
this
.
treeNodeDict
[
treeNodeViewModel
.
Id
]
=
treeNodeViewModel
;
}
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
public
List
<
TreeNodeData
>
GetDatas
()
{
List
<
TreeNodeData
>
treeNodeDatas
=
new
List
<
TreeNodeData
>();
var
treeNodeDatas
=
new
List
<
TreeNodeData
>();
foreach
(
TreeNodeViewModel
treeNodeViewModel
in
this
.
treeNodes
)
{
treeNodeDatas
.
Add
(
treeNodeViewModel
.
Data
);
TreeNodeData
treeNodeData
=
(
TreeNodeData
)
treeNodeViewModel
.
Data
.
Clone
();
treeNodeDatas
.
Add
(
treeNodeData
);
}
return
treeNodeDatas
;
}
...
...
@@ -91,7 +129,7 @@ namespace Modules.BehaviorTreeModule
parent
.
Children
.
Add
(
treeNode
.
Id
);
}
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
...
...
@@ -113,7 +151,7 @@ namespace Modules.BehaviorTreeModule
public
void
Remove
(
TreeNodeViewModel
treeNodeViewModel
)
{
List
<
int
>
allId
=
new
List
<
int
>();
var
allId
=
new
List
<
int
>();
this
.
GetChildrenIdAndSelf
(
treeNodeViewModel
,
allId
);
foreach
(
int
childId
in
allId
)
...
...
@@ -129,7 +167,7 @@ namespace Modules.BehaviorTreeModule
parent
.
Children
.
Remove
(
treeNodeViewModel
.
Id
);
}
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
...
...
@@ -137,7 +175,7 @@ namespace Modules.BehaviorTreeModule
{
treeNodeViewModel
.
X
+=
offsetX
;
treeNodeViewModel
.
Y
+=
offsetY
;
foreach
(
var
childId
in
treeNodeViewModel
.
Children
)
foreach
(
int
childId
in
treeNodeViewModel
.
Children
)
{
TreeNodeViewModel
child
=
this
.
Get
(
childId
);
this
.
RecursionMove
(
child
,
offsetX
,
offsetY
);
...
...
@@ -178,7 +216,7 @@ namespace Modules.BehaviorTreeModule
from
.
Parent
.
Children
.
Remove
(
from
.
Id
);
to
.
Children
.
Add
(
from
.
Id
);
from
.
Parent
=
to
;
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
...
...
@@ -188,7 +226,7 @@ namespace Modules.BehaviorTreeModule
/// <param name="treeNodeViewModel"></param>
public
void
Fold
(
TreeNodeViewModel
treeNodeViewModel
)
{
List
<
int
>
allChildId
=
new
List
<
int
>();
var
allChildId
=
new
List
<
int
>();
this
.
GetAllChildrenId
(
treeNodeViewModel
,
allChildId
);
foreach
(
int
childId
in
allChildId
)
...
...
@@ -199,7 +237,7 @@ namespace Modules.BehaviorTreeModule
treeNodeViewModel
.
IsFold
=
true
;
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
...
...
@@ -211,7 +249,7 @@ namespace Modules.BehaviorTreeModule
{
treeNodeViewModel
.
IsFold
=
false
;
List
<
int
>
allChildId
=
new
List
<
int
>();
var
allChildId
=
new
List
<
int
>();
this
.
GetAllChildrenId
(
treeNodeViewModel
,
allChildId
);
foreach
(
int
childId
in
allChildId
)
...
...
@@ -220,7 +258,7 @@ namespace Modules.BehaviorTreeModule
this
.
treeNodes
.
Add
(
child
);
}
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
...
...
@@ -230,7 +268,7 @@ namespace Modules.BehaviorTreeModule
{
return
;
}
var
parent
=
treeNodeViewModel
.
Parent
;
TreeNodeViewModel
parent
=
treeNodeViewModel
.
Parent
;
int
index
=
parent
.
Children
.
IndexOf
(
treeNodeViewModel
.
Id
);
if
(
index
==
0
)
{
...
...
@@ -239,7 +277,7 @@ namespace Modules.BehaviorTreeModule
parent
.
Children
.
Remove
(
treeNodeViewModel
.
Id
);
parent
.
Children
.
Insert
(
index
-
1
,
treeNodeViewModel
.
Id
);
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
...
...
@@ -249,7 +287,7 @@ namespace Modules.BehaviorTreeModule
{
return
;
}
var
parent
=
treeNodeViewModel
.
Parent
;
TreeNodeViewModel
parent
=
treeNodeViewModel
.
Parent
;
int
index
=
parent
.
Children
.
IndexOf
(
treeNodeViewModel
.
Id
);
if
(
index
==
parent
.
Children
.
Count
-
1
)
{
...
...
@@ -258,7 +296,7 @@ namespace Modules.BehaviorTreeModule
parent
.
Children
.
Remove
(
treeNodeViewModel
.
Id
);
parent
.
Children
.
Insert
(
index
+
1
,
treeNodeViewModel
.
Id
);
var
treeLayout
=
new
TreeLayout
(
this
);
TreeLayout
treeLayout
=
new
TreeLayout
(
this
);
treeLayout
.
ExcuteLayout
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录