2026-04-22 계산대 진행중
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using VRShopping.Items;
|
||||
|
||||
namespace VRShopping.UI
|
||||
@@ -9,9 +11,21 @@ public class CheckoutProductionRow : MonoBehaviour
|
||||
[SerializeField] private TMP_Text _nameText;
|
||||
[SerializeField] private TMP_Text _quantityText;
|
||||
[SerializeField] private TMP_Text _priceText;
|
||||
[SerializeField] private Button _addButton;
|
||||
[SerializeField] private Button _removeButton;
|
||||
|
||||
public ItemData Item { get; private set; }
|
||||
public int Quantity { get; private set; }
|
||||
|
||||
public event Action<ItemData> OnAddClicked;
|
||||
public event Action<ItemData> OnRemoveClicked;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (_addButton != null) _addButton.onClick.AddListener(() => OnAddClicked?.Invoke(Item));
|
||||
if (_removeButton != null) _removeButton.onClick.AddListener(() => OnRemoveClicked?.Invoke(Item));
|
||||
}
|
||||
|
||||
public void Bind(ItemData item, int quantity)
|
||||
{
|
||||
if (item == null)
|
||||
@@ -20,11 +34,12 @@ public void Bind(ItemData item, int quantity)
|
||||
return;
|
||||
}
|
||||
|
||||
Item = item;
|
||||
Quantity = quantity;
|
||||
|
||||
if (_nameText != null) _nameText.text = item.DisplayName;
|
||||
if (_quantityText != null) _quantityText.text = $"x{quantity}";
|
||||
if (_priceText != null) _priceText.text = (item.FinalPrice * quantity).ToString();
|
||||
if (_priceText != null) _priceText.text = (item.FinalPrice * quantity).ToString("N0");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user