using System; using UnityEngine; namespace BulletHellTemplate { /// /// ScriptableObject representing a Battle Pass Item. /// Contains item title, description, translations, icon, and reward details. /// [CreateAssetMenu(fileName = "NewBattlePassItem", menuName = "BattlePass/Item", order = 51)] public class BattlePassItem : ScriptableObject { /// /// Unique identifier for the Battle Pass item. /// public string passId; /// /// Fallback item title (in English). /// public string itemTitle; /// /// Translated item titles. /// public NameTranslatedByLanguage[] itemTitleTranslated; /// /// Fallback item description (in English). /// public string itemDescription; /// /// Translated item descriptions. /// public DescriptionTranslatedByLanguage[] itemDescriptionTranslated; /// /// Icon of the item. /// public Sprite itemIcon; /// /// Type of reward (Character, Currency, Icon, Frame, InventoryItem). /// public RewardType rewardType; /// /// Reward tier: Free or Paid. /// public RewardTier rewardTier; [Header("Character Reward")] public CharacterData[] characterData; [Header("Currency Reward")] public CurrencyReward currencyReward; [Header("Icon Reward")] public IconItem iconReward; [Header("Frame Reward")] public FrameItem frameReward; [Header("Items Reward")] public InventoryItem[] inventoryItems; /// /// Reward types enumeration. /// public enum RewardType { CharacterReward, CurrencyReward, IconReward, FrameReward, InventoryItemReward } /// /// Reward tier enumeration. /// public enum RewardTier { Free, Paid } /// /// Retrieves the translated item title for the specified language. /// Falls back to the default English title if translation is not available. /// /// The current language identifier. /// The translated title if available; otherwise, the fallback title. public string GetTranslatedTitle(string currentLang) { if (itemTitleTranslated != null) { foreach (var trans in itemTitleTranslated) { if (!string.IsNullOrEmpty(trans.LanguageId) && trans.LanguageId.Equals(currentLang, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(trans.Translate)) { return trans.Translate; } } } return itemTitle; } /// /// Retrieves the translated item description for the specified language. /// Falls back to the default English description if translation is not available. /// /// The current language identifier. /// The translated description if available; otherwise, the fallback description. public string GetTranslatedDescription(string currentLang) { if (itemDescriptionTranslated != null) { foreach (var trans in itemDescriptionTranslated) { if (!string.IsNullOrEmpty(trans.LanguageId) && trans.LanguageId.Equals(currentLang, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(trans.Translate)) { return trans.Translate; } } } return itemDescription; } } }