This commit is contained in:
YangHua 2023-11-23 19:53:51 +08:00
commit 3aae7026ec
1 changed files with 40 additions and 5 deletions

View File

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