PatchNotes.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 ReportBug()
  18. {
  19. Application.OpenURL("https://forms.gle/GhZgGVJS1qLeUMcG8");
  20. }
  21. public IEnumerator Open()
  22. {
  23. _verText.text = $"Patch Notes ver{ContinuousController.instance.GameVerString}";
  24. _isOpen = true;
  25. gameObject.SetActive(true);
  26. _anim.SetInteger("Open", 1);
  27. _anim.SetInteger("Close", 0);
  28. _scroll.gameObject.SetActive(false);
  29. yield return new WaitForSeconds(0.25f);
  30. _scroll.gameObject.SetActive(true);
  31. _scroll.verticalNormalizedPosition = 1;
  32. _scroll.content.GetComponent<ContentSizeFitter>().SetLayoutVertical();
  33. }
  34. public void Close()
  35. {
  36. Close_(true);
  37. }
  38. public void ClosePatchNotesPanel()
  39. {
  40. _isOpen = false;
  41. bool playSE = false;
  42. if (gameObject.activeSelf)
  43. {
  44. playSE = true;
  45. }
  46. Close_(playSE);
  47. }
  48. public void Close_(bool playSE)
  49. {
  50. if (playSE)
  51. {
  52. if (Opening.instance != null)
  53. {
  54. Opening.instance.PlayCancelSE();
  55. }
  56. else if (GManager.instance != null)
  57. {
  58. GManager.instance.PlayCancelSE();
  59. }
  60. }
  61. _anim.SetInteger("Open", 0);
  62. _anim.SetInteger("Close", 1);
  63. }
  64. public void Init()
  65. {
  66. if (_localizeTMPro != null)
  67. {
  68. _localizeTMPro._text_ENG = _text_ENG;
  69. _localizeTMPro._text_JPN = _text_JPN;
  70. }
  71. Off();
  72. }
  73. }