Exemple #1
0
        private static Task Show(string caption, string message, string dialogPrefabName)
        {
            var        dialog   = new DialogLoader <Dialog>(new Dialog(caption, message));
            GameObject dialogUi = dialog.LoadDialogPrefab(new DefaultPresenter(), dialogPrefabName);

            RootCanvas.GetOrAddRootCanvas().gameObject.AddChild(dialogUi); // Add dialog UI in a canvas
            return(dialog.ShowDialogAsync());
        }
Exemple #2
0
        public static async Task <bool> Show(string caption, string message, string confirmBtnText = null, string dialogPrefabName = "Dialogs/DefaultDialog2")
        {
            var        loader   = new DialogLoader <ConfirmCancelDialog>(new ConfirmCancelDialog(caption, message, confirmBtnText));
            GameObject dialogUi = loader.LoadDialogPrefab(new DefaultPresenter(), dialogPrefabName);

            RootCanvas.GetOrAddRootCanvas().gameObject.AddChild(dialogUi); // Add dialog UI in a canvas
            ConfirmCancelDialog dialog = await loader.ShowDialogAsync();

            return(dialog.dialogWasConfirmed);
        }
Exemple #3
0
        private static Task Show(string caption, string message, string confirmText, string dialogPrefabName)
        {
            var        dialog   = new DialogLoader <Dialog>(new Dialog(caption, message, confirmText));
            GameObject dialogUi = dialog.LoadDialogPrefab(new DefaultPresenter(), dialogPrefabName);

            RootCanvas.GetOrAddRootCanvas().gameObject.AddChild(dialogUi); // Add dialog UI in a canvas
            var d = dialog.ShowDialogAsync();

            EventBus.instance.Publish(EventConsts.catUi + UiEvents.DIALOG, dialog);
            return(d);
        }
Exemple #4
0
        public static async Task <bool> Show(string caption, string message, string confirmBtnText = null, string dialogPrefabName = "Dialogs/DefaultDialog2")
        {
            var        loader     = new DialogLoader <ConfirmCancelDialog>(new ConfirmCancelDialog(caption, message, confirmBtnText));
            var        rootCanvas = RootCanvas.GetOrAddRootCanvasV2().gameObject;
            GameObject dialogUi   = loader.LoadDialogPrefab(new DefaultPresenter(), dialogPrefabName);

            rootCanvas.AddChild(dialogUi); // Add dialog UI in a canvas
            ConfirmCancelDialog dialog = await loader.ShowDialogAsync();

            EventBus.instance.Publish(EventConsts.catUi + UiEvents.CONFIRM_CANCEL_DIALOG, dialog);
            return(dialog.dialogWasConfirmed);
        }