示例#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);
        }