59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using static UnityEditor.Progress;
|
|
|
|
public class NameplateController : MonoSingleton<NameplateController>
|
|
{
|
|
public GameObject NameplatePanel;
|
|
public RectTransform backTransform;
|
|
public RectTransform mtTransform;
|
|
public Image NameplateImage;
|
|
public GameObject[] Obj_Nameplate;
|
|
public List<TextMeshProUGUI> NameplateTextUGUI;
|
|
public List<TextMeshPro> TextUGUI_NBQ;
|
|
public List<TextMeshPro> TextUGUI_HGQ;
|
|
public Dictionary<string, TextMeshProUGUI> DictextMeshPro;
|
|
|
|
private void Start()
|
|
{
|
|
Invoke("AddNameplateClick",5.0f);
|
|
}
|
|
|
|
public void AddNameplateClick()
|
|
{
|
|
DictextMeshPro = new Dictionary<string, TextMeshProUGUI>();
|
|
|
|
TextUGUI_NBQ = new List<TextMeshPro>();
|
|
TextUGUI_HGQ = new List<TextMeshPro>();
|
|
|
|
DictextMeshPro.Add("低压互感器铭牌", NameplateTextUGUI[0]);
|
|
DictextMeshPro.Add("2号逆变器_铭牌_正确", NameplateTextUGUI[1]);
|
|
DictextMeshPro.Add("光伏板_铭牌", NameplateTextUGUI[2]);
|
|
|
|
Obj_Nameplate = GameObject.FindGameObjectsWithTag("铭牌");
|
|
foreach (GameObject item in Obj_Nameplate)
|
|
{
|
|
item.AddComponent<ShowNameplate>();
|
|
if (item.name != "光伏板_铭牌")
|
|
{
|
|
TextMeshPro itemMesh = item.transform.GetChild(0).GetComponent<TextMeshPro>();
|
|
if (item.name == "低压互感器铭牌")
|
|
TextUGUI_HGQ.Add(itemMesh);
|
|
else
|
|
TextUGUI_NBQ.Add(itemMesh);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void RefreshShown()
|
|
{
|
|
foreach (TextMeshProUGUI item in NameplateTextUGUI)
|
|
{
|
|
item.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|