PopUpUtil.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. public class PopUpUtil : MonoBehaviour {
  5. private Color color;
  6. private float bga = -1;
  7. private Image bg = null;
  8. private bool playAnimationEnd;
  9. public static System.Random random = new System.Random();
  10. void OnDestroy () {
  11. PopUpManager.UpdateModal();
  12. }
  13. void Start()
  14. {
  15. //transform.GetComponent<PopUpPanel>().type;
  16. PopUpPanel popupPanel = transform.GetComponent<PopUpPanel>();
  17. bg = popupPanel.backGround;
  18. playAnimationEnd = popupPanel.PlayAnimationEnd;
  19. if (!popupPanel.PlayAnimationStart)
  20. {
  21. return;
  22. }
  23. if (bg != null)
  24. {
  25. color = bg.color;
  26. bga = bg.color.a;
  27. color.a = 0;
  28. bg.color = color;
  29. }
  30. }
  31. public void Close()
  32. {
  33. if (!playAnimationEnd)
  34. {
  35. Destroy(this.gameObject);
  36. return;
  37. }
  38. if (bg != null)
  39. {
  40. color.a = 0;
  41. }
  42. else
  43. {
  44. CloseMove();
  45. }
  46. }
  47. private void CloseMove()
  48. {
  49. }
  50. }