增加收获属性逻辑,优化掉落物表现效果
This commit is contained in:
@@ -20,6 +20,8 @@ namespace SepCore.UI
|
||||
[SerializeField] private TMP_Text _costText;
|
||||
[SerializeField] private CommonButton _purchaseButton = null;
|
||||
[SerializeField] private TMP_Text _purchaseLabel = null;
|
||||
[SerializeField] private CommonButton _lockButton = null;
|
||||
[SerializeField] private TMP_Text _lockLabel = null;
|
||||
[SerializeField] private CanvasGroup _canvasGroup = null;
|
||||
[SerializeField] private RarityPalette _rarityPalette = null;
|
||||
[SerializeField] private Image _rarityBackground = null;
|
||||
@@ -46,6 +48,12 @@ namespace SepCore.UI
|
||||
_typeText.text = data.TypeName;
|
||||
_descriptionText.text = data.Description;
|
||||
_costText.text = $"{data.Price} <sprite name=\"coin\" index=0>";
|
||||
UpdateLockDisplay(data.IsLocked);
|
||||
}
|
||||
|
||||
public void UpdateLockDisplay(bool isLocked)
|
||||
{
|
||||
_lockLabel.text = isLocked ? "已锁定" : "锁定";
|
||||
}
|
||||
|
||||
public void OnReset()
|
||||
@@ -54,6 +62,8 @@ namespace SepCore.UI
|
||||
_data = null;
|
||||
_iconArea.OnReset();
|
||||
SetRarity(Rarity.None);
|
||||
_lockButton.interactable = true;
|
||||
_lockLabel.text = "锁定";
|
||||
}
|
||||
|
||||
public void MarkPurchased()
|
||||
@@ -63,6 +73,8 @@ namespace SepCore.UI
|
||||
_canvasGroup.alpha = 0.5f;
|
||||
_purchaseButton.interactable = false;
|
||||
_purchaseLabel.text = "已购买";
|
||||
_lockButton.interactable = false;
|
||||
_lockLabel.text = "锁定";
|
||||
}
|
||||
|
||||
private void SetRarity(Rarity rarity)
|
||||
@@ -95,6 +107,7 @@ namespace SepCore.UI
|
||||
_listenersBound = true;
|
||||
|
||||
_purchaseButton.onClick.AddListener(OnPurchaseClick);
|
||||
_lockButton.onClick.AddListener(OnLockClick);
|
||||
}
|
||||
|
||||
private void OnPurchaseClick()
|
||||
@@ -106,5 +119,15 @@ namespace SepCore.UI
|
||||
|
||||
GameEntry.Event.Fire(this, ShopPurchaseEventArgs.Create(_index));
|
||||
}
|
||||
|
||||
private void OnLockClick()
|
||||
{
|
||||
if (_index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameEntry.Event.Fire(this, ShopGoodsLockEventArgs.Create(_index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user