Пример #1
0
        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;
                }
            }
        }
Пример #2
0
        protected void TaskProc()
        {
            while (!CancelSource.IsCancellationRequested)
            {
                MsgSem.WaitOne();

                if (CancelSource.IsCancellationRequested)
                {
                    break;
                }

                T value = default(T);
                if (MsgQueue.TryDequeue(out value))
                {
                    InvokerAction?.Invoke(value);
                }
            }
        }