/// <summary> /// Shows an alert dialog with 2 buttons. /// </summary> /// <returns>The two buttons alert.</returns> /// <param name="title">Title.</param> /// <param name="message">Message.</param> /// <param name="button1">Button1.</param> /// <param name="button2">Button2.</param> internal static AlertPopup ShowTwoButtonAlert(string title, string message, string button1, string button2) { #if UNITY_EDITOR Debug.Log("Show 2-button alert with message: " + message); return(null); #elif UNITY_IOS if (Instance != null) { return(null); // only allow one alert at a time } // Create a Unity game object to receive messages from native side Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <AlertPopup>(); // Show iOS 2-button alert iOSNativeAlert.ShowTwoButtonsAlert(title, message, button1, button2); return(Instance); #elif UNITY_ANDROID if (Instance != null) { return(null); // only allow one alert at a time } // Create a Unity game object to receive messages from native side Instance = new GameObject(ALERT_GAMEOBJECT).AddComponent <AlertPopup>(); // Show Android 2-button alert AndroidNativeAlert.ShowTwoButtonsAlert(title, message, button1, button2); return(Instance); #else Debug.Log("Native alert is not supported on this platform."); return(null); #endif }
//TODO //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //FOLLOWING METHODS SHOULD BE IMPLEMENTED ELSEWHERE //TODO //STATICS public static AlertPopup ShowChallengePopup(string title, string message, Action callbackYes, Action callbackNo) { AlertPopup alert = null; Action OnAcceptButtonAction = () => { callbackYes(); alert.ScheduleCloseButtonPressed(-1); M3Utils.Instance.CloseAllPopups(); }; Action OnDeclineButtonAction = () => { callbackNo(); alert.ScheduleCloseButtonPressed(-1); alert.HideAndDestroy(); }; alert = AlertPopup.GetAlertPopup(AlertPopup.PopupType.Normal, title, message, LocalizationManager.Instance.GetString(LocalizationKeys.ACCEPT), LocalizationManager.Instance.GetString(LocalizationKeys.DECLINE), OnAcceptButtonAction, OnDeclineButtonAction, OnDeclineButtonAction, true, true); alert.ScheduleCloseButtonPressed(Mathf.Clamp(ServerConfigurableValues.Instance.BattleChallengeRoomWait, 10, ServerConfigurableValues.Instance.LoadingFailureTime - 5)); alert.Show(); return(alert); }
protected void DoTryToJoinRoomWithUserId(string userId) { UserProfile up = GameState.Instance.Player.profile; if (up.UserId == userId) //Challenging self //why'd you like to do that? { Helpers.Utility.LogMessage("DoTryToJoinRoomWithUserId: Challenging own user?? Why would someone do that?" + this.GetType().ToString()); popup = EventListenerForPrivateChallenge.ShowCannotChallengeSelfPopup(up.Nick); StateMachine.Instance.MakeTransition(typeof(StateWaitForChallenge)); } else { if (ConnectionController.Instance.insideLobby) { DoSearch(userId); } else { joinLobbyAfterLeave = true; searchAfterJoinLobby = true; ConnectionController.Instance.LeaveRoom(); } } }
void _onPhotonRandomJoinFailed(object[] codeAndMsg) { if (UserPrefHelper.IsLogEnabled) { Helpers.Utility.LogMessage(this.GetType().ToString(), "_onPhotonRandomJoinedFailed", codeAndMsg[0] + " " + codeAndMsg[1]); } System.Action HideVersusScreen = () => { DoHideVersusScreen(); }; string code = codeAndMsg[0].ToString(); switch (code) { case M3Constants.PUN_ERROR_CODE_SLOT_EXCEED_MAX_PLAYERS: case M3Constants.PUN_ERROR_CODE_EXPECTED_USERS: case M3Constants.PUN_ERROR_CODE_GAME_CLOSED: case M3Constants.PUN_ERROR_CODE_GAME_FULL: case M3Constants.PUN_ERROR_CODE_USER_NOT_EXPECTED: case M3Constants.PUN_ERROR_CODE_USER_EXCLUDED: //This user was not expected to Join popup = EventListenerForPrivateChallenge.ShowUserIsBusyPopup(privateChallengeArgs.OpponentNickName, HideVersusScreen); break; case M3Constants.PUN_ERROR_CODE_NO_RANDOM_MATCH: case M3Constants.PUN_ERROR_CODE_ROOM_DOESNT_EXIST: default: popup = EventListenerForPrivateChallenge.ShowUserIsNotAvailablePopup(privateChallengeArgs.OpponentNickName, HideVersusScreen); break; } DoGoBackToWaitState(); }
private void WillReset() { this.m_dialog = null; this.ClearReconnectData(); this.m_timeoutListeners.Clear(); this.m_pendingReconnectNotice = null; }
private void HideDialog() { if (this.m_dialog != null) { this.m_dialog.Hide(); this.m_dialog = null; } }
public void HideFriendChallengeWaitingForOpponentDialog() { if (this.m_friendChallengeWaitingPopup != null) { this.m_friendChallengeWaitingPopup.Hide(); this.m_friendChallengeWaitingPopup = null; } }
private bool OnGameplayDialogProcessed(DialogBase dialog, object userData) { this.m_dialog = (AlertPopup)dialog; SceneMgr.Mode mode = (SceneMgr.Mode)((int)userData); SceneMgr.Get().SetNextMode(mode); SceneMgr.Get().RegisterSceneLoadedEvent(new SceneMgr.SceneLoadedCallback(this.OnSceneLoaded)); return(true); }
public async Task ShowSuccessMessageAsync(string message, string acceptButtonText) { var tcs = new TaskCompletionSource <bool>(); var alert = new AlertPopup(tcs, NotificationType.Success, message, acceptButtonText); await PopupNavigation.PushAsync(alert); await tcs.Task; await PopupNavigation.RemovePageAsync(alert); }
public override void Unload() { base.Unload(); AlertPopup.OkClicked -= OnOkClicked; AlertPopup.CancelClicked -= OnCancelClicked; AlertPopup.Hide(); }
/// <summary> /// Shows the error list async. /// </summary> /// <returns>The error list async.</returns> /// <param name="errorList">Error list.</param> /// <param name="acceptButtonText">Accept button text.</param> public async Task ShowErrorListAsync(IList <string> errorList, string acceptButtonText) { var tcs = new TaskCompletionSource <bool>(); var alert = new AlertPopup(tcs, NotificationType.Error, ToErrorString(errorList), acceptButtonText); await PopupNavigation.PushAsync(alert); await tcs.Task; await PopupNavigation.RemovePageAsync(alert); }
public void Release() { // Release the singleton instance so a new alert can be created. Instance = null; // Destroy the used object Destroy(gameObject); OnNativeAlertCallback(""); }
// Alert callback to be called from native side with UnitySendMessage private void OnNativeAlertCallback(string buttonIndex) { // Release the singleton instance so a new alert can be created. Instance = null; // Fire event OnComplete(Convert.ToInt16(buttonIndex)); // Destroy the used object Destroy(gameObject); }
public override void Load() { base.Load(); AlertPopup.OkClicked += OnOkClicked; AlertPopup.CancelClicked += OnCancelClicked; AlertPopup.SetText(Text); AlertPopup.Show(); }
public bool TryStartGame(int currentRate) { if (!Mediator.Instance.ResourcesStorage.Chips.TrySpendResources(currentRate)) { AlertPopup alertPopup = Mediator.Instance.PopupsManager.CreatePopup <AlertPopup>(); alertPopup.Init(AlertType.Lack_Chips, "Установите ставку меньше!"); return(false); } return(true); }
private void UpdateChallengeSentDialog() { if ((this.m_partyId != null) && (this.m_challengeDialog != null)) { AlertPopup challengeDialog = (AlertPopup)this.m_challengeDialog; AlertPopup.PopupInfo info = challengeDialog.GetInfo(); if (info != null) { info.m_responseDisplay = AlertPopup.ResponseDisplay.CANCEL; challengeDialog.UpdateInfo(info); } } }
private bool OnReconnectingDialogProcessed(DialogBase dialog, object userData) { if (!this.IsReconnecting()) { return(false); } this.m_dialog = (AlertPopup)dialog; if (this.IsStartingReconnectGame()) { this.ChangeDialogToReconnected(); } return(true); }
void DoTimeOutChallenge(float t = 0) { CancelInvoke("DoTimeOutChallenge"); if (t == 0) { popup = EventListenerForPrivateChallenge.ShowUserIsBusyPopup(privateChallengeArgs.OpponentNickName); DoGoBackToWaitState(); } else if (t > 0) { Invoke("DoTimeOutChallenge", t); } }
private bool OnFriendChallengeWaitingForOpponentDialogProcessed(DialogBase dialog, object userData) { if (!FriendChallengeMgr.Get().HasChallenge()) { return(false); } if (FriendChallengeMgr.Get().DidOpponentSelectDeck()) { this.WaitForFriendChallengeToStart(); return(false); } this.m_friendChallengeWaitingPopup = (AlertPopup)dialog; return(true); }
private void OnTimeoutDialogResponse(AlertPopup.Response response, object userData) { this.m_dialog = null; if (!Network.IsLoggedIn()) { if (ApplicationMgr.AllowResetFromFatalError != null) { ApplicationMgr.Get().Reset(); } else { ApplicationMgr.Get().Exit(); } } }
void DoTimeOutChallenge(float t = 0) { CancelInvoke("DoTimeOutChallenge"); if (t == 0) { popup = EventListenerForPrivateChallenge.ShowUserIsBusyPopup(privateChallengeArgs.OpponentNickName); VersusScreen.Instance.HideCancelButton(); VersusScreen.Instance.StopAnimation(); if (ConnectionController.Instance.inRoom) { ConnectionController.Instance.LeaveRoom(); } else { _onConnectedToMaster(); } } else if (t > 0) { Invoke("DoTimeOutChallenge", t); } }
public static AlertPopup ShowPopupWithMessageAndCallback(string title, string message, Action callback = null) { AlertPopup alert = null; Action OnOkayButtonAction = () => { if (callback != null) { callback(); } alert.HideAndDestroy(); }; Action OnCloseButtonAction = OnOkayButtonAction; alert = AlertPopup.GetAlertPopup(AlertPopup.PopupType.Critical, title, message, LocalizationManager.Instance.GetString(LocalizationKeys.OK), OnOkayButtonAction, OnCloseButtonAction, true, true); alert.Show(); return(alert); }
void _onPlayerDisconnected(PhotonPlayer otherPlayer) { popup = EventListenerForPrivateChallenge.ShowUserIsNotAvailablePopup(privateChallengeArgs.OpponentNickName); DoGoBackToWaitState(); }
void DoShowDeclinedPopupAndGoBack() { DoTimeOutChallenge(-1); popup = EventListenerForPrivateChallenge.ShowUserDeclinedPopup(privateChallengeArgs.OpponentNickName); DoGoBackToWaitState(); }
private void OnGameplayDialogResponse(AlertPopup.Response response, object userData) { this.m_dialog = null; }
private void OnReconnectingDialogResponse(AlertPopup.Response response, object userData) { this.m_dialog = null; ApplicationMgr.Get().Exit(); }
/// <summary> /// Shows an alert with 2 buttons. /// </summary> /// <returns>The two buttons alert.</returns> /// <param name="title">Title.</param> /// <param name="message">Message.</param> /// <param name="button1">Button1.</param> /// <param name="button2">Button2.</param> public static AlertPopup ShowTwoButtonAlert(string title, string message, string button1, string button2) { return(AlertPopup.ShowTwoButtonAlert(title, message, button1, button2)); }
/// <summary> /// Shows a toast message (Android only). /// </summary> /// <param name="message">Message.</param> /// <param name="isLongToast">If set to <c>true</c> use long-length toast, otherwise use short-length toast.</param> public static void ShowToast(string message, bool isLongToast = false) { AlertPopup.ShowToast(message, isLongToast); }
/// <summary> /// Shows a one-button alert with the default "OK" button. /// </summary> /// <returns>The alert.</returns> /// <param name="title">Title.</param> /// <param name="message">Message.</param> public static AlertPopup Alert(string title, string message) { return(AlertPopup.Alert(title, message)); }
/// <summary> /// Shows a one-button alert with a custom button label. /// </summary> /// <returns>The one button alert.</returns> /// <param name="title">Title.</param> /// <param name="message">Message.</param> /// <param name="button">Button.</param> public static AlertPopup Alert(string title, string message, string button) { return(AlertPopup.ShowOneButtonAlert(title, message, button)); }