42 lines
991 B
C#
42 lines
991 B
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
/// <summary>
|
||
/// 10ml注射器对接硬件脚本
|
||
/// </summary>
|
||
public class ZhuSheQi_10SenSor : Sensor
|
||
{
|
||
/// <summary>
|
||
/// 进度值
|
||
/// </summary>
|
||
[HideInInspector]
|
||
public float progressValue;
|
||
|
||
[SerializeField]
|
||
Text txt;
|
||
private void Start()
|
||
{
|
||
transform.parent.GetComponent<SensorManager>().SendFunction("+++");
|
||
}
|
||
|
||
public override void ReceiveData(string datas)
|
||
{
|
||
base.ReceiveData(datas);
|
||
if (!datas.Split('%')[0].Split("ID:")[1].Split(',')[0].Equals("ZSQ10")) return;
|
||
//this.Error(datas);
|
||
|
||
progressValue = (Convert.ToInt32(datas.Split("%")[0].Split("LEVEL:")[1])) / 10.0f;
|
||
//this.Error($"当前10ml注射器的进度为:{progressValue}");
|
||
}
|
||
|
||
|
||
public override void Display(string datas)
|
||
{
|
||
base.Display(datas);
|
||
txt.text = $"10ml注射器拉取进度:{progressValue}";
|
||
}
|
||
}
|