private void AddButton(InvokerAction buttonEvent) { GameObject newButton = Instantiate <GameObject>(_invokerButtonPrefab); if (newButton != null) { newButton.transform.parent = _buttonParent.transform; InvokerButton invokerButton = newButton.GetComponent <InvokerButton>(); if (invokerButton != null) { invokerButton.OnClick = buttonEvent.OnButtonClick; invokerButton.Label = buttonEvent.ButtonLabel; } } }
protected void TaskProc() { while (!CancelSource.IsCancellationRequested) { MsgSem.WaitOne(); if (CancelSource.IsCancellationRequested) { break; } T value = default(T); if (MsgQueue.TryDequeue(out value)) { InvokerAction?.Invoke(value); } } }