43 lines
1012 B
C#
43 lines
1012 B
C#
using AdamSync;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DeviceManager : MonoSingleton<DeviceManager>
|
|
{
|
|
/// <summary>
|
|
/// 所有设备
|
|
/// </summary>
|
|
public List<EquipmentCommon> devices = new List<EquipmentCommon>();
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
SyncCreateRoom.send2roomRequset += GetSend2roomMsg;
|
|
}
|
|
|
|
|
|
public void AddDevice(EquipmentCommon d)
|
|
{
|
|
if (!devices.Contains(d))
|
|
{
|
|
devices.Add(d);
|
|
}
|
|
}
|
|
|
|
public void GetSend2roomMsg(string data)
|
|
{
|
|
data = data.Replace("send2room", "");
|
|
string[] info = data.Split(',');
|
|
EquipmentCommon equipmentCommon = devices.Find(x => x.deviceID == info[0]);
|
|
if (equipmentCommon)
|
|
{
|
|
equipmentCommon.ReceivingPositionAngle(info);
|
|
}
|
|
}
|
|
|
|
public void OnDisalbe()
|
|
{
|
|
SyncCreateRoom.send2roomRequset -= GetSend2roomMsg;
|
|
}
|
|
}
|