add test sample
This commit is contained in:
Родитель
75861b4faa
Коммит
bd6da74fd7
|
@ -0,0 +1,63 @@
|
|||
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");
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9916a1957385427fa807b2ce6a676522
|
||||
timeCreated: 1637912586
|
Загрузка…
Ссылка в новой задаче