using Godot;
using System;

public partial class TurnDisplay : PanelContainer
{
        private Label label;
        private Button button;

        public override void _Ready()
        {
                label = GetNode<Label>("Margin/HBoxContainer/Label");
                button = GetNode<Button>("Margin/HBoxContainer/Button");

                label.Text = "Turn: " + GameManager.Instance.TurnCounter.ToString();
                GameManager.Instance.TurnCounterModified += _SetTurnCounterLabel;

                button.Pressed += GameManager.Instance.NewEndTurn;
        }

        public override void _ExitTree()
        {
                GameManager.Instance.TurnCounterModified -= _SetTurnCounterLabel;
        }


        public void _SetTurnCounterLabel(int _new)
        {
                label.Text = "Turn: " + _new.ToString();
        }

}
