-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from AkiKurisu/dev-1.4.4
Merge dev
- Loading branch information
Showing
251 changed files
with
1,017 additions
and
842 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<div align="center"> | ||
|
||
# Editor Extensions | ||
|
||
This document contains notice for extending and customizing Editor. | ||
|
||
</div> | ||
|
||
## How to change font | ||
|
||
For visual effects such as fonts, colors, layout, etc, you can change the uss style file in `BehaviorTreeSetting`. | ||
|
||
## How to customize node | ||
|
||
For many reason, you may want to customize node like adding a button to preview effect. | ||
|
||
You can write an editor class to provide your node which is similar to customize `Editor` in `UnityEditor`. | ||
|
||
```C# | ||
[Ordered] | ||
public class SampleResolver : INodeResolver | ||
{ | ||
//Create custom node | ||
public IBehaviorTreeNode CreateNodeInstance(Type type) | ||
{ | ||
return new SampleNode(); | ||
} | ||
//Identify node type | ||
public static bool IsAcceptable(Type behaviorType) => behaviorType == typeof(SampleClass); | ||
|
||
//Your custom node | ||
private class SampleNode : ActionNode | ||
{ | ||
} | ||
} | ||
``` | ||
|
||
## How to customize field | ||
|
||
Since AkiBT use GraphView as frontend which is powered by UIElement, it can not support all fields. | ||
|
||
If you want to customize field or want to support some fields AkiBT currently not support (eg. `UnityEngine.Localization.LocalizedString`), you can write an editor class to provide your field which is similar to customize `PropertyDrawer` in `UnityEditor`. | ||
|
||
```C# | ||
[Ordered] | ||
public class LocalizedStringResolver : FieldResolver<LocalizedStringField,LocalizedString> | ||
{ | ||
public LocalizedStringResolver(FieldInfo fieldInfo) : base(fieldInfo) | ||
{ | ||
} | ||
protected override LocalizedStringField CreateEditorField(FieldInfo fieldInfo) | ||
{ | ||
return new LocalizedStringField(fieldInfo.Name); | ||
} | ||
public static bool IsAcceptable(Type infoType, FieldInfo _) => infoType == typeof(LocalizedString); | ||
|
||
} | ||
public class LocalizedStringField : BaseField<LocalizedString> | ||
{ | ||
|
||
} | ||
``` | ||
|
||
## How to use IMGUI in graph editor | ||
|
||
If you don't want to use ui element, you can notify the field with `WarpFieldAttribute` to let editor use IMGUI as field's frontend. | ||
|
||
```C# | ||
public class EventAction : Action | ||
{ | ||
[WarpField] | ||
public UnityEvent myEvent; | ||
} | ||
``` | ||
|
||
## How to customize graph editor | ||
|
||
TODO |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using UnityEngine; | ||
using UnityEngine.UIElements; | ||
namespace Kurisu.AkiBT.Editor | ||
{ | ||
internal class BehaviorTreeDebugButton : Button | ||
{ | ||
private const string ButtonText = "Edit BehaviorTree"; | ||
private const string DebugText = "Debug BehaviorTree"; | ||
public BehaviorTreeDebugButton(IBehaviorTree tree) : base(() => GraphEditorWindow.Show(tree)) | ||
{ | ||
style.fontSize = 15; | ||
style.unityFontStyleAndWeight = FontStyle.Bold; | ||
style.color = Color.white; | ||
if (!Application.isPlaying) | ||
{ | ||
style.backgroundColor = new StyleColor(new Color(140 / 255f, 160 / 255f, 250 / 255f)); | ||
text = ButtonText; | ||
} | ||
else | ||
{ | ||
text = DebugText; | ||
style.backgroundColor = new StyleColor(new Color(253 / 255f, 163 / 255f, 255 / 255f)); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.