62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
using UnityEngine;
|
|
/// <summary>
|
|
/// 指令触发
|
|
/// </summary>
|
|
public class InstructionTriggered : MonoBehaviour
|
|
{
|
|
private void Start()
|
|
{
|
|
SoftManage.Instance.SetSoftAction(ReceiveMessage);
|
|
}
|
|
/// <summary>
|
|
/// 二维软件接受消息
|
|
/// </summary>
|
|
/// <param name="data"></param>
|
|
/// <param name="softname"></param>
|
|
private void ReceiveMessage(string data, string softname)
|
|
{
|
|
if (SoftManage.Instance.CanHandle(softname))
|
|
{
|
|
Debug.Log("Recive Msg: " + data);
|
|
Debug.Log("Recive Msg: " + softname);
|
|
if (softname.Equals("车控软件"))
|
|
{
|
|
string[] contents = data.Split('|');
|
|
if (contents.Length > 1)
|
|
{
|
|
|
|
int orderCode = 0;
|
|
int.TryParse(contents[0], out orderCode);
|
|
string orderStateStr = contents[1];
|
|
int orderState = -100;
|
|
int.TryParse(orderStateStr, out orderState);
|
|
if (contents[0] == "停止继续")
|
|
{
|
|
CarPartsDriver.instance.StopMechanism();
|
|
|
|
return;
|
|
}
|
|
CarPartsDriver.instance.DriveMechanism(orderCode, orderState);
|
|
#region
|
|
//if (10000 < orderCode && orderCode <= 10020)
|
|
//{
|
|
//TruckCarBody.instance.ManageMsg(orderCode, orderState);
|
|
// }
|
|
// else if(orderCode== 10025)
|
|
//{
|
|
//TruckCarFaSheTai.instance.ManageMsg(orderCode, orderState);
|
|
//}
|
|
//TruckCarHuoJian.instance.ManageMsg(orderCode, orderState);
|
|
#endregion
|
|
}
|
|
}
|
|
else if (softname.Equals("瞄准系统软件"))
|
|
{
|
|
Debug.Log("Recive Msg:111");
|
|
// rc.ManageMsg(data);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|