Skip to content

Commit 5d4543f

Browse files
committed
sort of working again
1 parent 8f71200 commit 5d4543f

31 files changed

+2340
-66
lines changed

Assets/Editor/BehaviorLogDrawer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public void DrawBehaviorWithAllChildren()
114114
}
115115
this.TotalOffset.left = offset;
116116
this.TotalOffset.right = offset;
117-
DrawBehaviorLogEntry();
117+
DrawBehaviorLogEntry();
118118
}
119119

120120
private int DrawChildrenAndGetOffset()
@@ -142,8 +142,9 @@ private int DrawChildrenAndGetOffset()
142142
}
143143
return newOffset;
144144
}
145+
//FIXED
145146

146-
protected void DrawBehaviorLogEntry()
147+
public void DrawBehaviorLogEntry()
147148
{
148149
if(Entry != null)
149150
{

Assets/Editor/TreeDebuggerWindow.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ private void OnEnable()
3030
/// Behavior IDs to track current behaviors being watched.
3131
/// </summary>
3232
public Dictionary<int, BehaviorLogDrawer> LogDrawers = new Dictionary<int, BehaviorLogDrawer>();
33+
public Dictionary<int, List<BehaviorLogDrawer>> LogDrawersByDepth = new Dictionary<int, List<BehaviorLogDrawer>>();
34+
3335

3436
Rect TopToolbarRect
3537
{
@@ -122,6 +124,8 @@ private void TreeLogArea(Rect rect)
122124
TotalOffset = MinimumMargins,
123125
Entry = x
124126
});
127+
128+
125129
}
126130
})
127131
.Subscribe();
@@ -133,9 +137,11 @@ private void TreeLogArea(Rect rect)
133137
private void DrawAllLogDrawers()
134138
{
135139
var parentsDepthSorted = LogDrawers.Values.Where(x => x.Entry.State.Depth == -1);
136-
137-
foreach(var parentDrawer in parentsDepthSorted)
140+
141+
foreach (var parentDrawer in parentsDepthSorted)
138142
{
143+
//Should be called in sorted order, from bottom to top.
144+
//this allows lower depth parents to know the correct spacing of their children
139145
parentDrawer.DrawBehaviorWithAllChildren();
140146
}
141147
}

Assets/Editor/TypeDependantDrawer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ private static void DrawFieldsFlowLayout(GUIContent label, dynamic target, Rect
108108
}
109109
else
110110
{
111-
Debug.LogError(
112-
"DrawFields does not support fields of type " +
113-
fields[i].FieldType);
111+
//Debug.LogError(
112+
// "DrawFields does not support fields of type " +
113+
// fields[i].FieldType);
114114
}
115115
}
116116
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: ccda9b5dedb28eb4788e2d2d8c20a954, type: 3}
12+
m_Name: New BehaviorTreeManagerAsset 1
13+
m_EditorClassIdentifier:
14+
TimesToTick: 0
15+
SecondsBetweenTicks: 0.1
16+
RunnerElementsJSON: "[\r\n {\r\n \"NumberOfFailuresBeforeFail\": 0,\r\n \"NumberOfSuccessBeforeSucceed\":
17+
0,\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
18+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Components.ParallelRunner\",\r\n
19+
\ \"Depth\": -1,\r\n \"HasChildren\": false,\r\n \"Name\": \"root\",\r\n
20+
\ \"ID\": -1\r\n }\r\n]"

Assets/Examples/New BehaviorTreeManagerAsset 1.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: ccda9b5dedb28eb4788e2d2d8c20a954, type: 3}
12+
m_Name: New BehaviorTreeManagerAsset 2
13+
m_EditorClassIdentifier:
14+
TimesToTick: 0
15+
SecondsBetweenTicks: 0.1
16+
RunnerElementsJSON: "[\r\n {\r\n \"NumberOfFailuresBeforeFail\": 0,\r\n \"NumberOfSuccessBeforeSucceed\":
17+
0,\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
18+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Components.ParallelRunner\",\r\n
19+
\ \"Depth\": -1,\r\n \"HasChildren\": false,\r\n \"Name\": \"root\",\r\n
20+
\ \"ID\": -1\r\n }\r\n]"

