71 lines
2.4 KiB
C#
71 lines
2.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityEngine;
|
|
using Views;
|
|
|
|
public class ClampAmmetersManager : MonoBehaviour
|
|
{
|
|
[SerializeField] List<ClampAmmetersInteractive> clampAmmetersInteractives = new List<ClampAmmetersInteractive>();
|
|
[SerializeField] List<Multimeter> Multimeter = new List<Multimeter>();
|
|
public Dictionary<int, float> data = new Dictionary<int, float>();
|
|
public ThreeTransformerPhotovoltaicView Three;
|
|
private void Awake()
|
|
{
|
|
run();
|
|
}
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
//init();
|
|
StartCoroutine(QiDon());
|
|
}
|
|
IEnumerator QiDon()
|
|
{
|
|
yield return new WaitForSeconds(5f);
|
|
init();
|
|
}
|
|
/// <summary>
|
|
/// 获取低下预设数据
|
|
/// </summary>
|
|
void run()
|
|
{
|
|
clampAmmetersInteractives = GetComponentsInChildren<ClampAmmetersInteractive>().ToList();
|
|
Multimeter = GetComponentsInChildren<Multimeter>().ToList();
|
|
Three = GetComponentInChildren<ThreeTransformerPhotovoltaicView>();
|
|
}
|
|
void init()
|
|
{
|
|
for (int i = 0; i < clampAmmetersInteractives.Count; i++)
|
|
{
|
|
if (clampAmmetersInteractives[i].name.Equals("用电_AA2")|| clampAmmetersInteractives[i].name.Equals("用电_AA3"))
|
|
{
|
|
clampAmmetersInteractives[i].Fuan = Three.ttpData.data.qxA;
|
|
}
|
|
if (clampAmmetersInteractives[i].name.Equals("用电_BA2")|| clampAmmetersInteractives[i].name.Equals("用电_BA3"))
|
|
{
|
|
clampAmmetersInteractives[i].Fuan = Three.ttpData.data.qxB;
|
|
}
|
|
if (clampAmmetersInteractives[i].name.Equals("用电_CA2") || clampAmmetersInteractives[i].name.Equals("用电_CA3") )
|
|
{
|
|
clampAmmetersInteractives[i].Fuan = Three.ttpData.data.qxC;
|
|
}
|
|
}
|
|
for (int i = 0; i < Multimeter.Count; i++)
|
|
{
|
|
if (Multimeter[i].name.Equals("用电_AV1"))
|
|
{
|
|
Multimeter[i].activation = Three.ttpData.data.dyA;
|
|
}
|
|
if (Multimeter[i].name.Equals("用电_BV1"))
|
|
{
|
|
Multimeter[i].activation = Three.ttpData.data.dyB;
|
|
}
|
|
if (Multimeter[i].name.Equals("用电_CV1"))
|
|
{
|
|
Multimeter[i].activation = Three.ttpData.data.dyC;
|
|
}
|
|
}
|
|
}
|
|
}
|