private void ContinueWrite(IList <string> currentDialogue)
        {
            var forcedInput = currentDialogue[0];
            var npcResponse = currentDialogue[1];

            if (userInput.Length < forcedInput.Length)
            {
                userInput += forcedInput[userInput.Length];
            }
            else if (Keyboard.IsKeyDown(Keys.Enter))
            {
                ++progress;

                // Move previous user input up.
                var inputLines = userInput.Split('\n');
                outputLines.Add($"> {inputLines[0]}");
                if (inputLines.Length > 1)
                {
                    for (var i = 1; i < inputLines.Length; ++i)
                    {
                        outputLines.Add(inputLines[i]);
                    }
                }

                userInput = "";

                foreach (var line in npcResponse.Split('\n'))
                {
                    outputLines.Add(line);
                }
            }
        }
Пример #2
0
        protected override void Update(GameTime gameTime)
        {
            Keyboard.Update();
            DelayedKeyboard.Update(gameTime);

            if (Keyboard.IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (Keyboard.IsKeyNowDown(Keys.Space))
            {
                switch (elf.TextureType)
                {
                case DualTexture.DrawType.Ascii:
                    elf.TextureType = DualTexture.DrawType.Normal;
                    break;

                case DualTexture.DrawType.Normal:
                    elf.TextureType = DualTexture.DrawType.Ascii;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            console.Update(gameTime);

            base.Update(gameTime);
        }