alter vatter
This commit is contained in:
32
DropZone.cs
Normal file
32
DropZone.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Godot;
|
||||
|
||||
public partial class DropZone : Control
|
||||
{
|
||||
public override bool _CanDropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
return data.VariantType == Variant.Type.Object
|
||||
&& data.AsGodotObject() is MeetingControlDragData;
|
||||
}
|
||||
|
||||
public override void _DropData(Vector2 atPosition, Variant data)
|
||||
{
|
||||
var meetingControl = ((MeetingControlDragData)data).MeetingControl;
|
||||
var meetingPhysicsBox = meetingControl.MeetingPhysicsBox;
|
||||
|
||||
var main = (Main)FindParent("Main");
|
||||
main.AddChild(meetingPhysicsBox);
|
||||
meetingPhysicsBox.Position = GetGlobalMousePosition();
|
||||
meetingControl.QueueFree();
|
||||
|
||||
meetingControl.DragIsHandled = true;
|
||||
}
|
||||
|
||||
public override void _Notification(int what)
|
||||
{
|
||||
if (what == NotificationDragBegin)
|
||||
MouseFilter = MouseFilterEnum.Pass;
|
||||
|
||||
if (what == NotificationDragEnd)
|
||||
MouseFilter = MouseFilterEnum.Ignore;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user