using Godot;
using System;
using System.Reflection;

public partial class Menu : Control
{
	[Export] AnimationPlayer anim;
	[Export] Panel pause;
	[Export] Panel trick;
	[Export] CharacterBody2D player;
	Node parent;
	int spell {get; set;} = 0;

	// Called when the node enters the scene tree for the first time.
	public override void _Ready()
	{
		parent = player.GetParent().GetParent();
	}

	// Called every frame. 'delta' is the elapsed time since the previous frame.
	public override void _Process(double delta)
	{
	}

	public void ResumeDown()
	{
		Input.MouseMode = Input.MouseModeEnum.Hidden;
		anim.Play("resume");
	}

	public void OptionDown()
	{

		int i = 1;
		foreach (Label panel in trick.GetNode("GridContainer").GetChildren())
		{
			if (i <= spell)
			{
				panel.Modulate = new Color(1, 1, 1, 1);
				GD.Print("trew");
			}
			i++;
		}
		pause.Visible = false;
		trick.Visible = true;
	}

	public void ExitDown()
	{
		GetTree().Paused = false;
		parent.Call("ToPrincipalFunc");
	}

	public void Res()
	{
		GetTree().Paused = false;
	}

	public void ExitTrick()
	{
		pause.Visible = true;
		trick.Visible = false;
	}
}
