137 lines
3.9 KiB
C#
137 lines
3.9 KiB
C#
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
using HighlightPlus;
|
|
|
|
/// <summary>
|
|
/// 所有的方法脚本
|
|
/// </summary>
|
|
public class Manager : MonoBehaviour
|
|
{
|
|
public static Manager Instance;
|
|
public List<GameObject> ShowPanel; //展示的界面
|
|
|
|
public LookAtCameraName MyLookAtCameraNamel;
|
|
#region 驾驶舱
|
|
[Header("驾驶舱")]
|
|
public List<Toggle> UpAllToggle; //下方toggle
|
|
public GameObject EnterpriseInformation_image; //企业信息图片
|
|
public TextMeshProUGUI EnterpriseInformationName_text; //企业信息名称
|
|
public Image targetImage; // 企业信息替换图片
|
|
public bool isClick; //第一次展示第二次隐藏
|
|
public Button PipelineBtn; //点击展示管道按钮
|
|
public List<GameObject> Pipeline; //展示管道
|
|
public Tween Tween;
|
|
#endregion
|
|
|
|
#region 企业信息管理
|
|
[Header("企业信息管理")]
|
|
public List<Toggle> ScendToggle; //二级菜单可点击toggle
|
|
public GameObject middleTable_Image; //表2-2全厂项目工程类别及产品方案
|
|
public Image tableImage; //中间的表图片
|
|
public TextMeshProUGUI middleTable_Text; //
|
|
public Button ForDetailsBtn; // 企业信息管理企业产品产能的详情按钮
|
|
public bool isForDetails; //判断是否点击了详情按钮
|
|
|
|
public Sprite[] toggleSpr;//下拉
|
|
public List<GameObject> toggleObj;
|
|
public bool isxiala;
|
|
#endregion
|
|
|
|
#region 园区在线检测
|
|
[Header("园区在线检测")]
|
|
public List<Button> YQSPJKBtn; //园区视频监控按钮
|
|
public List<Button> PFJKSPBtn; //排放监视频
|
|
public GameObject GSYQSPJKObj; //公司园区视频监控
|
|
public RawImage GSYQSPJKRawImg;
|
|
public TextMeshProUGUI GSYQSPJKTopText; //公司园区视频监控顶部文字
|
|
|
|
#endregion
|
|
|
|
#region 污染排放管理
|
|
[Header("污染排放管理")]
|
|
public Button[] FSFQBtn; //右侧废水废气按钮
|
|
|
|
#endregion
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
Init();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
public void Init()
|
|
{
|
|
for (int i = 0; i < ShowPanel.Count; i++)
|
|
{
|
|
ShowPanel[i].SetActive(false);
|
|
ShowPanel[i].SetActive(i==0);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 物体高亮(闪来闪去)
|
|
/// </summary>
|
|
public void ObjOfHiglight(HighlightEffect HighlightObj)
|
|
{
|
|
Tween = DOVirtual.Float(1, 0f, 1f, t =>
|
|
{
|
|
HighlightObj.innerGlow = t;
|
|
HighlightObj.outline = t;
|
|
}).SetLoops(-1, LoopType.Yoyo);
|
|
HighlightObj?.SetHighlighted(true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 弹框
|
|
/// </summary>
|
|
/// <param name="ShowImage">所要展示的页面</param>
|
|
/// <param name="targetImages">中间的画面</param>
|
|
/// <param name="text">上方的标题文字</param>
|
|
/// <param name="path">中间图片的路径</param>
|
|
public void LoadImageFromResources(GameObject ShowImage,Image targetImages,TextMeshProUGUI text,string path)
|
|
{
|
|
ShowImage.SetActive(true);
|
|
Sprite sprite = Resources.Load<Sprite>(path);
|
|
Debug.Log(sprite.name);
|
|
text.text = sprite.name;
|
|
if (sprite != null)
|
|
{
|
|
targetImages.sprite = sprite;
|
|
Debug.Log("Sprite 加载成功!");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Sprite 加载失败,请检查路径和文件名");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 监控弹框
|
|
/// </summary>
|
|
/// <param name="ShowImage">所要展示的页面</param>
|
|
/// <param name="targetImages">中间的画面</param>
|
|
/// <param name="text">上方的标题文字</param>
|
|
/// <param name="path">中间图片的路径</param>
|
|
public void LoadRawImageFromResources(GameObject ShowImage,RawImage targetImages,TextMeshProUGUI text,string path)
|
|
{
|
|
ShowImage.SetActive(true);
|
|
Sprite sprite = Resources.Load<Sprite>(path);
|
|
text.text = sprite.name;
|
|
if (sprite != null)
|
|
{
|
|
targetImages.texture = sprite.texture;
|
|
Debug.Log("Sprite 加载成功!");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Sprite 加载失败,请检查路径和文件名");
|
|
}
|
|
}
|
|
}
|