Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
6a3cbc0a
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,发现更多精彩内容 >>
提交
6a3cbc0a
编写于
6月 26, 2017
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复行为树错误
上级
48857e7e
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
262 addition
and
199 deletion
+262
-199
Unity/Assets/Editor/BehaviorTreeEditor/BTEditor.cs
Unity/Assets/Editor/BehaviorTreeEditor/BTEditor.cs
+16
-7
Unity/Assets/Editor/BehaviorTreeEditor/BTEditor.cs.meta
Unity/Assets/Editor/BehaviorTreeEditor/BTEditor.cs.meta
+0
-0
Unity/Assets/Editor/BehaviorTreeEditor/BTEditorWindow.cs
Unity/Assets/Editor/BehaviorTreeEditor/BTEditorWindow.cs
+3
-3
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorNodeData.cs
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorNodeData.cs
+3
-3
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeConfigEditor.cs
...ets/Editor/BehaviorTreeEditor/BehaviorTreeConfigEditor.cs
+1
-1
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeConfigExtension.cs
.../Editor/BehaviorTreeEditor/BehaviorTreeConfigExtension.cs
+6
-4
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeNodeClassPopup.cs
...s/Editor/BehaviorTreeEditor/BehaviorTreeNodeClassPopup.cs
+3
-3
Unity/Assets/Editor/BehaviorTreeEditor/Event/BehaviorTreeRunTreeEvent_ShowDebugInfo.cs
...reeEditor/Event/BehaviorTreeRunTreeEvent_ShowDebugInfo.cs
+5
-5
Unity/Assets/Editor/BehaviorTreeEditor/GraphDesigner.cs
Unity/Assets/Editor/BehaviorTreeEditor/GraphDesigner.cs
+29
-29
Unity/Assets/Editor/BehaviorTreeEditor/NodeDesigner.cs
Unity/Assets/Editor/BehaviorTreeEditor/NodeDesigner.cs
+6
-6
Unity/Assets/Editor/BehaviorTreeEditor/NodeExtension.cs
Unity/Assets/Editor/BehaviorTreeEditor/NodeExtension.cs
+3
-3
Unity/Assets/Editor/BehaviorTreeEditor/PropertyDesigner.cs
Unity/Assets/Editor/BehaviorTreeEditor/PropertyDesigner.cs
+19
-19
Unity/Assets/Res/BT/BT_创建UI行为树.prefab
Unity/Assets/Res/BT/BT_创建UI行为树.prefab
+91
-105
Unity/Assets/Res/BT/BT_创建UI行为树.prefab.meta
Unity/Assets/Res/BT/BT_创建UI行为树.prefab.meta
+4
-3
Unity/Assets/Scripts/Component/BehaviorTreeComponent.cs
Unity/Assets/Scripts/Component/BehaviorTreeComponent.cs
+1
-1
Unity/Assets/Scripts/DllHelper.cs
Unity/Assets/Scripts/DllHelper.cs
+6
-1
Unity/Assets/Scripts/Init.cs
Unity/Assets/Scripts/Init.cs
+2
-0
Unity/Assets/Scripts/Object/AssemblyManager.cs
Unity/Assets/Scripts/Object/AssemblyManager.cs
+41
-0
Unity/Assets/Scripts/Object/AssemblyManager.cs.meta
Unity/Assets/Scripts/Object/AssemblyManager.cs.meta
+12
-0
Unity/Unity.Editor.csproj
Unity/Unity.Editor.csproj
+8
-5
Unity/Unity.csproj
Unity/Unity.csproj
+1
-0
Unity/Unity.sln.DotSettings.user
Unity/Unity.sln.DotSettings.user
+2
-1
未找到文件。
Unity/Assets/Editor/BehaviorTreeEditor/BTE
ntity
.cs
→
Unity/Assets/Editor/BehaviorTreeEditor/BTE
ditor
.cs
浏览文件 @
6a3cbc0a
...
@@ -10,9 +10,9 @@ using Object = UnityEngine.Object;
...
@@ -10,9 +10,9 @@ using Object = UnityEngine.Object;
namespace
MyEditor
namespace
MyEditor
{
{
public
class
BTE
ntity
:
Entity
public
class
BTE
ditor
:
Entity
{
{
private
static
BTE
ntity
instance
;
private
static
BTE
ditor
instance
;
public
const
int
NodeIdStartIndex
=
100000
;
public
const
int
NodeIdStartIndex
=
100000
;
private
int
AutoID
=
NodeIdStartIndex
;
private
int
AutoID
=
NodeIdStartIndex
;
...
@@ -34,7 +34,7 @@ namespace MyEditor
...
@@ -34,7 +34,7 @@ namespace MyEditor
}
}
}
}
public
static
BTE
ntity
Instance
public
static
BTE
ditor
Instance
{
{
get
get
{
{
...
@@ -43,7 +43,15 @@ namespace MyEditor
...
@@ -43,7 +43,15 @@ namespace MyEditor
return
instance
;
return
instance
;
}
}
instance
=
new
BTEntity
();
instance
=
new
BTEditor
();
AssemblyManager
.
Instance
.
Add
(
"Model"
,
typeof
(
Init
).
Assembly
);
AssemblyManager
.
Instance
.
Add
(
"Editor"
,
typeof
(
BTEditor
).
Assembly
);
instance
.
LoadNodeTypeProto
();
instance
.
AddComponent
<
EventComponent
>();
instance
.
AddComponent
<
TimerComponent
>();
instance
.
AddComponent
<
BTDebugComponent
>();
instance
.
AddComponent
<
BTDebugComponent
>();
return
instance
;
return
instance
;
}
}
...
@@ -98,7 +106,6 @@ namespace MyEditor
...
@@ -98,7 +106,6 @@ namespace MyEditor
public
void
NewLoadData
()
public
void
NewLoadData
()
{
{
LoadNodeTypeProto
();
NewLoadPrefabTree
();
NewLoadPrefabTree
();
FilterClassify
();
FilterClassify
();
}
}
...
@@ -191,7 +198,7 @@ namespace MyEditor
...
@@ -191,7 +198,7 @@ namespace MyEditor
public
void
RemoveUnusedArgs
(
NodeProto
nodeProto
)
public
void
RemoveUnusedArgs
(
NodeProto
nodeProto
)
{
{
NodeMeta
proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
nodeProto
.
Name
);
NodeMeta
proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
nodeProto
.
Name
);
List
<
string
>
unUsedList
=
new
List
<
string
>();
List
<
string
>
unUsedList
=
new
List
<
string
>();
foreach
(
KeyValuePair
<
string
,
object
>
item
in
nodeProto
.
Args
.
Dict
())
foreach
(
KeyValuePair
<
string
,
object
>
item
in
nodeProto
.
Args
.
Dict
())
{
{
...
@@ -420,9 +427,11 @@ namespace MyEditor
...
@@ -420,9 +427,11 @@ namespace MyEditor
}
}
selectNodeName
=
""
;
selectNodeName
=
""
;
CurTreeGO
=
go
;
CurTreeGO
=
go
;
NewLoadData
();
NewLoadData
();
BTEditorWindow
.
ShowWindow
();
BTEditorWindow
.
ShowWindow
();
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeOpenEditor
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeOpenEditor
);
}
}
public
string
[]
GetCanInPutEnvKeyArray
(
BehaviorNodeData
nodeData
,
NodeFieldDesc
desc
)
public
string
[]
GetCanInPutEnvKeyArray
(
BehaviorNodeData
nodeData
,
NodeFieldDesc
desc
)
...
...
Unity/Assets/Editor/BehaviorTreeEditor/BTE
ntity
.cs.meta
→
Unity/Assets/Editor/BehaviorTreeEditor/BTE
ditor
.cs.meta
浏览文件 @
6a3cbc0a
文件已移动
Unity/Assets/Editor/BehaviorTreeEditor/BTEditorWindow.cs
浏览文件 @
6a3cbc0a
...
@@ -95,11 +95,11 @@ namespace MyEditor
...
@@ -95,11 +95,11 @@ namespace MyEditor
case
EventType
.
KeyUp
:
case
EventType
.
KeyUp
:
if
(
e
.
keyCode
==
KeyCode
.
Escape
||
(
e
.
keyCode
==
KeyCode
.
S
&&
e
.
control
))
if
(
e
.
keyCode
==
KeyCode
.
Escape
||
(
e
.
keyCode
==
KeyCode
.
S
&&
e
.
control
))
{
{
BTE
ntity
.
Instance
.
SaveAll
();
BTE
ditor
.
Instance
.
SaveAll
();
}
}
else
if
(
e
.
keyCode
==
KeyCode
.
F4
)
else
if
(
e
.
keyCode
==
KeyCode
.
F4
)
{
{
BTE
ntity
.
Instance
.
SaveAll
();
BTE
ditor
.
Instance
.
SaveAll
();
}
}
break
;
break
;
case
EventType
.
MouseDown
:
case
EventType
.
MouseDown
:
...
@@ -109,7 +109,7 @@ namespace MyEditor
...
@@ -109,7 +109,7 @@ namespace MyEditor
public
void
OnDestroy
()
public
void
OnDestroy
()
{
{
BTE
ntity
.
Reset
();
BTE
ditor
.
Reset
();
}
}
public
void
onUpdatePropList
(
params
object
[]
list
)
public
void
onUpdatePropList
(
params
object
[]
list
)
...
...
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorNodeData.cs
浏览文件 @
6a3cbc0a
...
@@ -53,10 +53,10 @@ namespace MyEditor
...
@@ -53,10 +53,10 @@ namespace MyEditor
public
BehaviorNodeData
(
string
proto_name
)
public
BehaviorNodeData
(
string
proto_name
)
{
{
this
.
Name
=
proto_name
;
this
.
Name
=
proto_name
;
this
.
Proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
proto_name
);
this
.
Proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
proto_name
);
if
(
this
.
Proto
==
null
)
if
(
this
.
Proto
==
null
)
{
{
this
.
Proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
"Unknow"
);
this
.
Proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
"Unknow"
);
return
;
return
;
}
}
this
.
Classify
=
this
.
Proto
.
classify
;
this
.
Classify
=
this
.
Proto
.
classify
;
...
@@ -108,7 +108,7 @@ namespace MyEditor
...
@@ -108,7 +108,7 @@ namespace MyEditor
public
void
ResetId
()
public
void
ResetId
()
{
{
this
.
Id
=
BTE
ntity
.
Instance
.
AutoNodeId
();
this
.
Id
=
BTE
ditor
.
Instance
.
AutoNodeId
();
foreach
(
BehaviorNodeData
child
in
children
)
foreach
(
BehaviorNodeData
child
in
children
)
{
{
child
.
ResetId
();
child
.
ResetId
();
...
...
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeConfigEditor.cs
浏览文件 @
6a3cbc0a
...
@@ -14,7 +14,7 @@ namespace MyEditor
...
@@ -14,7 +14,7 @@ namespace MyEditor
if
(
GUILayout
.
Button
(
"打开行为树"
))
if
(
GUILayout
.
Button
(
"打开行为树"
))
{
{
BTE
ntity
.
Instance
.
OpenBehaviorEditor
(
config
.
gameObject
);
BTE
ditor
.
Instance
.
OpenBehaviorEditor
(
config
.
gameObject
);
}
}
EditorUtility
.
SetDirty
(
config
);
EditorUtility
.
SetDirty
(
config
);
}
}
...
...
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeConfigExtension.cs
浏览文件 @
6a3cbc0a
...
@@ -11,7 +11,7 @@ namespace Model
...
@@ -11,7 +11,7 @@ namespace Model
{
{
BehaviorNodeConfig
go
=
treeConfig
.
CreateNodeConfig
(
rootName
);
BehaviorNodeConfig
go
=
treeConfig
.
CreateNodeConfig
(
rootName
);
treeConfig
.
RootNodeConfig
=
go
.
GetComponent
<
BehaviorNodeConfig
>();
treeConfig
.
RootNodeConfig
=
go
.
GetComponent
<
BehaviorNodeConfig
>();
treeConfig
.
RootNodeConfig
.
id
=
BTE
ntity
.
NodeIdStartIndex
;
treeConfig
.
RootNodeConfig
.
id
=
BTE
ditor
.
NodeIdStartIndex
;
go
.
gameObject
.
name
=
rootName
;
go
.
gameObject
.
name
=
rootName
;
return
go
;
return
go
;
}
}
...
@@ -33,9 +33,11 @@ namespace Model
...
@@ -33,9 +33,11 @@ namespace Model
private
static
BehaviorNodeConfig
CreateNodeConfig
(
this
BehaviorTreeConfig
treeConfig
,
string
name
)
private
static
BehaviorNodeConfig
CreateNodeConfig
(
this
BehaviorTreeConfig
treeConfig
,
string
name
)
{
{
NodeMeta
proto
=
BTEntity
.
Instance
.
GetNodeMeta
(
name
);
NodeMeta
proto
=
BTEditor
.
Instance
.
GetNodeMeta
(
name
);
GameObject
go
=
new
GameObject
();
GameObject
go
=
new
GameObject
()
go
.
name
=
name
;
{
name
=
name
};
go
.
transform
.
parent
=
treeConfig
.
gameObject
.
transform
;
go
.
transform
.
parent
=
treeConfig
.
gameObject
.
transform
;
BehaviorNodeConfig
node
=
go
.
AddComponent
<
BehaviorNodeConfig
>();
BehaviorNodeConfig
node
=
go
.
AddComponent
<
BehaviorNodeConfig
>();
node
.
name
=
name
;
node
.
name
=
name
;
...
...
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeNodeClassPopup.cs
浏览文件 @
6a3cbc0a
...
@@ -68,7 +68,7 @@ namespace MyEditor
...
@@ -68,7 +68,7 @@ namespace MyEditor
foreach
(
string
name
in
nodeNameList
)
foreach
(
string
name
in
nodeNameList
)
{
{
NodeMeta
proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
name
);
NodeMeta
proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
name
);
if
(
GUILayout
.
Button
(
name
+
$"(
{
proto
.
describe
}
)"
,
GetButtonStyle
()))
if
(
GUILayout
.
Button
(
name
+
$"(
{
proto
.
describe
}
)"
,
GetButtonStyle
()))
{
{
if
(
SubWinType
.
CreateNode
==
mSubWinType
)
if
(
SubWinType
.
CreateNode
==
mSubWinType
)
...
@@ -109,7 +109,7 @@ namespace MyEditor
...
@@ -109,7 +109,7 @@ namespace MyEditor
selectType
=
Enum
.
GetName
(
typeof
(
NodeClassifyType
),
mEnumNodeTypeSelection
-
1
);
selectType
=
Enum
.
GetName
(
typeof
(
NodeClassifyType
),
mEnumNodeTypeSelection
-
1
);
foreach
(
string
name
in
list
)
foreach
(
string
name
in
list
)
{
{
NodeMeta
proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
name
);
NodeMeta
proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
name
);
if
(
selectType
==
proto
.
classify
)
if
(
selectType
==
proto
.
classify
)
{
{
result1
.
Add
(
name
);
result1
.
Add
(
name
);
...
@@ -125,7 +125,7 @@ namespace MyEditor
...
@@ -125,7 +125,7 @@ namespace MyEditor
List
<
string
>
result2
=
new
List
<
string
>();
List
<
string
>
result2
=
new
List
<
string
>();
foreach
(
string
name
in
result1
)
foreach
(
string
name
in
result1
)
{
{
NodeMeta
proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
name
);
NodeMeta
proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
name
);
if
(
name
.
ToUpper
().
Contains
(
text
.
ToUpper
())
||
proto
.
describe
.
ToUpper
().
Contains
(
text
.
ToUpper
()))
if
(
name
.
ToUpper
().
Contains
(
text
.
ToUpper
())
||
proto
.
describe
.
ToUpper
().
Contains
(
text
.
ToUpper
()))
{
{
result2
.
Add
(
name
);
result2
.
Add
(
name
);
...
...
Unity/Assets/Editor/BehaviorTreeEditor/Event/BehaviorTreeRunTreeEvent_ShowDebugInfo.cs
浏览文件 @
6a3cbc0a
...
@@ -8,12 +8,12 @@ namespace MyEditor
...
@@ -8,12 +8,12 @@ namespace MyEditor
{
{
public
void
Run
(
BehaviorTree
tree
,
List
<
long
>
pathList
)
public
void
Run
(
BehaviorTree
tree
,
List
<
long
>
pathList
)
{
{
if
(
BTE
ntity
.
Instance
.
BehaviorTreeConfig
!=
null
)
if
(
BTE
ditor
.
Instance
.
BehaviorTreeConfig
!=
null
)
{
{
BTE
ntity
.
Instance
.
ClearDebugState
();
BTE
ditor
.
Instance
.
ClearDebugState
();
BTE
ntity
.
Instance
.
GetComponent
<
BTDebugComponent
>().
TreePathList
.
Add
(
pathList
);
BTE
ditor
.
Instance
.
GetComponent
<
BTDebugComponent
>().
TreePathList
.
Add
(
pathList
);
BTE
ntity
.
Instance
.
GetComponent
<
BTDebugComponent
>().
BehaviorTree
=
tree
;
BTE
ditor
.
Instance
.
GetComponent
<
BTDebugComponent
>().
BehaviorTree
=
tree
;
BTE
ntity
.
Instance
.
SetDebugState
(
pathList
);
BTE
ditor
.
Instance
.
SetDebugState
(
pathList
);
}
}
}
}
}
}
...
...
Unity/Assets/Editor/BehaviorTreeEditor/GraphDesigner.cs
浏览文件 @
6a3cbc0a
...
@@ -199,7 +199,7 @@ namespace MyEditor
...
@@ -199,7 +199,7 @@ namespace MyEditor
if
(
mDragingRightBorder
)
if
(
mDragingRightBorder
)
{
{
mRightWidth
-=
e
.
delta
.
x
;
mRightWidth
-=
e
.
delta
.
x
;
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeRightDesignerDrag
,
e
.
delta
.
x
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeRightDesignerDrag
,
e
.
delta
.
x
);
return
;
return
;
}
}
...
@@ -327,9 +327,9 @@ namespace MyEditor
...
@@ -327,9 +327,9 @@ namespace MyEditor
if
(
mSelectedNode
!=
null
)
if
(
mSelectedNode
!=
null
)
{
{
if
(
mSelectedNode
.
NodeData
.
Proto
.
classify
==
NodeClassifyType
.
Root
.
ToString
()
||
if
(
mSelectedNode
.
NodeData
.
Proto
.
classify
==
NodeClassifyType
.
Root
.
ToString
()
||
BTE
ntity
.
Instance
.
CurTree
.
Root
.
Id
==
mSelectedNode
.
NodeData
.
Id
)
BTE
ditor
.
Instance
.
CurTree
.
Root
.
Id
==
mSelectedNode
.
NodeData
.
Id
)
{
{
List
<
NodeMeta
>
list
=
BTE
ntity
.
Instance
.
Classify2NodeProtoList
[
NodeClassifyType
.
Root
.
ToString
()];
List
<
NodeMeta
>
list
=
BTE
ditor
.
Instance
.
Classify2NodeProtoList
[
NodeClassifyType
.
Root
.
ToString
()];
foreach
(
NodeMeta
nodeType
in
list
)
foreach
(
NodeMeta
nodeType
in
list
)
{
{
result
.
Add
(
nodeType
.
name
);
result
.
Add
(
nodeType
.
name
);
...
@@ -339,7 +339,7 @@ namespace MyEditor
...
@@ -339,7 +339,7 @@ namespace MyEditor
else
else
{
{
// NodeChildLimitType nodeChildLimitType = mSelectedNode.NodeData.IsLeaf() ? NodeChildLimitType.All : NodeChildLimitType.WithChild;
// NodeChildLimitType nodeChildLimitType = mSelectedNode.NodeData.IsLeaf() ? NodeChildLimitType.All : NodeChildLimitType.WithChild;
List
<
NodeMeta
>
canSubtituteList
=
BTE
ntity
.
Instance
.
AllNodeProtoList
;
List
<
NodeMeta
>
canSubtituteList
=
BTE
ditor
.
Instance
.
AllNodeProtoList
;
canSubtituteList
.
Sort
(
CompareShowName
);
canSubtituteList
.
Sort
(
CompareShowName
);
foreach
(
NodeMeta
nodeType
in
canSubtituteList
)
foreach
(
NodeMeta
nodeType
in
canSubtituteList
)
{
{
...
@@ -362,7 +362,7 @@ namespace MyEditor
...
@@ -362,7 +362,7 @@ namespace MyEditor
{
{
List
<
string
>
result
=
new
List
<
string
>();
List
<
string
>
result
=
new
List
<
string
>();
foreach
(
KeyValuePair
<
string
,
List
<
NodeMeta
>>
kv
in
BTE
ntity
.
Instance
.
Classify2NodeProtoList
)
foreach
(
KeyValuePair
<
string
,
List
<
NodeMeta
>>
kv
in
BTE
ditor
.
Instance
.
Classify2NodeProtoList
)
{
{
string
classify
=
kv
.
Key
;
string
classify
=
kv
.
Key
;
List
<
NodeMeta
>
nodeProtoList
=
kv
.
Value
;
List
<
NodeMeta
>
nodeProtoList
=
kv
.
Value
;
...
@@ -389,8 +389,8 @@ namespace MyEditor
...
@@ -389,8 +389,8 @@ namespace MyEditor
menu
.
AddItem
(
new
GUIContent
(
"创建子节点"
),
false
,
this
.
PopUpCreate
);
menu
.
AddItem
(
new
GUIContent
(
"创建子节点"
),
false
,
this
.
PopUpCreate
);
menu
.
AddItem
(
new
GUIContent
(
"替换当前节点"
),
false
,
this
.
PopUpReplace
);
menu
.
AddItem
(
new
GUIContent
(
"替换当前节点"
),
false
,
this
.
PopUpReplace
);
string
selectNodeName
=
BTE
ntity
.
Instance
.
selectNodeName
;
string
selectNodeName
=
BTE
ditor
.
Instance
.
selectNodeName
;
string
selectNodeType
=
BTE
ntity
.
Instance
.
selectNodeType
;
string
selectNodeType
=
BTE
ditor
.
Instance
.
selectNodeType
;
if
(
mSelectedNode
!=
null
&&
selectNodeName
!=
""
)
if
(
mSelectedNode
!=
null
&&
selectNodeName
!=
""
)
{
{
if
(
selectNodeType
!=
NodeClassifyType
.
Root
.
ToString
()
&&
mSelectedNode
.
NodeData
.
Children
.
Count
<
mSelectedNode
.
NodeData
.
Proto
.
child_limit
)
if
(
selectNodeType
!=
NodeClassifyType
.
Root
.
ToString
()
&&
mSelectedNode
.
NodeData
.
Children
.
Count
<
mSelectedNode
.
NodeData
.
Proto
.
child_limit
)
...
@@ -467,8 +467,8 @@ namespace MyEditor
...
@@ -467,8 +467,8 @@ namespace MyEditor
private
void
CreateNode
()
private
void
CreateNode
()
{
{
NodeMeta
nodeProto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
BTEntity
.
Instance
.
selectNodeName
);
NodeMeta
nodeProto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
BTEditor
.
Instance
.
selectNodeName
);
BehaviorNodeData
nodeData
=
BTE
ntity
.
Instance
.
CreateNode
((
int
)
BTEntity
.
Instance
.
CurTree
.
Id
,
nodeProto
.
name
);
BehaviorNodeData
nodeData
=
BTE
ditor
.
Instance
.
CreateNode
((
int
)
BTEditor
.
Instance
.
CurTree
.
Id
,
nodeProto
.
name
);
CreateNode
(
nodeData
,
MousePosToGraphPos
(
mMousePos
));
CreateNode
(
nodeData
,
MousePosToGraphPos
(
mMousePos
));
}
}
...
@@ -500,8 +500,8 @@ namespace MyEditor
...
@@ -500,8 +500,8 @@ namespace MyEditor
}
}
if
(
mCopyNode
!=
null
&&
mCopyNode
!=
mSelectedNode
)
if
(
mCopyNode
!=
null
&&
mCopyNode
!=
mSelectedNode
)
{
{
BehaviorNodeData
data
=
BTE
ntity
.
Instance
.
CopyNode
(
mCopyNode
.
NodeData
);
BehaviorNodeData
data
=
BTE
ditor
.
Instance
.
CopyNode
(
mCopyNode
.
NodeData
);
BTE
ntity
.
Instance
.
ResetTreeId
();
BTE
ditor
.
Instance
.
ResetTreeId
();
NodeDesigner
node
=
CreateNode
(
data
,
Vector2
.
zero
);
NodeDesigner
node
=
CreateNode
(
data
,
Vector2
.
zero
);
ConnectNode
(
node
,
mSelectedNode
);
ConnectNode
(
node
,
mSelectedNode
);
}
}
...
@@ -537,20 +537,20 @@ namespace MyEditor
...
@@ -537,20 +537,20 @@ namespace MyEditor
return
;
return
;
}
}
mDetachedNodes
.
Remove
(
mSelectedNode
);
mDetachedNodes
.
Remove
(
mSelectedNode
);
BTE
ntity
.
Instance
.
ResetTreeId
();
BTE
ditor
.
Instance
.
ResetTreeId
();
}
}
private
void
ChangeNodeType
()
private
void
ChangeNodeType
()
{
{
ChangeNodeType
(
BTE
ntity
.
Instance
.
selectNodeName
);
ChangeNodeType
(
BTE
ditor
.
Instance
.
selectNodeName
);
}
}
//有待优化
//有待优化
private
void
ChangeNodeType
(
object
obj
)
private
void
ChangeNodeType
(
object
obj
)
{
{
string
nodeType
=
(
string
)
obj
;
string
nodeType
=
(
string
)
obj
;
NodeMeta
nodeProto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
nodeType
);
NodeMeta
nodeProto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
nodeType
);
BehaviorNodeData
nodeData
=
BTE
ntity
.
Instance
.
CreateNode
((
int
)
BTEntity
.
Instance
.
CurTree
.
Id
,
nodeProto
.
name
);
BehaviorNodeData
nodeData
=
BTE
ditor
.
Instance
.
CreateNode
((
int
)
BTEditor
.
Instance
.
CurTree
.
Id
,
nodeProto
.
name
);
NodeDesigner
oldNode
=
mSelectedNode
;
NodeDesigner
oldNode
=
mSelectedNode
;
NodeDesigner
newNode
=
new
NodeDesigner
(
nodeData
);
NodeDesigner
newNode
=
new
NodeDesigner
(
nodeData
);
...
@@ -558,11 +558,11 @@ namespace MyEditor
...
@@ -558,11 +558,11 @@ namespace MyEditor
{
{
newNode
.
NodeData
.
Id
=
RootNode
.
NodeData
.
Id
;
newNode
.
NodeData
.
Id
=
RootNode
.
NodeData
.
Id
;
RootNode
=
newNode
;
RootNode
=
newNode
;
BehaviorTreeData
oldTree
=
BTE
ntity
.
Instance
.
CurTree
;
BehaviorTreeData
oldTree
=
BTE
ditor
.
Instance
.
CurTree
;
BehaviorTreeData
newTree
=
new
BehaviorTreeData
(
oldTree
.
Id
);
BehaviorTreeData
newTree
=
new
BehaviorTreeData
(
oldTree
.
Id
);
newTree
.
classify
=
oldTree
.
classify
;
newTree
.
classify
=
oldTree
.
classify
;
newTree
.
Root
=
nodeData
;
newTree
.
Root
=
nodeData
;
BTE
ntity
.
Instance
.
CurTree
=
newTree
;
BTE
ditor
.
Instance
.
CurTree
=
newTree
;
}
}
else
else
{
{
...
@@ -575,8 +575,8 @@ namespace MyEditor
...
@@ -575,8 +575,8 @@ namespace MyEditor
{
{
newNode
.
AddChild
(
child
);
newNode
.
AddChild
(
child
);
}
}
BTE
ntity
.
Instance
.
ResetTreeId
();
BTE
ditor
.
Instance
.
ResetTreeId
();
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeAfterChangeNodeType
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeAfterChangeNodeType
);
}
}
public
void
onChangeNodeType
(
params
object
[]
list
)
public
void
onChangeNodeType
(
params
object
[]
list
)
...
@@ -606,20 +606,20 @@ namespace MyEditor
...
@@ -606,20 +606,20 @@ namespace MyEditor
{
{
mDetachedNodes
.
Add
(
node
);
mDetachedNodes
.
Add
(
node
);
}
}
BTE
ntity
.
Instance
.
ResetTreeId
();
BTE
ditor
.
Instance
.
ResetTreeId
();
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeCreateNode
,
node
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeCreateNode
,
node
);
return
node
;
return
node
;
}
}
/// 事件相关
/// 事件相关
public
NodeDesigner
onCreateTree
(
params
object
[]
list
)
public
NodeDesigner
onCreateTree
(
params
object
[]
list
)
{
{
if
(
BTE
ntity
.
Instance
.
CurTree
==
null
)
if
(
BTE
ditor
.
Instance
.
CurTree
==
null
)
{
{
Log
.
Error
(
$"CurTree can not be null"
);
Log
.
Error
(
$"CurTree can not be null"
);
return
null
;
return
null
;
}
}
RootNode
=
new
NodeDesigner
(
BTE
ntity
.
Instance
.
CurTree
.
Root
);
RootNode
=
new
NodeDesigner
(
BTE
ditor
.
Instance
.
CurTree
.
Root
);
CalcGraphRect
();
CalcGraphRect
();
return
RootNode
;
return
RootNode
;
}
}
...
@@ -636,8 +636,8 @@ namespace MyEditor
...
@@ -636,8 +636,8 @@ namespace MyEditor
string
name
=
(
string
)
list
[
0
];
string
name
=
(
string
)
list
[
0
];
Vector2
pos
=
(
Vector2
)
list
[
1
];
Vector2
pos
=
(
Vector2
)
list
[
1
];
NodeMeta
nodeProto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
name
);
NodeMeta
nodeProto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
name
);
BehaviorNodeData
nodeData
=
BTE
ntity
.
Instance
.
CreateNode
((
int
)
BTEntity
.
Instance
.
CurTree
.
Id
,
nodeProto
.
name
);
BehaviorNodeData
nodeData
=
BTE
ditor
.
Instance
.
CreateNode
((
int
)
BTEditor
.
Instance
.
CurTree
.
Id
,
nodeProto
.
name
);
CreateNode
(
nodeData
,
pos
);
CreateNode
(
nodeData
,
pos
);
}
}
...
@@ -707,7 +707,7 @@ namespace MyEditor
...
@@ -707,7 +707,7 @@ namespace MyEditor
public
void
ClickNode
(
NodeDesigner
dstNode
)
public
void
ClickNode
(
NodeDesigner
dstNode
)
{
{
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeClickNode
,
dstNode
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeClickNode
,
dstNode
);
}
}
public
void
ShiftNode
(
NodeDesigner
dstNode
)
public
void
ShiftNode
(
NodeDesigner
dstNode
)
...
@@ -734,7 +734,7 @@ namespace MyEditor
...
@@ -734,7 +734,7 @@ namespace MyEditor
int
idx
=
parent1
.
Children
.
IndexOf
(
node1
);
int
idx
=
parent1
.
Children
.
IndexOf
(
node1
);
parent1
.
AddChild
(
node2
,
idx
);
parent1
.
AddChild
(
node2
,
idx
);
parent1
.
AutoSort
();
parent1
.
AutoSort
();
//BTE
ntity
.GetInstance().ResetTreeId();
//BTE
ditor
.GetInstance().ResetTreeId();
}
}
// //不同父,插到node1的子节点
// //不同父,插到node1的子节点
...
@@ -745,7 +745,7 @@ namespace MyEditor
...
@@ -745,7 +745,7 @@ namespace MyEditor
// parent2.AutoSort();
// parent2.AutoSort();
// node1.AddChild(node2);
// node1.AddChild(node2);
// node1.AutoSort();
// node1.AutoSort();
// BTE
ntity
.GetInstance().ResetTreeId();
// BTE
ditor
.GetInstance().ResetTreeId();
}
}
public
void
MoveNode
(
NodeDesigner
dstNode
)
public
void
MoveNode
(
NodeDesigner
dstNode
)
...
@@ -776,7 +776,7 @@ namespace MyEditor
...
@@ -776,7 +776,7 @@ namespace MyEditor
parent2
.
AutoSort
();
parent2
.
AutoSort
();
node1
.
AddChild
(
node2
);
node1
.
AddChild
(
node2
);
node1
.
AutoSort
();
node1
.
AutoSort
();
//BTE
ntity
.GetInstance().ResetTreeId();
//BTE
ditor
.GetInstance().ResetTreeId();
}
}
}
}
}
}
\ No newline at end of file
Unity/Assets/Editor/BehaviorTreeEditor/NodeDesigner.cs
浏览文件 @
6a3cbc0a
...
@@ -90,7 +90,7 @@ namespace MyEditor
...
@@ -90,7 +90,7 @@ namespace MyEditor
public
void
Init
()
public
void
Init
()
{
{
NodeData
.
Proto
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
NodeData
.
Name
);
NodeData
.
Proto
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
NodeData
.
Name
);
string
[]
arr
=
NodeData
.
Proto
.
style
.
Split
(
'/'
);
string
[]
arr
=
NodeData
.
Proto
.
style
.
Split
(
'/'
);
string
style
=
arr
.
Length
>
0
?
arr
[
0
]
:
""
;
string
style
=
arr
.
Length
>
0
?
arr
[
0
]
:
""
;
if
(
style
==
""
)
if
(
style
==
""
)
...
@@ -178,7 +178,7 @@ namespace MyEditor
...
@@ -178,7 +178,7 @@ namespace MyEditor
{
{
GUI
.
DrawTexture
(
rect
,
mBoxSelectHighLight
);
GUI
.
DrawTexture
(
rect
,
mBoxSelectHighLight
);
}
}
else
if
(
BTE
ntity
.
Instance
.
IsHighLight
(
this
.
NodeData
))
else
if
(
BTE
ditor
.
Instance
.
IsHighLight
(
this
.
NodeData
))
{
{
GUI
.
DrawTexture
(
rect
,
mBoxHighLight
);
GUI
.
DrawTexture
(
rect
,
mBoxHighLight
);
}
}
...
@@ -281,17 +281,17 @@ namespace MyEditor
...
@@ -281,17 +281,17 @@ namespace MyEditor
if
(!
isSelected
&&
mouse
.
x
>
Pos
.
x
-
Width
/
2
-
30f
&&
mouse
.
x
<
Pos
.
x
+
Width
/
2
+
30f
&&
mouse
.
y
>
Pos
.
y
-
Height
/
2
&&
if
(!
isSelected
&&
mouse
.
x
>
Pos
.
x
-
Width
/
2
-
30f
&&
mouse
.
x
<
Pos
.
x
+
Width
/
2
+
30f
&&
mouse
.
y
>
Pos
.
y
-
Height
/
2
&&
mouse
.
y
<
Pos
.
y
+
Height
/
2
)
mouse
.
y
<
Pos
.
y
+
Height
/
2
)
{
{
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeMouseInNode
,
NodeData
,
this
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeMouseInNode
,
NodeData
,
this
);
}
}
//并判断是否点中了连线柄
//并判断是否点中了连线柄
if
(
mouse
.
x
>
LeftPos
.
x
-
30f
&&
mouse
.
x
<
LeftPos
.
x
+
10f
&&
mouse
.
y
>
LeftPos
.
y
-
30f
&&
mouse
.
y
<
LeftPos
.
y
+
30f
)
if
(
mouse
.
x
>
LeftPos
.
x
-
30f
&&
mouse
.
x
<
LeftPos
.
x
+
10f
&&
mouse
.
y
>
LeftPos
.
y
-
30f
&&
mouse
.
y
<
LeftPos
.
y
+
30f
)
{
{
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeConnectState
,
this
,
State
.
ConnectLeft
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeConnectState
,
this
,
State
.
ConnectLeft
);
}
}
if
(
mouse
.
x
>
RightPos
.
x
-
10f
&&
mouse
.
x
<
RightPos
.
x
+
30f
&&
mouse
.
y
>
RightPos
.
y
-
30f
&&
mouse
.
y
<
RightPos
.
y
+
30f
&&
NodeData
.
CanAddChild
())
if
(
mouse
.
x
>
RightPos
.
x
-
10f
&&
mouse
.
x
<
RightPos
.
x
+
30f
&&
mouse
.
y
>
RightPos
.
y
-
30f
&&
mouse
.
y
<
RightPos
.
y
+
30f
&&
NodeData
.
CanAddChild
())
{
{
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeConnectState
,
this
,
State
.
ConnectRight
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeConnectState
,
this
,
State
.
ConnectRight
);
}
}
for
(
int
i
=
0
;
i
<
this
.
Children
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
this
.
Children
.
Count
;
i
++)
...
@@ -305,7 +305,7 @@ namespace MyEditor
...
@@ -305,7 +305,7 @@ namespace MyEditor
isSelected
=
flag
;
isSelected
=
flag
;
if
(
flag
)
if
(
flag
)
{
{
BTE
ntity
.
Instance
.
SelectNode
(
this
.
NodeData
);
BTE
ditor
.
Instance
.
SelectNode
(
this
.
NodeData
);
}
}
}
}
...
...
Unity/Assets/Editor/BehaviorTreeEditor/NodeExtension.cs
浏览文件 @
6a3cbc0a
...
@@ -9,14 +9,14 @@ namespace Model
...
@@ -9,14 +9,14 @@ namespace Model
{
{
public
class
BTEditorTree
public
class
BTEditorTree
{
{
private
int
_id
=
BTE
ntity
.
NodeIdStartIndex
;
private
int
_id
=
BTE
ditor
.
NodeIdStartIndex
;
private
readonly
Node
_root
;
private
readonly
Node
_root
;
public
BTEditorTree
(
BehaviorTreeConfig
config
)
public
BTEditorTree
(
BehaviorTreeConfig
config
)
{
{
Type
rootType
=
typeof
(
Game
).
Assembly
.
GetType
(
$"Model.
{
config
.
RootNodeProto
.
Name
}
"
);
Type
rootType
=
typeof
(
Game
).
Assembly
.
GetType
(
$"Model.
{
config
.
RootNodeProto
.
Name
}
"
);
Node
root
=
(
Node
)
Activator
.
CreateInstance
(
rootType
,
config
.
RootNodeProto
);
Node
root
=
(
Node
)
Activator
.
CreateInstance
(
rootType
,
config
.
RootNodeProto
);
root
.
Id
=
BTE
ntity
.
NodeIdStartIndex
;
root
.
Id
=
BTE
ditor
.
NodeIdStartIndex
;
Queue
<
NodeProto
>
protoStack
=
new
Queue
<
NodeProto
>();
Queue
<
NodeProto
>
protoStack
=
new
Queue
<
NodeProto
>();
Queue
<
Node
>
nodeStack
=
new
Queue
<
Node
>();
Queue
<
Node
>
nodeStack
=
new
Queue
<
Node
>();
protoStack
.
Enqueue
(
config
.
RootNodeProto
);
protoStack
.
Enqueue
(
config
.
RootNodeProto
);
...
@@ -73,7 +73,7 @@ namespace Model
...
@@ -73,7 +73,7 @@ namespace Model
private
BTEditorTree
(
Node
root
,
BehaviorTreeConfig
config
)
private
BTEditorTree
(
Node
root
,
BehaviorTreeConfig
config
)
{
{
_root
=
root
;
_root
=
root
;
_root
.
Id
=
BTE
ntity
.
NodeIdStartIndex
;
_root
.
Id
=
BTE
ditor
.
NodeIdStartIndex
;
this
.
BTConfig
=
config
;
this
.
BTConfig
=
config
;
}
}
...
...
Unity/Assets/Editor/BehaviorTreeEditor/PropertyDesigner.cs
浏览文件 @
6a3cbc0a
...
@@ -113,7 +113,7 @@ namespace MyEditor
...
@@ -113,7 +113,7 @@ namespace MyEditor
mNodeFoldout
=
new
FoldoutFolder
(
"所有节点"
,
SelectNodeFolderCallback
);
mNodeFoldout
=
new
FoldoutFolder
(
"所有节点"
,
SelectNodeFolderCallback
);
mNodeFoldout
.
Fold
=
true
;
mNodeFoldout
.
Fold
=
true
;
foreach
(
KeyValuePair
<
string
,
List
<
NodeMeta
>>
kv
in
BTE
ntity
.
Instance
.
Classify2NodeProtoList
)
foreach
(
KeyValuePair
<
string
,
List
<
NodeMeta
>>
kv
in
BTE
ditor
.
Instance
.
Classify2NodeProtoList
)
{
{
string
classify
=
kv
.
Key
;
string
classify
=
kv
.
Key
;
List
<
NodeMeta
>
nodeTypeList
=
kv
.
Value
;
List
<
NodeMeta
>
nodeTypeList
=
kv
.
Value
;
...
@@ -195,18 +195,18 @@ namespace MyEditor
...
@@ -195,18 +195,18 @@ namespace MyEditor
{
{
Rect
boxRect
=
new
Rect
(
0f
,
Screen
.
height
-
offset
+
15f
,
this
.
mWidth
,
200f
);
Rect
boxRect
=
new
Rect
(
0f
,
Screen
.
height
-
offset
+
15f
,
this
.
mWidth
,
200f
);
GUILayout
.
BeginArea
(
boxRect
);
GUILayout
.
BeginArea
(
boxRect
);
BTE
ntity
.
Instance
.
selectNodeName
=
""
;
BTE
ditor
.
Instance
.
selectNodeName
=
""
;
if
(
mCurNode
!=
null
)
if
(
mCurNode
!=
null
)
{
{
string
[]
arr
=
mCurNode
.
Text
.
Split
(
' '
);
string
[]
arr
=
mCurNode
.
Text
.
Split
(
' '
);
string
name
=
arr
[
0
];
string
name
=
arr
[
0
];
BTE
ntity
.
Instance
.
selectNodeName
=
name
;
BTE
ditor
.
Instance
.
selectNodeName
=
name
;
BTE
ntity
.
Instance
.
selectNodeType
=
mCurNode
.
folderName
;
BTE
ditor
.
Instance
.
selectNodeType
=
mCurNode
.
folderName
;
if
(
mCurNode
.
folderName
!=
NodeClassifyType
.
Root
.
ToString
())
if
(
mCurNode
.
folderName
!=
NodeClassifyType
.
Root
.
ToString
())
{
{
if
(
GUILayout
.
Button
(
"新建"
))
if
(
GUILayout
.
Button
(
"新建"
))
{
{
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreePropertyDesignerNewCreateClick
,
name
,
Vector2
.
zero
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreePropertyDesignerNewCreateClick
,
name
,
Vector2
.
zero
);
}
}
}
}
if
(
mCurNode
.
folderName
!=
NodeClassifyType
.
Root
.
ToString
()
||
if
(
mCurNode
.
folderName
!=
NodeClassifyType
.
Root
.
ToString
()
||
...
@@ -214,15 +214,15 @@ namespace MyEditor
...
@@ -214,15 +214,15 @@ namespace MyEditor
{
{
if
(
GUILayout
.
Button
(
"替换"
))
if
(
GUILayout
.
Button
(
"替换"
))
{
{
Game
.
Scen
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeReplaceClick
,
name
,
Vector2
.
zero
);
BTEditor
.
Instanc
e
.
GetComponent
<
EventComponent
>().
Run
(
EventIdType
.
BehaviorTreeReplaceClick
,
name
,
Vector2
.
zero
);
}
}
}
}
if
(
GUILayout
.
Button
(
"保存"
))
if
(
GUILayout
.
Button
(
"保存"
))
{
{
BTE
ntity
.
Instance
.
SaveAll
();
BTE
ditor
.
Instance
.
SaveAll
();
}
}
NodeMeta
node
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
name
);
NodeMeta
node
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
name
);
GUILayout
.
Label
(
"节点名:"
+
node
.
name
);
GUILayout
.
Label
(
"节点名:"
+
node
.
name
);
GUILayout
.
Label
(
"描述:"
+
node
.
describe
);
GUILayout
.
Label
(
"描述:"
+
node
.
describe
);
}
}
...
@@ -232,7 +232,7 @@ namespace MyEditor
...
@@ -232,7 +232,7 @@ namespace MyEditor
private
void
ClearNodes
()
private
void
ClearNodes
()
{
{
BTE
ntity
.
Instance
.
selectNodeName
=
""
;
BTE
ditor
.
Instance
.
selectNodeName
=
""
;
mEnumNodeTypeSelection
=
0
;
mEnumNodeTypeSelection
=
0
;
mSearchNode
=
""
;
mSearchNode
=
""
;
foreach
(
FoldoutFolder
folder
in
mNodeFoldout
.
Folders
)
foreach
(
FoldoutFolder
folder
in
mNodeFoldout
.
Folders
)
...
@@ -308,7 +308,7 @@ namespace MyEditor
...
@@ -308,7 +308,7 @@ namespace MyEditor
value
=
(
GameObject
)
EditorGUILayout
.
ObjectField
(
desc
,
value
,
typeof
(
GameObject
),
false
);
value
=
(
GameObject
)
EditorGUILayout
.
ObjectField
(
desc
,
value
,
typeof
(
GameObject
),
false
);
if
(
value
.
GetComponent
<
BehaviorTreeConfig
>()
!=
null
&&
GUILayout
.
Button
(
"打开行为树"
))
if
(
value
.
GetComponent
<
BehaviorTreeConfig
>()
!=
null
&&
GUILayout
.
Button
(
"打开行为树"
))
{
{
BTE
ntity
.
Instance
.
OpenBehaviorEditor
(
value
);
BTE
ditor
.
Instance
.
OpenBehaviorEditor
(
value
);
SetToolBar
(
2
);
SetToolBar
(
2
);
}
}
EditorGUILayout
.
EndHorizontal
();
EditorGUILayout
.
EndHorizontal
();
...
@@ -323,7 +323,7 @@ namespace MyEditor
...
@@ -323,7 +323,7 @@ namespace MyEditor
}
}
if
(
GUILayout
.
Button
(
"保存行为树"
))
if
(
GUILayout
.
Button
(
"保存行为树"
))
{
{
BTE
ntity
.
Instance
.
SaveAll
();
BTE
ditor
.
Instance
.
SaveAll
();
}
}
NodeMeta
proto
=
mCurBehaviorNode
.
Proto
;
NodeMeta
proto
=
mCurBehaviorNode
.
Proto
;
GUILayout
.
Space
(
10f
);
GUILayout
.
Space
(
10f
);
...
@@ -382,7 +382,7 @@ namespace MyEditor
...
@@ -382,7 +382,7 @@ namespace MyEditor
{
{
NodeFieldDesc
desc
=
fieldList
[
i
];
NodeFieldDesc
desc
=
fieldList
[
i
];
Type
fieldType
=
NodeMetaHelper
.
GetFieldType
(
nodeName
,
desc
.
name
);
Type
fieldType
=
NodeMetaHelper
.
GetFieldType
(
nodeName
,
desc
.
name
);
NodeMeta
nodeMeta
=
BTE
ntity
.
Instance
.
GetNodeMeta
(
nodeName
);
NodeMeta
nodeMeta
=
BTE
ditor
.
Instance
.
GetNodeMeta
(
nodeName
);
// 如果不存在这个参数,给一个默认的
// 如果不存在这个参数,给一个默认的
if
(!
mCurBehaviorNode
.
Args
.
ContainsKey
(
desc
.
name
))
if
(!
mCurBehaviorNode
.
Args
.
ContainsKey
(
desc
.
name
))
...
@@ -630,7 +630,7 @@ namespace MyEditor
...
@@ -630,7 +630,7 @@ namespace MyEditor
private
object
InputEnumFieldValue
(
NodeFieldDesc
desc
)
private
object
InputEnumFieldValue
(
NodeFieldDesc
desc
)
{
{
string
oldValue
=
mCurBehaviorNode
.
Args
.
Get
(
desc
.
name
)?.
ToString
();
string
oldValue
=
mCurBehaviorNode
.
Args
.
Get
(
desc
.
name
)?.
ToString
();
string
[]
enumValueArr
=
BTE
ntity
.
Instance
.
GetCanInPutEnvKeyArray
(
mCurBehaviorNode
,
desc
);
string
[]
enumValueArr
=
BTE
ditor
.
Instance
.
GetCanInPutEnvKeyArray
(
mCurBehaviorNode
,
desc
);
if
(
enumValueArr
.
Length
==
0
)
if
(
enumValueArr
.
Length
==
0
)
{
{
enumValueArr
=
new
string
[
1
]
{
BTEnvKey
.
None
};
enumValueArr
=
new
string
[
1
]
{
BTEnvKey
.
None
};
...
@@ -704,8 +704,8 @@ namespace MyEditor
...
@@ -704,8 +704,8 @@ namespace MyEditor
public
void
DrawDebugView
()
public
void
DrawDebugView
()
{
{
BehaviorTree
behaviorTree
=
BTE
ntity
.
Instance
.
GetComponent
<
BTDebugComponent
>().
BehaviorTree
;
BehaviorTree
behaviorTree
=
BTE
ditor
.
Instance
.
GetComponent
<
BTDebugComponent
>().
BehaviorTree
;
List
<
List
<
long
>>
treePathList
=
BTE
ntity
.
Instance
.
GetComponent
<
BTDebugComponent
>().
TreePathList
;
List
<
List
<
long
>>
treePathList
=
BTE
ditor
.
Instance
.
GetComponent
<
BTDebugComponent
>().
TreePathList
;
if
(
behaviorTree
==
null
)
if
(
behaviorTree
==
null
)
{
{
return
;
return
;
...
@@ -713,7 +713,7 @@ namespace MyEditor
...
@@ -713,7 +713,7 @@ namespace MyEditor
if
(
GUILayout
.
Button
(
"清空执行记录"
))
if
(
GUILayout
.
Button
(
"清空执行记录"
))
{
{
treePathList
.
Clear
();
treePathList
.
Clear
();
BTE
ntity
.
Instance
.
ClearDebugState
();
BTE
ditor
.
Instance
.
ClearDebugState
();
}
}
const
float
offset
=
55f
;
const
float
offset
=
55f
;
GUILayout
.
BeginArea
(
new
Rect
(
0f
,
20f
,
this
.
mWidth
,
Screen
.
height
-
offset
));
GUILayout
.
BeginArea
(
new
Rect
(
0f
,
20f
,
this
.
mWidth
,
Screen
.
height
-
offset
));
...
@@ -721,12 +721,12 @@ namespace MyEditor
...
@@ -721,12 +721,12 @@ namespace MyEditor
new
Rect
(
0f
,
0f
,
this
.
mWidth
,
Screen
.
height
-
offset
),
this
.
mTreeScrollPos
,
new
Rect
(
0f
,
0f
,
this
.
mWidth
,
Screen
.
height
-
offset
),
this
.
mTreeScrollPos
,
new
Rect
(
0f
,
0f
,
this
.
mWidth
-
20f
,
treePathList
.
Count
*
22
),
false
,
false
);
new
Rect
(
0f
,
0f
,
this
.
mWidth
-
20f
,
treePathList
.
Count
*
22
),
false
,
false
);
for
(
int
i
=
0
;
i
<
BTE
ntity
.
Instance
.
GetComponent
<
BTDebugComponent
>().
TreePathList
.
Count
;
i
++)
for
(
int
i
=
0
;
i
<
BTE
ditor
.
Instance
.
GetComponent
<
BTDebugComponent
>().
TreePathList
.
Count
;
i
++)
{
{
if
(
GUILayout
.
Button
(
$"frame
{
i
}
"
))
if
(
GUILayout
.
Button
(
$"frame
{
i
}
"
))
{
{
BTE
ntity
.
Instance
.
ClearDebugState
();
BTE
ditor
.
Instance
.
ClearDebugState
();
BTE
ntity
.
Instance
.
SetDebugState
(
treePathList
[
i
]);
BTE
ditor
.
Instance
.
SetDebugState
(
treePathList
[
i
]);
}
}
}
}
GUI
.
EndScrollView
();
GUI
.
EndScrollView
();
...
...
Unity/Assets/Res/BT/BT_
大厅UI创建时执行
行为树.prefab
→
Unity/Assets/Res/BT/BT_
创建UI
行为树.prefab
浏览文件 @
6a3cbc0a
...
@@ -9,37 +9,50 @@ Prefab:
...
@@ -9,37 +9,50 @@ Prefab:
m_Modifications
:
[]
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_RemovedComponents
:
[]
m_ParentPrefab
:
{
fileID
:
0
}
m_ParentPrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1
000012987241756
}
m_RootGameObject
:
{
fileID
:
1
783477931437860
}
m_IsPrefabParent
:
1
m_IsPrefabParent
:
1
---
!u!1
&1000010648217578
---
!u!1
&1120422365835790
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
4465453297948628
}
-
component
:
{
fileID
:
114509792806546196
}
m_Layer
:
0
m_Name
:
UICreateRoot
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1279530075351798
GameObject
:
GameObject
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
serializedVersion
:
5
m_Component
:
m_Component
:
-
component
:
{
fileID
:
4000012502268996
}
-
component
:
{
fileID
:
4936977615441378
}
-
component
:
{
fileID
:
114000012927878958
}
-
component
:
{
fileID
:
114626019597701266
}
-
component
:
{
fileID
:
114000012831209000
}
-
component
:
{
fileID
:
114000012254895660
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
UIScal
e
m_Name
:
Sequenc
e
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
1
---
!u!1
&1
000011153220328
---
!u!1
&1
731652014909292
GameObject
:
GameObject
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
serializedVersion
:
5
m_Component
:
m_Component
:
-
component
:
{
fileID
:
4000010573939176
}
-
component
:
{
fileID
:
4480680075265146
}
-
component
:
{
fileID
:
114000012101497390
}
-
component
:
{
fileID
:
114176872673644624
}
-
component
:
{
fileID
:
114000012687440004
}
-
component
:
{
fileID
:
114472900551181156
}
-
component
:
{
fileID
:
114000013925923264
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
CreateUIEffect
m_Name
:
CreateUIEffect
m_TagString
:
Untagged
m_TagString
:
Untagged
...
@@ -47,208 +60,181 @@ GameObject:
...
@@ -47,208 +60,181 @@ GameObject:
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
1
---
!u!1
&1
000012663018806
---
!u!1
&1
783477931437860
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
serializedVersion
:
5
m_Component
:
m_Component
:
-
component
:
{
fileID
:
4000012504621142
}
-
component
:
{
fileID
:
4011488779620680
}
-
component
:
{
fileID
:
114000012710832806
}
-
component
:
{
fileID
:
114700535858552550
}
-
component
:
{
fileID
:
114000010724577698
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
UICreateRoot
m_Name
:
"
BT_
\u521B\u5EFA
UI
\u884C\u4E3A\u6811
"
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
1
---
!u!1
&1
0000129872417
56
---
!u!1
&1
8061816009330
56
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
serializedVersion
:
5
m_Component
:
m_Component
:
-
component
:
{
fileID
:
4
00001358535102
2
}
-
component
:
{
fileID
:
4
64636773024350
2
}
-
component
:
{
fileID
:
114
000011653782440
}
-
component
:
{
fileID
:
114
986442712064258
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
"
BT_
\u5927\u5385
UI
\u521B\u5EFA\u65F6\u6267\u884C\u884C\u4E3A\u6811
"
m_Name
:
Selector
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
m_IsActive
:
1
---
!u!4
&40
00010573939176
---
!u!4
&40
11488779620680
Transform
:
Transform
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000011153220328
}
m_GameObject
:
{
fileID
:
1
783477931437860
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
m_Father
:
{
fileID
:
4000012504621142
}
-
{
fileID
:
4465453297948628
}
m_RootOrder
:
1
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&4
000012502268996
---
!u!4
&4
465453297948628
Transform
:
Transform
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000010648217578
}
m_GameObject
:
{
fileID
:
1
120422365835790
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
m_Father
:
{
fileID
:
4000012504621142
}
-
{
fileID
:
4646367730243502
}
m_Father
:
{
fileID
:
4011488779620680
}
m_RootOrder
:
0
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&4
000012504621142
---
!u!4
&4
480680075265146
Transform
:
Transform
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000012663018806
}
m_GameObject
:
{
fileID
:
1
731652014909292
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
m_Children
:
[]
-
{
fileID
:
4000012502268996
}
m_Father
:
{
fileID
:
4646367730243502
}
-
{
fileID
:
4000010573939176
}
m_Father
:
{
fileID
:
4000013585351022
}
m_RootOrder
:
0
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&4
00001358535102
2
---
!u!4
&4
64636773024350
2
Transform
:
Transform
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
0000129872417
56
}
m_GameObject
:
{
fileID
:
1
8061816009330
56
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
m_Children
:
-
{
fileID
:
4000012504621142
}
-
{
fileID
:
4480680075265146
}
m_Father
:
{
fileID
:
0
}
-
{
fileID
:
4936977615441378
}
m_Father
:
{
fileID
:
4465453297948628
}
m_RootOrder
:
0
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&114000010724577698
---
!u!4
&4936977615441378
MonoBehaviour
:
Transform
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1000012663018806
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
872ab75cd8949824c994b1fb31d221f1
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
fieldName
:
ui
fieldValue
:
UI
---
!u!114
&114000011653782440
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000012987241756
}
m_GameObject
:
{
fileID
:
1
279530075351798
}
m_
Enabled
:
1
m_
LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_
EditorHideFlags
:
0
m_
LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_
Script
:
{
fileID
:
11500000
,
guid
:
450b9a4ed562c1546b663af4135cc7e7
,
type
:
3
}
m_
LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_
Name
:
m_
Children
:
[]
m_
EditorClassIdentifier
:
m_
Father
:
{
fileID
:
4646367730243502
}
RootNodeConfig
:
{
fileID
:
114000012710832806
}
m_RootOrder
:
1
m
AutoId
:
1
m
_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&114
000012101497390
---
!u!114
&114
176872673644624
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000011153220328
}
m_GameObject
:
{
fileID
:
1
731652014909292
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
2d74453161f00b24287b1f1fb56b0778
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
840ecb1e4ef94d2429fcb0ff2696d581
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
id
:
100003
id
:
100003
describe
:
describe
:
---
!u!114
&114
000012254895660
---
!u!114
&114
472900551181156
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000010648217578
}
m_GameObject
:
{
fileID
:
1
731652014909292
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
543f3ab39de095e4e80a0c5bbff4242e
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
179b62fdf77cfeb4188878f675b8fffd
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
fieldName
:
scale
fieldName
:
effect
fieldValue
:
1
fieldValue
:
{
fileID
:
0
}
---
!u!114
&114
000012687440004
---
!u!114
&114
509792806546196
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000011153220328
}
m_GameObject
:
{
fileID
:
1
120422365835790
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
8
72ab75cd8949824c994b1fb31d221f
1
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
8
40ecb1e4ef94d2429fcb0ff2696d58
1
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
fieldName
:
uiKey
id
:
100001
fieldValue
:
UI
describe
:
"
\u521B\u5EFA
UI
\u884C\u4E3A\u6811
"
---
!u!114
&114
00001271083280
6
---
!u!114
&114
62601959770126
6
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000012663018806
}
m_GameObject
:
{
fileID
:
1
279530075351798
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
2d74453161f00b24287b1f1fb56b0778
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
840ecb1e4ef94d2429fcb0ff2696d581
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
id
:
10000
1
id
:
10000
4
describe
:
"
\u5927\u5385
UI
\u521B\u5EFA\u65F6\u6267\u884C\u884C\u4E3A\u6811
"
describe
:
---
!u!114
&114
00001283120900
0
---
!u!114
&114
70053585855255
0
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000010648217578
}
m_GameObject
:
{
fileID
:
1
783477931437860
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
872ab75cd8949824c994b1fb31d221f1
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
4f1d451aabfc8454d94cbc4032d6a308
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
fieldName
:
uiKey
RootNodeConfig
:
{
fileID
:
114509792806546196
}
fieldValue
:
UI
---
!u!114
&114986442712064258
---
!u!114
&114000012927878958
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1
000010648217578
}
m_GameObject
:
{
fileID
:
1
806181600933056
}
m_Enabled
:
1
m_Enabled
:
1
m_EditorHideFlags
:
0
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
2d74453161f00b24287b1f1fb56b0778
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
840ecb1e4ef94d2429fcb0ff2696d581
,
type
:
3
}
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
id
:
100002
id
:
100002
describe
:
describe
:
---
!u!114
&114000013925923264
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1000011153220328
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
7be3fccf10005084b99360e730465802
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
fieldName
:
effect
fieldValue
:
{
fileID
:
1000013439777610
,
guid
:
ec75b784e8d7596478790f42fd4d9937
,
type
:
2
}
Unity/Assets/Res/BT/BT_
大厅UI创建时执行
行为树.prefab.meta
→
Unity/Assets/Res/BT/BT_
创建UI
行为树.prefab.meta
浏览文件 @
6a3cbc0a
fileFormatVersion: 2
fileFormatVersion: 2
guid:
5dfe2c32bf2efc044a7f3f57c34ab33
4
guid:
f9f78e1edb39dfd41a2722b1a53c7ad
4
timeCreated: 14
87666017
timeCreated: 14
98460809
licenseType:
Pro
licenseType:
Free
NativeFormatImporter:
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
Unity/Assets/Scripts/Component/BehaviorTreeComponent.cs
浏览文件 @
6a3cbc0a
...
@@ -55,7 +55,7 @@ namespace Model
...
@@ -55,7 +55,7 @@ namespace Model
private
static
void
InitFieldValue
(
ref
Node
node
,
NodeProto
nodeProto
)
private
static
void
InitFieldValue
(
ref
Node
node
,
NodeProto
nodeProto
)
{
{
Type
type
=
typeof
(
Game
).
Assembly
.
GetType
(
"Model."
+
nodeProto
.
Name
);
Type
type
=
AssemblyManager
.
Instance
.
Get
(
"Model"
)
.
GetType
(
"Model."
+
nodeProto
.
Name
);
foreach
(
var
args_item
in
nodeProto
.
Args
.
Dict
())
foreach
(
var
args_item
in
nodeProto
.
Args
.
Dict
())
{
{
...
...
Unity/Assets/Scripts/DllHelper.cs
浏览文件 @
6a3cbc0a
...
@@ -38,7 +38,12 @@ namespace Model
...
@@ -38,7 +38,12 @@ namespace Model
public
static
Type
[]
GetMonoTypes
()
public
static
Type
[]
GetMonoTypes
()
{
{
return
typeof
(
Game
).
Assembly
.
GetTypes
();
List
<
Type
>
types
=
new
List
<
Type
>();
foreach
(
Assembly
assembly
in
AssemblyManager
.
Instance
.
GetAll
())
{
types
.
AddRange
(
assembly
.
GetTypes
());
}
return
types
.
ToArray
();
}
}
public
static
IMethod
[]
GetMethodInfo
(
string
typeName
)
public
static
IMethod
[]
GetMethodInfo
(
string
typeName
)
...
...
Unity/Assets/Scripts/Init.cs
浏览文件 @
6a3cbc0a
...
@@ -29,6 +29,8 @@ namespace Model
...
@@ -29,6 +29,8 @@ namespace Model
{
{
Instance
=
this
;
Instance
=
this
;
AssemblyManager
.
Instance
.
Add
(
"Model"
,
typeof
(
Model
.
Init
).
Assembly
);
this
.
RegisterAssembly
();
this
.
RegisterAssembly
();
this
.
RegisterILAdapter
();
this
.
RegisterILAdapter
();
this
.
RegisterDelegate
();
this
.
RegisterDelegate
();
...
...
Unity/Assets/Scripts/Object/AssemblyManager.cs
0 → 100644
浏览文件 @
6a3cbc0a
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
namespace
Model
{
public
class
AssemblyManager
{
private
static
readonly
AssemblyManager
instance
=
new
AssemblyManager
();
public
static
AssemblyManager
Instance
{
get
{
return
instance
;
}
}
private
readonly
Dictionary
<
string
,
Assembly
>
dictionary
=
new
Dictionary
<
string
,
Assembly
>();
public
void
Add
(
string
name
,
Assembly
assembly
)
{
this
.
dictionary
[
name
]
=
assembly
;
}
public
void
Remove
(
string
name
)
{
this
.
dictionary
.
Remove
(
name
);
}
public
Assembly
[]
GetAll
()
{
return
this
.
dictionary
.
Values
.
ToArray
();
}
public
Assembly
Get
(
string
name
)
{
return
this
.
dictionary
[
name
];
}
}
}
Unity/Assets/Scripts/Object/AssemblyManager.cs.meta
0 → 100644
浏览文件 @
6a3cbc0a
fileFormatVersion: 2
guid: 65c436598fced964691bd88d3883b041
timeCreated: 1498464228
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Unity.Editor.csproj
浏览文件 @
6a3cbc0a
...
@@ -12,12 +12,15 @@
...
@@ -12,12 +12,15 @@
<ProjectTypeGuids>
{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<ProjectTypeGuids>
{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<TargetFrameworkIdentifier>
.NETFramework
</TargetFrameworkIdentifier>
<TargetFrameworkIdentifier>
.NETFramework
</TargetFrameworkIdentifier>
<TargetFrameworkVersion>
v4.6
</TargetFrameworkVersion>
<TargetFrameworkVersion>
v4.6
</TargetFrameworkVersion>
<TargetFrameworkProfile></TargetFrameworkProfile>
<TargetFrameworkProfile>
<CompilerResponseFile></CompilerResponseFile>
</TargetFrameworkProfile>
<CompilerResponseFile>
</CompilerResponseFile>
<UnityProjectType>
Editor:5
</UnityProjectType>
<UnityProjectType>
Editor:5
</UnityProjectType>
<UnityBuildTarget>
StandaloneWindows64:19
</UnityBuildTarget>
<UnityBuildTarget>
StandaloneWindows64:19
</UnityBuildTarget>
<UnityVersion>
2017.1.0b8
</UnityVersion>
<UnityVersion>
2017.1.0b8
</UnityVersion>
<RootNamespace></RootNamespace>
<RootNamespace>
</RootNamespace>
<LangVersion>
6
</LangVersion>
<LangVersion>
6
</LangVersion>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
...
@@ -140,7 +143,7 @@
...
@@ -140,7 +143,7 @@
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTBatchOperation.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTBatchOperation.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTDesignerUtility.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTDesignerUtility.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTEditorWindow.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTEditorWindow.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTE
ntity
.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\BTE
ditor
.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\Component\BTDebugComponent.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\Component\BTDebugComponent.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\CustomArrayField.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\CustomArrayField.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\Event\BehaviorTreeAfterChangeNodeTypeEvent_SelectNode.cs"
/>
<Compile
Include=
"Assets\Editor\BehaviorTreeEditor\Event\BehaviorTreeAfterChangeNodeTypeEvent_SelectNode.cs"
/>
...
@@ -168,4 +171,4 @@
...
@@ -168,4 +171,4 @@
</ItemGroup>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Target
Name=
"GenerateTargetFrameworkMonikerAttribute"
/>
<Target
Name=
"GenerateTargetFrameworkMonikerAttribute"
/>
</Project>
</Project>
\ No newline at end of file
Unity/Unity.csproj
浏览文件 @
6a3cbc0a
...
@@ -484,6 +484,7 @@
...
@@ -484,6 +484,7 @@
<Compile
Include=
"Assets\Scripts\Message\OpcodeHelper.cs"
/>
<Compile
Include=
"Assets\Scripts\Message\OpcodeHelper.cs"
/>
<Compile
Include=
"Assets\Scripts\Message\RpcException.cs"
/>
<Compile
Include=
"Assets\Scripts\Message\RpcException.cs"
/>
<Compile
Include=
"Assets\Scripts\MonoMethod.cs"
/>
<Compile
Include=
"Assets\Scripts\MonoMethod.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\AssemblyManager.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\Component.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\Component.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\Disposer.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\Disposer.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\Entity.cs"
/>
<Compile
Include=
"Assets\Scripts\Object\Entity.cs"
/>
...
...
Unity/Unity.sln.DotSettings.user
浏览文件 @
6a3cbc0a
<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">
<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/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/NonCompletingCharacters/@EntryValue"></s:String></wpf:ResourceDictionary>
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/NonCompletingCharacters/@EntryValue"></s:String>
\ No newline at end of file
<s:String x:Key="/Default/Housekeeping/Layout/DialogWindows/RefactoringWizardWindow/Location/@EntryValue">247,-4</s:String></wpf:ResourceDictionary>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录