Exemplo n.º 1
0
 private void Finalize(PopupResultType resultType)
 {
     this.Log($"Finalize popup with resultType '{resultType.ToString()}'.", LogLevel.DevelopmentInfo);
     _resultCallback?.Invoke(new PopupResult(resultType, _customPopupParam, _neverShowAgain));
     CoreGameEventsManager.Unsubscribe <HardwareBackButtonEvent>(OnHardwareBackButtonEvent);
     OnEnableDisable?.Invoke(false);
 }
Exemplo n.º 2
0
        private void ShowPopup(ShowPopupEvent showPopupEvent)
        {
            if (string.IsNullOrEmpty(showPopupEvent.PopupTitleKey))
            {
                Title     = "Title";
                ShowTitle = false;
            }
            else
            {
                ShowTitle = true;
                Title     = Translate(showPopupEvent.PopupTitleKey);
            }

            Content = Translate(showPopupEvent.PopupContentKey);

            SizeOptions    = showPopupEvent.Size;
            PositiveButton = (!string.IsNullOrEmpty(showPopupEvent.PositiveButtonKey)) ? Translate(showPopupEvent.PositiveButtonKey) : Translate("OK");
            NegativeButton = (!string.IsNullOrEmpty(showPopupEvent.NegativeButtonKey)) ? Translate(showPopupEvent.NegativeButtonKey) : Translate("NO");
            CancelButton   = (!string.IsNullOrEmpty(showPopupEvent.CancelButtonKey)) ? Translate(showPopupEvent.CancelButtonKey) : Translate("CANCEL");

            ButtonOptions   = showPopupEvent.ButtonOptions;
            _resultCallback = showPopupEvent.ResultCallback;

            _cancelOnBackgroundAvailable = showPopupEvent.CancelOnBackgroundAvailable;
            _customPopupParam            = showPopupEvent.CustomParam;

            if (showPopupEvent.AllButtonsColor == new Color())
            {
                _buttonsColors = _defaultColors;
            }
            else
            {
                _buttonsColors = new[] { showPopupEvent.AllButtonsColor, showPopupEvent.AllButtonsColor, showPopupEvent.AllButtonsColor }
            };

            _showNeverShowAgainOption = showPopupEvent.ShowNeverShowAgainCheckbox;

            CoreGameEventsManager.Subscribe <HardwareBackButtonEvent>(OnHardwareBackButtonEvent);
            // Enabling popup cause Refreshing on view model so FireOnPropertyChanged will be invoked from Refresh function.
            OnEnableDisable?.Invoke(true);
        }