Exemple #1
0
 private void TimedLine()
 {
     ConsoleAccess.Lock();
     if (CurrentLine.ConsolePos == null)
     {
         CurrentLine.ConsolePos = new int[2] {
             Console.CursorLeft, Console.CursorTop
         }
     }
     ;
     if (CurrentLineTimer >= CurrentLine.Speed)
     {
         if (CurrentLine.Line[CurrentLine.LineIndex] != '$')
         {
             ConsoleAccess.Write(CurrentLine.Line[CurrentLine.LineIndex]);
             CurrentLine.LineIndex++;
             CurrentLine.RealCharLineIndex++;
             CurrentLineTimer -= CurrentLine.Speed;
         }
         else if (CurrentLine.SpecialColor == false)
         {
             LineQueueProcessColor();
         }
         else
         {
             LineQueueRestoreColor();
         }
     }
     ConsoleAccess.Unlock();
 }
Exemple #2
0
        private void InstantLine()
        {
            ConsoleAccess.Lock();
            CurrentLine.ConsolePos = new int[2] {
                Console.CursorLeft, Console.CursorTop
            };
            while (CurrentLine.LineIndex < CurrentLine.Line.Length)
            {
                if (CurrentLine.Line[CurrentLine.LineIndex] != '$')
                {
                    Console.Write(CurrentLine.Line[CurrentLine.LineIndex]);
                    CurrentLine.LineIndex++;
                    CurrentLine.RealCharLineIndex++;
                }
                else if (CurrentLine.SpecialColor == false)
                {
                    LineQueueProcessColor();
                }
                else
                {
                    LineQueueRestoreColor();
                }
            }

            LineQueueEndOfLine();
            ConsoleAccess.Unlock();

            if (LineQueue.Count > 0)
            {
                LineQueuePop();
                if (CurrentLine.Speed <= 0.0f)
                {
                    InstantLine();
                }
            }
            else
            {
                FinishedTyping();
            }
        }
Exemple #3
0
        public void Update(float deltaTime)
        {
            if (CurrentLine == null && LineQueue.Count > 0)
            {
                LineQueuePop();

                GConsole.Instance.Input.ClearCurrentLine();

                if (PreviousLine != null && PreviousLine.Line == CurrentLine.Line &&
                    GConsole.Settings.SameLinesProduceDots == true)
                {
                    SameLineDot();
                }
            }
            else if (CurrentLine != null && CurrentLine.LineIndex < CurrentLine.Line.Length)
            {
                if (CurrentLine.ConsolePos != null && CurrentLine.ConsolePos[1] == Console.WindowTop + Console.WindowHeight - 2)
                {
                    Console.SetWindowPosition(Console.WindowLeft, Console.WindowTop + 1);
                }

                if (CurrentLine.Speed <= 0.0f)
                {
                    InstantLine();
                }
                else
                {
                    CurrentLineTimer += deltaTime;
                    TimedLine();
                }
            }
            else if (CurrentLine != null && CurrentLine.LineIndex >= CurrentLine.Line.Length)
            {
                ConsoleAccess.Lock();
                LineQueueEndOfLine();
                ConsoleAccess.Unlock();
                FinishedTyping();
            }
        }
Exemple #4
0
        private void SameLineDot()
        {
            ConsoleAccess.Lock();
            var OrigConsolePos = new int[2] {
                Console.CursorLeft, Console.CursorTop
            };

            ConsoleAccess.ForegroundColor = PreviousLine.LastCharForeground;
            ConsoleAccess.BackgroundColor = PreviousLine.LastCharBackground;

            if (PreviousLine.DotCount < 3)
            {
                ConsoleAccess.SetCursorPosition(
                    PreviousLine.ConsolePos[0] + PreviousLine.RealCharLineIndex + PreviousLine.DotCount,
                    PreviousLine.ConsolePos[1]);
                PreviousLine.DotCount++;
                ConsoleAccess.Write(".");
            }
            else
            {
                ConsoleAccess.SetCursorPosition(
                    PreviousLine.ConsolePos[0] + PreviousLine.RealCharLineIndex,
                    PreviousLine.ConsolePos[1]);
                ConsoleAccess.Write(".  ");
                PreviousLine.DotCount = 1;
            }

            ConsoleAccess.ResetColor();

            ConsoleAccess.ConsolePosition = OrigConsolePos;
            CurrentLine = PreviousLine;
            LineQueueEndOfSameLine();
            ConsoleAccess.Unlock();

            FinishedTyping();
        }