69 lines
1.6 KiB
C#
69 lines
1.6 KiB
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
using UnityEngine.UI;
|
|||
|
|
|
|||
|
|
public class WeiGuan_Sensor : Sensor
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public Text txt;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7>嵽<EFBFBD>˱ǿ<CBB1>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector]
|
|||
|
|
public bool isBiKong;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7>嵽<EFBFBD>˺<EFBFBD><CBBA><EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector]
|
|||
|
|
public bool isHouLong;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20>Ƿ<EFBFBD><C7B7>嵽<EFBFBD><E5B5BD>θ<EFBFBD><CEB8>
|
|||
|
|
/// </summary>
|
|||
|
|
[HideInInspector]
|
|||
|
|
public bool isWeiBu;
|
|||
|
|
|
|||
|
|
bool isChannl1;
|
|||
|
|
bool isChannl2;
|
|||
|
|
bool isChannl4;
|
|||
|
|
public override void ReceiveData(string datas)
|
|||
|
|
{
|
|||
|
|
base.ReceiveData(datas);
|
|||
|
|
if (!datas.Contains("WB")) return;
|
|||
|
|
//this.Error($"θ<>ܲ<EFBFBD><DCB2><EFBFBD>:{datas}");
|
|||
|
|
string[] arrDatas = datas.Split('%')[0].Split(',');
|
|||
|
|
for (int i = 0; i < arrDatas.Length; i++)
|
|||
|
|
{
|
|||
|
|
if (arrDatas[i].Contains("Channl:"))
|
|||
|
|
{
|
|||
|
|
if (arrDatas[i].Split("Channl:")[1].Equals("1"))
|
|||
|
|
{
|
|||
|
|
isChannl1 = !isChannl1;
|
|||
|
|
}
|
|||
|
|
if (arrDatas[i].Split("Channl:")[1].Equals("2"))
|
|||
|
|
{
|
|||
|
|
isChannl2 = !isChannl2;
|
|||
|
|
}
|
|||
|
|
if (arrDatas[i].Split("Channl:")[1].Equals("4"))
|
|||
|
|
{
|
|||
|
|
isChannl4 = !isChannl4;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
isBiKong = isChannl1;
|
|||
|
|
isHouLong = (isChannl1 && isChannl2);
|
|||
|
|
isWeiBu = (isChannl1 && isChannl2 && isChannl4);
|
|||
|
|
|
|||
|
|
txt.text = $"θ<>ܲ嵽:<3A><>ǻ:{isBiKong}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:{isHouLong}<7D><>θ<EFBFBD><CEB8>:{isWeiBu}";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Display(string datas)
|
|||
|
|
{
|
|||
|
|
base.Display(datas);
|
|||
|
|
}
|
|||
|
|
}
|