Exemple #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);
        }
Exemple #2
0
 public QueuedDialog(Dialog_Base dialogPrefab, IList <string> variableOptions, IList <string> variableOptionLabels)
 {
     DialogPrefab         = dialogPrefab;
     VariableOptions      = variableOptions;
     VariableOptionLabels = variableOptionLabels;
 }