示例#1
0
        private void Execute(bool isPaused, string buttonKey, Action <bool> handler)
        {
            var hasAppToggled = appState.Pause(isPaused);

            controller.IsPaused = isPaused;

            if (!hasAppToggled)
            {
                return;
            }

            if (isPaused)
            {
                var data = new DialogueData
                {
                    Message         = localization.Get(TextKeys.PAUSE_TEXT),
                    BackgroundAlpha = 1f
                };

                if (!string.IsNullOrEmpty(buttonKey))
                {
                    var buttonText = localization.Get(buttonKey);
                    data.AddAction(buttonText, handler);
                }

                onShowDialogue.Dispatch(data);
            }
            else
            {
                onHideDialogue.Dispatch();
            }
        }