StudyPanel.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /****************************************************************************
  2. * 2024.9 CHIVA
  3. ****************************************************************************/
  4. using System;
  5. using System.Collections.Generic;
  6. using UnityEngine;
  7. using UnityEngine.UI;
  8. using QFramework;
  9. namespace QFramework
  10. {
  11. public partial class StudyPanel : UIElement
  12. {
  13. public bool isPause = false;
  14. private void Awake()
  15. {
  16. PlayBtn.onClick.AddListener(() =>
  17. {
  18. SoundManager.Instance.RePlay();
  19. Time.timeScale = 1;
  20. PlayBtn.gameObject.SetActive(false);
  21. PauseBtn.gameObject.SetActive(true);
  22. isPause = false;
  23. });
  24. PauseBtn.onClick.AddListener(() =>
  25. {
  26. SoundManager.Instance.Pause();
  27. Time.timeScale = 0;
  28. PlayBtn.gameObject.SetActive(true);
  29. PauseBtn.gameObject.SetActive(false);
  30. isPause = true;
  31. });
  32. }
  33. public void Play()
  34. {
  35. SoundManager.Instance.RePlay();
  36. Time.timeScale = 1;
  37. PlayBtn.gameObject.SetActive(false);
  38. PauseBtn.gameObject.SetActive(true);
  39. isPause = false;
  40. }
  41. protected override void OnBeforeDestroy()
  42. {
  43. }
  44. }
  45. }