tested version with most of the final functionality. Still a few known issues, like dragging to a row that extends to multiple lines

This commit is contained in:
2024-04-24 18:18:03 -05:00
parent f67885d217
commit e25e7da40f
25 changed files with 568 additions and 56 deletions

79
create_menu_popup.cs Normal file
View File

@@ -0,0 +1,79 @@
using Godot;
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
public partial class create_menu_popup : PanelContainer
{
[Signal]
public delegate void ClearMenuEventHandler();
private CardCreateMarginContainer _CardContainer;
public CardCreateMarginContainer CardContainer
{ get
{
_CardContainer ??= GetNode<CardCreateMarginContainer>("%CardCreateMarginContainer");
return _CardContainer;
}
}
private RowCreateMarginContainer _RowContainer;
public RowCreateMarginContainer RowContainer
{ get
{
_RowContainer ??= GetNode<RowCreateMarginContainer>("%RowCreateMarginContainer");
return _RowContainer;
}
}
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public void ShowPopup()
{
this.GetParentOfType<game>().MenuOpenDisableInteraction();
Show();
}
public void ClosePopup()
{
Hide();
EmitSignal(SignalName.ClearMenu);
this.GetParentOfType<game>().MenuClosedEnableInteraction();
}
public void OkPressed()
{
var current = GetNode<TabContainer>("%CreateTabContainer").CurrentTab;
if (current == 0)
{
CardContainer.SendCardToGame();
ClosePopup();
}
else if (current == 1)
{
RowContainer.SendRowToGame();
ClosePopup();
}
else
{
throw new Exception("No create container visible");
}
}
public void CancelPressed()
{
ClosePopup();
}
private void OnVisibilityChange(bool visibility)
{
// EmitSignal(SignalName.Clear);
var tabs = GetNode<TabContainer>("%CreateTabContainer");
if (tabs.SelectNextAvailable())
tabs.SelectPreviousAvailable();
if (tabs.SelectPreviousAvailable())
tabs.SelectNextAvailable();
}
}