using System;
using Core;
using Script.Gameplay.Player;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace UI
{
    public class PlayerWatchModeViewer : UIBase
    {
        private PlayerWatchModeController watchModeController;
        [SerializeField] private TMP_Text modeText;

        private void Awake()
        {
            ControllerLocator.Instance.TryGetWait<PlayerWatchModeController>(OnGet);
        }
        
        private void OnGet(PlayerWatchModeController watchModeCtrl)
        {
            watchModeController = watchModeCtrl;
            modeText.text = "Watch Mode: " + watchModeController.CurrentWatchMode;
            watchModeController.OnEnterWatchMode += mode => modeText.text = "Watch Mode: " + mode;
        }
    }
}