[Add] Dice & Refactor private names
This commit is contained in:
@@ -25,7 +25,7 @@ namespace YachtDice.Shop
|
||||
[SerializeField] private Color rareColor = new(0.4f, 0.6f, 1f);
|
||||
[SerializeField] private Color epicColor = new(0.8f, 0.4f, 1f);
|
||||
|
||||
private IShopItem data;
|
||||
private IShopItem _data;
|
||||
|
||||
public event Action<IShopItem> OnBuyClicked;
|
||||
public event Action<IShopItem, RectTransform> OnHoverEnter;
|
||||
@@ -34,21 +34,21 @@ namespace YachtDice.Shop
|
||||
private void Awake()
|
||||
{
|
||||
if (buyButton != null)
|
||||
buyButton.onClick.AddListener(() => OnBuyClicked?.Invoke(data));
|
||||
buyButton.onClick.AddListener(() => OnBuyClicked?.Invoke(_data));
|
||||
}
|
||||
|
||||
public void Setup(IShopItem item, ShopItemState state)
|
||||
{
|
||||
data = item;
|
||||
_data = item;
|
||||
|
||||
if (nameText != null) nameText.text = data.DisplayName;
|
||||
if (descriptionText != null) descriptionText.text = data.Description;
|
||||
if (priceText != null) priceText.text = data.ShopPrice.ToString();
|
||||
if (iconImage != null && data.Icon != null) iconImage.sprite = data.Icon;
|
||||
if (nameText != null) nameText.text = _data.DisplayName;
|
||||
if (descriptionText != null) descriptionText.text = _data.Description;
|
||||
if (priceText != null) priceText.text = _data.ShopPrice.ToString();
|
||||
if (iconImage != null && _data.Icon != null) iconImage.sprite = _data.Icon;
|
||||
|
||||
if (rarityText != null)
|
||||
{
|
||||
if (data is ModifierDefinition mod)
|
||||
if (_data is ModifierDefinition mod)
|
||||
{
|
||||
rarityText.gameObject.SetActive(true);
|
||||
rarityText.text = mod.Rarity.ToString();
|
||||
@@ -90,7 +90,7 @@ namespace YachtDice.Shop
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
OnHoverEnter?.Invoke(data, transform as RectTransform);
|
||||
OnHoverEnter?.Invoke(_data, transform as RectTransform);
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
|
||||
Reference in New Issue
Block a user