mirror of
https://codeberg.org/Ikatono/TierMaker.git
synced 2025-10-28 20:45:35 -05:00
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:
79
create_menu_popup.cs
Normal file
79
create_menu_popup.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user