GQ_Communicate/GQ_TongXin/Assets/script/UI/PatternChoose.cs

124 lines
3.3 KiB
C#

using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 模式选择
/// </summary>
[AddComponentMenu("PatternChoose/模式选择")]
public class PatternChoose : MonoBehaviour
{
static PatternChoose _inst;
public static PatternChoose Inst => _inst;
public Button TS_button;
public Button RL_button;
/// <summary>
/// 热力效果图
/// </summary>
public GameObject heatMap;
public GameObject search_go;
Vector3 init_pos;
Vector3 init_rot;
[SerializeField] public Color red_alarm;
[SerializeField] public Color yellow_alarm;
[SerializeField] public Color blue_alarm;
public Toggle roomCut;
public Toggle quanJing;
/// <summary>
/// 设备新增窗口
/// </summary>
public GameObject sb_xz_page;
/// <summary>
/// 设备编辑窗口
/// </summary>
public GameObject sb_bj_page;
/// <summary>
/// 端口新增窗口
/// </summary>
public GameObject dk_xz_page;
/// <summary>
/// 端口编辑窗口
/// </summary>
public GameObject dk_bj_page;
public CreateLine huaXian;
/// <summary>
/// 线缆
/// </summary>
public ByCode xianlan;
public UIToCabinet uiToCabinet;
public Image xunJianImg;
private void Awake()
{
if (_inst != null && _inst != this)
{
Destroy(this.gameObject);
}
else
{
_inst = this;
//DontDestroyOnLoad(this.gameObject);
}
init_pos = Camera.main.transform.localPosition;
init_rot = Camera.main.transform.localEulerAngles;
}
void Start()
{
roomCut.onValueChanged.AddListener((x) =>
{
if (CabinetUIManager.Instance.current_menu == Menu.M_数字孪生_智能巡检)
return;
ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu, 2);
});
quanJing.onValueChanged.AddListener((x) =>
{
ExtendedFlycam.Inst.QieHuan(CabinetUIManager.Instance.current_menu);
});
}
// Update is called once per frame
void Update()
{
}
public void F1(bool isheatMap)
{
heatMap.SetActive(isheatMap);
ExtendedFlycam.Inst.init_mainCamera_rot();
Camera.main.transform.DOMove(/*TransparentGlowManage.Inst.MainCamera_pos*/init_pos, 1f);
Camera.main.transform.DORotateQuaternion(Quaternion.Euler(/*TransparentGlowManage.Inst.MainCamera_rot*/init_rot), 1f).OnComplete(() =>
{
//更新相机初始旋转角度
ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
});
TransparentGlowManage.Inst.renewALL();
}
void F2(bool isheatMap)
{
heatMap.SetActive(isheatMap);
ExtendedFlycam.Inst.init_mainCamera_rot();
Camera.main.transform.DOMove(/*TransparentGlowManage.Inst.MainCamera_pos*/init_pos, 1f);
Camera.main.transform.DORotateQuaternion(Quaternion.Euler(/*TransparentGlowManage.Inst.MainCamera_rot*/init_rot), 1f).OnComplete(() =>
{
//更新相机初始旋转角度
ExtendedFlycam.Inst.initialRotationEulerAngles = Camera.main.transform.localEulerAngles;
});
TransparentGlowManage.Inst.renewALL();
}
}