private void Initialize(IEnumerable <string> itemNames, string title, string selectButtonName, OnSelectCallback onSelectCB, OnCancelCallback onCancelCB)
        {
            m_txtTitle.text            = title;
            m_txtSelectButtonName.text = selectButtonName;

            m_OnSelectCB = onSelectCB;
            m_OnCancelCB = onCancelCB;

            m_btnSelect.interactable = false;

            // Create list of items in scroll view from itemNames
            foreach (string name in itemNames)
            {
                GameObject item = Instantiate(m_ItemPrefab);
                item.GetComponentInChildren <Text>().text = name;
                item.transform.SetParent(m_ItemContainer);
                item.transform.localScale = Vector3.one;
            }
        }
 protected void OnCancel() => OnCancelCallback.InvokeAsync(null);
        /// <summary>
        /// Creates and presents the selection dialog to the user.
        /// </summary>
        /// <param name="itemNames">The list of string items to present for selection.</param>
        /// <param name="title">The title of the dialog box.</param>
        /// <param name="selectButtonName">The text of the select button.</param>
        /// <param name="onSelectCB">The callback that receives the selected item.</param>
        /// <param name="onCancelCB">The callback for when the user cancels selection.</param>
        public static ListSelectDialog Create(IEnumerable <string> itemNames, string title, string selectButtonName, OnSelectCallback onSelectCB, OnCancelCallback onCancelCB = null)
        {
            GameObject       goDialog = Instantiate(Resources.Load <GameObject>("Dialogs/ListSelectDialog"));
            ListSelectDialog dialog   = goDialog.GetComponent <ListSelectDialog>();

            dialog.Initialize(itemNames, title, selectButtonName, onSelectCB, onCancelCB);

            return(dialog);
        }