Add backbone for card creation and implement Camera minigame mechanics
This commit is contained in:
3
Assets/Scripts/Data/CardSystem.meta
Normal file
3
Assets/Scripts/Data/CardSystem.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52a47d9c5b29456faca1c9b43f8f4750
|
||||
timeCreated: 1759923654
|
||||
115
Assets/Scripts/Data/CardSystem/CardData.cs
Normal file
115
Assets/Scripts/Data/CardSystem/CardData.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppleHills.Data.CardSystem
|
||||
{
|
||||
[Serializable]
|
||||
public class CardData
|
||||
{
|
||||
// Core data (serialized)
|
||||
public string Id; // Auto-generated unique ID (GUID)
|
||||
public string DefinitionId; // ID of the card definition this instance was created from
|
||||
public CardRarity Rarity; // Current rarity (may be upgraded from original)
|
||||
public int CopiesOwned; // Number of copies the player has (for stacking)
|
||||
|
||||
// Reference back to the definition (not serialized)
|
||||
[NonSerialized]
|
||||
private CardDefinition _definition;
|
||||
|
||||
// Properties that reference definition data
|
||||
public string Name => _definition?.Name;
|
||||
public string Description => _definition?.Description;
|
||||
public CardZone Zone => _definition?.Zone ?? CardZone.AppleHills;
|
||||
public int CollectionIndex => _definition?.CollectionIndex ?? 0;
|
||||
public Sprite CardImage => _definition?.CardImage;
|
||||
|
||||
// Derived properties
|
||||
public Color BackgroundColor => _definition?.GetBackgroundColor() ?? Color.white;
|
||||
|
||||
// Get frame shape based on rarity
|
||||
public string GetFrameShapeName()
|
||||
{
|
||||
return $"Frame_{Rarity}";
|
||||
}
|
||||
|
||||
// Default constructor
|
||||
public CardData()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
CopiesOwned = 0;
|
||||
}
|
||||
|
||||
// Constructor from definition
|
||||
public CardData(CardDefinition definition)
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
DefinitionId = definition.Id;
|
||||
Rarity = definition.Rarity;
|
||||
CopiesOwned = 1;
|
||||
_definition = definition;
|
||||
}
|
||||
|
||||
// Copy constructor
|
||||
public CardData(CardData other)
|
||||
{
|
||||
Id = other.Id;
|
||||
DefinitionId = other.DefinitionId;
|
||||
Rarity = other.Rarity;
|
||||
CopiesOwned = other.CopiesOwned;
|
||||
_definition = other._definition;
|
||||
}
|
||||
|
||||
// Method to link this card data to its definition
|
||||
public void SetDefinition(CardDefinition definition)
|
||||
{
|
||||
if (definition != null)
|
||||
{
|
||||
_definition = definition;
|
||||
DefinitionId = definition.Id;
|
||||
}
|
||||
}
|
||||
|
||||
// Method to upgrade rarity when enough copies are collected
|
||||
public bool TryUpgradeRarity()
|
||||
{
|
||||
// Simple implementation - each rarity needs twice as many copies to upgrade
|
||||
int requiredCopies = (int)Rarity * 2 + 1;
|
||||
|
||||
if (CopiesOwned >= requiredCopies && Rarity < CardRarity.Legendary)
|
||||
{
|
||||
Rarity += 1;
|
||||
CopiesOwned -= requiredCopies;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ToString method for debugging
|
||||
public override string ToString()
|
||||
{
|
||||
return $"CardData [ID: {Id}, Name: {Name}, Rarity: {Rarity}, Zone: {Zone}, " +
|
||||
$"DefinitionID: {DefinitionId}, Copies: {CopiesOwned}, " +
|
||||
$"Has Definition: {_definition != null}, Has Image: {CardImage != null}]";
|
||||
}
|
||||
}
|
||||
|
||||
// Enums for card attributes
|
||||
public enum CardRarity
|
||||
{
|
||||
Common = 0,
|
||||
Uncommon = 1,
|
||||
Rare = 2,
|
||||
Epic = 3,
|
||||
Legendary = 4
|
||||
}
|
||||
|
||||
public enum CardZone
|
||||
{
|
||||
AppleHills,
|
||||
Quarry,
|
||||
Forest,
|
||||
Mountain,
|
||||
Beach
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Data/CardSystem/CardData.cs.meta
Normal file
3
Assets/Scripts/Data/CardSystem/CardData.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 812f681e555841c584d5791cb66278de
|
||||
timeCreated: 1759923654
|
||||
61
Assets/Scripts/Data/CardSystem/CardDefinition.cs
Normal file
61
Assets/Scripts/Data/CardSystem/CardDefinition.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppleHills.Data.CardSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Scriptable object defining a collectible card's properties.
|
||||
/// Used as a template for generating CardData instances.
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "New Card", menuName = "Apple Hills/Card System/Card Definition")]
|
||||
public class CardDefinition : ScriptableObject
|
||||
{
|
||||
[Header("Identification")]
|
||||
[Tooltip("Unique identifier for this card definition")]
|
||||
public string Id = Guid.NewGuid().ToString();
|
||||
|
||||
[Header("Basic Info")]
|
||||
public string Name;
|
||||
[TextArea(3, 5)]
|
||||
public string Description;
|
||||
public CardRarity Rarity;
|
||||
public CardZone Zone;
|
||||
|
||||
[Header("Visual Elements")]
|
||||
public Sprite CardImage; // The actual card image
|
||||
|
||||
[Header("Collection Info")]
|
||||
public int CollectionIndex; // Position in the album
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new CardData instance from this definition
|
||||
/// </summary>
|
||||
public CardData CreateCardData()
|
||||
{
|
||||
return new CardData(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the background color for this card based on its zone
|
||||
/// </summary>
|
||||
public Color GetBackgroundColor()
|
||||
{
|
||||
// Colors based on zone
|
||||
switch (Zone)
|
||||
{
|
||||
case CardZone.AppleHills:
|
||||
return new Color(0.8f, 0.9f, 0.8f); // Light green
|
||||
case CardZone.Quarry:
|
||||
return new Color(0.85f, 0.8f, 0.7f); // Sandy brown
|
||||
case CardZone.Forest:
|
||||
return new Color(0.6f, 0.8f, 0.6f); // Forest green
|
||||
case CardZone.Mountain:
|
||||
return new Color(0.7f, 0.7f, 0.9f); // Bluish
|
||||
case CardZone.Beach:
|
||||
return new Color(0.9f, 0.85f, 0.7f); // Sandy yellow
|
||||
default:
|
||||
return Color.white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Data/CardSystem/CardDefinition.cs.meta
Normal file
3
Assets/Scripts/Data/CardSystem/CardDefinition.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a80cc88c9884512b8b633110d838780
|
||||
timeCreated: 1759923702
|
||||
264
Assets/Scripts/Data/CardSystem/CardSystemManager.cs
Normal file
264
Assets/Scripts/Data/CardSystem/CardSystemManager.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppleHills.Data.CardSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Manages the player's card collection, booster packs, and related operations.
|
||||
/// Uses a singleton pattern for global access.
|
||||
/// </summary>
|
||||
public class CardSystemManager : MonoBehaviour
|
||||
{
|
||||
private static CardSystemManager _instance;
|
||||
private static bool _isQuitting = false;
|
||||
|
||||
public static CardSystemManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null && Application.isPlaying && !_isQuitting)
|
||||
{
|
||||
_instance = FindAnyObjectByType<CardSystemManager>();
|
||||
if (_instance == null)
|
||||
{
|
||||
var go = new GameObject("CardSystemManager");
|
||||
_instance = go.AddComponent<CardSystemManager>();
|
||||
DontDestroyOnLoad(go);
|
||||
}
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
[Header("Card Collection")]
|
||||
[SerializeField] private List<CardDefinition> availableCards = new List<CardDefinition>();
|
||||
|
||||
// Runtime data - will be serialized for save/load
|
||||
[SerializeField] private CardInventory playerInventory = new CardInventory();
|
||||
|
||||
// Dictionary to quickly look up card definitions by ID
|
||||
private Dictionary<string, CardDefinition> _definitionLookup = new Dictionary<string, CardDefinition>();
|
||||
|
||||
// Event callbacks using System.Action
|
||||
public event Action<List<CardData>> OnBoosterOpened;
|
||||
public event Action<CardData> OnCardCollected;
|
||||
public event Action<CardData> OnCardRarityUpgraded;
|
||||
public event Action<int> OnBoosterCountChanged;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (_instance != null && _instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
_instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
|
||||
// Build lookup dictionary
|
||||
BuildDefinitionLookup();
|
||||
}
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
_isQuitting = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a lookup dictionary for quick access to card definitions by ID
|
||||
/// </summary>
|
||||
private void BuildDefinitionLookup()
|
||||
{
|
||||
_definitionLookup.Clear();
|
||||
|
||||
foreach (var cardDef in availableCards)
|
||||
{
|
||||
if (cardDef != null && !string.IsNullOrEmpty(cardDef.Id))
|
||||
{
|
||||
_definitionLookup[cardDef.Id] = cardDef;
|
||||
}
|
||||
}
|
||||
|
||||
// Link existing card data to their definitions
|
||||
foreach (var cardData in playerInventory.CollectedCards.Values)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(cardData.DefinitionId) &&
|
||||
_definitionLookup.TryGetValue(cardData.DefinitionId, out CardDefinition def))
|
||||
{
|
||||
cardData.SetDefinition(def);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a booster pack to the player's inventory
|
||||
/// </summary>
|
||||
public void AddBoosterPack(int count = 1)
|
||||
{
|
||||
playerInventory.BoosterPackCount += count;
|
||||
OnBoosterCountChanged?.Invoke(playerInventory.BoosterPackCount);
|
||||
Debug.Log($"[CardSystemManager] Added {count} booster pack(s). Total: {playerInventory.BoosterPackCount}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a booster pack and returns the newly obtained cards
|
||||
/// </summary>
|
||||
public List<CardData> OpenBoosterPack()
|
||||
{
|
||||
if (playerInventory.BoosterPackCount <= 0)
|
||||
{
|
||||
Debug.LogWarning("[CardSystemManager] Attempted to open a booster pack, but none are available.");
|
||||
return new List<CardData>();
|
||||
}
|
||||
|
||||
playerInventory.BoosterPackCount--;
|
||||
OnBoosterCountChanged?.Invoke(playerInventory.BoosterPackCount);
|
||||
|
||||
// Draw 3 cards based on rarity distribution
|
||||
List<CardData> drawnCards = DrawRandomCards(3);
|
||||
|
||||
// Add cards to the inventory
|
||||
foreach (var card in drawnCards)
|
||||
{
|
||||
AddCardToInventory(card);
|
||||
}
|
||||
|
||||
// Notify listeners
|
||||
OnBoosterOpened?.Invoke(drawnCards);
|
||||
|
||||
Debug.Log($"[CardSystemManager] Opened a booster pack and obtained {drawnCards.Count} cards. Remaining boosters: {playerInventory.BoosterPackCount}");
|
||||
return drawnCards;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a card to the player's inventory, handles duplicates
|
||||
/// </summary>
|
||||
private void AddCardToInventory(CardData card)
|
||||
{
|
||||
// Check if the player already has this card type (definition)
|
||||
if (playerInventory.CollectedCards.TryGetValue(card.DefinitionId, out CardData existingCard))
|
||||
{
|
||||
existingCard.CopiesOwned++;
|
||||
|
||||
// Check if the card can be upgraded
|
||||
if (existingCard.TryUpgradeRarity())
|
||||
{
|
||||
OnCardRarityUpgraded?.Invoke(existingCard);
|
||||
}
|
||||
|
||||
Debug.Log($"[CardSystemManager] Added duplicate card '{card.Name}'. Now have {existingCard.CopiesOwned} copies.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add new card
|
||||
playerInventory.CollectedCards.Add(card.DefinitionId, new CardData(card));
|
||||
OnCardCollected?.Invoke(card);
|
||||
|
||||
Debug.Log($"[CardSystemManager] Added new card '{card.Name}' to collection.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws random cards based on rarity distribution
|
||||
/// </summary>
|
||||
private List<CardData> DrawRandomCards(int count)
|
||||
{
|
||||
List<CardData> result = new List<CardData>();
|
||||
|
||||
if (availableCards.Count == 0)
|
||||
{
|
||||
Debug.LogError("[CardSystemManager] No available cards defined!");
|
||||
return result;
|
||||
}
|
||||
|
||||
// Simple weighted random selection based on rarity
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
// Determine card rarity first
|
||||
CardRarity rarity = DetermineRandomRarity();
|
||||
|
||||
// Filter cards by the selected rarity
|
||||
List<CardDefinition> cardsOfRarity = availableCards.FindAll(c => c.Rarity == rarity);
|
||||
|
||||
if (cardsOfRarity.Count > 0)
|
||||
{
|
||||
// Select a random card of this rarity
|
||||
int randomIndex = UnityEngine.Random.Range(0, cardsOfRarity.Count);
|
||||
CardDefinition selectedDef = cardsOfRarity[randomIndex];
|
||||
|
||||
// Create card data from definition
|
||||
CardData newCard = selectedDef.CreateCardData();
|
||||
result.Add(newCard);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback if no cards of the selected rarity
|
||||
Debug.LogWarning($"[CardSystemManager] No cards of rarity {rarity} available, selecting a random card instead.");
|
||||
int randomIndex = UnityEngine.Random.Range(0, availableCards.Count);
|
||||
CardDefinition randomDef = availableCards[randomIndex];
|
||||
|
||||
CardData newCard = randomDef.CreateCardData();
|
||||
result.Add(newCard);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines a random card rarity with appropriate weighting
|
||||
/// </summary>
|
||||
private CardRarity DetermineRandomRarity()
|
||||
{
|
||||
// Simple weighted random - can be adjusted for better distribution
|
||||
float rand = UnityEngine.Random.value;
|
||||
|
||||
if (rand < 0.6f) return CardRarity.Common;
|
||||
if (rand < 0.85f) return CardRarity.Uncommon;
|
||||
if (rand < 0.95f) return CardRarity.Rare;
|
||||
if (rand < 0.99f) return CardRarity.Epic;
|
||||
return CardRarity.Legendary;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all cards from the player's collection
|
||||
/// </summary>
|
||||
public List<CardData> GetAllCollectedCards()
|
||||
{
|
||||
List<CardData> result = new List<CardData>();
|
||||
foreach (var card in playerInventory.CollectedCards.Values)
|
||||
{
|
||||
result.Add(card);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of booster packs the player has
|
||||
/// </summary>
|
||||
public int GetBoosterPackCount()
|
||||
{
|
||||
return playerInventory.BoosterPackCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether a specific card definition has been collected
|
||||
/// </summary>
|
||||
public bool IsCardCollected(string definitionId)
|
||||
{
|
||||
return playerInventory.CollectedCards.ContainsKey(definitionId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializable class to store the player's card inventory
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CardInventory
|
||||
{
|
||||
public Dictionary<string, CardData> CollectedCards = new Dictionary<string, CardData>();
|
||||
public int BoosterPackCount;
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Data/CardSystem/CardSystemManager.cs.meta
Normal file
3
Assets/Scripts/Data/CardSystem/CardSystemManager.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d80347e4bd04c87be23a9399860783d
|
||||
timeCreated: 1759923691
|
||||
203
Assets/Scripts/Data/CardSystem/CardVisualConfig.cs
Normal file
203
Assets/Scripts/Data/CardSystem/CardVisualConfig.cs
Normal file
@@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AppleHills.Data.CardSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// ScriptableObject containing visual configuration for card display
|
||||
/// Maps card rarities to colors and zones to colors/shapes
|
||||
/// </summary>
|
||||
[CreateAssetMenu(fileName = "CardVisualConfig", menuName = "Apple Hills/Card System/Visual Config")]
|
||||
public class CardVisualConfig : ScriptableObject
|
||||
{
|
||||
[Serializable]
|
||||
public class RarityColorMapping
|
||||
{
|
||||
public CardRarity rarity;
|
||||
public Color color = Color.white;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class ZoneVisualMapping
|
||||
{
|
||||
public CardZone zone;
|
||||
public Color color = Color.white;
|
||||
public Sprite backgroundShape;
|
||||
}
|
||||
|
||||
[Header("Rarity Configuration")]
|
||||
[Tooltip("Color mappings for different card rarities")]
|
||||
[SerializeField] private List<RarityColorMapping> rarityColors = new List<RarityColorMapping>();
|
||||
|
||||
[Header("Zone Configuration")]
|
||||
[Tooltip("Visual mappings for different card zones")]
|
||||
[SerializeField] private List<ZoneVisualMapping> zoneVisuals = new List<ZoneVisualMapping>();
|
||||
|
||||
private Dictionary<CardRarity, Color> _rarityColorLookup;
|
||||
private Dictionary<CardZone, Color> _zoneColorLookup;
|
||||
private Dictionary<CardZone, Sprite> _zoneShapeLookup;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the lookup dictionaries when the asset is loaded
|
||||
/// </summary>
|
||||
private void OnEnable()
|
||||
{
|
||||
InitializeLookups();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the lookup dictionaries from the serialized lists
|
||||
/// </summary>
|
||||
private void InitializeLookups()
|
||||
{
|
||||
// Build rarity color lookup
|
||||
_rarityColorLookup = new Dictionary<CardRarity, Color>();
|
||||
foreach (var mapping in rarityColors)
|
||||
{
|
||||
_rarityColorLookup[mapping.rarity] = mapping.color;
|
||||
}
|
||||
|
||||
// Build zone color and shape lookups
|
||||
_zoneColorLookup = new Dictionary<CardZone, Color>();
|
||||
_zoneShapeLookup = new Dictionary<CardZone, Sprite>();
|
||||
|
||||
foreach (var mapping in zoneVisuals)
|
||||
{
|
||||
_zoneColorLookup[mapping.zone] = mapping.color;
|
||||
_zoneShapeLookup[mapping.zone] = mapping.backgroundShape;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the color for a specific card rarity
|
||||
/// </summary>
|
||||
public Color GetRarityColor(CardRarity rarity)
|
||||
{
|
||||
// Initialize lookups if needed
|
||||
if (_rarityColorLookup == null)
|
||||
{
|
||||
InitializeLookups();
|
||||
}
|
||||
|
||||
// Return the color if found, otherwise white
|
||||
if (_rarityColorLookup.TryGetValue(rarity, out Color color))
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
Debug.LogWarning($"[CardVisualConfig] No color mapping found for rarity {rarity}, using default");
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the color for a specific card zone
|
||||
/// </summary>
|
||||
public Color GetZoneColor(CardZone zone)
|
||||
{
|
||||
// Initialize lookups if needed
|
||||
if (_zoneColorLookup == null)
|
||||
{
|
||||
InitializeLookups();
|
||||
}
|
||||
|
||||
// Return the color if found, otherwise white
|
||||
if (_zoneColorLookup.TryGetValue(zone, out Color color))
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
Debug.LogWarning($"[CardVisualConfig] No color mapping found for zone {zone}, using default");
|
||||
return Color.white;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the background shape sprite for a specific zone
|
||||
/// </summary>
|
||||
public Sprite GetZoneShape(CardZone zone)
|
||||
{
|
||||
// Initialize lookups if needed
|
||||
if (_zoneShapeLookup == null)
|
||||
{
|
||||
InitializeLookups();
|
||||
}
|
||||
|
||||
// Return the sprite if found, otherwise null
|
||||
if (_zoneShapeLookup.TryGetValue(zone, out Sprite sprite))
|
||||
{
|
||||
return sprite;
|
||||
}
|
||||
|
||||
Debug.LogWarning($"[CardVisualConfig] No shape mapping found for zone {zone}");
|
||||
return null;
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
/// <summary>
|
||||
/// Editor-only utility to reset the config with default values
|
||||
/// </summary>
|
||||
public void ResetWithDefaults()
|
||||
{
|
||||
// Clear existing mappings
|
||||
rarityColors.Clear();
|
||||
zoneVisuals.Clear();
|
||||
|
||||
// Add default rarity colors
|
||||
rarityColors.Add(new RarityColorMapping { rarity = CardRarity.Common, color = Color.gray });
|
||||
rarityColors.Add(new RarityColorMapping { rarity = CardRarity.Uncommon, color = Color.green });
|
||||
rarityColors.Add(new RarityColorMapping { rarity = CardRarity.Rare, color = Color.blue });
|
||||
rarityColors.Add(new RarityColorMapping { rarity = CardRarity.Epic, color = new Color(0.5f, 0, 0.5f) });
|
||||
rarityColors.Add(new RarityColorMapping { rarity = CardRarity.Legendary, color = Color.yellow });
|
||||
|
||||
// Add default zone colors
|
||||
zoneVisuals.Add(new ZoneVisualMapping {
|
||||
zone = CardZone.AppleHills,
|
||||
color = new Color(0.8f, 0.9f, 0.8f)
|
||||
});
|
||||
|
||||
zoneVisuals.Add(new ZoneVisualMapping {
|
||||
zone = CardZone.Quarry,
|
||||
color = new Color(0.85f, 0.8f, 0.7f)
|
||||
});
|
||||
|
||||
zoneVisuals.Add(new ZoneVisualMapping {
|
||||
zone = CardZone.Forest,
|
||||
color = new Color(0.6f, 0.8f, 0.6f)
|
||||
});
|
||||
|
||||
zoneVisuals.Add(new ZoneVisualMapping {
|
||||
zone = CardZone.Mountain,
|
||||
color = new Color(0.7f, 0.7f, 0.9f)
|
||||
});
|
||||
|
||||
zoneVisuals.Add(new ZoneVisualMapping {
|
||||
zone = CardZone.Beach,
|
||||
color = new Color(0.9f, 0.85f, 0.7f)
|
||||
});
|
||||
|
||||
// Initialize the lookups
|
||||
InitializeLookups();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[UnityEditor.CustomEditor(typeof(CardVisualConfig))]
|
||||
public class CardVisualConfigEditor : UnityEditor.Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
|
||||
CardVisualConfig config = (CardVisualConfig)target;
|
||||
|
||||
UnityEditor.EditorGUILayout.Space();
|
||||
if (GUILayout.Button("Reset with Defaults"))
|
||||
{
|
||||
config.ResetWithDefaults();
|
||||
UnityEditor.EditorUtility.SetDirty(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
3
Assets/Scripts/Data/CardSystem/CardVisualConfig.cs.meta
Normal file
3
Assets/Scripts/Data/CardSystem/CardVisualConfig.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a82f88f485b4410e9eb7c383b44557cf
|
||||
timeCreated: 1759931508
|
||||
Reference in New Issue
Block a user