diff --git a/Assets/Scripts/UI/Popup/ShakePopup.cs b/Assets/Scripts/UI/Popup/ShakePopup.cs index 28c4c5e..83d47dc 100644 --- a/Assets/Scripts/UI/Popup/ShakePopup.cs +++ b/Assets/Scripts/UI/Popup/ShakePopup.cs @@ -1,29 +1,29 @@ using CodeJay.Enum; using System.Collections; -using System.Collections.Generic; using UnityEngine; public class ShakePopup : PopupBase { [SerializeField] private UnityEngine.UI.Image[] Images; - private ECardType[] cardTypes; + public void SetData(ECardType[] cardTypes, bool fourCard) { - for (int i = 0; i < Images.Length; i++) - { - if (i == Images.Length - 1) + if (cardTypes != null && cardTypes.Length == Images.Length) + for (int i = 0; i < Images.Length; i++) { - if (fourCard) + if (i == Images.Length - 1) { - Images[i].gameObject.SetActive(true); - Images[i].sprite = GameManager.Resource.GetSprite(cardTypes[i]); + if (fourCard) + { + Images[i].gameObject.SetActive(true); + Images[i].sprite = GameManager.Resource.GetSprite(cardTypes[i]); + } + else + Images[i].gameObject.SetActive(false); } else - Images[i].gameObject.SetActive(false); + Images[i].sprite = GameManager.Resource.GetSprite(cardTypes[i]); } - else - Images[i].sprite = GameManager.Resource.GetSprite(cardTypes[i]); - } StartCoroutine(coroHide()); GameManager.Sound.PlaySFX(ESFXType.Open_Popup);