Example #1
0
        protected override IEnumerator Run(string text, MessageInteractionType interaction, bool isLast)
        {
            var waitForPage = interaction == MessageInteractionType.WaitForInput || interaction == MessageInteractionType.WaitForFinalInput;

            _characterDelay                  = CharactersPerSecond == 0.0f ? 0.0f : 1.0f / CharactersPerSecond;
            _currentPageCharacterCount       = 0;
            DisplayText.text                 = text;
            DisplayText.maxVisibleCharacters = 0;
            DisplayText.ForceMeshUpdate();

            yield return(null);            // consume the press that opened the message

            for (var page = 0; page < DisplayText.textInfo.pageCount; page++)
            {
                SetInteraction(MessageControlDisplay.None, interaction, isLast);

                yield return(ShowPage(page));

                var lastPage = DisplayText.pageToDisplay == DisplayText.textInfo.pageCount;
                var wait     = interaction == MessageInteractionType.WaitForInput || (lastPage && interaction == MessageInteractionType.WaitForFinalInput);

                if (wait)
                {
                    SetInteraction(lastPage ? MessageControlDisplay.Finished : MessageControlDisplay.Continue, interaction, isLast);
                }

                while (wait && !InterfaceManager.Instance.Accept.Pressed)
                {
                    yield return(null);
                }

                yield return(null);                // consume the accept press
            }
        }