//#define UIMENU_DEBUG
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;

public class UIMenuView : UIBaseView {


    [SerializeField]
    private Text gamesPlayedText;

    [SerializeField]
    private Text deadCountText;

    [SerializeField]
    private Text zombiesKilledCountText;

    [SerializeField]
    private Text timeSpendPlayingText;

    public UnityAction OnNewGameClicked;
    public UnityAction OnQuitClicked;

    public void ShowMenu (GlobalStatisticsData data) {
        this.ShowView();

        this.gamesPlayedText.text = data.GamesPlayed.ToString();
        this.deadCountText.text = data.DeadCount.ToString();
        this.zombiesKilledCountText.text = data.ZombiesKilled.ToString();
        this.timeSpendPlayingText.text = string.Format("{0:00}:{1:00}:{2:00}", data.TimeSpendPlaying.TotalHours, data.TimeSpendPlaying.Minutes, data.TimeSpendPlaying.Seconds);
    }

    public void StartNewGame () {
#if UIMENU_DEBUG
        Debug.Log("[UIMenu] Start New Game");
#endif

        if (OnNewGameClicked != null)
            OnNewGameClicked.Invoke();
    }

    public void QuitGame () {
#if UIMENU_DEBUG
        Debug.Log("[UIMenu] Quit Game");
#endif

        if (OnQuitClicked != null)
            OnQuitClicked.Invoke();
    }
}
