基于UGUI的拖拽组件系统,主要支持以下功能:
- Item的自由拖拽及与Target的附着;
- Item和Target响应Enter、Exit、Attach、Detach等事件,并通过代理为其添加回调;
- 使用
matchingChannel
来限制只有特定通道的Item和Target可以匹配; - 使用
matchingTag
来识别不同的目标类别; - 支持点击或长按Item使其从Target脱离;
- 除拖放之外,Item还支持响应点击事件,并兼容
ScrollRect
的拖动事件;
用法详见工程中附带的示例,场景Scene
及脚本TestScript
。
A Drag&Drop components system based on UGUI that has the following features:
- Drag Items freely and attach them to Targets;
- Items and Targets can receive callback events like Enter, Exit, Attach, Detach etc;
- Use
matchingChannel
to make sure that only Items and Targets with exact channels can match; - Use
matchingTag
to identify different Item or Target types; - Detach with long press is supported;
- Items can also receive click events and are able to work with drag events of a
ScrollRect
as well;
For more details please run Scene
or view TestScript
.