| | 1 | | using System; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | public class NftPageView : BaseComponentView |
| | 5 | | { |
| | 6 | |
|
| | 7 | | public event Action<string> OnClickBuyNft; |
| | 8 | |
|
| | 9 | | [SerializeField] private NFTIconComponentView[] nftElements; |
| 0 | 10 | | private string[] nftIds = new string[4]; |
| | 11 | |
|
| | 12 | | public void SetPageElementsContent(NFTIconComponentModel[] nftModels, string[] ids) |
| | 13 | | { |
| 0 | 14 | | nftIds = ids; |
| 0 | 15 | | for (int i = 0; i < nftModels.Length; i++) |
| | 16 | | { |
| 0 | 17 | | if (nftModels[i] != null) |
| | 18 | | { |
| 0 | 19 | | nftElements[i].gameObject.SetActive(true); |
| 0 | 20 | | nftElements[i].Configure(nftModels[i]); |
| 0 | 21 | | nftElements[i].onMarketplaceButtonClick.RemoveAllListeners(); |
| 0 | 22 | | int idIndex = i; |
| 0 | 23 | | nftElements[i].onMarketplaceButtonClick.AddListener(() => ClickOnBuyWearable(idIndex)); |
| | 24 | | } |
| | 25 | | else |
| | 26 | | { |
| 0 | 27 | | nftElements[i].gameObject.SetActive(false); |
| | 28 | | } |
| | 29 | | } |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | | private void ClickOnBuyWearable(int index) |
| | 33 | | { |
| 0 | 34 | | OnClickBuyNft?.Invoke(nftIds[index]); |
| 0 | 35 | | } |
| | 36 | |
|
| | 37 | | public override void RefreshControl() |
| | 38 | | { |
| 0 | 39 | | } |
| | 40 | | } |