Exemple #1
0
        // Token: 0x06015896 RID: 88214 RVA: 0x0057C378 File Offset: 0x0057A578
        public static IEnumerator Show(GameObject parentObj, string prefabPath, string msgText, string okText, string cancelText, Action <DialogBoxResult> onClose)
        {
            GameObject dlgObj = null;

            yield return(ResourceManager.Instance.LoadAsset <GameObject>(prefabPath, delegate(string path, GameObject obj)
            {
                dlgObj = UnityEngine.Object.Instantiate <GameObject>(obj);
            }, false, false));

            dlgObj.transform.SetParent(parentObj.transform, false);
            DialogBox dlg = dlgObj.AddComponent <DialogBox>();

            dlg.Initialize();
            bool            isClose = false;
            DialogBoxResult result  = DialogBoxResult.None;

            dlg.Show(msgText, okText, cancelText, delegate(DialogBoxResult ret)
            {
                isClose = true;
                result  = ret;
            });
            yield return(new WaitUntil(() => isClose));

            dlgObj.transform.SetParent(null);
            UnityEngine.Object.Destroy(dlgObj);
            if (onClose != null)
            {
                onClose(result);
            }
            yield break;
        }