예제 #1
0
    static private int updateStats()
    {
        Console.Clear();

        List <string> playerStats = player.getStats();
        List <string> oppStats    = opponent.getStats();

        int wp = 0, hp = 0, wo = 0, ho = 0;

        Console.ForegroundColor = player.color; Console.Write(player.name);
        Console.ForegroundColor = ConsoleColor.White; Console.WriteLine();
        wp = player.name.Length;
        hp++;
        foreach (string line in playerStats)
        {
            if (wp < line.Length)
            {
                wp = line.Length;
            }
            hp++;
            Console.WriteLine(line);
        }

        Console.ForegroundColor = opponent.color; Console.Write(opponent.name);
        Console.ForegroundColor = ConsoleColor.White; Console.WriteLine();
        wo = opponent.name.Length;
        ho++;
        foreach (string line in oppStats)
        {
            if (wo < line.Length)
            {
                wo = line.Length;
            }
            ho++;
            Console.WriteLine(line);
        }

        if (Console.BufferWidth < wp + wo + 1)
        {
            Console.BufferWidth = wp + wo + 1;
        }
        Console.MoveBufferArea(0, hp, wo, ho, Console.WindowWidth - wo, 0);

        return(Math.Max(hp, ho));
    }