CardDetail.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using DG.Tweening;
  6. public class CardDetail : MonoBehaviour
  7. {
  8. [Header("card detail HandCard")]
  9. public HandCard DetailHandCard;
  10. public void OpenCardDetail(CardSource cardSource, bool CanLookOpponentCard)
  11. {
  12. this.gameObject.SetActive(true);
  13. DetailHandCard.SetUpHandCard(cardSource);
  14. if (CanLookOpponentCard)
  15. {
  16. DetailHandCard.SetUpHandCardImage();
  17. }
  18. #region animation
  19. DetailHandCard.transform.localPosition = new Vector3(400, 0, 0);
  20. DetailHandCard.transform.localScale = new Vector3(5.6f, 5.6f, 5.6f);
  21. float animationTime = 0.12f;
  22. var sequence = DOTween.Sequence();
  23. sequence
  24. .Append(DetailHandCard.transform.DOLocalMove(new Vector3(550, 0, 0), animationTime))
  25. .Join(DetailHandCard.transform.DOScale(new Vector3(7, 7, 7), animationTime));
  26. sequence.Play();
  27. #endregion
  28. }
  29. bool first = false;
  30. public void CloseCardDetail()
  31. {
  32. if(first)
  33. {
  34. if (GManager.instance != null)
  35. {
  36. GManager.instance.PlayCancelSE ();
  37. }
  38. }
  39. first = true;
  40. this.gameObject.SetActive(false);
  41. }
  42. }