GQ_Communicate/GQ_URP/GQ/Assets/script/巡检/IssueInspectionInstructions.cs

59 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
/// <summary>
/// 下发巡检指令
/// </summary>
public class IssueInspectionInstructions : MonoBehaviour
{
public static IssueInspectionInstructions Inst;
/// <summary>
/// 是否初始化数据
/// </summary>
[HideInInspector] public bool init_data = false;
public List<Button> buttons;
private void Awake()
{
Inst = this;
}
// Start is called before the first frame update
void Start()
{
}
public void init()
{
if (RobotDataManager.Inst && RobotDataManager.Inst.obtainListening && RobotDataManager.Inst.rootCabinDictionary.cabinDictionaries != null)
{
RobotDataManager.Inst.obtainListening = false;
foreach (var item in RobotDataManager.Inst.rootCabinDictionary.cabinDictionaries)
{
for (int i = 0; i < GameManager.Inst.Cabinets_go.Count; i++)
{
if (item.name == GameManager.Inst.Cabinets_go[i].name)
{
buttons[i].onClick.AddListener(() =>
{
RobotDataManager.Inst.UsageExample(item.pointNos);
});
break;
}
}
}
}
}
// Update is called once per frame
void Update()
{
init();
}
}