89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
using Adam;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using ttpData;
|
||
using UnityEngine;
|
||
//============================================================
|
||
//支持中文,文件使用UTF-8编码
|
||
//@author YangHua
|
||
//@create 20230915
|
||
//@company QianHuo
|
||
//
|
||
//@description: 三相_有互感器_无光伏
|
||
//============================================================
|
||
namespace Views
|
||
{
|
||
public class ThreeTransformerPhotovoltaicView : MonoBehaviour
|
||
{
|
||
public SpriteRenderer spriteRenderer;
|
||
public TextMesh textMesh;
|
||
public string isFD;
|
||
public Sprite[] sprites;
|
||
public List<string> infos = new List<string>();
|
||
/// <summary>
|
||
/// 表计信息
|
||
/// </summary>
|
||
public List<ttpData.JfpgItem> ttpData = new List<ttpData.JfpgItem>();
|
||
/// <summary>
|
||
/// 是否正常
|
||
/// </summary>
|
||
public TrainState trainData;
|
||
|
||
// Use this for initialization
|
||
private void OnEnable ()
|
||
{
|
||
ttpData = ExamusersController.Instance.GetTTPDs();
|
||
for (int i = 0; i < ttpData.Count; i++)
|
||
{
|
||
int index = i;
|
||
if (isFD.Equals(ttpData[index].type))
|
||
{
|
||
infos = ttpData[index].rdj;
|
||
infos.Add(ttpData[index].AA1.ToString());
|
||
infos.Add(ttpData[index].AV1.ToString());
|
||
if (GlobalFlag.sceneData.info0 == "单相")
|
||
{
|
||
textMesh.text = infos[0];
|
||
return;
|
||
}
|
||
infos.Add(ttpData[index].BA1.ToString());
|
||
infos.Add(ttpData[index].BV1.ToString());
|
||
infos.Add(ttpData[index].CA1.ToString());
|
||
infos.Add(ttpData[index].CV1.ToString());
|
||
}
|
||
}
|
||
textMesh.text = infos[0];
|
||
}
|
||
|
||
public int index = 0;
|
||
public void OnUp()
|
||
{
|
||
index--;
|
||
if (index < 0)
|
||
{
|
||
index = 0;
|
||
}
|
||
SetValue(index);
|
||
}
|
||
|
||
public void OnDown()
|
||
{
|
||
index++;
|
||
if (index >= sprites.Length - 1)
|
||
{
|
||
index = sprites.Length - 1;
|
||
}
|
||
SetValue(index);
|
||
}
|
||
|
||
private void SetValue(int index)
|
||
{
|
||
if (infos == null || infos.Count == 0) return;
|
||
spriteRenderer.sprite = sprites[index];
|
||
textMesh.text = infos[index];
|
||
}
|
||
}
|
||
|
||
}
|