feat():大改前的提交,这个版本保存了所有冗余的代码

This commit is contained in:
2025-10-17 15:10:19 +08:00
parent 668bfe12eb
commit 3d03c59dc3
68 changed files with 2045 additions and 159 deletions

View File

@@ -5,7 +5,8 @@ namespace Gameplay
public class Card
{
private CardData _cardData;
public Texture Texture => _cardData.CardTexture;
public Texture FrontTexture => _cardData.FrontCardTexture;
public Texture BackTexture => _cardData.BackCardTexture;
public string CardName => _cardData.CardName;
public string CardDescription => _cardData.CardDescription;
public EffectData[] Effects => _cardData.Effects;

View File

@@ -10,7 +10,8 @@ namespace Gameplay
public int CardID;
public string CardName;
public string CardDescription;
public Texture CardTexture;
public Texture FrontCardTexture;
public Texture BackCardTexture;
public EffectData[] Effects;
}

View File

@@ -1,5 +1,5 @@
using UnityEngine;
using Share;
using Interface;
namespace Gameplay
{
public class CardContext

View File

@@ -1,23 +1,62 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using Interface;
using Core;
using Gameplay.Player;
namespace Gameplay
{
public class CardViewer : MonoBehaviour
public class CardViewer : MonoBehaviour, IInteractable
{
public Card Card;
[SerializeField] private MeshRenderer meshRenderer;
[SerializeField] private MeshRenderer frontMeshRenderer;
[SerializeField] private MeshRenderer backMeshRenderer;
[SerializeField] private Text cardNameText;
[SerializeField] private Text cardDescriptionText;
public void Setup(Card card)
private PlayerController _playerController;
private void Start()
{
ControllerLocator.Instance.TryGet<PlayerController>(out _playerController);
}
public void SetCard(Card card)
{
Card = card;
meshRenderer.material.mainTexture = card.Texture;
if (frontMeshRenderer != null && card.FrontTexture != null)
{
frontMeshRenderer.material.mainTexture = card.FrontTexture;
}
if (backMeshRenderer != null && card.BackTexture != null)
{
backMeshRenderer.material.mainTexture = card.BackTexture;
}
cardNameText.text = card.CardName;
cardDescriptionText.text = card.CardDescription;
}
}
}
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();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5db247b9fcb44b3f85bdcc7cdb634481
timeCreated: 1760575054

View File

@@ -1,7 +1,7 @@
using UnityEngine;
namespace Gameplay
{
// 从Resources文件夹加载卡牌数据的静态类
// 用来加载卡牌数据的静态类
public static class CardLoader
{
public static CardData GetCardDataByID(int cardID)
@@ -17,5 +17,15 @@ namespace Gameplay
Debug.LogError($"Card with ID {cardID} not found!");
return null;
}
public static Card GetCardByID(int cardID)
{
CardData cardData = GetCardDataByID(cardID);
if (cardData != null)
{
return new Card(cardData);
}
return null;
}
}
}