public static void Show(string message) { var details = new ModalDialogDetails { DialogMessage = message, Button1 = new ModalDialogButtonDetails { Title = "OK" } }; Show(details); }
public static void ShowNotification(GameInfo info) { info.GameState = GameStates.Paused; var details = new ModalDialogDetails { DialogMessage = "Next player: " + info.ActivePlayer.Name, Button1 = new ModalDialogButtonDetails { Title = "OK", Handler = () => info.GameState = GameStates.Started } }; ModalDialog.Show(details); }
public static void Show(ModalDialogDetails details) { Assert.That(View.gameObject.activeSelf == false, "You cannot call ModalDialog.Show until you dont close current one"); View.transform.SetAsLastSibling(); View.gameObject.SetActive(true); (View.transform as RectTransform).localPosition = Vector3.zero; View.Button1.gameObject.SetActive(false); View.Button2.gameObject.SetActive(false); View.Button3.gameObject.SetActive(false); View.DialogMessageText.text = details.DialogMessage; View.Button1.onClick.RemoveAllListeners(); View.Button1.onClick.AddListener(CloseDialog); if (details.Button1.Handler != null) { View.Button1.onClick.AddListener(() => details.Button1.Handler()); } View.Button1Text.text = details.Button1.Title; View.Button1.gameObject.SetActive(true); if (details.Button2 != null) { View.Button2.onClick.RemoveAllListeners(); View.Button2.onClick.AddListener(CloseDialog); if (details.Button2.Handler != null) { View.Button2.onClick.AddListener(() => details.Button2.Handler()); } View.Button2Text.text = details.Button2.Title; View.Button2.gameObject.SetActive(true); } if (details.Button3 != null) { View.Button3.onClick.RemoveAllListeners(); View.Button3.onClick.AddListener(CloseDialog); if (details.Button3.Handler != null) { View.Button3.onClick.AddListener(() => details.Button3.Handler()); } View.Button3Text.text = details.Button3.Title; View.Button3.gameObject.SetActive(true); } }
private void StartGame() { var details = new ModalDialogDetails { DialogMessage = "Board is ready. Press \"OK\" to continue.", Button1 = new ModalDialogButtonDetails { Title = "OK", Handler = () => { Info.HistoryItems = null; Info.GameState = GameStates.Started; ActivePlayerHandler.ShowNotification(Info); } } }; ModalDialog.Show(details); }