PatchNotes.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.Events;
  6. using System.Threading.Tasks;
  7. using System;
  8. public class PatchNotes : OffAnimation
  9. {
  10. [SerializeField] Animator _anim;
  11. [SerializeField] Text _verText;
  12. [SerializeField] LocalizeTMPro _localizeTMPro;
  13. [SerializeField][TextArea] string _text_ENG;
  14. [SerializeField][TextArea] string _text_JPN;
  15. [SerializeField] ScrollRect _scroll;
  16. bool _isOpen = false;
  17. public void OnClickOpenPatchNotesPanelButton()
  18. {
  19. if (_isOpen)
  20. {
  21. ClosePatchNotesPanel();
  22. }
  23. else
  24. {
  25. if (Opening.instance != null)
  26. {
  27. Opening.instance.PlayDecisionSE();
  28. }
  29. else if (GManager.instance != null)
  30. {
  31. GManager.instance.PlayDecisionSE();
  32. }
  33. ContinuousController.instance.StartCoroutine(Open());
  34. }
  35. }
  36. public IEnumerator Open()
  37. {
  38. _verText.text = $"Patch Notes ver{ContinuousController.instance.GameVerString}";
  39. _isOpen = true;
  40. gameObject.SetActive(true);
  41. _anim.SetInteger("Open", 1);
  42. _anim.SetInteger("Close", 0);
  43. _scroll.gameObject.SetActive(false);
  44. yield return new WaitForSeconds(0.25f);
  45. _scroll.gameObject.SetActive(true);
  46. _scroll.verticalNormalizedPosition = 1;
  47. _scroll.content.GetComponent<ContentSizeFitter>().SetLayoutVertical();
  48. }
  49. public void Close()
  50. {
  51. Close_(true);
  52. }
  53. public void ClosePatchNotesPanel()
  54. {
  55. _isOpen = false;
  56. bool playSE = false;
  57. if (gameObject.activeSelf)
  58. {
  59. playSE = true;
  60. }
  61. Close_(playSE);
  62. }
  63. public void Close_(bool playSE)
  64. {
  65. if (playSE)
  66. {
  67. if (Opening.instance != null)
  68. {
  69. Opening.instance.PlayCancelSE();
  70. }
  71. else if (GManager.instance != null)
  72. {
  73. GManager.instance.PlayCancelSE();
  74. }
  75. }
  76. _anim.SetInteger("Open", 0);
  77. _anim.SetInteger("Close", 1);
  78. }
  79. public void Init()
  80. {
  81. if (_localizeTMPro != null)
  82. {
  83. _localizeTMPro._text_ENG = _text_ENG;
  84. _localizeTMPro._text_JPN = _text_JPN;
  85. }
  86. Off();
  87. }
  88. }