示例#1
0
        private static Task Show(string caption, string message, string confirmText, string dialogPrefabName)
        {
            var        dialog     = new DialogLoader <Dialog>(new Dialog(caption, message, confirmText));
            var        rootCanvas = RootCanvas.GetOrAddRootCanvasV2().gameObject;
            GameObject dialogUi   = dialog.LoadDialogPrefab(new DefaultPresenter(), dialogPrefabName);

            rootCanvas.AddChild(dialogUi); // Add dialog UI in the root canvas
            var d = dialog.ShowDialogAsync();

            EventBus.instance.Publish(EventConsts.catUi + UiEvents.DIALOG, dialog);
            return(d);
        }
示例#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));
            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);
        }
示例#3
0
 public static ViewStack MainViewStack()
 {
     return(RootCanvas.GetOrAddRootCanvasV2().GetOrAddViewStack("Canvas/MainViewStack"));
 }