浏览代码

add test sample

/zxw-support_editor_dragdrop
Xingwei Zhu 3 年前
当前提交
1fee4b50
共有 2 个文件被更改,包括 66 次插入0 次删除
  1. 63
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/UnityObjectDragging.cs
  2. 3
      Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/UnityObjectDragging.cs.meta

63
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/UnityObjectDragging.cs


using System.Collections.Generic;
using uiwidgets;
using Unity.UIWidgets.Editor;
using Unity.UIWidgets.gestures;
using Unity.UIWidgets.widgets;
using UnityEditor;
using UnityEngine;
namespace UIWidgetsEditorWindowSample
{
public class UnityObjectDraggingWindow : UIWidgetsEditorPanel
{
[MenuItem("UIWidgets/EditorSample/UnityObjectDragging")]
public static void CountDemo()
{
CreateWindow<UnityObjectDraggingWindow>();
}
protected override void onEnable()
{
AddFont("Material Icons", new List<string> {"MaterialIcons-Regular.ttf"}, new List<int> {0});
AddFont("CupertinoIcons", new List<string> {"CupertinoIcons.ttf"}, new List<int> {0});
AddFont("GalleryIcons", new List<string> {"gallery/GalleryIcons.ttf"}, new List<int> {0});
}
protected override void main()
{
editor_ui_.runEditorApp(new MyApp());
}
public class MyApp : StatelessWidget
{
public override Widget build(BuildContext context)
{
return
new Container(color: Colors.green, child:
new Center(child:
new UnityObjectDetector(
child: new Container(color: Colors.blue, width: 200f, height: 200f,
child: new Center(child: new Text("Drag UnityObject or file to me"))),
onEnter: (details) =>
{
Debug.Log("enter");
},
onHover: (details =>
{
Debug.Log("position = " + details.position);
}),
onExit: () =>
{
Debug.Log("on exit");
},
onRelease: (details) =>
{
Debug.Log("on release");
}
)
)
);
}
}
}
}

3
Samples/UIWidgetsSamples_2019_4/Assets/Editor/EditorWindowSample/UnityObjectDragging.cs.meta


fileFormatVersion: 2
guid: 9916a1957385427fa807b2ce6a676522
timeCreated: 1637912586
正在加载...
取消
保存