最新对接硬件提交
This commit is contained in:
parent
1d4a5ebe77
commit
38977d0e7f
8
Assets/SenSorSystem.meta
Normal file
8
Assets/SenSorSystem.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f220a41c2163924418de05ca51a6509a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
63
Assets/SenSorSystem/ChuanCiZhen_SenSor.cs
Normal file
63
Assets/SenSorSystem/ChuanCiZhen_SenSor.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 穿刺针对接硬件脚本
|
||||||
|
/// </summary>
|
||||||
|
public class ChuanCiZhen_SenSor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 进度值
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float progressValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旋转X
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float X;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旋转Y
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float Y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旋转Z
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float Z;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Text txt;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
transform.parent.GetComponent<SensorManager>().SendFunction("+++");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
if (!datas.Split("OK")[0].Split("ID:")[1].Split(',')[0].Equals("CCZ")) return;
|
||||||
|
//this.Error(datas);
|
||||||
|
progressValue = (Convert.ToInt32(datas.Split("OK")[0].Split("LEVEL:")[1])) / 10.0f;
|
||||||
|
//this.Error($"当前穿刺针的拔出进度为:{progressValue}");
|
||||||
|
X = float.Parse(datas.Split("OK")[0].Split("PIT:")[1].Split(',')[0]);
|
||||||
|
Y = float.Parse(datas.Split("OK")[0].Split("YAW:")[1].Split(',')[0]);
|
||||||
|
Z = float.Parse(datas.Split("OK")[0].Split("ROL:")[1].Split(',')[0]);
|
||||||
|
this.Error($"当前旋转角度为:{X},{Y},{Z}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
txt.text = $"穿刺针进度:{progressValue},X:{X},Y:{Y},Z:{Z}";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/ChuanCiZhen_SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/ChuanCiZhen_SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1f7a462535b96bb49bb3c08e661285cc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
54
Assets/SenSorSystem/MianQian_SenSor.cs
Normal file
54
Assets/SenSorSystem/MianQian_SenSor.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
using DongWuYiXue.DaoNiaoShu;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 棉签对接硬件脚本
|
||||||
|
/// </summary>
|
||||||
|
public class MianQian_SenSor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 旋转X
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float X;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旋转Y
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float Y;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 旋转Z
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float Z;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Text txt;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
GameManager.Instance.senSor.SendFunction("+++");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
if (!datas.Split("OK")[0].Split("ID:")[1].Split(',')[0].Equals("MQ")) return;
|
||||||
|
//this.Error(datas);
|
||||||
|
X = float.Parse(datas.Split("OK")[0].Split("PIT:")[1].Split(',')[0]);
|
||||||
|
Y = float.Parse(datas.Split("OK")[0].Split("YAW:")[1].Split(',')[0]);
|
||||||
|
Z = float.Parse(datas.Split("OK")[0].Split("ROL:")[1].Split(',')[0]);
|
||||||
|
this.Error($"当前旋转角度为:{X},{Y},{Z}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
txt.text = $"棉签:X:{X},Y:{Y},Z:{Z}";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/MianQian_SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/MianQian_SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eaf58d795a4325d438bd0ea53eae3127
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
41
Assets/SenSorSystem/ZhuSheQi_10SenSor.cs
Normal file
41
Assets/SenSorSystem/ZhuSheQi_10SenSor.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
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}";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/ZhuSheQi_10SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/ZhuSheQi_10SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dee96b6ec9e1103438964d08217229ec
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
63
Assets/SenSorSystem/ZhuSheQi_20SenSor.cs
Normal file
63
Assets/SenSorSystem/ZhuSheQi_20SenSor.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using DongWuYiXue.DaoNiaoShu;
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 20ml注射器对接硬件脚本
|
||||||
|
/// </summary>
|
||||||
|
public class ZhuSheQi_20SenSor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 进度值
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float progressValue;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Text txt;
|
||||||
|
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isOpen;
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
//transform.parent.GetComponent<SensorManager>().SendFunction("+++");
|
||||||
|
GameManager.Instance.senSor.SendFunction("+++");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
if (!datas.Split('%')[0].Split("ID:")[1].Split(',')[0].Equals("ZSQ20")) return;
|
||||||
|
lastTime = time;
|
||||||
|
//this.Error(datas);
|
||||||
|
progressValue = ((Convert.ToInt32(datas.Split("%")[0].Split("LEVEL:")[1])) - 1) / 9.0f;
|
||||||
|
//this.Error($"当前20ml注射器的进度为:{progressValue}");
|
||||||
|
}
|
||||||
|
|
||||||
|
float time;
|
||||||
|
float lastTime;
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
time += Time.deltaTime;
|
||||||
|
if (time - lastTime < 1.0f)
|
||||||
|
{
|
||||||
|
isOpen = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOpen = false;
|
||||||
|
//progressValue = 0;
|
||||||
|
}
|
||||||
|
txt.text = $"20ml注射器开启:{isOpen}拉取进度:{progressValue}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/ZhuSheQi_20SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/ZhuSheQi_20SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6515ceb79208d2043abd8b8ae96b2915
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
60
Assets/SenSorSystem/ZhuSheQi_50SenSor.cs
Normal file
60
Assets/SenSorSystem/ZhuSheQi_50SenSor.cs
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 50ml注射器对接硬件脚本
|
||||||
|
/// </summary>
|
||||||
|
public class ZhuSheQi_50SenSor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 进度值
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float progressValue;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
Text txt;
|
||||||
|
|
||||||
|
public bool isOpen;
|
||||||
|
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("ZSQ50")) return;
|
||||||
|
lastTime = time;
|
||||||
|
progressValue = (Convert.ToInt32(datas.Split("%")[0].Split("LEVEL:")[1])) / 10.0f;
|
||||||
|
//this.Error($"当前50ml注射器的进度为:{progressValue}");
|
||||||
|
}
|
||||||
|
|
||||||
|
float time;
|
||||||
|
float lastTime;
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
time += Time.deltaTime;
|
||||||
|
if (time - lastTime < 1.0f)
|
||||||
|
{
|
||||||
|
isOpen = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isOpen = false;
|
||||||
|
//progressValue = 0;
|
||||||
|
}
|
||||||
|
txt.text = $"50ml注射器开启:{isOpen}拉取进度:{progressValue}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/ZhuSheQi_50SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/ZhuSheQi_50SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0686ff7ec08456848803a48f332b6f45
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
43
Assets/SenSorSystem/ZhuSheQi_5SenSor.cs
Normal file
43
Assets/SenSorSystem/ZhuSheQi_5SenSor.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using ZXKFramework;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 5ml注射器对接硬件脚本
|
||||||
|
/// </summary>
|
||||||
|
public class ZhuSheQi_5SenSor : 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("ZSQ5")) return;
|
||||||
|
//this.Error(datas);
|
||||||
|
|
||||||
|
//progressValue = ((Convert.ToInt32(datas.Split("%")[0].Split("LEVEL:")[1]))-3) / 7.0f;
|
||||||
|
progressValue = ((Convert.ToInt32(datas.Split("%")[0].Split("LEVEL:")[1]))-3) / 6.0f;
|
||||||
|
//this.Error($"当前5ml注射器的进度为:{progressValue}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
txt.text = $"5ml注射器拉取进度:{progressValue}";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/ZhuSheQi_5SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/ZhuSheQi_5SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 69a0daf26ab454b498450dd3fa562c2b
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SenSorSystem/胃管置入术.meta
Normal file
8
Assets/SenSorSystem/胃管置入术.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 477adfb4edcb2de43b8e701c1a1f22d8
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
67
Assets/SenSorSystem/胃管置入术/WeiGuanJianCe_SenSor.cs
Normal file
67
Assets/SenSorSystem/胃管置入术/WeiGuanJianCe_SenSor.cs
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class WeiGuanJianCe_SenSor : Sensor
|
||||||
|
{
|
||||||
|
public bool isBiQiang = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否进入口咽部
|
||||||
|
/// </summary>
|
||||||
|
public bool isYanHou = false;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否进入气管
|
||||||
|
/// </summary>
|
||||||
|
public bool isQiGuan = false;
|
||||||
|
|
||||||
|
int BiQiangNum = 0;
|
||||||
|
int YanHouNum = 0;
|
||||||
|
int QiGuanNum = 0;
|
||||||
|
|
||||||
|
public Text txt;
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
if (!datas.Split('%')[0].Split("ID:")[1].Split(',')[0].Equals("XTJC")) return;
|
||||||
|
if (datas.Contains("Channl:"))
|
||||||
|
{
|
||||||
|
string str = datas.Split("Channl:")[1].Split(',')[0];
|
||||||
|
this.Log($"检测的数据为:{datas.Split("Channl:")[1].Split(',')[0]}");
|
||||||
|
switch (str)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
BiQiangNum++;
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
YanHouNum++;
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
QiGuanNum++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
isBiQiang = BiQiangNum % 2 != 0;
|
||||||
|
isYanHou = YanHouNum % 2 != 0;
|
||||||
|
isQiGuan = QiGuanNum % 2 != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetZero_WeiGuan()
|
||||||
|
{
|
||||||
|
BiQiangNum = 0;
|
||||||
|
YanHouNum = 0;
|
||||||
|
QiGuanNum = 0;
|
||||||
|
isBiQiang = false;
|
||||||
|
isYanHou = false;
|
||||||
|
isQiGuan = false;
|
||||||
|
txt.text = $"胃管:{isBiQiang}+{BiQiangNum},咽喉:{isYanHou}+{YanHouNum},气管:{isQiGuan}+{QiGuanNum}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
txt.text = $"胃管:{isBiQiang}+{BiQiangNum},咽喉:{isYanHou}+{YanHouNum},气管:{isQiGuan}+{QiGuanNum}";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/胃管置入术/WeiGuanJianCe_SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/胃管置入术/WeiGuanJianCe_SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9693bcd15aab72548b7f6d59cac303f0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
25
Assets/SenSorSystem/胃管置入术/WeiGuanZhiRu_SenSor.cs
Normal file
25
Assets/SenSorSystem/胃管置入术/WeiGuanZhiRu_SenSor.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class WeiGuanZhiRu_SenSor : Sensor
|
||||||
|
{
|
||||||
|
[HideInInspector]
|
||||||
|
public int deep_Num;
|
||||||
|
|
||||||
|
public Text txt;
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
if (!datas.Contains("WBJC")) return;
|
||||||
|
|
||||||
|
deep_Num = int.Parse(datas.Split('%')[0].Split("Deep:")[1].Split("mm")[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
txt.text = $"θ¹ÜµÄ²åÈëÉî¶ÈΪ£º{deep_Num}";
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/胃管置入术/WeiGuanZhiRu_SenSor.cs.meta
Normal file
11
Assets/SenSorSystem/胃管置入术/WeiGuanZhiRu_SenSor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8b3e3bbbc6ae43844becc0b5343b3cbf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
68
Assets/SenSorSystem/胃管置入术/WeiGuan_Sensor.cs
Normal file
68
Assets/SenSorSystem/胃管置入术/WeiGuan_Sensor.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class WeiGuan_Sensor : Sensor
|
||||||
|
{
|
||||||
|
|
||||||
|
public Text txt;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否插到了鼻孔
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isBiKong;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否插到了喉咙
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isHouLong;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否插到了胃部
|
||||||
|
/// </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($"胃管插入:{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 = $"胃管插到:鼻腔:{isBiKong},喉咙:{isHouLong},胃部:{isWeiBu}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SenSorSystem/胃管置入术/WeiGuan_Sensor.cs.meta
Normal file
11
Assets/SenSorSystem/胃管置入术/WeiGuan_Sensor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e11823940990814082ae9983cd3aadf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule.meta
Normal file
8
Assets/SensorModule.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8ef9423fcd07d734ca7c165fbc0705b1
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule/Scenes.meta
Normal file
8
Assets/SensorModule/Scenes.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eeb02cf842adb2640967e1fedd67f10a
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
646
Assets/SensorModule/Scenes/SampleScene.unity
Normal file
646
Assets/SensorModule/Scenes/SampleScene.unity
Normal file
@ -0,0 +1,646 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!29 &1
|
||||||
|
OcclusionCullingSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_OcclusionBakeSettings:
|
||||||
|
smallestOccluder: 5
|
||||||
|
smallestHole: 0.25
|
||||||
|
backfaceThreshold: 100
|
||||||
|
m_SceneGUID: 00000000000000000000000000000000
|
||||||
|
m_OcclusionCullingData: {fileID: 0}
|
||||||
|
--- !u!104 &2
|
||||||
|
RenderSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 9
|
||||||
|
m_Fog: 0
|
||||||
|
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||||
|
m_FogMode: 3
|
||||||
|
m_FogDensity: 0.01
|
||||||
|
m_LinearFogStart: 0
|
||||||
|
m_LinearFogEnd: 300
|
||||||
|
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||||
|
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||||
|
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||||
|
m_AmbientIntensity: 1
|
||||||
|
m_AmbientMode: 0
|
||||||
|
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||||
|
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
m_HaloStrength: 0.5
|
||||||
|
m_FlareStrength: 1
|
||||||
|
m_FlareFadeSpeed: 3
|
||||||
|
m_HaloTexture: {fileID: 0}
|
||||||
|
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_DefaultReflectionMode: 0
|
||||||
|
m_DefaultReflectionResolution: 128
|
||||||
|
m_ReflectionBounces: 1
|
||||||
|
m_ReflectionIntensity: 1
|
||||||
|
m_CustomReflection: {fileID: 0}
|
||||||
|
m_Sun: {fileID: 0}
|
||||||
|
m_IndirectSpecularColor: {r: 0.12731749, g: 0.13414757, b: 0.1210787, a: 1}
|
||||||
|
m_UseRadianceAmbientProbe: 0
|
||||||
|
--- !u!157 &3
|
||||||
|
LightmapSettings:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 12
|
||||||
|
m_GIWorkflowMode: 1
|
||||||
|
m_GISettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_BounceScale: 1
|
||||||
|
m_IndirectOutputScale: 1
|
||||||
|
m_AlbedoBoost: 1
|
||||||
|
m_EnvironmentLightingMode: 0
|
||||||
|
m_EnableBakedLightmaps: 1
|
||||||
|
m_EnableRealtimeLightmaps: 0
|
||||||
|
m_LightmapEditorSettings:
|
||||||
|
serializedVersion: 12
|
||||||
|
m_Resolution: 2
|
||||||
|
m_BakeResolution: 40
|
||||||
|
m_AtlasSize: 1024
|
||||||
|
m_AO: 0
|
||||||
|
m_AOMaxDistance: 1
|
||||||
|
m_CompAOExponent: 1
|
||||||
|
m_CompAOExponentDirect: 0
|
||||||
|
m_ExtractAmbientOcclusion: 0
|
||||||
|
m_Padding: 2
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_LightmapsBakeMode: 1
|
||||||
|
m_TextureCompression: 1
|
||||||
|
m_FinalGather: 0
|
||||||
|
m_FinalGatherFiltering: 1
|
||||||
|
m_FinalGatherRayCount: 256
|
||||||
|
m_ReflectionCompression: 2
|
||||||
|
m_MixedBakeMode: 2
|
||||||
|
m_BakeBackend: 1
|
||||||
|
m_PVRSampling: 1
|
||||||
|
m_PVRDirectSampleCount: 32
|
||||||
|
m_PVRSampleCount: 512
|
||||||
|
m_PVRBounces: 2
|
||||||
|
m_PVREnvironmentSampleCount: 256
|
||||||
|
m_PVREnvironmentReferencePointCount: 2048
|
||||||
|
m_PVRFilteringMode: 1
|
||||||
|
m_PVRDenoiserTypeDirect: 1
|
||||||
|
m_PVRDenoiserTypeIndirect: 1
|
||||||
|
m_PVRDenoiserTypeAO: 1
|
||||||
|
m_PVRFilterTypeDirect: 0
|
||||||
|
m_PVRFilterTypeIndirect: 0
|
||||||
|
m_PVRFilterTypeAO: 0
|
||||||
|
m_PVREnvironmentMIS: 1
|
||||||
|
m_PVRCulling: 1
|
||||||
|
m_PVRFilteringGaussRadiusDirect: 1
|
||||||
|
m_PVRFilteringGaussRadiusIndirect: 5
|
||||||
|
m_PVRFilteringGaussRadiusAO: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||||
|
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||||
|
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||||
|
m_ExportTrainingData: 0
|
||||||
|
m_TrainingDataDestination: TrainingData
|
||||||
|
m_LightProbeSampleCountMultiplier: 4
|
||||||
|
m_LightingDataAsset: {fileID: 0}
|
||||||
|
m_LightingSettings: {fileID: 0}
|
||||||
|
--- !u!196 &4
|
||||||
|
NavMeshSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_BuildSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
agentTypeID: 0
|
||||||
|
agentRadius: 0.5
|
||||||
|
agentHeight: 2
|
||||||
|
agentSlope: 45
|
||||||
|
agentClimb: 0.4
|
||||||
|
ledgeDropHeight: 0
|
||||||
|
maxJumpAcrossDistance: 0
|
||||||
|
minRegionArea: 2
|
||||||
|
manualCellSize: 0
|
||||||
|
cellSize: 0.16666667
|
||||||
|
manualTileSize: 0
|
||||||
|
tileSize: 256
|
||||||
|
accuratePlacement: 0
|
||||||
|
maxJobWorkers: 0
|
||||||
|
preserveTilesOutsideBounds: 0
|
||||||
|
debug:
|
||||||
|
m_Flags: 0
|
||||||
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &71307873
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 71307876}
|
||||||
|
- component: {fileID: 71307875}
|
||||||
|
- component: {fileID: 71307874}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: EventSystem
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &71307874
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 71307873}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_SendPointerHoverToParent: 1
|
||||||
|
m_HorizontalAxis: Horizontal
|
||||||
|
m_VerticalAxis: Vertical
|
||||||
|
m_SubmitButton: Submit
|
||||||
|
m_CancelButton: Cancel
|
||||||
|
m_InputActionsPerSecond: 10
|
||||||
|
m_RepeatDelay: 0.5
|
||||||
|
m_ForceModuleActive: 0
|
||||||
|
--- !u!114 &71307875
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 71307873}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_FirstSelected: {fileID: 0}
|
||||||
|
m_sendNavigationEvents: 1
|
||||||
|
m_DragThreshold: 10
|
||||||
|
--- !u!4 &71307876
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 71307873}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1 &330585543
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 330585546}
|
||||||
|
- component: {fileID: 330585545}
|
||||||
|
- component: {fileID: 330585544}
|
||||||
|
- component: {fileID: 330585547}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Main Camera
|
||||||
|
m_TagString: MainCamera
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!81 &330585544
|
||||||
|
AudioListener:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 330585543}
|
||||||
|
m_Enabled: 1
|
||||||
|
--- !u!20 &330585545
|
||||||
|
Camera:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 330585543}
|
||||||
|
m_Enabled: 1
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ClearFlags: 1
|
||||||
|
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
||||||
|
m_projectionMatrixMode: 1
|
||||||
|
m_GateFitMode: 2
|
||||||
|
m_FOVAxisMode: 0
|
||||||
|
m_SensorSize: {x: 36, y: 24}
|
||||||
|
m_LensShift: {x: 0, y: 0}
|
||||||
|
m_FocalLength: 50
|
||||||
|
m_NormalizedViewPortRect:
|
||||||
|
serializedVersion: 2
|
||||||
|
x: 0
|
||||||
|
y: 0
|
||||||
|
width: 1
|
||||||
|
height: 1
|
||||||
|
near clip plane: 0.3
|
||||||
|
far clip plane: 1000
|
||||||
|
field of view: 60
|
||||||
|
orthographic: 0
|
||||||
|
orthographic size: 5
|
||||||
|
m_Depth: -1
|
||||||
|
m_CullingMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RenderingPath: -1
|
||||||
|
m_TargetTexture: {fileID: 0}
|
||||||
|
m_TargetDisplay: 0
|
||||||
|
m_TargetEye: 3
|
||||||
|
m_HDR: 1
|
||||||
|
m_AllowMSAA: 1
|
||||||
|
m_AllowDynamicResolution: 0
|
||||||
|
m_ForceIntoRT: 0
|
||||||
|
m_OcclusionCulling: 1
|
||||||
|
m_StereoConvergence: 10
|
||||||
|
m_StereoSeparation: 0.022
|
||||||
|
--- !u!4 &330585546
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 330585543}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &330585547
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 330585543}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_RenderShadows: 1
|
||||||
|
m_RequiresDepthTextureOption: 2
|
||||||
|
m_RequiresOpaqueTextureOption: 2
|
||||||
|
m_CameraType: 0
|
||||||
|
m_Cameras: []
|
||||||
|
m_RendererIndex: -1
|
||||||
|
m_VolumeLayerMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 1
|
||||||
|
m_VolumeTrigger: {fileID: 0}
|
||||||
|
m_VolumeFrameworkUpdateModeOption: 2
|
||||||
|
m_RenderPostProcessing: 1
|
||||||
|
m_Antialiasing: 0
|
||||||
|
m_AntialiasingQuality: 2
|
||||||
|
m_StopNaN: 0
|
||||||
|
m_Dithering: 0
|
||||||
|
m_ClearDepth: 1
|
||||||
|
m_AllowXRRendering: 1
|
||||||
|
m_RequiresDepthTexture: 0
|
||||||
|
m_RequiresColorTexture: 0
|
||||||
|
m_Version: 2
|
||||||
|
--- !u!1 &330895702 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 2354870448391347380, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 2354870448281023138}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!1 &878783925
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 878783927}
|
||||||
|
- component: {fileID: 878783926}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Prefab Indexer
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &878783926
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 878783925}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 05a7c62fccbafd342991629222351294, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_scenePrefabInstances:
|
||||||
|
- _gameObject: {fileID: 330895702}
|
||||||
|
_prefab: Assets/SensorModule/SensorConsole.prefab
|
||||||
|
--- !u!4 &878783927
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 11
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 878783925}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 3
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1001 &2354870448281023138
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 1538575156, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1538575156, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1538575156, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1538575156, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1538575156, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160554, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160555, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160555, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160555, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160555, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160555, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 1551160555, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2131783165, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2131783165, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2131783165, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2131783165, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2131783165, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348738, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348738, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348738, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348738, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348738, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348738, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447667348797, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447797163002, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447797163002, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447797163002, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447797163002, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447797163002, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447873841641, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447873841641, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447873841641, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447873841641, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870447873841641, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347380, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: SensorConsole
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347381, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347386, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: dataType
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870448391347386, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: portName
|
||||||
|
value: COM3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449063151044, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449063151044, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449063151044, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449063151044, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449063151044, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449216273281, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449216273281, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449216273281, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449216273281, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2354870449216273281, guid: 1a1201bb09fe35a4ba7a1d787be0c122,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 1a1201bb09fe35a4ba7a1d787be0c122, type: 3}
|
||||||
7
Assets/SensorModule/Scenes/SampleScene.unity.meta
Normal file
7
Assets/SensorModule/Scenes/SampleScene.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7aa75609ef342f84288ea7ec5a82a345
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule/Scripts.meta
Normal file
8
Assets/SensorModule/Scripts.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 241b85daacaad9c4ba0c421dd706f7af
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule/Scripts/Common.meta
Normal file
8
Assets/SensorModule/Scripts/Common.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 23cd81b4a2fb0584489fc0f58b41cd58
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
136
Assets/SensorModule/Scripts/Common/CommonTools.cs
Normal file
136
Assets/SensorModule/Scripts/Common/CommonTools.cs
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通用工具
|
||||||
|
/// </summary>
|
||||||
|
public class CommonTools
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取角度
|
||||||
|
/// </summary>.
|
||||||
|
/// <returns></returns>
|
||||||
|
public static float GetDu(string data1, string data2)
|
||||||
|
{
|
||||||
|
float loData = (Convert.ToInt32(data1, 16) << 8 | Convert.ToInt32(data2, 16)) / 100f;
|
||||||
|
if (loData > 360)
|
||||||
|
{
|
||||||
|
loData = 360 - (Convert.ToInt32("0xffff", 16) - (Convert.ToInt32(data1, 16) << 8 | Convert.ToInt32(data2, 16))) / 100f;
|
||||||
|
}
|
||||||
|
return loData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data1"></param>
|
||||||
|
/// <param name="data2"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static float GetShuJu(string data1, string data2)
|
||||||
|
{
|
||||||
|
return Convert.ToInt32(data1, 16) * 256 + Convert.ToInt32(data2, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取角度
|
||||||
|
/// </summary>
|
||||||
|
public static Quaternion GetEuler(float pitch, float yaw, float roll)
|
||||||
|
{
|
||||||
|
Vector3 eulerAngles2 = new(pitch, yaw, roll);
|
||||||
|
return Quaternion.Euler(eulerAngles2);
|
||||||
|
}
|
||||||
|
#region 16进制转换相关
|
||||||
|
/// <summary>
|
||||||
|
/// 字节数组转16进制字符串
|
||||||
|
/// </summary>
|
||||||
|
public static string byteToHexStr(byte[] bytes)
|
||||||
|
{
|
||||||
|
string returnStr = "";
|
||||||
|
if (bytes != null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < bytes.Length; i++)
|
||||||
|
{
|
||||||
|
returnStr += bytes[i].ToString("X2");
|
||||||
|
returnStr += "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnStr;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转16进制
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">要转格式的字符串</param>
|
||||||
|
/// <returns>转化为16进制的字符串</returns>
|
||||||
|
private static string ToSixteen(string input)
|
||||||
|
{
|
||||||
|
char[] values = input.ToCharArray();
|
||||||
|
string end = string.Empty;
|
||||||
|
foreach (char letter in values)
|
||||||
|
{
|
||||||
|
int value = Convert.ToInt32(letter);
|
||||||
|
string hexoutput = string.Format("{0:X}", value); //0 表示占位符 x或X表示十六进制
|
||||||
|
end += hexoutput + "_";
|
||||||
|
}
|
||||||
|
end = end.Remove(end.Length - 1);
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 16进制转回字符串
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">16进制</param>
|
||||||
|
/// <returns>转回的字符串</returns>
|
||||||
|
private static string ToMyString(string input)
|
||||||
|
{
|
||||||
|
string[] hexvaluesplit = input.Split('_');
|
||||||
|
string end = string.Empty;
|
||||||
|
foreach (string hex in hexvaluesplit)
|
||||||
|
{
|
||||||
|
int value = Convert.ToInt32(hex, 16);
|
||||||
|
string stringvalue = char.ConvertFromUtf32(value);
|
||||||
|
char charValue = (char)value;
|
||||||
|
end += charValue;
|
||||||
|
}
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转字节流
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hexStr"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static byte[] HexStringToBytes(string hexStr)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(hexStr))
|
||||||
|
{
|
||||||
|
return new byte[0];
|
||||||
|
}
|
||||||
|
if (hexStr.StartsWith("0x"))
|
||||||
|
{
|
||||||
|
hexStr = hexStr.Remove(0, 2);
|
||||||
|
}
|
||||||
|
var count = hexStr.Length;
|
||||||
|
var byteCount = count / 2;
|
||||||
|
var result = new byte[byteCount];
|
||||||
|
for (int ii = 0; ii < byteCount; ++ii)
|
||||||
|
{
|
||||||
|
var tempBytes = Byte.Parse(hexStr.Substring(2 * ii, 2), System.Globalization.NumberStyles.HexNumber);
|
||||||
|
result[ii] = tempBytes;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 字符串转字节流 -- 推荐用法
|
||||||
|
/// </summary>
|
||||||
|
public static byte[] Convert16(string strText)
|
||||||
|
{
|
||||||
|
strText = strText.Replace(" ", "");
|
||||||
|
byte[] bText = new byte[strText.Length / 2];
|
||||||
|
for (int i = 0; i < strText.Length / 2; i++)
|
||||||
|
{
|
||||||
|
bText[i] = Convert.ToByte(Convert.ToInt32(strText.Substring(i * 2, 2), 16));
|
||||||
|
}
|
||||||
|
return bText;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
11
Assets/SensorModule/Scripts/Common/CommonTools.cs.meta
Normal file
11
Assets/SensorModule/Scripts/Common/CommonTools.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d0ec13398055c23489b7a6ecb8f465d2
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule/Scripts/Sensor.meta
Normal file
8
Assets/SensorModule/Scripts/Sensor.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5a6238098e030c84fad1cc5546bd27db
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
17
Assets/SensorModule/Scripts/Sensor/AngleSensor.cs
Normal file
17
Assets/SensorModule/Scripts/Sensor/AngleSensor.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class AngleSensor : Sensor
|
||||||
|
{
|
||||||
|
public Text x;
|
||||||
|
public Text y;
|
||||||
|
public Text z;
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
Debug.Log(datas);
|
||||||
|
}
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SensorModule/Scripts/Sensor/AngleSensor.cs.meta
Normal file
11
Assets/SensorModule/Scripts/Sensor/AngleSensor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 13c6e4cb294236a48bfa83317ee7a51c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule/Scripts/Sensor/Base.meta
Normal file
8
Assets/SensorModule/Scripts/Sensor/Base.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2eccb318e4dfaf5449eff90d3387cb45
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
28
Assets/SensorModule/Scripts/Sensor/Base/Sensor.cs
Normal file
28
Assets/SensorModule/Scripts/Sensor/Base/Sensor.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
/// <summary>
|
||||||
|
/// ´«¸ÐÆ÷»ùÀà
|
||||||
|
/// </summary>
|
||||||
|
public abstract class Sensor : MonoBehaviour
|
||||||
|
{
|
||||||
|
SensorManager sensorManager;
|
||||||
|
public void Init(SensorManager sm)
|
||||||
|
{
|
||||||
|
sensorManager = sm;
|
||||||
|
}
|
||||||
|
public void SendData(string data)
|
||||||
|
{
|
||||||
|
sensorManager.SendFunction(data);
|
||||||
|
}
|
||||||
|
public virtual void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
if (!gameObject.activeSelf) return;
|
||||||
|
Display(datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Display(string datas)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SensorModule/Scripts/Sensor/Base/Sensor.cs.meta
Normal file
11
Assets/SensorModule/Scripts/Sensor/Base/Sensor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1241e5cf7985ea145a27ee4429841c9c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
32
Assets/SensorModule/Scripts/Sensor/DYKGSensor.cs
Normal file
32
Assets/SensorModule/Scripts/Sensor/DYKGSensor.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DYKGSensor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// µçÔ´ÊÇ·ñ¿ªÆô
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isOpen;
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
|
||||||
|
//if (!datas.Split(',')[0].Split(':')[1].Equals(" XWJ")) return;
|
||||||
|
this.Log(datas);
|
||||||
|
if (datas.Contains("CONNECTED 1") || !string.IsNullOrEmpty(datas))
|
||||||
|
{
|
||||||
|
isOpen = true;
|
||||||
|
}
|
||||||
|
if (datas.Contains("DISCONNECTED"))
|
||||||
|
{
|
||||||
|
isOpen = false;
|
||||||
|
}
|
||||||
|
//isOpen = (!string.IsNullOrEmpty(datas));
|
||||||
|
}
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
//pressText.text = press;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SensorModule/Scripts/Sensor/DYKGSensor.cs.meta
Normal file
11
Assets/SensorModule/Scripts/Sensor/DYKGSensor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0b457dfe735ee534d800c5050702f685
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
52
Assets/SensorModule/Scripts/Sensor/PipeSensor.cs
Normal file
52
Assets/SensorModule/Scripts/Sensor/PipeSensor.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 洗胃机接入三个管道
|
||||||
|
/// </summary>
|
||||||
|
public class PipeSensor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 接胃管是否链接
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isJieWei;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排污管是否链接
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isPaiWu;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 进液管是否链接
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public bool isJinYe;
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
//if (!datas.Split(',')[0].Split(':')[1].Equals(" XWJ")) return;
|
||||||
|
if (datas.Contains("Channl"))
|
||||||
|
{
|
||||||
|
if (datas.Split(',')[8].Split(':')[1].Equals("1"))
|
||||||
|
{
|
||||||
|
isPaiWu = true;
|
||||||
|
}
|
||||||
|
else if (datas.Split(',')[8].Split(':')[1].Equals("2"))
|
||||||
|
{
|
||||||
|
isJieWei = true;
|
||||||
|
}
|
||||||
|
else if (datas.Split(',')[8].Split(':')[1].Equals("3"))
|
||||||
|
{
|
||||||
|
isJinYe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/SensorModule/Scripts/Sensor/PipeSensor.cs.meta
Normal file
11
Assets/SensorModule/Scripts/Sensor/PipeSensor.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bc56e723d7a82e548b9d67a825c4132c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/SensorModule/Scripts/Sensor/导尿术_狗.meta
Normal file
8
Assets/SensorModule/Scripts/Sensor/导尿术_狗.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: dcb2d505986238e4d972a75539abb577
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
31
Assets/SensorModule/Scripts/Sensor/导尿术_狗/DaoNiao_Sensor.cs
Normal file
31
Assets/SensorModule/Scripts/Sensor/导尿术_狗/DaoNiao_Sensor.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class DaoNiao_Sensor : Sensor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 导尿管插入深度
|
||||||
|
/// </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public float daoNiaoDeep;
|
||||||
|
string data;
|
||||||
|
public Text txt;
|
||||||
|
public override void ReceiveData(string datas)
|
||||||
|
{
|
||||||
|
base.ReceiveData(datas);
|
||||||
|
data = datas.Split("#")[1].Split("%")[0];
|
||||||
|
if (!data.Contains("DWYX2")) return;
|
||||||
|
if (data.Contains("DNDeep"))
|
||||||
|
{
|
||||||
|
daoNiaoDeep = float.Parse(data.Split(",")[3].Split(":")[1].Split("mm")[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Display(string datas)
|
||||||
|
{
|
||||||
|
base.Display(datas);
|
||||||
|
txt.text = $"导尿管插入深度:{daoNiaoDeep}mm";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b7dbd95d45afec74c972e04b25b4cd74
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
213
Assets/SensorModule/Scripts/SensorManager.cs
Normal file
213
Assets/SensorModule/Scripts/SensorManager.cs
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SqlTypes;
|
||||||
|
using System.IO.Ports;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
//using UnityEditor.PackageManager.UI;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityThreadingUtils;
|
||||||
|
using ZXKFramework;
|
||||||
|
|
||||||
|
public class SensorManager : MonoBehaviour /*MonoSingleton<SensorManager>*/
|
||||||
|
{
|
||||||
|
public enum DataType
|
||||||
|
{
|
||||||
|
字符串,
|
||||||
|
字节流,
|
||||||
|
}
|
||||||
|
#region 串口参数,主要修改串口名与波特率
|
||||||
|
[Header("串口名")]
|
||||||
|
public string portName = "COM10";
|
||||||
|
[Header("波特率")]
|
||||||
|
public int baudRate = 115200;
|
||||||
|
[Header("奇偶校验")]
|
||||||
|
private Parity parity = Parity.None;
|
||||||
|
[Header("数据位")]
|
||||||
|
private int dataBits = 8;
|
||||||
|
[Header("停止位")]
|
||||||
|
private StopBits stopBits = StopBits.One;
|
||||||
|
SerialPort sp = null;
|
||||||
|
Thread dataReceiveThread;
|
||||||
|
[Header("接收数据格式")]
|
||||||
|
public DataType dataType;
|
||||||
|
#endregion
|
||||||
|
private Dictionary<string, Sensor> allSensor = new Dictionary<string, Sensor>();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
sp = new SerialPort(portName, baudRate, parity, dataBits, stopBits);
|
||||||
|
foreach (Sensor s in GetComponentsInChildren<Sensor>())
|
||||||
|
{
|
||||||
|
allSensor.TryAdd(s.GetType().Name, s);
|
||||||
|
}
|
||||||
|
switch (dataType)
|
||||||
|
{
|
||||||
|
case DataType.字节流:
|
||||||
|
dataReceiveThread = new Thread(new ThreadStart(DataReceiveBytesThread));
|
||||||
|
break;
|
||||||
|
case DataType.字符串:
|
||||||
|
dataReceiveThread = new Thread(new ThreadStart(DataReceiveStrThread));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
OpenPort();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 接收字节流
|
||||||
|
/// </summary>
|
||||||
|
private void DataReceiveBytesThread()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (sp != null && sp.IsOpen)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (sp.BytesToRead > 0)
|
||||||
|
{
|
||||||
|
byte[] buffer = new byte[sp.BytesToRead];
|
||||||
|
sp.Read(buffer, 0, sp.BytesToRead);
|
||||||
|
string receivedData = Encoding.Default.GetString(buffer);
|
||||||
|
//Debug.Log(receivedData);
|
||||||
|
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
||||||
|
{
|
||||||
|
foreach (var s in allSensor)
|
||||||
|
{
|
||||||
|
s.Value.ReceiveData(receivedData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Log("消息接收失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Thread.Sleep(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收字符串
|
||||||
|
/// </summary>
|
||||||
|
private void DataReceiveStrThread()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (sp != null && sp.IsOpen)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (sp.BytesToRead > 0)
|
||||||
|
{
|
||||||
|
sb.Append(sp.ReadExisting());
|
||||||
|
//this.ColorLog(GDLog.LogColorState.Blue, sp.ReadLine());
|
||||||
|
UnityMainThreadDispatcher.Instance().Enqueue(() =>
|
||||||
|
{
|
||||||
|
foreach (var s in allSensor)
|
||||||
|
{
|
||||||
|
s.Value.ReceiveData(sb.ToString());
|
||||||
|
}
|
||||||
|
sb.Clear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Log("消息接收失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Thread.Sleep(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 发送消息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataSend"></param>
|
||||||
|
public void SendFunction(string str)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] dataSend = Encoding.ASCII.GetBytes(str);
|
||||||
|
if (sp != null && sp.IsOpen)
|
||||||
|
{
|
||||||
|
if (dataSend != null && dataSend.Length > 0)
|
||||||
|
{
|
||||||
|
sp.Write(dataSend, 0, dataSend.Length);
|
||||||
|
Debug.Log("发送消息成功:" + str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Log("发送消息失败:" + str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//获取指定传感器
|
||||||
|
public T GetSensor<T>() where T : Sensor
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string name = typeof(T).Name;
|
||||||
|
if (!allSensor.ContainsKey(name))
|
||||||
|
{
|
||||||
|
allSensor.TryAdd(name, GetComponentInChildren<T>());
|
||||||
|
allSensor[name].Init(this);
|
||||||
|
}
|
||||||
|
//Debug.Log("传感器获取成功");
|
||||||
|
return allSensor[name] as T;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Log("传感器获取失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#region 串口开启关闭相关
|
||||||
|
//打开串口
|
||||||
|
public void OpenPort()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!sp.IsOpen)
|
||||||
|
{
|
||||||
|
sp.Open();
|
||||||
|
dataReceiveThread.Start();
|
||||||
|
Debug.Log("串口打开成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Log("串口打开失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//关闭串口
|
||||||
|
public void ClosePort()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sp.Close();
|
||||||
|
dataReceiveThread.Abort();
|
||||||
|
Debug.Log("串口关闭");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Log("串口关闭失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Unity 退出相关
|
||||||
|
private void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
ClosePort();
|
||||||
|
}
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
this.Log("为什么关闭了:" + gameObject.name);
|
||||||
|
ClosePort();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
11
Assets/SensorModule/Scripts/SensorManager.cs.meta
Normal file
11
Assets/SensorModule/Scripts/SensorManager.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6c58763dd2491d94c882310d382a6dfc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2387
Assets/SensorModule/SensorConsole.prefab
Normal file
2387
Assets/SensorModule/SensorConsole.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/SensorModule/SensorConsole.prefab.meta
Normal file
7
Assets/SensorModule/SensorConsole.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1a1201bb09fe35a4ba7a1d787be0c122
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -19,7 +19,7 @@ namespace UnityThreadingUtils
|
|||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
// 让这个游戏对象在场景切换时不被销毁,确保持续可用
|
// 让这个游戏对象在场景切换时不被销毁,确保持续可用
|
||||||
DontDestroyOnLoad(gameObject);
|
//DontDestroyOnLoad(gameObject);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ namespace UnityThreadingUtils
|
|||||||
GameObject dispatcherGameObject = new GameObject("UnityMainThreadDispatcher");
|
GameObject dispatcherGameObject = new GameObject("UnityMainThreadDispatcher");
|
||||||
_instance = dispatcherGameObject.AddComponent<UnityMainThreadDispatcher>();
|
_instance = dispatcherGameObject.AddComponent<UnityMainThreadDispatcher>();
|
||||||
// 让这个游戏对象在场景切换时不被销毁,确保持续可用
|
// 让这个游戏对象在场景切换时不被销毁,确保持续可用
|
||||||
UnityEngine.Object.DontDestroyOnLoad(dispatcherGameObject);
|
//UnityEngine.Object.DontDestroyOnLoad(dispatcherGameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -29,14 +29,21 @@ namespace DongWuYiXue.DaoNiaoShu
|
|||||||
public override void OnStateStay()
|
public override void OnStateStay()
|
||||||
{
|
{
|
||||||
base.OnStateStay();
|
base.OnStateStay();
|
||||||
if (isChaGuan)
|
//if (isChaGuan)
|
||||||
|
//{
|
||||||
|
// chaGuanValue += .0005f;
|
||||||
|
// fsm.PlayClip("²å¹Ü_TimeLine", null, chaGuanValue);
|
||||||
|
// avProValue.PlayValue = chaGuanValue;
|
||||||
|
// avProValue.PlayVideoAsValue();
|
||||||
|
//}
|
||||||
|
if (isChaGuan && Input.GetKeyDown(KeyCode.L))
|
||||||
{
|
{
|
||||||
chaGuanValue += .0005f;
|
chaGuanValue = 1.0f;
|
||||||
fsm.PlayClip("²å¹Ü_TimeLine", null, chaGuanValue);
|
fsm.PlayClip("²å¹Ü_TimeLine", null, chaGuanValue);
|
||||||
avProValue.PlayValue = chaGuanValue;
|
avProValue.PlayValue = chaGuanValue;
|
||||||
avProValue.PlayVideoAsValue();
|
avProValue.PlayVideoAsValue();
|
||||||
}
|
}
|
||||||
if (isChaGuan && Input.GetKeyDown(KeyCode.L))
|
if (isChaGuan && GameManager.Instance.senSor.GetSensor<DaoNiao_Sensor>().daoNiaoDeep > 45f)
|
||||||
{
|
{
|
||||||
chaGuanValue = 1.0f;
|
chaGuanValue = 1.0f;
|
||||||
fsm.PlayClip("²å¹Ü_TimeLine", null, chaGuanValue);
|
fsm.PlayClip("²å¹Ü_TimeLine", null, chaGuanValue);
|
||||||
@ -65,7 +72,7 @@ namespace DongWuYiXue.DaoNiaoShu
|
|||||||
}
|
}
|
||||||
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
||||||
{
|
{
|
||||||
fsm.ShowTxtQuestion("²åÈëµ¼Äò¹Ü¡·²å¹Ü¡·²½Öè2",3, 5, 3, () =>
|
fsm.ShowTxtQuestion("²åÈëµ¼Äò¹Ü¡·²å¹Ü¡·²½Öè2", 3, 5, 3, () =>
|
||||||
{
|
{
|
||||||
fsm.nextState = true;
|
fsm.nextState = true;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -50,14 +50,14 @@ namespace DongWuYiXue.DaoNiaoShu
|
|||||||
public override void OnStateStay()
|
public override void OnStateStay()
|
||||||
{
|
{
|
||||||
base.OnStateStay();
|
base.OnStateStay();
|
||||||
if (isTui)
|
//if (isTui)
|
||||||
{
|
//{
|
||||||
tuiValue += .0005f;
|
// tuiValue += .0005f;
|
||||||
fsm.PlayClip("冲洗包皮腔_TimeLine", null, tuiValue);
|
// fsm.PlayClip("녑求관튄퓨_TimeLine", null, tuiValue);
|
||||||
//ZhuSheQi.length += .0005f;
|
// //ZhuSheQi.length += .0005f;
|
||||||
//ZhuSheQi.animName = "注射器打入";
|
// //ZhuSheQi.animName = "鬧<>포댔흙";
|
||||||
//ZhuSheQi.Move();
|
// //ZhuSheQi.Move();
|
||||||
}
|
//}
|
||||||
if (isTui && Input.GetKeyDown(KeyCode.L))
|
if (isTui && Input.GetKeyDown(KeyCode.L))
|
||||||
{
|
{
|
||||||
//ZhuSheQi.length = 1.0f;
|
//ZhuSheQi.length = 1.0f;
|
||||||
@ -65,8 +65,23 @@ namespace DongWuYiXue.DaoNiaoShu
|
|||||||
//ZhuSheQi.Move();
|
//ZhuSheQi.Move();
|
||||||
tuiValue = 1.0f;
|
tuiValue = 1.0f;
|
||||||
fsm.PlayClip("³åÏ´°üƤǻ_TimeLine", null, tuiValue);
|
fsm.PlayClip("³åÏ´°üƤǻ_TimeLine", null, tuiValue);
|
||||||
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
||||||
|
{
|
||||||
|
fsm.AddScore(5, 1);
|
||||||
|
}
|
||||||
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
||||||
|
{
|
||||||
|
fsm.AddScore(5, 1);
|
||||||
|
}
|
||||||
|
isTui = false;
|
||||||
|
fsm.nextState = true;
|
||||||
}
|
}
|
||||||
if (tuiValue >= 1.0f)
|
if (isTui && GameManager.Instance.senSor.GetSensor<ZhuSheQi_20SenSor>().isOpen)
|
||||||
|
{
|
||||||
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_20SenSor>().progressValue;
|
||||||
|
fsm.PlayClip("녑求관튄퓨_TimeLine", null, 1.0f - tuiValue);
|
||||||
|
}
|
||||||
|
if (tuiValue == 0f && GameManager.Instance.senSor.GetSensor<ZhuSheQi_20SenSor>().isOpen && isTui)
|
||||||
{
|
{
|
||||||
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,6 +6,11 @@ namespace DongWuYiXue.DaoNiaoShu
|
|||||||
{
|
{
|
||||||
public class GameManager : MonoSingleton<GameManager>
|
public class GameManager : MonoSingleton<GameManager>
|
||||||
{
|
{
|
||||||
|
bool isActive = false;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
GameObject yingJianCanvas;
|
||||||
|
public SensorManager senSor;
|
||||||
//½»»¥Ä£¿é
|
//½»»¥Ä£¿é
|
||||||
[HideInInspector]
|
[HideInInspector]
|
||||||
public InteractionManager interactionManager;
|
public InteractionManager interactionManager;
|
||||||
@ -89,6 +94,22 @@ namespace DongWuYiXue.DaoNiaoShu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(KeyCode.Escape))
|
||||||
|
{
|
||||||
|
isActive = !isActive;
|
||||||
|
if (isActive)
|
||||||
|
{
|
||||||
|
yingJianCanvas.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yingJianCanvas.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void PlaySound(PlaySoundEvent e)
|
private void PlaySound(PlaySoundEvent e)
|
||||||
{
|
{
|
||||||
Game.Instance.sound.PlayBGM(e.path, false, clip => {
|
Game.Instance.sound.PlayBGM(e.path, false, clip => {
|
||||||
|
|||||||
@ -818,7 +818,8 @@ PlayerSettings:
|
|||||||
gcIncremental: 0
|
gcIncremental: 0
|
||||||
assemblyVersionValidation: 1
|
assemblyVersionValidation: 1
|
||||||
gcWBarrierValidation: 0
|
gcWBarrierValidation: 0
|
||||||
apiCompatibilityLevelPerPlatform: {}
|
apiCompatibilityLevelPerPlatform:
|
||||||
|
Standalone: 3
|
||||||
m_RenderingPath: 1
|
m_RenderingPath: 1
|
||||||
m_MobileRenderingPath: 1
|
m_MobileRenderingPath: 1
|
||||||
metroPackageName: com.unity.template-starter-kit
|
metroPackageName: com.unity.template-starter-kit
|
||||||
|
|||||||
@ -5,3 +5,10 @@ E0925 09:32:11.709 15412:Res_mgr::Res_delete | res still been used, refCount = 1
|
|||||||
E0925 09:32:11.710 15412:Error: ret= 60010
|
E0925 09:32:11.710 15412:Error: ret= 60010
|
||||||
E0925 09:32:11.710 15412:IvwInterfaceImp::wIvwResourceDelete | ResType = IVW_KEYWORD, ResID = 119, ret = 60010
|
E0925 09:32:11.710 15412:IvwInterfaceImp::wIvwResourceDelete | ResType = IVW_KEYWORD, ResID = 119, ret = 60010
|
||||||
E0925 09:32:11.710 15412:Error: ret= 60010
|
E0925 09:32:11.710 15412:Error: ret= 60010
|
||||||
|
Log file created at: 2025/11/25 15:23:37
|
||||||
|
Running on machine: ADMIN
|
||||||
|
Log line format: [IWEF]mmdd hh:mm:ss.mmm threadid: msg
|
||||||
|
E1125 15:23:37.581 35828:Res_mgr::Res_delete | res still been used, refCount = 1 resId = 119 resType = IVW_KEYWORD
|
||||||
|
E1125 15:23:37.622 35828:Error: ret= 60010
|
||||||
|
E1125 15:23:37.622 35828:IvwInterfaceImp::wIvwResourceDelete | ResType = IVW_KEYWORD, ResID = 119, ret = 60010
|
||||||
|
E1125 15:23:37.622 35828:Error: ret= 60010
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user