Title.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using DG.Tweening;
  6. using TMPro;
  7. public class Title : MonoBehaviour
  8. {
  9. public Animator anim;
  10. public void OffTitle()
  11. {
  12. this.gameObject.SetActive(false);
  13. }
  14. public void SetUpTitle()
  15. {
  16. this.gameObject.SetActive(true);
  17. anim.enabled = true;
  18. }
  19. bool _clicked = false;
  20. public List<TextMeshProUGUI> titleTexts = new List<TextMeshProUGUI>();
  21. public CheckUpdate checkUpdate;
  22. public GameObject Parent;
  23. public Image TitleLogo;
  24. public GameObject ClickToStart;
  25. public void OnClick()
  26. {
  27. if(_clicked)
  28. {
  29. return;
  30. }
  31. _clicked = true;
  32. ContinuousController.instance.StartCoroutine(OnClickCoroutine());
  33. }
  34. IEnumerator OnClickCoroutine()
  35. {
  36. anim.enabled = false;
  37. ClickToStart.SetActive(false);
  38. float waitTime = 0.5f;
  39. /*
  40. var sequence1 = DOTween.Sequence();
  41. sequence1.Append(Parent.transform.DOLocalMoveY(200, waitTime));
  42. sequence1.Play();
  43. */
  44. /*
  45. foreach (TextMeshProUGUI text in titleTexts)
  46. {
  47. var sequence = DOTween.Sequence();
  48. sequence
  49. .Append(DOTween.To(() => text.color, (x) => text.color = x, new Color(text.color.r, text.color.g, text.color.b, 0), waitTime));
  50. sequence.Play();
  51. }
  52. */
  53. var sequence = DOTween.Sequence();
  54. sequence
  55. .Append(DOTween.To(() => TitleLogo.color, (x) => TitleLogo.color = x, new Color(TitleLogo.color.r, TitleLogo.color.g, TitleLogo.color.b, 0), waitTime));
  56. sequence.Play();
  57. yield return new WaitForSeconds(waitTime + 0.2f);
  58. OffTitle();
  59. //yield return ContinuousController.instance.StartCoroutine(checkUpdate.CheckUpdateCoroutine());
  60. Opening.instance.home.SetUpHome();
  61. }
  62. }