using System;
using eagle;
using Net.Eagle0.Eagle.Api;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

public class RunningGameItem : MonoBehaviour {
    public GameObject item;
    public TextMeshProUGUI gameIdField;
    public TextMeshProUGUI leaderField;
    public Button goButton;

    public Action<long> GoCallback;

    private long gameId;

    // Use this for initialization
    void Start() {}

    public void GoClicked() { GoCallback(gameId); }

    public void SetRunningGame(long gameId, AvailableLeader leader) {
        this.gameId = gameId;

        gameIdField.text = string.Format("{0:X}", gameId);
        leaderField.text = string.Format(
                "{0} ({1})",
                ClientTextProvider.Provider.GetTextEntry(leader.NameTextId).Text,
                DisplayNames.ProfessionNames[leader.Profession]);
    }
}
