diff --git a/Assets/Zion/Scripts/Adam/DeviceManager.cs b/Assets/Zion/Scripts/Adam/DeviceManager.cs index 3ff32a95..7453c85b 100644 --- a/Assets/Zion/Scripts/Adam/DeviceManager.cs +++ b/Assets/Zion/Scripts/Adam/DeviceManager.cs @@ -9,15 +9,50 @@ public class DeviceManager : MonoSingleton /// 所有设备 /// public List devices = new List(); - // Start is called before the first frame update - void Start() - { - SyncCreateRoom.send2roomRequset += GetSend2roomMsg; - } /// /// 发送消息 /// public Queue send2roomStr = new Queue(); + + private bool _isStartRehearsing = false; + // 属性绑定布尔值,并在值变化时触发事件 + public bool isStartRehearsing + { + get { return _isStartRehearsing; } + set + { + if (_isStartRehearsing != value) + { + _isStartRehearsing = value; + OnActivationChanged?.Invoke(_isStartRehearsing); + } + } + } + // 布尔值变化时触发的事件 + public event System.Action OnActivationChanged; + + + // Start is called before the first frame update + void Start() + { + SyncCreateRoom.send2roomRequset += GetSend2roomMsg; + + // 订阅布尔值变化事件 + OnActivationChanged += OnActivationChangedHandler; + } + + /// + /// 导条 暂停开始控制 + /// + /// + void OnActivationChangedHandler(bool newValue) + { + devices.ForEach(x => x.isStartRehearsing = newValue); + } + + + + private void Update() { if (send2roomStr.Count > 0)