34 lines
974 B
C#
34 lines
974 B
C#
using Godot;
|
|
using yourareanaiceo;
|
|
|
|
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 game = this.GetGame();
|
|
game.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;
|
|
}
|
|
}
|