优化道具稀有度的 UI 表现
This commit is contained in:
@@ -2,6 +2,8 @@ using System;
|
||||
using SepCore.Event;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using SepCore.Definition;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
@@ -19,6 +21,9 @@ namespace SepCore.UI
|
||||
[SerializeField] private CommonButton _purchaseButton = null;
|
||||
[SerializeField] private TMP_Text _purchaseLabel = null;
|
||||
[SerializeField] private CanvasGroup _canvasGroup = null;
|
||||
[SerializeField] private RarityPalette _rarityPalette = null;
|
||||
[SerializeField] private Image _rarityBackground = null;
|
||||
[SerializeField] private Image _rarityBorder = null;
|
||||
|
||||
private GoodsItemContext _data;
|
||||
|
||||
@@ -35,6 +40,7 @@ namespace SepCore.UI
|
||||
_canvasGroup.alpha = 1f;
|
||||
_purchaseLabel.text = "购买";
|
||||
|
||||
SetRarity(data.Rarity);
|
||||
_iconArea.OnInit(data.Icon, data.Rarity);
|
||||
_titleText.text = data.Name;
|
||||
_typeText.text = data.TypeName;
|
||||
@@ -46,16 +52,26 @@ namespace SepCore.UI
|
||||
{
|
||||
_index = -1;
|
||||
_data = null;
|
||||
_iconArea.OnReset();
|
||||
SetRarity(Rarity.None);
|
||||
}
|
||||
|
||||
public void MarkPurchased()
|
||||
{
|
||||
OnReset();
|
||||
_index = -1;
|
||||
_data = null;
|
||||
_canvasGroup.alpha = 0.5f;
|
||||
_purchaseButton.interactable = false;
|
||||
_purchaseLabel.text = "已购买";
|
||||
}
|
||||
|
||||
private void SetRarity(Rarity rarity)
|
||||
{
|
||||
RarityPalette.Colors colors = _rarityPalette.Get(rarity);
|
||||
_rarityBackground.color = colors.CardBackground;
|
||||
_rarityBorder.color = colors.Border;
|
||||
}
|
||||
|
||||
public void RefreshAvailability(int playerCoin, bool weaponCapacityFull)
|
||||
{
|
||||
if (_index < 0)
|
||||
|
||||
Reference in New Issue
Block a user