void OnCloseComplete(IModalHandle closedHandle) { closedHandle.CloseCompleteEvent -= OnCloseComplete; closedHandle.Destroy(); if (closedHandle == _current) { _current = null; } else { _sustainedModals.Remove(closedHandle); _queueModals.Remove(closedHandle); } if (_sustainedModals.Count > 0) { _current = _sustainedModals [_sustainedModals.Count - 1]; _sustainedModals.RemoveAt(_sustainedModals.Count - 1); _current.RetunToForeground(); } else if (_queueModals.Count > 0) { Open(_queueModals [0]); _queueModals.RemoveAt(0); } else { if (_modalsCanvas != null) { _modalsCanvas.HideMask(); } } }
void Open(IModalHandle modal) { _current = modal; _current.Parent = _modalsParent; _current.CloseCompleteEvent += OnCloseComplete; _current.Open(); }
private void ShowWaitingModalIfNeeded() { // On ios - display a waiting modal to improve UI experience of first purchase (which is slow on ios) if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor) { // Should be replaced by using a gsdk-only configuration table bool shouldShowModalDuringPurchase = generalParamtersConfigModel.GetBool("ShouldShowWaitingModal", true); if (shouldShowModalDuringPurchase) { _waitingModal = new AppModalHandle("GamePopups/WaitForPurchaseModal", IModalMaskType.Masked); modalityManager.Add(_waitingModal, true, true); } } }
public IModalHandle Add(IModalHandle handle, bool isOverriding = false, bool isStacking = false) { if (_current == null) { if (_modalsCanvas != null && handle.MaskType != IModalMaskType.NonMasked) { _modalsCanvas.ShowMask(); } Open(handle); return(handle); } if (isStacking) { if (isOverriding) { _sustainedModals.Add(_current); Open(handle); } else { _current.MoveToBackground(); _sustainedModals.Add(_current); Open(handle); } } else { if (isOverriding) { _current.MoveToBackground(); _sustainedModals.Add(_current); Open(handle); } else { _queueModals.Add(handle); } } return(handle); }
public IModalHandle Add(IModalHandle handle, bool isOverriding = false, bool isStacking = false) { return(handle); }
public IEnumerator ShowAlert(string pTitle, string pMessage, string pButtonOne, string pButtonTwo, Action <bool> pEndAction) { clickOne = false; bool onlyOneButton = string.IsNullOrEmpty(pButtonTwo); processing = true; #if USE_SYSTEM_ALERT_VIEW Action <string> clickEvent = (button) => { clickOne = button == pButtonOne; processing = false; }; Action cancelEvent = () => { clickOne = false; processing = false; }; EtceteraAndroidManager.alertButtonClickedEvent += clickEvent; EtceteraAndroidManager.alertCancelledEvent += cancelEvent; if (onlyOneButton) { EtceteraAndroid.showAlert(pTitle, pMessage, pButtonOne); } else { EtceteraAndroid.showAlert(pTitle, pMessage, pButtonOne, pButtonTwo); } if (Application.platform == RuntimePlatform.Android) { while (processing) { yield return(null); } } else { yield return(new WaitForSeconds(1.0f)); clickOne = UnityEngine.Random.value < 0.5f; processing = false; } EtceteraAndroidManager.alertButtonClickedEvent -= clickEvent; EtceteraAndroidManager.alertCancelledEvent -= cancelEvent; #else // Action<string> clickEvent = (button) => { // clickOne = (button == "ShowAlertViewOne"); // processing = false; // }; uiButtonClickSignal.AddListener(clickEvent); IModalHandle handle = modalityManager.Add(new AppModalHandle("ShowAlertViewUIPrefab", IModalMaskType.NonMasked), true); GameUIAlertViewContentAdjuster adjuster = handle.Parent.GetComponentInChildren <GameUIAlertViewContentAdjuster> (); adjuster.UpdateContent(pTitle, pMessage, pButtonOne, pButtonTwo); while (processing) { yield return(null); } uiButtonClickSignal.RemoveListener(clickEvent); #endif if (pEndAction != null) { pEndAction(clickOne); } }