consoleWrapCount() публичный Метод

public consoleWrapCount ( ) : int
Результат int
Пример #1
0
 public static void Output(AttackState attackState)
 {
     if (attackState.cmdComplete)
     {
         printPrompt(attackState);
     }
     int currentCusorPos = Console.CursorTop;
     string prompt = createPrompt(attackState);
     Console.SetCursorPosition(prompt.Length, attackState.promptPos);
     Console.Write(new string(' ', Console.WindowWidth));
     int cursorDiff = currentCusorPos - attackState.promptPos;
     while (cursorDiff > 0)
     {
         Console.SetCursorPosition(0, attackState.promptPos + cursorDiff);
         Console.Write(new string(' ', Console.WindowWidth));
         cursorDiff -= 1;
     }
     Console.SetCursorPosition(prompt.Length, attackState.promptPos);
     Console.Write(attackState.displayCmd);
     int consoleWrapCount = attackState.consoleWrapCount();
     int relativeCursorPos = attackState.relativeCursorPos();
     if (attackState.cursorPos >= Console.WindowWidth)
     {
         attackState.cursorPos = attackState.cursorPos - Console.WindowWidth * consoleWrapCount;
     }
     Console.SetCursorPosition(attackState.cursorPos, attackState.promptPos + consoleWrapCount);
 }
Пример #2
0
        public static void Output(AttackState attackState)
        {
            if (attackState.cmdComplete)
            {
                printPrompt(attackState);
            }
            int currentCusorPos = Console.CursorTop;
            string prompt = createPrompt(attackState);

            // This is where we juggle things to make sure the cursor ends up where
            // it's expected to be. I'm sure this could be improved on.

            // Clear out typed text after prompt
            Console.SetCursorPosition(prompt.Length, attackState.promptPos);
            Console.Write(new string(' ', Console.WindowWidth));

            // Clear out any lines below the prompt
            int cursorDiff = attackState.consoleWrapCount();
            while (cursorDiff > 0)
            {
                Console.SetCursorPosition(0, attackState.promptPos + cursorDiff);
                Console.Write(new string(' ', Console.WindowWidth));
                cursorDiff -= 1;
            }
            Console.SetCursorPosition(prompt.Length, attackState.promptPos);

            // Re-print the command
            Console.Write(attackState.displayCmd);

            List<int> cursorXY = attackState.getCursorXY();
            Console.SetCursorPosition(cursorXY[0], cursorXY[1]);
        }