2026-04-21 가격창, 사운드
This commit is contained in:
@@ -12,10 +12,10 @@ public class ItemInfoPanel : MonoBehaviour
|
||||
//[SerializeField] private Image _iconImage;
|
||||
[SerializeField] private TMP_Text _nameText;
|
||||
[SerializeField] private TMP_Text _brandText;
|
||||
[SerializeField] private TMP_Text _priceText;
|
||||
[SerializeField] private TMP_Text _originalPriceText;
|
||||
[SerializeField] private GameObject _discountBadge;
|
||||
[SerializeField] private TMP_Text _discountPriceText;
|
||||
[SerializeField] private TMP_Text _discountRateText;
|
||||
[SerializeField] private GameObject _discountRoot;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -41,18 +41,23 @@ public void Show(ItemData data)
|
||||
|
||||
if (_nameText != null) _nameText.text = data.DisplayName;
|
||||
if (_brandText != null) _brandText.text = data.Brand;
|
||||
if (_priceText != null) _priceText.text = FormatPrice(data.FinalPrice);
|
||||
|
||||
bool hasDiscount = data.DiscountRate > 0f;
|
||||
|
||||
if (_originalPriceText != null)
|
||||
{
|
||||
_originalPriceText.gameObject.SetActive(hasDiscount);
|
||||
if (hasDiscount) _originalPriceText.text = $"<s>{FormatPrice(data.BasePrice)}</s>";
|
||||
_originalPriceText.gameObject.SetActive(true);
|
||||
_originalPriceText.text = hasDiscount
|
||||
? $"<s>{FormatPrice(data.BasePrice)}</s>"
|
||||
: FormatPrice(data.FinalPrice);
|
||||
}
|
||||
if (_discountBadge != null) _discountBadge.SetActive(hasDiscount);
|
||||
if (_discountRateText != null && hasDiscount)
|
||||
|
||||
if (_discountRoot != null) _discountRoot.SetActive(hasDiscount);
|
||||
|
||||
if (hasDiscount)
|
||||
{
|
||||
_discountRateText.text = $"-{Mathf.RoundToInt(data.DiscountRate * 100f)}%";
|
||||
if (_discountPriceText != null) _discountPriceText.text = FormatPrice(data.FinalPrice);
|
||||
if (_discountRateText != null) _discountRateText.text = $"-{Mathf.RoundToInt(data.DiscountRate * 100f)}%";
|
||||
}
|
||||
|
||||
_root.SetActive(true);
|
||||
|
||||
Reference in New Issue
Block a user