56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using Game.Extensions;
|
|
using Godot;
|
|
|
|
namespace Game;
|
|
|
|
[SceneTree]
|
|
public partial class TimeSlot : PanelContainer
|
|
{
|
|
public MeetingControl MeetingControl { get; set; }
|
|
|
|
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 meetingData = (MeetingControlDragData)data;
|
|
|
|
MeetingControl = meetingData.MeetingControl;
|
|
MeetingControl.Reparent(this, false);
|
|
MeetingControl.Visible = true;
|
|
|
|
meetingData.MeetingControl.DragIsHandled = true;
|
|
}
|
|
|
|
public override void _Notification(int what)
|
|
{
|
|
if (what == NotificationDragBegin)
|
|
MouseFilter = MouseFilterEnum.Pass;
|
|
|
|
if (what == NotificationDragEnd)
|
|
MouseFilter = MouseFilterEnum.Ignore;
|
|
}
|
|
|
|
public void StartMeeting()
|
|
{
|
|
GD.Print("New Meeting starts!");
|
|
var gameState = this.GetMain().GameState;
|
|
|
|
// TODO: TimeSlot hat bekommt die MeetingResource on Drop?? oder zumindest nicht über Gfx gehen
|
|
MeetingControl?.MeetingControlGfx.MeetingResource.StartMeeting(gameState);
|
|
MeetingControl?.Animate();
|
|
}
|
|
|
|
public void EndMeeting()
|
|
{
|
|
GD.Print("Meeting Ends!");
|
|
var gameState = this.GetMain().GameState;
|
|
|
|
// TODO: TimeSlot hat bekommt die MeetingResource on Drop?? oder zumindest nicht über Gfx gehen
|
|
MeetingControl?.MeetingControlGfx.MeetingResource.EndMeeting(gameState);
|
|
}
|
|
}
|