Ooops!Easy to create EditorWindow

UnityEditorScript(UES) is so easy to creat EditorWindow.It’s looks like ActionScript3.

Features:

  • Easy to creat EditorWindow.
  • Easy to creat ui element on stage.
  • Easy to add event listener.
  • Comes with full C# source code.

Enjoy!

Documentation and api reference manual would be great

UnityEditorScript(UES) Document

UnityEditorScript(UES) is so easy to creat EditorWindow.It’s looks like ActionScript3.You can find help in “Tools/UnityEditorScript”.
UnityEditorScript(UES)是灵活简便实现[/COLOR]EditorWindow界面的插件。它的实现与ActionScript3比较相似。你可以在顶部菜单Tools/UnityEditorScript查看相关内容。[/FONT]

1.Creat Window
Your custom EditorWindow need inherited USEWindow.
创建窗体[/COLOR][/FONT]
自定义窗口需要继承自[/COLOR]UESWindow[/FONT]

public class UESDemoWindow : UESWindow
{
//Open window
[MenuItem(“Tools/UnityEditorScript/Demo”)]
static void Init()
{
var window = EditorWindow.GetWindow();
window.titleContent = new GUIContent(“Demo Window”);
window.Show();
}

2.Creat DisplayObject
创建显示对象[/COLOR][/FONT]
一般情况在[/COLOR]Awake()中创建显示对象,使用AddChild添加对象。[/FONT]

protected override void Awake()
{
base.Awake(); //Important!Window initialize(初始化[/COLOR])

var box = UESTool.Create(this); //Creat[/FONT]e display object(创建对象[/COLOR])
box.Rect = new Rect(100,100,100,100); [/FONT] //Set size and position(设置尺寸位置[/COLOR])
box.Mask = new Rect(-20, -20, 220, 300); [/FONT] //Support mask(支持遮罩[/COLOR])
stage.AddChild(box); //Important!Add to stage for rendering(添加到舞台才能显示)[/FONT][/LEFT]
}

3.Add Listener
It’s different between Target and CurrentTarget.
添加事件监听[/COLOR][/FONT]
注意[/COLOR]Target与CurrentTarget的区别![/FONT]
if you want to display object add “DoubleClick” event,you must set “DoubleClickEbabled=true”
如果要显示对象接受双击事件,需设置DoubleClickEnabled=true


stage.AddEventListener(UESMouseEvent.MOUSE_CLICK, OnMouseClick); //舞台添加鼠标点击监听[/COLOR][/FONT]
void OnMouseClick(UESEvent obj)
{
var display = obj.Target as UESDisplayObject;
Debug.Log(display.Name);
}
stage.DoubleClickEnabled = true;
stage.AddEventListener(UESMouseEvent.MOUSE_DOUBLE_CLICK, OnMouseDoubleClick);
private void OnMouseDoubleClick(UESEvent obj)
{
Debug.Log(obj.Target+" double click");
}

4.DisplayObject List
显示对象列表[/COLOR][/FONT]

V1.01
1.Add “ObjectPreview” display element.
2.optimize “DoubleClick” experience.you must set “DoubleClickEbabled=true” for receive “MOUSE_DOUBLE_CLICK” event.

V1.0
1.Easy to creat EditorWindow.
2.You can add ui element on stage.

3109826–235039–readme.docx (93 KB)