InfraredGuider.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class InfraredGuider : MonoBehaviour
  6. {
  7. public GameObject infraredLightGuider;
  8. public GameObject infraredLightGuider2;
  9. public GameObject infraredResulutionGuider;
  10. public Button resulutionButton;
  11. public GameObject Title1ARTEMISPro;
  12. public GameObject Title1;
  13. public GameObject Title2;
  14. public int collisionCount = 0;
  15. bool bRemove = false;
  16. //相机感光部分
  17. [SerializeField]
  18. Slider slider;
  19. [Tooltip("异常校准时候步骤1")]
  20. public GameObject Step1;
  21. [Tooltip("正常游戏流程步骤2")]
  22. public GameObject Step2;
  23. [Tooltip("异常问题时候文字提示步骤1")]
  24. public GameObject Step3;
  25. // Start is called before the first frame update
  26. void Start()
  27. {
  28. if (InfraredDemo._ins)
  29. {
  30. slider.onValueChanged.AddListener((value) =>
  31. {
  32. InfraredDemo._ins.onSliderEvent(value, "PU_BRIGHTNESS");
  33. });
  34. InfraredDemo._ins.onSetSliderValue(slider, "PU_BRIGHTNESS");
  35. }
  36. #if UNITY_STANDALONE_WIN || UNITY_EDITOR
  37. resulutionButton.gameObject.SetActive(false);
  38. #endif
  39. //枪暂时不显示
  40. if (BluetoothAim.ins.isMainConnectToGun()) {
  41. Title1ARTEMISPro.SetActive(false);
  42. Title1.SetActive(false);
  43. }
  44. else
  45. //切换ARTEMISPro
  46. if (BluetoothAim.ins.isMainConnectToARTEMISPRO()) {
  47. Title1ARTEMISPro.SetActive(true);
  48. Title1.SetActive(false);
  49. }
  50. }
  51. // Update is called once per frame
  52. //void Update()
  53. //{
  54. //}
  55. public void enterLightView() {
  56. Instantiate(infraredLightGuider);
  57. }
  58. public void enterInfraredResulutionGuider() {
  59. #if UNITY_ANDROID
  60. Instantiate(infraredResulutionGuider);
  61. #endif
  62. }
  63. public void ExitGuider() {
  64. //if (NewUserGuiderManager.ins)
  65. // NewUserGuiderManager.ins.OnEnd();
  66. GameAssistUI.ins.onBtnBack();
  67. //GameMgr.bNavBack = false;
  68. //Destroy(gameObject);
  69. }
  70. /// <summary>
  71. /// 校准后切换标题
  72. /// </summary>
  73. public void SetTitleAfterCalibration() {
  74. Title1ARTEMISPro.SetActive(false);
  75. Title1.SetActive(false);
  76. Title2.SetActive(true) ;
  77. }
  78. /// <summary>
  79. /// 进入相机感光度的页面
  80. /// </summary>
  81. public void enterInfraredLightGuider2()
  82. {
  83. #if UNITY_ANDROID
  84. Instantiate(infraredLightGuider2);
  85. #endif
  86. }
  87. /// <summary>
  88. /// 异常问题处理时候的文字提示步骤
  89. /// </summary>
  90. public void OnStep3TextTip()
  91. {
  92. if (Step1.activeSelf && !bRemove)
  93. {
  94. bRemove = true;
  95. StartCoroutine(delaySet());
  96. }
  97. Step1.SetActive(false);
  98. Step2.SetActive(false);
  99. Step3.SetActive(true);
  100. }
  101. /// <summary>
  102. /// 射击页面测试显示
  103. /// </summary>
  104. public void OnStep2ShootTest()
  105. {
  106. if (Step1.activeSelf && !bRemove)
  107. {
  108. bRemove = true;
  109. StartCoroutine(delaySet());
  110. }
  111. Step1.SetActive(false);
  112. Step2.SetActive(true);
  113. Step3.SetActive(false);
  114. }
  115. IEnumerator delaySet() {
  116. yield return new WaitForSeconds(0.5f);
  117. SimulateMouseController.ins?.RemoveOpenLocker(this);
  118. }
  119. public void SetCollisionEvent() {
  120. if (collisionCount < 3)
  121. {
  122. collisionCount++;
  123. }
  124. else {
  125. //进入下一步
  126. OnStep2ShootTest();
  127. }
  128. }
  129. void OnEnable()
  130. {
  131. SimulateMouseController.ins?.AddOpenLocker(this);
  132. }
  133. void OnDisable()
  134. {
  135. }
  136. }