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()); }
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); }
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); }
public void Update() { if (Input.GetKeyUp(KeyCode.Escape)) // back button pressed { var c = GetComponentInParent <Canvas>()?.rootCanvas; if (c != null && c == RootCanvas.GetAllRootCanvases().First()) { gameObject.GetComponentInParent <ViewStack>()?.SwitchBackToLastView(gameObject, destroyFinalView); } } }
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); }
public static ViewStack MainViewStack() { return(RootCanvas.GetOrAddRootCanvasV2().GetOrAddViewStack("Canvas/MainViewStack")); }
private void OnEnable() { RootCanvas.InitEventSystemIfNeeded(); }