using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

public class ArtefactInteractUI : MonoBehaviour
{
    [SerializeField] private TMP_Text _text;
    [SerializeField] private DialogueSettings _settings;

    private string _gamepadText;
    private string _keyboardText;
    
    public PlayerInput Input { get; set; }
    
    void Awake()
    {
        _gamepadText = _text.text.Replace("[INTERACT]", $"<sprite index={_settings.GamepadInputPrompts.interact}>");
        _keyboardText = _text.text.Replace("[INTERACT]", $"<sprite index={_settings.KeyboardInputPrompts.interact}>");
    }
    
    private void OnDisable()
    {
        Input = null;
    }

    private void LateUpdate()
    {
        switch (Input.currentControlScheme)
        {
            case InputSchemes.PCMR:
                _text.text = _keyboardText;
                break;
            case InputSchemes.GAMEPAD:
                _text.text = _gamepadText;
                break;
        }
    }
}