using UnityEngine;
using mgaia.Utils;
using mgaia.Utils.LayerSystem;
using mgaia.Utils.Text;
using mgaia.tk2d;

public class GameOverView : IInputReceivable
{
    [SerializeField]
    private tk2dTextMesh _gameOverText;

    [SerializeField]
    private GameObject _retryButton;

    private void Awake()
    {
        RegisterButtonAction(_retryButton.name, (gameobject) => { }, (gameobject) =>
        {
            Application.LoadLevel("Gameplay");
        });
    }

    public override void OnDataPackReceived(object dataPack)
    {
        Assert.AssertTrue(dataPack is string, "O dataPack precisa ser string!");

        TextMeshFormatter.FormatTextMeshFollowingTemplate(new Tk2dTextMeshContainer(_gameOverText), dataPack.ToString(), true);
    }
}