示例#1
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;
            Board b = new Board(20, 20);
            Snake s = new Snake();

            b.setSnake(s);

            Selector selSnake = new Selector("Type de serpent?");

            selSnake.question.addAnswer("====", "Green", ConsoleColor.Green);
            selSnake.question.addAnswer("====", "Blue", ConsoleColor.Blue);
            selSnake.question.addAnswer("====", "Yellow", ConsoleColor.Yellow);

            selSnake.start().Join();
            Console.BackgroundColor = ConsoleColor.Black;
            Console.Clear();

            Selector selDiff = new Selector("Difficulté?");

            selDiff.question.addAnswer("Facile", "2", ConsoleColor.Green);
            selDiff.question.addAnswer("Moyen", "10", ConsoleColor.Yellow);
            selDiff.question.addAnswer("Difficile", "20", ConsoleColor.Red);
            selDiff.question.addAnswer("HARDCORE!!", "80", ConsoleColor.DarkRed);

            selDiff.start().Join();

            Console.BackgroundColor = ConsoleColor.Black;

            string color = selSnake.question.getAnswer();

            s.color = (ConsoleColor)(Enum.Parse(typeof(ConsoleColor), color));

            int diff = int.Parse(selDiff.question.getAnswer());

            b.difficulty = diff;

            Thread updateThread = new Thread(b.loop);

            updateThread.Start();

            Board.InputHandler inputHandler = new Board.InputHandler(s);
            Thread             inputThread  = new Thread(inputHandler.handleInput);

            inputThread.Start();


            updateThread.Join();
        }