2025-10-17 15:10:19 +08:00
|
|
|
using System;
|
2025-10-14 12:39:53 +08:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
2025-10-17 15:10:19 +08:00
|
|
|
using Interface;
|
|
|
|
using Core;
|
|
|
|
using Gameplay.Player;
|
2025-10-14 12:39:53 +08:00
|
|
|
|
2025-10-15 21:31:13 +08:00
|
|
|
namespace Gameplay
|
2025-10-14 12:39:53 +08:00
|
|
|
{
|
2025-10-17 15:10:19 +08:00
|
|
|
public class CardViewer : MonoBehaviour, IInteractable
|
2025-10-14 12:39:53 +08:00
|
|
|
{
|
|
|
|
public Card Card;
|
2025-10-17 15:10:19 +08:00
|
|
|
|
|
|
|
[SerializeField] private MeshRenderer frontMeshRenderer;
|
|
|
|
[SerializeField] private MeshRenderer backMeshRenderer;
|
2025-10-14 12:39:53 +08:00
|
|
|
[SerializeField] private Text cardNameText;
|
|
|
|
[SerializeField] private Text cardDescriptionText;
|
2025-10-17 15:10:19 +08:00
|
|
|
|
|
|
|
private PlayerController _playerController;
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
ControllerLocator.Instance.TryGet<PlayerController>(out _playerController);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetCard(Card card)
|
2025-10-14 12:39:53 +08:00
|
|
|
{
|
|
|
|
Card = card;
|
2025-10-17 15:10:19 +08:00
|
|
|
if (frontMeshRenderer != null && card.FrontTexture != null)
|
|
|
|
{
|
|
|
|
frontMeshRenderer.material.mainTexture = card.FrontTexture;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (backMeshRenderer != null && card.BackTexture != null)
|
|
|
|
{
|
|
|
|
backMeshRenderer.material.mainTexture = card.BackTexture;
|
|
|
|
}
|
|
|
|
|
2025-10-14 12:39:53 +08:00
|
|
|
cardNameText.text = card.CardName;
|
|
|
|
cardDescriptionText.text = card.CardDescription;
|
|
|
|
}
|
|
|
|
|
2025-10-17 15:10:19 +08:00
|
|
|
public string GetInteractPrompt()
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Interact(GameObject interactor)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnGazeEnter(GameObject editor)
|
|
|
|
{
|
|
|
|
if(_playerController != null) _playerController.playerCardsController.StopRotatingCards();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnGazeExit(GameObject editor)
|
|
|
|
{
|
|
|
|
if (_playerController != null) _playerController.playerCardsController.StartRotatingCards();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|