Esempio n. 1
0
        public async Task <string> DisplayQueuedDialog(Dialog_Base dialogPrefab, IList <string> variableOptions, IList <string> variableOptionLabels = null)
        {
            if (dialogPrefab == null)
            {
                Debug.LogError("Attempting to display null dialog - attempt will be ignored.");
                return(null);
            }

            if (dialogQueue.Count == 0)
            {
                UIBlocking.Instance.Block();
                gameObject.SetActive(true);
            }

            var queuedDialog = new QueuedDialog(dialogPrefab, variableOptions, variableOptionLabels);

            dialogQueue.Add(queuedDialog);

            while (dialogQueue[0] != queuedDialog)
            {
                await Task.Yield();
            }

            var result = await queuedDialog.Display(parent : transform);

            dialogQueue.Remove(queuedDialog);

            if (dialogQueue.Count == 0)
            {
                gameObject.SetActive(false);
                UIBlocking.Instance.Unblock();
            }

            return(result);
        }
 public static Task<IUICommand> OpenMessageDialogQueued(this MessageDialog dialog)
 {
     var queuedDialog = new QueuedDialog(dialog);
     _dialogs.Enqueue(queuedDialog);
     if (!handlingDialog)
     {
         ShowNextDialog();
     }
     return queuedDialog.CompletionSource.Task;
 }