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

public class UIGameOverView : UIBaseView {

    [SerializeField]
    private Text windowTitle;
    
    [SerializeField]
    private Text gameTimeText;

    [SerializeField]
    private Text zombieCountText;

    public UnityAction OnSummaryClosed;
    public UnityAction OnGameReplay;

    public void ShowSummary(CurrentGameData gameData) {
        this.ShowView();

        this.windowTitle.text = gameData.SessionState == CurrentGameData.SessionStateEnum.FinishedWithSuccess ? "Zombies can't touch you!" : "You've become Zombies dinner";

        this.gameTimeText.text = string.Format("{0:00}:{1:00}:{2:00}", gameData.SessionTime.TotalHours, gameData.SessionTime.Minutes, gameData.SessionTime.Seconds);
        this.zombieCountText.text = gameData.ZombiesKilled.ToString();

    }

    public void OnConfirmedClicked () {
#if UIGAMEOVER_DEBUG
        Debug.Log("[UIGameOver] Confirm Summary");
#endif

        if (OnSummaryClosed != null) {
            OnSummaryClosed.Invoke();
        }
    }

    public void OnReplayClicked () {
#if UIGAMEOVER_DEBUG
        Debug.Log("[UIGameOver] Replay Game");
#endif

        if (OnGameReplay != null) {
            OnGameReplay.Invoke();
        }
    }
}
