using AdamSync; using System.Collections; using System.Collections.Generic; using UnityEngine; public class DeviceManager : MonoSingleton { /// /// 所有设备 /// public List devices = new List(); // 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[1]); if (equipmentCommon) { equipmentCommon.ReceivingPositionAngle(info); } } public void OnDisalbe() { SyncCreateRoom.send2roomRequset -= GetSend2roomMsg; } }