285 lines
8.3 KiB
C#
285 lines
8.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Hoister : MonoBehaviour
|
|
{
|
|
/// <summary>
|
|
/// 关闭窗口按钮
|
|
/// </summary>
|
|
public Button Offbutton;
|
|
/// <summary>
|
|
/// 显示信息
|
|
/// </summary>
|
|
public Text Hoistertext, Currentlayertext, Targetlayertext, Startinglayertext, Currentstatetext, Currentstatetext3;
|
|
/// <summary>
|
|
/// 是否启用
|
|
/// </summary>
|
|
public Toggle DescendTe, OnlineTe, LowerinplaceTe, TyperboundaryTe, TyperboundaryTe1, TyperboundaryTe2, OperationTe, SuperiorlimitTe, LowerlimitTe;
|
|
public Toggle OvertimeTe, BreakdownTe, SensordetectionTe, TheliftingcircuitbreakerisfaultyTe, SensordetectionTe2, ContactorfaulTe, TransmissionfaultTe, Layer2faultTe;
|
|
public void Gethoister(string hoistertext, string currentlayertext, string targetlayertext, string startinglayertext, string currentstatetext,
|
|
string currentstatetext3, string descendTe, string onlineTe, string lowerinplaceTe, string typerboundaryTe, string typerboundaryTe1, string typerboundaryTe2,
|
|
string operationTe, string superiorlimitTe, string lowerlimitTe, string overtimeTe, string breakdownTe, string sensordetectionTe, string theliftingcircuitbreakerisfaultyTe, string sensordetectionTe2,
|
|
string contactorfaulTe, string transmissionfaultTe, string layer2faultTe, Action action)
|
|
{
|
|
Hoistertext.text = hoistertext;
|
|
Currentlayertext.text = currentlayertext;
|
|
Targetlayertext.text = targetlayertext;
|
|
Startinglayertext.text = startinglayertext;
|
|
Currentstatetext.text = currentstatetext;
|
|
Currentstatetext3.text = currentstatetext3;
|
|
if (descendTe != null)
|
|
{
|
|
switch (descendTe)
|
|
{
|
|
case "False":
|
|
DescendTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
DescendTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (onlineTe != null)
|
|
{
|
|
switch (onlineTe)
|
|
{
|
|
case "False":
|
|
OnlineTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
OnlineTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (lowerinplaceTe != null)
|
|
{
|
|
switch (lowerinplaceTe)
|
|
{
|
|
case "False":
|
|
LowerinplaceTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
LowerinplaceTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (typerboundaryTe != null)
|
|
{
|
|
switch (typerboundaryTe)
|
|
{
|
|
case "False":
|
|
TyperboundaryTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
TyperboundaryTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (typerboundaryTe1 != null)
|
|
{
|
|
switch (typerboundaryTe1)
|
|
{
|
|
case "False":
|
|
TyperboundaryTe1.isOn = false;
|
|
break;
|
|
case "True":
|
|
TyperboundaryTe1.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (typerboundaryTe2 != null)
|
|
{
|
|
switch (typerboundaryTe2)
|
|
{
|
|
case "False":
|
|
TyperboundaryTe2.isOn = false;
|
|
break;
|
|
case "True":
|
|
TyperboundaryTe2.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (operationTe != null)
|
|
{
|
|
switch (operationTe)
|
|
{
|
|
case "False":
|
|
OperationTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
OperationTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (superiorlimitTe != null)
|
|
{
|
|
switch (superiorlimitTe)
|
|
{
|
|
case "False":
|
|
SuperiorlimitTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
SuperiorlimitTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (lowerlimitTe != null)
|
|
{
|
|
switch (lowerlimitTe)
|
|
{
|
|
case "False":
|
|
LowerlimitTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
LowerlimitTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (overtimeTe != null)
|
|
{
|
|
switch (overtimeTe)
|
|
{
|
|
case "False":
|
|
OvertimeTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
OvertimeTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (breakdownTe != null)
|
|
{
|
|
switch (breakdownTe)
|
|
{
|
|
case "False":
|
|
BreakdownTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
BreakdownTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (sensordetectionTe != null)
|
|
{
|
|
switch (sensordetectionTe)
|
|
{
|
|
case "False":
|
|
SensordetectionTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
SensordetectionTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (theliftingcircuitbreakerisfaultyTe != null)
|
|
{
|
|
switch (theliftingcircuitbreakerisfaultyTe)
|
|
{
|
|
case "False":
|
|
TheliftingcircuitbreakerisfaultyTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
TheliftingcircuitbreakerisfaultyTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (sensordetectionTe2 != null)
|
|
{
|
|
switch (sensordetectionTe2)
|
|
{
|
|
case "False":
|
|
SensordetectionTe2.isOn = false;
|
|
break;
|
|
case "True":
|
|
SensordetectionTe2.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (contactorfaulTe != null)
|
|
{
|
|
switch (contactorfaulTe)
|
|
{
|
|
case "False":
|
|
ContactorfaulTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
ContactorfaulTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (transmissionfaultTe != null)
|
|
{
|
|
switch (transmissionfaultTe)
|
|
{
|
|
case "False":
|
|
TransmissionfaultTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
TransmissionfaultTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
if (layer2faultTe != null)
|
|
{
|
|
switch (layer2faultTe)
|
|
{
|
|
case "False":
|
|
Layer2faultTe.isOn = false;
|
|
break;
|
|
case "True":
|
|
Layer2faultTe.isOn = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
Offbutton.onClick.AddListener(() =>
|
|
{
|
|
if (action != null)
|
|
{
|
|
action?.Invoke();
|
|
}
|
|
});
|
|
}
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|