69 lines
1.8 KiB
C#
69 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using DG.Tweening;
|
|
|
|
/// <summary>
|
|
/// 所有的方法脚本
|
|
/// </summary>
|
|
public class Manager : MonoBehaviour
|
|
{
|
|
public static Manager Instance;
|
|
public List<GameObject> ShowPanel; //展示的界面
|
|
|
|
#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; //
|
|
#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);
|
|
}
|
|
}
|
|
|
|
public void LoadImageFromResources(GameObject ShowImage,Image targetImages,TextMeshProUGUI text,string path)
|
|
{
|
|
ShowImage.SetActive(true);
|
|
Sprite sprite = Resources.Load<Sprite>(path);
|
|
text.text = sprite.name;
|
|
if (sprite != null)
|
|
{
|
|
targetImages.sprite = sprite;
|
|
Debug.Log("Sprite 加载成功!");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Sprite 加载失败,请检查路径和文件名");
|
|
}
|
|
}
|
|
}
|