Assets/Examples/New BehaviorTreeManagerAsset 2.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: ccda9b5dedb28eb4788e2d2d8c20a954, type: 3}
12+
m_Name: New BehaviorTreeManagerAsset 3
13+
m_EditorClassIdentifier:
14+
TimesToTick: 0
15+
SecondsBetweenTicks: 0.1
16+
RunnerElementsJSON: "[\r\n {\r\n \"NumberOfFailuresBeforeFail\": 0,\r\n \"NumberOfSuccessBeforeSucceed\":
17+
0,\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
18+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Components.ParallelRunner\",\r\n
19+
\ \"Depth\": -1,\r\n \"HasChildren\": true,\r\n \"Name\": \"root\",\r\n
20+
\ \"ID\": -1\r\n },\r\n {\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\":
21+
{\r\n \"Value\": 0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\":
22+
\"Assets.Scripts.AI.Components.Selector\",\r\n \"Depth\": 0,\r\n \"HasChildren\":
23+
true,\r\n \"Name\": \"Selector 0\",\r\n \"ID\": 0\r\n },\r\n {\r\n \"Initialized\":
24+
false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\": 0,\r\n \"HasValue\":
25+
true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Decorators.Inverter\",\r\n
26+
\ \"Depth\": 1,\r\n \"HasChildren\": true,\r\n \"Name\": \"Inverter 4\",\r\n
27+
\ \"ID\": 4\r\n },\r\n {\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\":
28+
{\r\n \"Value\": 0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\":
29+
\"Assets.Scripts.AI.Nodes.DebugOutNode\",\r\n \"Depth\": 2,\r\n \"HasChildren\":
30+
false,\r\n \"Name\": \"DebugOutNode 5\",\r\n \"ID\": 5\r\n },\r\n {\r\n
31+
\ \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
32+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Components.Sequencer\",\r\n
33+
\ \"Depth\": 1,\r\n \"HasChildren\": true,\r\n \"Name\": \"Sequencer 3\",\r\n
34+
\ \"ID\": 3\r\n },\r\n {\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\":
35+
{\r\n \"Value\": 0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\":
36+
\"Assets.Scripts.AI.Decorators.Inverter\",\r\n \"Depth\": 2,\r\n \"HasChildren\":
37+
true,\r\n \"Name\": \"Inverter 1\",\r\n \"ID\": 1\r\n },\r\n {\r\n \"MoveSpeed\":
38+
1.0,\r\n \"UpdatePlayersTickInterval\": 20,\r\n \"UpdateSelfPositionTickInterval\":
39+
5,\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
40+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.MoveEnemyIfCloseToPlayer\",\r\n
41+
\ \"Depth\": 3,\r\n \"HasChildren\": false,\r\n \"Name\": \"MoveEnemyIfCloseToPlayer
42+
2\",\r\n \"ID\": 2\r\n }\r\n]"

Assets/Examples/New BehaviorTreeManagerAsset 3.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: ccda9b5dedb28eb4788e2d2d8c20a954, type: 3}
12+
m_Name: New BehaviorTreeManagerAsset 4
13+
m_EditorClassIdentifier:
14+
TimesToTick: 0
15+
SecondsBetweenTicks: 0.1
16+
RunnerElementsJSON: "[\r\n {\r\n \"NumberOfFailuresBeforeFail\": 0,\r\n \"NumberOfSuccessBeforeSucceed\":
17+
0,\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
18+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Components.ParallelRunner\",\r\n
19+
\ \"Depth\": -1,\r\n \"HasChildren\": true,\r\n \"Name\": \"root\",\r\n
20+
\ \"ID\": -1\r\n },\r\n {\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\":
21+
{\r\n \"Value\": 0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\":
22+
\"Assets.Scripts.AI.Components.Sequencer\",\r\n \"Depth\": 0,\r\n \"HasChildren\":
23+
true,\r\n \"Name\": \"Sequencer 0\",\r\n \"ID\": 0\r\n },\r\n {\r\n \"NumberOfFailuresBeforeFail\":
24+
0,\r\n \"NumberOfSuccessBeforeSucceed\": 0,\r\n \"Initialized\": false,\r\n
25+
\ \"NumberOfTicksReceived\": {\r\n \"Value\": 0,\r\n \"HasValue\":
26+
true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Components.ParallelRunner\",\r\n
27+
\ \"Depth\": 1,\r\n \"HasChildren\": true,\r\n \"Name\": \"ParallelRunner
28+
4\",\r\n \"ID\": 4\r\n },\r\n {\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\":
29+
{\r\n \"Value\": 0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\":
30+
\"Assets.Scripts.AI.Decorators.Inverter\",\r\n \"Depth\": 2,\r\n \"HasChildren\":
31+
true,\r\n \"Name\": \"Inverter 5\",\r\n \"ID\": 5\r\n },\r\n {\r\n \"Initialized\":
32+
false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\": 0,\r\n \"HasValue\":
33+
true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.DebugOutNode\",\r\n
34+
\ \"Depth\": 3,\r\n \"HasChildren\": false,\r\n \"Name\": \"DebugOutNode
35+
3\",\r\n \"ID\": 3\r\n },\r\n {\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\":
36+
{\r\n \"Value\": 0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\":
37+
\"Assets.Scripts.AI.Decorators.Inverter\",\r\n \"Depth\": 1,\r\n \"HasChildren\":
38+
true,\r\n \"Name\": \"Inverter 1\",\r\n \"ID\": 1\r\n },\r\n {\r\n \"MoveSpeed\":
39+
1.0,\r\n \"UpdatePlayersTickInterval\": 20,\r\n \"UpdateSelfPositionTickInterval\":
40+
5,\r\n \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
41+
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.MoveEnemyIfCloseToPlayer\",\r\n
42+
\ \"Depth\": 2,\r\n \"HasChildren\": false,\r\n \"Name\": \"MoveEnemyIfCloseToPlayer
43+
2\",\r\n \"ID\": 2\r\n }\r\n]"

Assets/Examples/New BehaviorTreeManagerAsset.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Examples/test2.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--- !u!114 &11400000
44
MonoBehaviour:
55
m_ObjectHideFlags: 0
6-
m_PrefabParentObject: {fileID: 0}
6+
m_CorrespondingSourceObject: {fileID: 0}
77
m_PrefabInternal: {fileID: 0}
88
m_GameObject: {fileID: 0}
99
m_Enabled: 1
@@ -45,7 +45,7 @@ MonoBehaviour:
4545
\ \"Initialized\": false,\r\n \"NumberOfTicksReceived\": {\r\n \"Value\":
4646
0,\r\n \"HasValue\": true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.DebugOutNode\",\r\n
4747
\ \"Depth\": 3,\r\n \"HasChildren\": false,\r\n \"Name\": \"DebugOutNode
48-
12\",\r\n \"ID\": 12\r\n },\r\n {\r\n \"MoveSpeed\": 1.0,\r\n \"UpdatePlayersTickInterval\":
48+
12\",\r\n \"ID\": 12\r\n },\r\n {\r\n \"MoveSpeed\": 12.0,\r\n \"UpdatePlayersTickInterval\":
4949
6,\r\n \"UpdateSelfPositionTickInterval\": 3,\r\n \"Initialized\": false,\r\n
5050
\ \"NumberOfTicksReceived\": {\r\n \"Value\": 0,\r\n \"HasValue\":
5151
true\r\n },\r\n \"ElementType\": \"Assets.Scripts.AI.Nodes.MoveEnemyIfCloseToPlayer\",\r\n
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))
2+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
3+
4+
using System;
5+
using System.Collections.Generic;
6+
7+
namespace UniRx.Async
8+
{
9+
public static class EnumerableAsyncExtensions
10+
{
11+
// overload resolver - .Select(async x => { }) : IEnumerable<UniTask<T>>
12+
13+
public static IEnumerable<UniTask> Select<T>(this IEnumerable<T> source, Func<T, UniTask> selector)
14+
{
15+
return System.Linq.Enumerable.Select(source, selector);
16+
}
17+
18+
public static IEnumerable<UniTask<TR>> Select<T, TR>(this IEnumerable<T> source, Func<T, UniTask<TR>> selector)
19+
{
20+
return System.Linq.Enumerable.Select(source, selector);
21+
}
22+
23+
public static IEnumerable<UniTask> Select<T>(this IEnumerable<T> source, Func<T, int, UniTask> selector)
24+
{
25+
return System.Linq.Enumerable.Select(source, selector);
26+
}
27+
28+
public static IEnumerable<UniTask<TR>> Select<T, TR>(this IEnumerable<T> source, Func<T, int, UniTask<TR>> selector)
29+
{
30+
return System.Linq.Enumerable.Select(source, selector);
31+
}
32+
}
33+
}
34+
35+
36+
#endif

Assets/Plugins/UniRx/Scripts/Async/EnumerableAsyncExtensions.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#if CSHARP_7_OR_LATER || (UNITY_2018_3_OR_NEWER && (NET_STANDARD_2_0 || NET_4_6))
2+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
3+
4+
using System.Collections.Generic;
5+
6+
namespace UniRx.Async.Internal
7+
{
8+
public static class PromiseHelper
9+
{
10+
public static void TrySetResultAll<TPromise, T>(IEnumerable<TPromise> source, T value)
11+
where TPromise : class, IResolvePromise<T>
12+
{
13+
var rentArray = ArrayPoolUtil.Materialize(source);
14+
var clearArray = true;
15+
try
16+
{
17+
var array = rentArray.Array;
18+
var len = rentArray.Length;
19+
for (int i = 0; i < len; i++)
20+
{
21+
array[i].TrySetResult(value);
22+
array[i] = null;
23+
}
24+
clearArray = false;
25+
}
26+
finally
27+
{
28+
rentArray.DisposeManually(clearArray);
29+
}
30+
}
31+
}
32+
}
33+
34+
#endif

Assets/Plugins/UniRx/Scripts/Async/Internal/PromiseHelper.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)