using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InfraredGuider : MonoBehaviour
{
public GameObject infraredLightGuider;
public GameObject infraredLightGuider2;
public GameObject infraredResulutionGuider;
public Button resulutionButton;
public GameObject Title1ARTEMISPro;
public GameObject Title1;
public GameObject Title2;
public int collisionCount = 0;
bool bRemove = false;
//相机感光部分
[SerializeField]
Slider slider;
[Tooltip("异常校准时候步骤1")]
public GameObject Step1;
[Tooltip("正常游戏流程步骤2")]
public GameObject Step2;
[Tooltip("异常问题时候文字提示步骤1")]
public GameObject Step3;
// Start is called before the first frame update
void Start()
{
if (InfraredDemo._ins)
{
slider.onValueChanged.AddListener((value) =>
{
InfraredDemo._ins.onSliderEvent(value, "PU_BRIGHTNESS");
});
InfraredDemo._ins.onSetSliderValue(slider, "PU_BRIGHTNESS");
}
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
resulutionButton.gameObject.SetActive(false);
#endif
//枪暂时不显示
if (BluetoothAim.ins.isMainConnectToGun()) {
Title1ARTEMISPro.SetActive(false);
Title1.SetActive(false);
}
else
//切换ARTEMISPro
if (BluetoothAim.ins.isMainConnectToARTEMISPRO()) {
Title1ARTEMISPro.SetActive(true);
Title1.SetActive(false);
}
}
// Update is called once per frame
//void Update()
//{
//}
public void enterLightView() {
Instantiate(infraredLightGuider);
}
public void enterInfraredResulutionGuider() {
#if UNITY_ANDROID
Instantiate(infraredResulutionGuider);
#endif
}
public void ExitGuider() {
//if (NewUserGuiderManager.ins)
// NewUserGuiderManager.ins.OnEnd();
GameAssistUI.ins.onBtnBack();
//GameMgr.bNavBack = false;
//Destroy(gameObject);
}
///
/// 校准后切换标题
///
public void SetTitleAfterCalibration() {
Title1ARTEMISPro.SetActive(false);
Title1.SetActive(false);
Title2.SetActive(true) ;
}
///
/// 进入相机感光度的页面
///
public void enterInfraredLightGuider2()
{
#if UNITY_ANDROID
Instantiate(infraredLightGuider2);
#endif
}
///
/// 异常问题处理时候的文字提示步骤
///
public void OnStep3TextTip()
{
if (Step1.activeSelf && !bRemove)
{
bRemove = true;
StartCoroutine(delaySet());
}
Step1.SetActive(false);
Step2.SetActive(false);
Step3.SetActive(true);
}
///
/// 射击页面测试显示
///
public void OnStep2ShootTest()
{
Debug.Log("OnStep2ShootTest hui 1:" + Step1.activeSelf + " = " + bRemove);
if (Step1.activeSelf && !bRemove)
{
bRemove = true;
StartCoroutine(delaySet());
Debug.Log("OnStep2ShootTest delaySet:" + Step1.activeSelf + " = " + bRemove);
}
Step1.SetActive(false);
Step2.SetActive(true);
Step3.SetActive(false);
}
IEnumerator delaySet() {
yield return new WaitForSeconds(0.5f);
SimulateMouseController.ins?.RemoveOpenLocker(this);
}
public void SetCollisionEvent() {
if (collisionCount < 3)
{
collisionCount++;
}
else {
//进入下一步
OnStep2ShootTest();
}
}
void OnEnable()
{
SimulateMouseController.ins?.AddOpenLocker(this);
}
void OnDisable()
{
}
}