驱蚊app
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

81 行
1.8 KiB

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class UIMainModel : UIBase
  6. {
  7. [SerializeField]
  8. Button StartButton;
  9. [SerializeField]
  10. Button StopButton;
  11. bool _isPlaySound;
  12. string bgmPath;
  13. bool IsPlaySound
  14. {
  15. get { return _isPlaySound; }
  16. set
  17. {
  18. _isPlaySound = value;
  19. if (_isPlaySound)
  20. {
  21. AudioManager.Instance.PlayBGM(bgmPath);
  22. StartButton.gameObject.SetActive(false);
  23. StopButton.gameObject.SetActive(true);
  24. }
  25. else
  26. {
  27. AudioManager.Instance.StopBGM();
  28. StartButton.gameObject.SetActive(true);
  29. StopButton.gameObject.SetActive(false);
  30. }
  31. }
  32. }
  33. public override void OnOpen(params object[] args)
  34. {
  35. int model = (int)args[0];
  36. switch (model)
  37. {
  38. case 0:
  39. bgmPath = "B-2·ÖÖÓ - ºØ, ÍõºØ";
  40. break;
  41. case 1:
  42. bgmPath = "Sinus 2500Hz _ 10dB - Test Tones";
  43. break;
  44. case 2:
  45. bgmPath = "Sinus 6000Hz _ 10dB - Test Tones";
  46. break;
  47. case 3:
  48. bgmPath = "Sinus 8000Hz _ 10dB - Test Tones";
  49. break;
  50. default:
  51. bgmPath = "B-2·ÖÖÓ - ºØ, ÍõºØ";
  52. break;
  53. }
  54. IsPlaySound = false;
  55. }
  56. public override void OnClose()
  57. {
  58. IsPlaySound = false;
  59. }
  60. public void ClickCloseButton()
  61. {
  62. Close();
  63. }
  64. public void ClickStartButton()
  65. {
  66. IsPlaySound = true;
  67. }
  68. public void ClickStopButton()
  69. {
  70. IsPlaySound = false;
  71. }
  72. }